diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-02 22:00:43 +0200 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-02 22:00:43 +0200 |
commit | 4ea9e0293d8490d3a2775a4391518f61537d56ab (patch) | |
tree | 737a5992f44960aa667a4a1430ec1ca490afb2d1 /src/libserver | |
parent | f0b0d219cbeb25cfd6381b21107f507524eae0c4 (diff) | |
download | rspamd-4ea9e0293d8490d3a2775a4391518f61537d56ab.tar.gz rspamd-4ea9e0293d8490d3a2775a4391518f61537d56ab.zip |
[Minor] Simplify rspamc conversion routines
Diffstat (limited to 'src/libserver')
-rw-r--r-- | src/libserver/protocol.c | 16 | ||||
-rw-r--r-- | src/libserver/protocol.h | 3 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index fa4f20e09..a48de05dc 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -874,8 +874,7 @@ rspamd_metric_result_ucl (struct rspamd_task *task, } void -rspamd_ucl_torspamc_output (struct rspamd_task *task, - ucl_object_t *top, +rspamd_ucl_torspamc_output (const ucl_object_t *top, rspamd_fstring_t **out) { const ucl_object_t *metric, *score, @@ -927,12 +926,15 @@ rspamd_ucl_torspamc_output (struct rspamd_task *task, } } - rspamd_printf_fstring (out, "Message-ID: %s\r\n", task->message_id); + elt = ucl_object_lookup (top, "message-id"); + if (elt != NULL) { + rspamd_printf_fstring (out, "Message-ID: %s\r\n", + ucl_object_tostring (elt)); + } } static void -rspamd_ucl_tospamc_output (struct rspamd_task *task, - ucl_object_t *top, +rspamd_ucl_tospamc_output (const ucl_object_t *top, rspamd_fstring_t **out) { const ucl_object_t *metric, *score, @@ -1055,10 +1057,10 @@ rspamd_protocol_http_reply (struct rspamd_http_message *msg, } else { if (RSPAMD_TASK_IS_SPAMC (task)) { - rspamd_ucl_tospamc_output (task, top, &msg->body); + rspamd_ucl_tospamc_output (top, &msg->body); } else { - rspamd_ucl_torspamc_output (task, top, &msg->body); + rspamd_ucl_torspamc_output (top, &msg->body); } } diff --git a/src/libserver/protocol.h b/src/libserver/protocol.h index 186ed939a..1f7acbab2 100644 --- a/src/libserver/protocol.h +++ b/src/libserver/protocol.h @@ -88,8 +88,7 @@ void rspamd_protocol_write_reply (struct rspamd_task *task); * @param top * @param out */ -void rspamd_ucl_torspamc_output (struct rspamd_task *task, - ucl_object_t *top, +void rspamd_ucl_torspamc_output (const ucl_object_t *top, rspamd_fstring_t **out); #endif |