aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/em-junk-filter.c37
2 files changed, 29 insertions, 14 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 637faa5f30..3c0c219b7d 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,9 @@
+2004-02-06 Radek Doulik <rodo@ximian.com>
+
+ * em-junk-filter.c (em_junk_sa_test_spamd): split into
+ spamassassin and spamd tests
+ (em_junk_sa_is_available): test spamd only if spamd usage enabled
+
2004-02-06 Not Zed <NotZed@Ximian.com>
** See bug #53258.
diff --git a/mail/em-junk-filter.c b/mail/em-junk-filter.c
index ddb18c245e..29e618205f 100644
--- a/mail/em-junk-filter.c
+++ b/mail/em-junk-filter.c
@@ -64,6 +64,7 @@ static EMJunkPlugin spam_assassin_plugin = {
};
static gboolean em_junk_sa_tested = FALSE;
+static gboolean em_junk_sa_spamd_tested = FALSE;
static gboolean em_junk_sa_use_spamc = FALSE;
static gboolean em_junk_sa_available = FALSE;
static int em_junk_sa_spamd_port = -1;
@@ -202,28 +203,32 @@ em_junk_sa_test_spamd_running (int port)
return pipe_to_sa (NULL, "From test@127.0.0.1", argv) == 0;
}
-#define SPAMD_PORT 7830
-#define MAX_SPAMD_PORTS 1
-
static void
-em_junk_sa_test_spamd (void)
+em_junk_sa_test_spamassassin (void)
{
- int port = em_junk_sa_get_daemon_port ();
- int i;
- char *argv[6] = {
+ char *argv[4] = {
"/bin/sh",
"-c",
"spamassassin --version",
NULL,
};
- if (pipe_to_sa (NULL, NULL, argv) != 0) {
+ if (pipe_to_sa (NULL, NULL, argv) != 0)
em_junk_sa_available = FALSE;
- em_junk_sa_tested = TRUE;
- return;
- }
-
- em_junk_sa_available = TRUE;
+ else
+ em_junk_sa_available = TRUE;
+
+ em_junk_sa_tested = TRUE;
+}
+
+#define MAX_SPAMD_PORTS 1
+
+static void
+em_junk_sa_test_spamd (void)
+{
+ int port = em_junk_sa_get_daemon_port ();
+ int i;
+
em_junk_sa_use_spamc = FALSE;
if (em_junk_sa_test_spamd_running (-1)) {
@@ -240,6 +245,7 @@ em_junk_sa_test_spamd (void)
}
if (!em_junk_sa_use_spamc) {
+ char *argv[6];
char port_buf[12];
int i = 0;
@@ -270,7 +276,7 @@ em_junk_sa_test_spamd (void)
d(fprintf (stderr, "use spamd %d at port %d\n", em_junk_sa_use_spamc, em_junk_sa_spamd_port));
- em_junk_sa_tested = TRUE;
+ em_junk_sa_spamd_tested = TRUE;
}
static gboolean
@@ -284,6 +290,9 @@ em_junk_sa_is_available (void)
}
if (!em_junk_sa_tested)
+ em_junk_sa_test_spamassassin ();
+
+ if (em_junk_sa_available && !em_junk_sa_spamd_tested && em_junk_sa_get_use_daemon ())
em_junk_sa_test_spamd ();
pthread_mutex_unlock (&em_junk_sa_init_lock);