]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Simplify rspamc conversion routines
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 2 Jun 2016 20:00:43 +0000 (22:00 +0200)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 2 Jun 2016 20:00:43 +0000 (22:00 +0200)
src/libserver/protocol.c
src/libserver/protocol.h

index fa4f20e094742acbab0d9ba62ebd5cc77ccbc526..a48de05dcf129d44b1c81fd2359cb1fba11fa7d8 100644 (file)
@@ -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);
                }
        }
 
index 186ed939adbda9beddca9b0b8db00b228382ac9c..1f7acbab2213f07b9eb3575c3ebdf2af261b6353 100644 (file)
@@ -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