[evolution] Adapt to CamelJunkFilter API changes.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Adapt to CamelJunkFilter API changes.
- Date: Tue, 16 Oct 2012 15:26:00 +0000 (UTC)
commit d84ba383ac994cbebd3976c9d747e04e79e953ff
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Oct 16 11:24:06 2012 -0400
Adapt to CamelJunkFilter API changes.
modules/bogofilter/evolution-bogofilter.c | 15 ++++++++-------
modules/spamassassin/evolution-spamassassin.c | 22 +++++++++++++---------
2 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/modules/bogofilter/evolution-bogofilter.c b/modules/bogofilter/evolution-bogofilter.c
index 2056f4f..00bb763 100644
--- a/modules/bogofilter/evolution-bogofilter.c
+++ b/modules/bogofilter/evolution-bogofilter.c
@@ -328,15 +328,15 @@ bogofilter_new_config_widget (EMailJunkFilter *junk_filter)
return box;
}
-static gboolean
+static CamelJunkStatus
bogofilter_classify (CamelJunkFilter *junk_filter,
CamelMimeMessage *message,
- CamelJunkStatus *status,
GCancellable *cancellable,
GError **error)
{
EBogofilter *extension = E_BOGOFILTER (junk_filter);
static gboolean wordlist_initialized = FALSE;
+ CamelJunkStatus status;
gint exit_code;
const gchar *argv[] = {
@@ -353,18 +353,19 @@ retry:
switch (exit_code) {
case BOGOFILTER_EXIT_STATUS_SPAM:
- *status = CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK;
+ status = CAMEL_JUNK_STATUS_MESSAGE_IS_JUNK;
break;
case BOGOFILTER_EXIT_STATUS_HAM:
- *status = CAMEL_JUNK_STATUS_MESSAGE_IS_NOT_JUNK;
+ status = CAMEL_JUNK_STATUS_MESSAGE_IS_NOT_JUNK;
break;
case BOGOFILTER_EXIT_STATUS_UNSURE:
- *status = CAMEL_JUNK_STATUS_INCONCLUSIVE;
+ status = CAMEL_JUNK_STATUS_INCONCLUSIVE;
break;
case BOGOFILTER_EXIT_STATUS_ERROR:
+ status = CAMEL_JUNK_STATUS_ERROR;
if (!wordlist_initialized) {
wordlist_initialized = TRUE;
bogofilter_init_wordlist (extension);
@@ -380,12 +381,12 @@ retry:
}
/* Check that the return value and GError agree. */
- if (exit_code != BOGOFILTER_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);
- return (exit_code != BOGOFILTER_EXIT_STATUS_ERROR);
+ return status;
}
static gboolean
diff --git a/modules/spamassassin/evolution-spamassassin.c b/modules/spamassassin/evolution-spamassassin.c
index 4adb1e8..480fedc 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]