diff options
author | Radek Doulik <rodo@ximian.com> | 2004-02-06 23:29:36 +0800 |
---|---|---|
committer | Radek Doulik <rodo@src.gnome.org> | 2004-02-06 23:29:36 +0800 |
commit | 20b54a93a6e2e715c9f20405bb6fb004de00d482 (patch) | |
tree | 725d1618a88e75483b571ba647aa7be765a992fa /mail | |
parent | 5752d6268ad27c904a6928655cd34add7ab6ec54 (diff) | |
download | gsoc2013-evolution-20b54a93a6e2e715c9f20405bb6fb004de00d482.tar gsoc2013-evolution-20b54a93a6e2e715c9f20405bb6fb004de00d482.tar.gz gsoc2013-evolution-20b54a93a6e2e715c9f20405bb6fb004de00d482.tar.bz2 gsoc2013-evolution-20b54a93a6e2e715c9f20405bb6fb004de00d482.tar.lz gsoc2013-evolution-20b54a93a6e2e715c9f20405bb6fb004de00d482.tar.xz gsoc2013-evolution-20b54a93a6e2e715c9f20405bb6fb004de00d482.tar.zst gsoc2013-evolution-20b54a93a6e2e715c9f20405bb6fb004de00d482.zip |
split into spamassassin and spamd tests (em_junk_sa_is_available): test
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
svn path=/trunk/; revision=24647
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/em-junk-filter.c | 37 |
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); |