summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-08 09:14:37 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-08 09:14:37 +0100
commit143802abc9c97559fd128b3ad698d40e5ad3393c (patch)
tree0d7ee48057d04d23a21c983239ac15ee6c2e436a /src/client
parent8ddac787506f4d68ef1ec7501c53afe065b8040f (diff)
downloadrspamd-143802abc9c97559fd128b3ad698d40e5ad3393c.tar.gz
rspamd-143802abc9c97559fd128b3ad698d40e5ad3393c.zip
Allow mime output to stdout.
Issue: #357
Diffstat (limited to 'src/client')
-rw-r--r--src/client/rspamc.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/client/rspamc.c b/src/client/rspamc.c
index 6648aef21..6f6c4311d 100644
--- a/src/client/rspamc.c
+++ b/src/client/rspamc.c
@@ -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);
+ }
}
}