aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Doulik <rodo@src.gnome.org>2003-11-13 19:33:26 +0800
committerRadek Doulik <rodo@src.gnome.org>2003-11-13 19:33:26 +0800
commit9cc6ce25257ce6b1a28cf8fe755faf32dfd50327 (patch)
treefbb63f519d9384d8513ce00747648865461575fe
parentda01ce03ba060ccbdef2047119e5c537c0759aee (diff)
downloadgsoc2013-evolution-9cc6ce25257ce6b1a28cf8fe755faf32dfd50327.tar
gsoc2013-evolution-9cc6ce25257ce6b1a28cf8fe755faf32dfd50327.tar.gz
gsoc2013-evolution-9cc6ce25257ce6b1a28cf8fe755faf32dfd50327.tar.bz2
gsoc2013-evolution-9cc6ce25257ce6b1a28cf8fe755faf32dfd50327.tar.lz
gsoc2013-evolution-9cc6ce25257ce6b1a28cf8fe755faf32dfd50327.tar.xz
gsoc2013-evolution-9cc6ce25257ce6b1a28cf8fe755faf32dfd50327.tar.zst
gsoc2013-evolution-9cc6ce25257ce6b1a28cf8fe755faf32dfd50327.zip
(em_junk_sa_test_spamd): rename em_junk_sa_spamd_tested to
em_junk_sa_tested, always set em_junk_sa_tested svn path=/trunk/; revision=23319
-rw-r--r--mail/ChangeLog2
-rw-r--r--mail/em-junk-filter.c71
2 files changed, 37 insertions, 36 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 3487a5a251..ee17da9db2 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -3,6 +3,8 @@
* em-junk-filter.c (em_junk_sa_is_available): new helper function,
use it before any call to spamassassin, spamc and sa-learn
(em_junk_sa_test_spamd): first test if spamassassin is available
+ (em_junk_sa_test_spamd): rename em_junk_sa_spamd_tested to
+ em_junk_sa_tested, always set em_junk_sa_tested
* mail-folder-cache.c (folder_changed): don't call
CAMEL_IS_VJUNK_FOLDER, it was added by mistake
diff --git a/mail/em-junk-filter.c b/mail/em-junk-filter.c
index cb0a53557e..7d6b9346e8 100644
--- a/mail/em-junk-filter.c
+++ b/mail/em-junk-filter.c
@@ -59,7 +59,7 @@ static EMJunkPlugin spam_assassin_plugin =
NULL
};
-static gboolean em_junk_sa_spamd_tested = FALSE;
+static gboolean em_junk_sa_tested = FALSE;
static gboolean em_junk_sa_use_spamc = FALSE;
static gboolean em_junk_sa_available = FALSE;
static gint em_junk_sa_spamd_port = -1;
@@ -80,8 +80,8 @@ pipe_to_sa (CamelMimeMessage *msg, gchar *in, int argc, gchar **argv)
int in_fds[2];
pid_t pid;
- d(printf ("pipe_to_sa %s, %s, %s, %s\n", argc > 0 ? argv [0] : "N/A", argc > 1 ? argv [1] : "N/A", argc > 2 ? argv [2] : "N/A", argc > 3 ? argv [3] : "N/A"));
-
+ d(printf ("pipe_to_sa %s %s %s %s\n", argc > 0 ? argv [0] : "", argc > 1 ? argv [1] : "", argc > 2 ? argv [2] : "", argc > 3 ? argv [3] : ""));
+
if (argc < 1 || argv[0] == '\0')
return 0;
@@ -192,15 +192,13 @@ em_junk_sa_test_spamd ()
"spamassassin --version"
};
- if (pipe_to_sa (NULL, NULL, 3, args)) {
+ if (pipe_to_sa (NULL, NULL, 3, args))
em_junk_sa_available = FALSE;
- return;
- } else
+ else {
em_junk_sa_available = TRUE;
+ em_junk_sa_use_spamc = FALSE;
- em_junk_sa_use_spamc = FALSE;
-
- /* if (em_junk_sa_test_spamd_running (-1)) {
+ /* if (em_junk_sa_test_spamd_running (-1)) {
em_junk_sa_use_spamc = TRUE;
em_junk_sa_spamd_port = -1;
} else { */
@@ -214,42 +212,43 @@ em_junk_sa_test_spamd ()
}
/* } */
- if (!em_junk_sa_use_spamc) {
- static gchar *sad_args [3] = {
- "/bin/sh",
- "-c",
- NULL
- };
- gint i, port = 7830;
-
- d(fprintf (stderr, "looks like spamd is not running\n");)
-
- 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);
- if (!pipe_to_sa (NULL, NULL, 3, sad_args)) {
- g_free (sad_args [2]);
- em_junk_sa_use_spamc = TRUE;
- em_junk_sa_spamd_port = port;
- d(fprintf (stderr, "success at port %d\n", port));
- break;
- }
- g_free (sad_args [2]);
- port ++;
+ if (!em_junk_sa_use_spamc) {
+ static gchar *sad_args [3] = {
+ "/bin/sh",
+ "-c",
+ NULL
+ };
+ gint i, port = 7830;
+
+ d(fprintf (stderr, "looks like spamd is not running\n");)
+
+ 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);
+ if (!pipe_to_sa (NULL, NULL, 3, sad_args)) {
+ g_free (sad_args [2]);
+ em_junk_sa_use_spamc = TRUE;
+ em_junk_sa_spamd_port = port;
+ d(fprintf (stderr, "success at port %d\n", port));
+ break;
+ }
+ g_free (sad_args [2]);
+ port ++;
+ }
}
- }
- d(fprintf (stderr, "use spamd %d at port %d\n", em_junk_sa_use_spamc, em_junk_sa_spamd_port);)
+ d(fprintf (stderr, "use spamd %d at port %d\n", em_junk_sa_use_spamc, em_junk_sa_spamd_port));
+ }
- em_junk_sa_spamd_tested = TRUE;
+ em_junk_sa_tested = TRUE;
}
static gboolean
em_junk_sa_is_available ()
{
LOCK (em_junk_sa_test_lock);
- if (!em_junk_sa_spamd_tested)
+ if (!em_junk_sa_tested)
em_junk_sa_test_spamd ();
UNLOCK (em_junk_sa_test_lock);