]> source.dussan.org Git - rspamd.git/commitdiff
Allow mime output to stdout.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 8 Sep 2015 08:14:37 +0000 (09:14 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 8 Sep 2015 08:14:37 +0000 (09:14 +0100)
Issue: #357

src/client/rspamc.c

index 6648aef215e7f4bdd15bc4c83806ea63074a7296..6f6c4311dd90859885b05653b83b3b3da640505b 100644 (file)
@@ -1047,40 +1047,45 @@ rspamc_client_cb (struct rspamd_client_connection *conn,
                rspamc_client_execute_cmd (cmd, result, input, err);
        }
        else {
-               if (cmd->need_input) {
-                       rspamd_fprintf (out, "Results for file: %s\n", cbdata->filename);
+
+               if (cmd->cmd == RSPAMC_COMMAND_SYMBOLS && mime_output && input) {
+                       rspamc_mime_output (out, result, input, err);
                }
                else {
-                       rspamd_fprintf (out, "Results for command: %s\n", cmd->name);
-               }
-
-
-               if (result != NULL) {
-                       if (headers && msg != NULL) {
-                               rspamc_output_headers (out, msg);
+                       if (cmd->need_input) {
+                               rspamd_fprintf (out, "Results for file: %s\n", cbdata->filename);
                        }
-                       if (raw || cmd->command_output_func == NULL) {
-                               if (json) {
-                                       ucl_out = ucl_object_emit (result, UCL_EMIT_JSON);
+                       else {
+                               rspamd_fprintf (out, "Results for command: %s\n", cmd->name);
+                       }
+
+                       if (result != NULL) {
+                               if (headers && msg != NULL) {
+                                       rspamc_output_headers (out, msg);
+                               }
+                               if (raw || cmd->command_output_func == NULL) {
+                                       if (json) {
+                                               ucl_out = ucl_object_emit (result, UCL_EMIT_JSON);
+                                       }
+                                       else {
+                                               ucl_out = ucl_object_emit (result, UCL_EMIT_CONFIG);
+                                       }
+                                       rspamd_fprintf (out, "%s", ucl_out);
+                                       free (ucl_out);
                                }
                                else {
-                                       ucl_out = ucl_object_emit (result, UCL_EMIT_CONFIG);
+                                       cmd->command_output_func (out, result);
                                }
-                               rspamd_fprintf (out, "%s", ucl_out);
-                               free (ucl_out);
-                       }
-                       else {
-                               cmd->command_output_func (out, result);
-                       }
 
-                       ucl_object_unref (result);
-               }
-               else if (err != NULL) {
-                       rspamd_fprintf (out, "%s\n", err->message);
+                               ucl_object_unref (result);
+                       }
+                       else if (err != NULL) {
+                               rspamd_fprintf (out, "%s\n", err->message);
 
-                       if (json && msg != NULL && msg->body != NULL) {
-                               /* We can also output the resulting json */
-                               rspamd_fprintf (out, "%v\n", msg->body);
+                               if (json && msg != NULL && msg->body != NULL) {
+                                       /* We can also output the resulting json */
+                                       rspamd_fprintf (out, "%v\n", msg->body);
+                               }
                        }
                }