From 1c4599a82920d2ca4144517a32af9dfd453435be Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Mon, 12 Jan 2004 17:11:18 +0000 Subject: added SA prefs (mail_session_get_sa_local_only): new helper method 2004-01-12 Radek Doulik * mail-session.c: added SA prefs (mail_session_get_sa_local_only): new helper method (mail_session_set_sa_local_only): ditto (mail_session_get_sa_use_daemon): ditto (mail_session_set_sa_use_daemon): ditto (mail_session_check_junk_notify): fix the key comparison (mail_session_init): add gconf dir so that we get notified * mail-config.glade: added SA preferences * em-mailer-prefs.c (em_mailer_prefs_construct): added more junk prefs (em_mailer_prefs_apply): ditto * em-junk-filter.c: use preferences svn path=/trunk/; revision=24174 --- mail/em-junk-filter.c | 61 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 22 deletions(-) (limited to 'mail/em-junk-filter.c') diff --git a/mail/em-junk-filter.c b/mail/em-junk-filter.c index 8c5888e7c5..d81b04feda 100644 --- a/mail/em-junk-filter.c +++ b/mail/em-junk-filter.c @@ -32,6 +32,7 @@ #include #include +#include "mail-session.h" #include "em-junk-filter.h" #define LOCK(x) pthread_mutex_lock(&x) @@ -228,7 +229,7 @@ em_junk_sa_test_spamd () for (i = 0; i < NPORTS; i ++) { d(fprintf (stderr, "trying to run spamd at port %d\n", port)); - sad_args [2] = g_strdup_printf ("spamd --port %d --local --daemonize", port); + sad_args [2] = g_strdup_printf ("spamd --port %d %s--daemonize", port, mail_session_get_sa_local_only () ? "--local " : ""); if (!pipe_to_sa (NULL, NULL, 3, sad_args)) { g_free (sad_args [2]); em_junk_sa_use_spamc = TRUE; @@ -282,10 +283,11 @@ em_junk_sa_check_junk (CamelMimeMessage *msg) " -c" /* Exit with a non-zero exit code if the tested message was junk */ " -p %d", em_junk_sa_spamd_port)) - : g_strdup ("spamassassin" - " --exit-code" /* Exit with a non-zero exit code if the - tested message was junk */ - " --local"); /* Local tests only (no online tests) */ + : g_strdup_printf ("spamassassin" + " --exit-code%s", /* Exit with a non-zero exit code if the + tested message was junk */ + mail_session_get_sa_local_only () + ? " --local" : ""); /* Local tests only (no online tests) */ retval = pipe_to_sa (msg, NULL, 3, args); @@ -300,18 +302,23 @@ em_junk_sa_report_junk (CamelMimeMessage *msg) static gchar *args [4] = { "/bin/sh", "-c", - "sa-learn" - " --no-rebuild" /* do not rebuild db */ - " --spam" /* report junk */ - " --single" /* single message */ - " --local", /* local only */ + NULL, NULL }; d(fprintf (stderr, "em_junk_sa_report_junk\n")); - if (em_junk_sa_is_available ()) + if (em_junk_sa_is_available ()) { + args [2] = g_strdup_printf + ("sa-learn" + " --no-rebuild" /* do not rebuild db */ + " --spam" /* report junk */ + " --single%s", /* single message */ + mail_session_get_sa_local_only () + ? " --local" : ""); /* local only */ pipe_to_sa (msg, NULL, 3, args); + g_free (args [2]); + } } static void @@ -320,18 +327,23 @@ em_junk_sa_report_notjunk (CamelMimeMessage *msg) static gchar *args [4] = { "/bin/sh", "-c", - "sa-learn" - " --no-rebuild" /* do not rebuild db */ - " --ham" /* report notjunk */ - " --single" /* single message */ - " --local", /* local only */ + NULL, NULL }; d(fprintf (stderr, "em_junk_sa_report_notjunk\n")); - if (em_junk_sa_is_available ()) + if (em_junk_sa_is_available ()) { + args [2] = g_strdup_printf + ("sa-learn" + " --no-rebuild" /* do not rebuild db */ + " --ham" /* report notjunk */ + " --single%s", /* single message */ + mail_session_get_sa_local_only () + ? " --local" : ""); /* local only */ pipe_to_sa (msg, NULL, 3, args); + g_free (args [2]); + } } static void @@ -340,16 +352,21 @@ em_junk_sa_commit_reports (void) static gchar *args [4] = { "/bin/sh", "-c", - "sa-learn" - " --rebuild" /* do not rebuild db */ - " --local", /* local only */ + NULL, NULL }; - d(fprintf (stderr, "em_junk_sa_commit_reports\n");) + d(fprintf (stderr, "em_junk_sa_commit_reports\n")); - if (em_junk_sa_is_available ()) + if (em_junk_sa_is_available ()) { + args [2] = g_strdup_printf + ("sa-learn" + " --rebuild%s", /* do not rebuild db */ + mail_session_get_sa_local_only () + ? " --local" : ""); /* local only */ pipe_to_sa (NULL, NULL, 3, args); + g_free (args [2]); + } } const EMJunkPlugin * -- cgit v1.2.3