aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2012-08-21 04:42:47 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-10-01 11:26:23 +0800
commitc539a9ec20f46e0dc66df76fa518f8b659467bcd (patch)
tree26699d756bf65041f34bb8cf69d6086ad0c525a7
parentf186c2a87448f0e6410344b5e8e4b8f587e9987f (diff)
downloadgsoc2013-evolution-c539a9ec20f46e0dc66df76fa518f8b659467bcd.tar
gsoc2013-evolution-c539a9ec20f46e0dc66df76fa518f8b659467bcd.tar.gz
gsoc2013-evolution-c539a9ec20f46e0dc66df76fa518f8b659467bcd.tar.bz2
gsoc2013-evolution-c539a9ec20f46e0dc66df76fa518f8b659467bcd.tar.lz
gsoc2013-evolution-c539a9ec20f46e0dc66df76fa518f8b659467bcd.tar.xz
gsoc2013-evolution-c539a9ec20f46e0dc66df76fa518f8b659467bcd.tar.zst
gsoc2013-evolution-c539a9ec20f46e0dc66df76fa518f8b659467bcd.zip
Remove e_mail_junk_filter_available().
Because we now check for junk filtering software in configure, junk filtering modules can now safely assume the required junk filtering software is installed. No more having the module installed but not the required software. If this invariant is broken, an error will be shown for each new message received.
-rw-r--r--libemail-engine/e-mail-junk-filter.c13
-rw-r--r--libemail-engine/e-mail-junk-filter.h2
-rw-r--r--libemail-engine/e-mail-session.c27
-rw-r--r--modules/bogofilter/evolution-bogofilter.c7
-rw-r--r--modules/spamassassin/evolution-spamassassin.c67
5 files changed, 3 insertions, 113 deletions
diff --git a/libemail-engine/e-mail-junk-filter.c b/libemail-engine/e-mail-junk-filter.c
index fda8efb163..d6c77eae61 100644
--- a/libemail-engine/e-mail-junk-filter.c
+++ b/libemail-engine/e-mail-junk-filter.c
@@ -39,19 +39,6 @@ e_mail_junk_filter_init (EMailJunkFilter *junk_filter)
{
}
-gboolean
-e_mail_junk_filter_available (EMailJunkFilter *junk_filter)
-{
- EMailJunkFilterClass *class;
-
- g_return_val_if_fail (E_IS_MAIL_JUNK_FILTER (junk_filter), FALSE);
-
- class = E_MAIL_JUNK_FILTER_GET_CLASS (junk_filter);
- g_return_val_if_fail (class->available != NULL, FALSE);
-
- return class->available (junk_filter);
-}
-
GtkWidget *
e_mail_junk_filter_new_config_widget (EMailJunkFilter *junk_filter)
{
diff --git a/libemail-engine/e-mail-junk-filter.h b/libemail-engine/e-mail-junk-filter.h
index 375a0f2c60..efcd25f9d9 100644
--- a/libemail-engine/e-mail-junk-filter.h
+++ b/libemail-engine/e-mail-junk-filter.h
@@ -58,12 +58,10 @@ struct _EMailJunkFilterClass {
const gchar *filter_name;
const gchar *display_name;
- gboolean (*available) (EMailJunkFilter *junk_filter);
GtkWidget * (*new_config_widget) (EMailJunkFilter *junk_filter);
};
GType e_mail_junk_filter_get_type (void) G_GNUC_CONST;
-gboolean e_mail_junk_filter_available (EMailJunkFilter *junk_filter);
GtkWidget * e_mail_junk_filter_new_config_widget
(EMailJunkFilter *junk_filter);
gint e_mail_junk_filter_compare (EMailJunkFilter *junk_filter_a,
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 79dcad2edf..d89515eedd 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -421,11 +421,7 @@ mail_session_set_junk_filter_name (EMailSession *session,
if (junk_filter_name != NULL) {
junk_filter = g_hash_table_lookup (
session->priv->junk_filters, junk_filter_name);
- if (junk_filter != NULL) {
- if (!e_mail_junk_filter_available (
- E_MAIL_JUNK_FILTER (junk_filter)))
- junk_filter = NULL;
- } else {
+ if (junk_filter == NULL) {
g_warning (
"Unrecognized junk filter name "
"'%s' in GSettings", junk_filter_name);
@@ -1996,30 +1992,13 @@ e_mail_session_get_local_folder_uri (EMailSession *session,
GList *
e_mail_session_get_available_junk_filters (EMailSession *session)
{
- GList *list, *link;
- GQueue trash = G_QUEUE_INIT;
+ GList *list;
g_return_val_if_fail (E_IS_MAIL_SESSION (session), NULL);
list = g_hash_table_get_values (session->priv->junk_filters);
- /* Discard unavailable junk filters. (e.g. Junk filter
- * requires Bogofilter but Bogofilter is not installed,
- * hence the junk filter is unavailable.) */
-
- for (link = list; link != NULL; link = g_list_next (link)) {
- EMailJunkFilter *junk_filter;
-
- junk_filter = E_MAIL_JUNK_FILTER (link->data);
- if (!e_mail_junk_filter_available (junk_filter))
- g_queue_push_tail (&trash, link);
- }
-
- while ((link = g_queue_pop_head (&trash)) != NULL)
- list = g_list_delete_link (list, link);
-
- /* Sort the remaining junk filters by display name. */
-
+ /* Sort the available junk filters by display name. */
return g_list_sort (list, (GCompareFunc) e_mail_junk_filter_compare);
}
diff --git a/modules/bogofilter/evolution-bogofilter.c b/modules/bogofilter/evolution-bogofilter.c
index f48658055b..2056f4f11a 100644
--- a/modules/bogofilter/evolution-bogofilter.c
+++ b/modules/bogofilter/evolution-bogofilter.c
@@ -295,12 +295,6 @@ bogofilter_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-static gboolean
-bogofilter_available (EMailJunkFilter *junk_filter)
-{
- return g_file_test (BOGOFILTER_COMMAND, G_FILE_TEST_IS_EXECUTABLE);
-}
-
static GtkWidget *
bogofilter_new_config_widget (EMailJunkFilter *junk_filter)
{
@@ -477,7 +471,6 @@ e_bogofilter_class_init (EBogofilterClass *class)
junk_filter_class = E_MAIL_JUNK_FILTER_CLASS (class);
junk_filter_class->filter_name = "Bogofilter";
junk_filter_class->display_name = _("Bogofilter");
- junk_filter_class->available = bogofilter_available;
junk_filter_class->new_config_widget = bogofilter_new_config_widget;
g_object_class_install_property (
diff --git a/modules/spamassassin/evolution-spamassassin.c b/modules/spamassassin/evolution-spamassassin.c
index 8db0ce278c..4adb1e8cc3 100644
--- a/modules/spamassassin/evolution-spamassassin.c
+++ b/modules/spamassassin/evolution-spamassassin.c
@@ -379,55 +379,6 @@ spam_assassin_set_use_daemon (ESpamAssassin *extension,
g_object_notify (G_OBJECT (extension), "use-daemon");
}
-static gboolean
-spam_assassin_get_version (ESpamAssassin *extension,
- gint *spam_assassin_version,
- GCancellable *cancellable,
- GError **error)
-{
- GByteArray *output_buffer;
- gint exit_code;
- guint ii;
-
- const gchar *argv[] = {
- SA_LEARN_COMMAND,
- "--version",
- NULL
- };
-
- if (extension->version_set) {
- if (spam_assassin_version != NULL)
- *spam_assassin_version = extension->version;
- return TRUE;
- }
-
- output_buffer = g_byte_array_new ();
-
- exit_code = spam_assassin_command_full (
- argv, NULL, NULL, output_buffer, TRUE, cancellable, error);
-
- if (exit_code != 0) {
- g_byte_array_free (output_buffer, TRUE);
- return FALSE;
- }
-
- for (ii = 0; ii < output_buffer->len; ii++) {
- if (g_ascii_isdigit (output_buffer->data[ii])) {
- guint8 ch = output_buffer->data[ii];
- extension->version = (ch - '0');
- extension->version_set = TRUE;
- break;
- }
- }
-
- if (spam_assassin_version != NULL)
- *spam_assassin_version = extension->version;
-
- g_byte_array_free (output_buffer, TRUE);
-
- return TRUE;
-}
-
#ifdef HAVE_SPAM_DAEMON
static void
spam_assassin_test_spamd_allow_tell (ESpamAssassin *extension)
@@ -783,23 +734,6 @@ spam_assassin_finalize (GObject *object)
G_OBJECT_CLASS (e_spam_assassin_parent_class)->finalize (object);
}
-static gboolean
-spam_assassin_available (EMailJunkFilter *junk_filter)
-{
- ESpamAssassin *extension = E_SPAM_ASSASSIN (junk_filter);
- gboolean available;
- GError *error = NULL;
-
- available = spam_assassin_get_version (extension, NULL, NULL, &error);
-
- if (error != NULL) {
- g_warning ("%s", error->message);
- g_error_free (error);
- }
-
- return available;
-}
-
static GtkWidget *
spam_assassin_new_config_widget (EMailJunkFilter *junk_filter)
{
@@ -1094,7 +1028,6 @@ e_spam_assassin_class_init (ESpamAssassinClass *class)
junk_filter_class = E_MAIL_JUNK_FILTER_CLASS (class);
junk_filter_class->filter_name = "SpamAssassin";
junk_filter_class->display_name = _("SpamAssassin");
- junk_filter_class->available = spam_assassin_available;
junk_filter_class->new_config_widget = spam_assassin_new_config_widget;
g_object_class_install_property (