]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Use `thresholds` object in rspamc
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 23 Jan 2023 21:58:23 +0000 (21:58 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 23 Jan 2023 21:58:23 +0000 (21:58 +0000)
Closes: #4380
src/client/rspamc.cxx

index 2adc80a7c0484efb27a0b67962cdd12dc9d7ffc2..a2d11fc13b69ba40bab2671a1a167d1f5e681920 100644 (file)
@@ -969,18 +969,21 @@ rspamc_metric_output(FILE *out, const ucl_object_t *obj)
                got_scores++;
        }
 
-       /* XXX: greylist_score is not yet in checkv2 */
-       elt = ucl_object_lookup(obj, "greylist_score");
-       if (elt) {
-               greylist_score = ucl_object_todouble(elt);
-       }
+       const auto *thresholds_obj = ucl_object_lookup(obj, "thresholds");
 
-       /* XXX: addheader_score is not yet in checkv2 */
-       elt = ucl_object_lookup(obj, "addheader_score");
-       if (elt) {
-               addheader_score = ucl_object_todouble(elt);
+       if (thresholds_obj && ucl_object_type(thresholds_obj) == UCL_OBJECT) {
+               const auto *greylist_obj = ucl_object_lookup(thresholds_obj, "greylist");
+               if (greylist_obj) {
+                       greylist_score = ucl_object_todouble(greylist_obj);
+               }
+
+               const auto *add_header_obj = ucl_object_lookup(thresholds_obj, "add header");
+               if (add_header_obj) {
+                       addheader_score = ucl_object_todouble(add_header_obj);
+               }
        }
 
+
        if (humanreport) {
                fmt::print(out,
                        "{}/{}/{}/{}",