]> source.dussan.org Git - rspamd.git/commitdiff
Add more options to rspamc client.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 13 May 2011 16:02:17 +0000 (20:02 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 13 May 2011 16:02:17 +0000 (20:02 +0400)
Remove unused scores.

src/client/rspamc.c
src/settings.c

index 155db86c6fff705612c084eda22fe00c41d9c72b..260581d479cfb7f92daaa0b32c99b5ac576bcce2 100644 (file)
@@ -34,6 +34,10 @@ static gchar                   *connect_str = "localhost";
 static gchar                   *password;
 static gchar                   *statfile;
 static gchar                   *ip;
+static gchar                   *from;
+static gchar                   *deliver_to;
+static gchar                   *rcpt;
+static gchar                   *user;
 static gint                     weight = 1;
 static gint                     flag;
 static gint                     timeout = 5;
@@ -51,6 +55,10 @@ static GOptionEntry entries[] =
                { "pass", 'p', 0, G_OPTION_ARG_NONE, &pass_all, "Pass all filters", NULL },
                { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose, "More verbose output", NULL },
                { "ip", 'i', 0, G_OPTION_ARG_STRING, &ip, "Emulate that message was received from specified ip address", NULL },
+               { "user", 'u', 0, G_OPTION_ARG_STRING, &user, "Emulate that message was from specified user", NULL },
+               { "deliver", 'd', 0, G_OPTION_ARG_STRING, &deliver_to, "Emulate that message is delivered to specified user", NULL },
+               { "from", 'F', 0, G_OPTION_ARG_STRING, &from, "Emulate that message is from specified user", NULL },
+               { "rcpt", 'r', 0, G_OPTION_ARG_STRING, &rcpt, "Emulate that message is for specified user", NULL },
                { "timeout", 't', 0, G_OPTION_ARG_INT, &timeout, "Timeout for waiting for a reply", NULL },
                { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
 };
@@ -289,6 +297,18 @@ add_options (GHashTable *opts)
        if (ip != NULL) {
                g_hash_table_insert (opts, "Ip", ip);
        }
+       if (from != NULL) {
+               g_hash_table_insert (opts, "From", from);
+       }
+       if (user != NULL) {
+               g_hash_table_insert (opts, "User", user);
+       }
+       if (rcpt != NULL) {
+               g_hash_table_insert (opts, "Rcpt", rcpt);
+       }
+       if (deliver_to != NULL) {
+               g_hash_table_insert (opts, "Deliver-To", deliver_to);
+       }
        if (pass_all) {
                g_hash_table_insert (opts, "Pass", "all");
        }
index 6dd6cd3b05529c040d3059320e8efcfe62fd3ceb..1d0853f0a9292d5c6d22fe16b4147c8cacaf6fda 100644 (file)
@@ -438,22 +438,11 @@ check_metric_settings (struct worker_task * task, struct metric * metric, double
 {
        struct rspamd_settings         *us = NULL, *ds = NULL;
        double                         *sc, *rs;
-       gboolean                        black;
 
        *rscore = DEFAULT_REJECT_SCORE;
 
        if (check_setting (task, &us, &ds)) {
                if (us != NULL) {
-                       /* First look in user white list */
-                       if (check_bwhitelist(task, us, &black)) {
-                               if (black) {
-                                       *score = -DEFAULT_REJECT_SCORE;
-                               }
-                               else {
-                                       *score = DEFAULT_REJECT_SCORE;
-                               }
-                               return TRUE;
-                       }
                        if ((rs = g_hash_table_lookup (us->reject_scores, metric->name)) != NULL) {
                                *rscore = *rs;
                        }
@@ -471,15 +460,6 @@ check_metric_settings (struct worker_task * task, struct metric * metric, double
                        }
                }
                else if (ds != NULL) {
-                       if (check_bwhitelist(task, ds, &black)) {
-                               if (black) {
-                                       *score = DEFAULT_REJECT_SCORE;
-                               }
-                               else {
-                                       *score = 0;
-                               }
-                               return TRUE;
-                       }
                        if ((rs = g_hash_table_lookup (ds->reject_scores, metric->name)) != NULL) {
                                *rscore = *rs;
                        }