From: Vsevolod Stakhov Date: Fri, 17 Jun 2011 12:16:55 +0000 (+0400) Subject: Fix rspamc client to handle multiply files properly. X-Git-Tag: 0.4.0~48 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a47bd1324d38975e283d09027645bdbe06abef4e;p=rspamd.git Fix rspamc client to handle multiply files properly. --- diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 260581d47..f5561cdab 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -366,10 +366,6 @@ scan_rspamd_file (const gchar *file) /* Init options hash */ opts = g_hash_table_new (g_str_hash, g_str_equal); add_options (opts); - - /* Add server */ - add_rspamd_server (FALSE); - res = rspamd_scan_file (file, opts, &err); g_hash_table_destroy (opts); if (err != NULL) { @@ -438,8 +434,6 @@ learn_rspamd_file (const gchar *file) fprintf (stderr, "cannot learn message without password and symbol name\n"); exit (EXIT_FAILURE); } - /* Add server */ - add_rspamd_server (TRUE); if (!rspamd_learn_file (file, statfile, password, &err)) { if (err != NULL) { @@ -516,8 +510,6 @@ fuzzy_rspamd_file (const gchar *file, gboolean delete) fprintf (stderr, "cannot learn message without password\n"); exit (EXIT_FAILURE); } - /* Add server */ - add_rspamd_server (TRUE); if (!rspamd_fuzzy_file (file, password, weight, flag, delete, &err)) { if (err != NULL) { @@ -649,6 +641,15 @@ main (gint argc, gchar **argv, gchar **env) else { if ((cmd = check_rspamc_command (argv[1])) != RSPAMC_COMMAND_UNKNOWN) { /* In case of command read arguments starting from 2 */ + switch (cmd) { + case RSPAMC_COMMAND_SYMBOLS: + /* Add server */ + add_rspamd_server (FALSE); + break; + default: + add_rspamd_server (TRUE); + break; + } for (i = 2; i < argc; i ++) { if (tty) { printf ("\033[1m");