summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-01-23 21:58:23 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-01-23 21:58:23 +0000
commitc2f01dc0af36186a5185e2be310c655ad9277477 (patch)
tree1706a7864e14c1d77b51075984fd7b5269af7251 /src/client
parent16d8e1ef572d5ee720015672b9afb4f168fbb94f (diff)
downloadrspamd-c2f01dc0af36186a5185e2be310c655ad9277477.tar.gz
rspamd-c2f01dc0af36186a5185e2be310c655ad9277477.zip
[Minor] Use `thresholds` object in rspamc
Closes: #4380
Diffstat (limited to 'src/client')
-rw-r--r--src/client/rspamc.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/client/rspamc.cxx b/src/client/rspamc.cxx
index 2adc80a7c..a2d11fc13 100644
--- a/src/client/rspamc.cxx
+++ b/src/client/rspamc.cxx
@@ -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,
"{}/{}/{}/{}",