diff options
Diffstat (limited to 'src/libserver/symcache/symcache_item.cxx')
-rw-r--r-- | src/libserver/symcache/symcache_item.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libserver/symcache/symcache_item.cxx b/src/libserver/symcache/symcache_item.cxx index c41d3d68c..57a0a6695 100644 --- a/src/libserver/symcache/symcache_item.cxx +++ b/src/libserver/symcache/symcache_item.cxx @@ -500,6 +500,21 @@ cache_item::get_augmentation_weight() const -> int }); } +auto cache_item::get_numeric_augmentation(std::string_view name) const -> std::optional<double> +{ + const auto augmentation_value_maybe = rspamd::find_map(this->augmentations, name); + + if (augmentation_value_maybe.has_value()) { + const auto &augmentation = augmentation_value_maybe.value().get(); + + if (std::holds_alternative<double>(augmentation.value)) { + return std::get<double>(augmentation.value); + } + } + + return std::nullopt; +} + auto virtual_item::get_parent(const symcache &cache) const -> const cache_item * { |