aboutsummaryrefslogtreecommitdiffstats
path: root/modules/spamassassin
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-10-16 23:24:06 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-10-16 23:24:06 +0800
commitd84ba383ac994cbebd3976c9d747e04e79e953ff (patch)
tree1138ac0587ae719c8d8b1a6d987edededd6b534c /modules/spamassassin
parentab873378afd4f103e068ff5b659f4b29bb50fb25 (diff)
downloadgsoc2013-evolution-d84ba383ac994cbebd3976c9d747e04e79e953ff.tar
gsoc2013-evolution-d84ba383ac994cbebd3976c9d747e04e79e953ff.tar.gz
gsoc2013-evolution-d84ba383ac994cbebd3976c9d747e04e79e953ff.tar.bz2
gsoc2013-evolution-d84ba383ac994cbebd3976c9d747e04e79e953ff.tar.lz
gsoc2013-evolution-d84ba383ac994cbebd3976c9d747e04e79e953ff.tar.xz
gsoc2013-evolution-d84ba383ac994cbebd3976c9d747e04e79e953ff.tar.zst
gsoc2013-evolution-d84ba383ac994cbebd3976c9d747e04e79e953ff.zip
Adapt to CamelJunkFilter API changes.
Diffstat (limited to 'modules/spamassassin')
-rw-r--r--modules/spamassassin/evolution-spamassassin.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/modules/spamassassin/evolution-spamassassin.c b/modules/spamassassin/evolution-spamassassin.c
index 4adb1e8cc3..480fedccd4 100644
--- a/modules/spamassassin/evolution-spamassassin.c
+++ b/modules/spamassassin/evolution-spamassassin.c
@@ -786,14 +786,14 @@ spam_assassin_new_config_widget (EMailJunkFilter *junk_filter)
return box;
}
-static gboolean
+static CamelJunkStatus
spam_assassin_classify (CamelJunkFilter *junk_filter,
CamelMimeMessage *message,
- CamelJunkStatus *status,
GCancellable *cancellable,
GError **error)
{
ESpamAssassin *extension = E_SPAM_ASSASSIN (junk_filter);
+ CamelJunkStatus status;
const gchar *argv[7];
gint exit_code;
gint ii = 0;
@@ -833,32 +833,36 @@ spam_assassin_classify (CamelJunkFilter *junk_filter,
exit_code = spam_assassin_command (
argv, message, NULL, cancellable, error);
+ /* Check for an error while spawning the program. */
+ if (exit_code == SPAM_ASSASSIN_EXIT_STATUS_ERROR)
+ status = CAMEL_JUNK_STATUS_ERROR;
+
/* For either program, exit code 0 means the message is ham. */
- if (exit_code == 0)
- *status = CAMEL_JUNK_STATUS_MESSAGE_IS_NOT_JUNK;
+ else if (exit_code == 0)
+ status = CAMEL_JUNK_STATUS_MESSAGE_IS_NOT_JUNK;
/* spamassassin(1) only specifies zero and non-zero exit codes. */
else if (!extension->use_spamc)
- *status = CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK;
+ status = CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK;
/* Whereas spamc(1) explicitly states exit code 1 means spam. */
else if (exit_code == 1)
- *status = CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK;
+ status = CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK;
/* Consider any other spamc(1) exit code to be inconclusive
* since it most likely failed to process the message. */
else
- *status = CAMEL_JUNK_STATUS_INCONCLUSIVE;
+ status = CAMEL_JUNK_STATUS_INCONCLUSIVE;
/* Check that the return value and GError agree. */
- if (exit_code != SPAM_ASSASSIN_EXIT_STATUS_ERROR)
+ if (status != CAMEL_JUNK_STATUS_ERROR)
g_warn_if_fail (error == NULL || *error == NULL);
else
g_warn_if_fail (error == NULL || *error != NULL);
g_mutex_unlock (extension->socket_path_mutex);
- return (exit_code != SPAM_ASSASSIN_EXIT_STATUS_ERROR);
+ return status;
}
static gboolean