diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-23 14:52:26 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-23 14:52:26 +0100 |
commit | c719ab34ec748f1095d79420745fe39b9477e0e2 (patch) | |
tree | 72ad06d0e3030fc081707433ff591f0854a9865d | |
parent | abeb180044e33c529d1aa736958321d2e0ef11ec (diff) | |
download | rspamd-c719ab34ec748f1095d79420745fe39b9477e0e2.tar.gz rspamd-c719ab34ec748f1095d79420745fe39b9477e0e2.zip |
Another fix for legacy symbols output.
-rw-r--r-- | src/libmime/protocol.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/libmime/protocol.c b/src/libmime/protocol.c index 907757ea6..1b7bdf42f 100644 --- a/src/libmime/protocol.c +++ b/src/libmime/protocol.c @@ -659,7 +659,7 @@ static void rspamd_ucl_tolegacy_output (struct rspamd_task *task, ucl_object_t *top, GString *out) { const ucl_object_t *metric, *score, - *required_score, *is_spam, *elt, *symbols; + *required_score, *is_spam, *elt; ucl_object_iter_t iter = NULL; metric = ucl_object_find_key (top, DEFAULT_METRIC); @@ -677,14 +677,15 @@ rspamd_ucl_tolegacy_output (struct rspamd_task *task, ucl_object_t *top, GString ucl_object_tostring (elt)); } - symbols = ucl_object_find_key (metric, "symbols"); iter = NULL; - while ((elt = ucl_iterate_object (symbols, &iter, true)) != NULL) { - const ucl_object_t *sym_score; - sym_score = ucl_object_find_key (elt, "score"); - g_string_append_printf (out, "Symbol: %s; %.2f\r\n", - ucl_object_key (elt), - ucl_object_todouble (sym_score)); + while ((elt = ucl_iterate_object (metric, &iter, true)) != NULL) { + if (elt->type == UCL_OBJECT) { + const ucl_object_t *sym_score; + sym_score = ucl_object_find_key (elt, "score"); + g_string_append_printf (out, "Symbol: %s(%.2f)\r\n", + ucl_object_key (elt), + ucl_object_todouble (sym_score)); + } } elt = ucl_object_find_key (metric, "subject"); |