diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile.am | 4 | ||||
-rw-r--r-- | mail/em-config.c | 82 | ||||
-rw-r--r-- | mail/em-config.h | 15 | ||||
-rw-r--r-- | mail/em-event.c | 80 | ||||
-rw-r--r-- | mail/em-event.h | 15 | ||||
-rw-r--r-- | mail/em-junk-hook.c | 440 | ||||
-rw-r--r-- | mail/em-junk-hook.h | 102 | ||||
-rw-r--r-- | mail/em-junk.c | 31 | ||||
-rw-r--r-- | mail/em-junk.h | 66 |
9 files changed, 99 insertions, 736 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index 63cceb43f3..043ffeebed 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -71,7 +71,7 @@ mailinclude_HEADERS = \ em-html-stream.h \ em-icon-stream.h \ em-inline-filter.h \ - em-junk-hook.h \ + em-junk.h \ em-search-context.h \ em-subscribe-editor.h \ em-sync-stream.h \ @@ -129,7 +129,7 @@ libevolution_mail_la_SOURCES = \ em-html-stream.c \ em-icon-stream.c \ em-inline-filter.c \ - em-junk-hook.c \ + em-junk.c \ em-search-context.c \ em-subscribe-editor.c \ em-sync-stream.c \ diff --git a/mail/em-config.c b/mail/em-config.c index 357e88555b..dcdf9b10ef 100644 --- a/mail/em-config.c +++ b/mail/em-config.c @@ -223,85 +223,3 @@ em_config_target_new_account(EMConfig *emp, struct _EAccount *account) return t; } - -/* ********************************************************************** */ - -/* Popup menu plugin handler */ - -/* -<e-plugin - class="org.gnome.mail.plugin.popup:1.0" - id="org.gnome.mail.plugin.popup.item:1.0" - type="shlib" - location="/opt/gnome2/lib/camel/1.0/libcamelimap.so" - name="imap" - description="IMAP4 and IMAP4v1 mail store"> - <hook class="org.gnome.mail.popupMenu:1.0" - handler="HandlePopup"> - <menu id="any" target="select"> - <item - type="item|toggle|radio|image|submenu|bar" - active - path="foo/bar" - label="label" - icon="foo" - mask="select_one" - activate="emp_view_emacs"/> - </menu> - </extension> - -*/ - -static gpointer emph_parent_class; -#define emph ((EMConfigHook *)eph) - -static const EConfigHookTargetMask emph_no_masks[] = { - { NULL } -}; - -static const EConfigHookTargetMap emph_targets[] = { - { "folder", EM_CONFIG_TARGET_FOLDER, emph_no_masks }, - { "prefs", EM_CONFIG_TARGET_PREFS, emph_no_masks }, - { "account", EM_CONFIG_TARGET_ACCOUNT, emph_no_masks }, - { NULL } -}; - -static void -emph_finalise(GObject *o) -{ - /*EPluginHook *eph = (EPluginHook *)o;*/ - - ((GObjectClass *)emph_parent_class)->finalize(o); -} - -static void -emph_class_init(EPluginHookClass *klass) -{ - gint i; - - ((GObjectClass *)klass)->finalize = emph_finalise; - ((EPluginHookClass *)klass)->id = "org.gnome.evolution.mail.config:1.0"; - - for (i=0;emph_targets[i].type;i++) - e_config_hook_class_add_target_map((EConfigHookClass *)klass, &emph_targets[i]); - - ((EConfigHookClass *)klass)->config_class = g_type_class_ref(em_config_get_type()); -} - -GType -em_config_hook_get_type(void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EMConfigHookClass), NULL, NULL, (GClassInitFunc) emph_class_init, NULL, NULL, - sizeof(EMConfigHook), 0, (GInstanceInitFunc) NULL, - }; - - emph_parent_class = g_type_class_ref(e_config_hook_get_type()); - type = g_type_register_static(e_config_hook_get_type(), "EMConfigHook", &info, 0); - } - - return type; -} diff --git a/mail/em-config.h b/mail/em-config.h index 05401f026f..62e74bea51 100644 --- a/mail/em-config.h +++ b/mail/em-config.h @@ -91,21 +91,6 @@ EMConfigTargetFolder *em_config_target_new_folder(EMConfig *emp, CamelFolder *fo EMConfigTargetPrefs *em_config_target_new_prefs(EMConfig *emp, GConfClient *gconf); EMConfigTargetAccount *em_config_target_new_account(EMConfig *emp, EAccount *account); -/* ********************************************************************** */ - -typedef struct _EMConfigHook EMConfigHook; -typedef struct _EMConfigHookClass EMConfigHookClass; - -struct _EMConfigHook { - EConfigHook hook; -}; - -struct _EMConfigHookClass { - EConfigHookClass hook_class; -}; - -GType em_config_hook_get_type(void); - G_END_DECLS #endif /* __EM_CONFIG_H__ */ diff --git a/mail/em-event.c b/mail/em-event.c index 2cdbb23125..de8f468fa9 100644 --- a/mail/em-event.c +++ b/mail/em-event.c @@ -204,83 +204,3 @@ em_event_target_new_custom_icon(EMEvent *eme, GtkTreeStore *store, GtkTreeIter * return t; } - -/* ********************************************************************** */ - -static gpointer emeh_parent_class; -#define emeh ((EMEventHook *)eph) - -static const EEventHookTargetMask emeh_folder_masks[] = { - { "newmail", EM_EVENT_FOLDER_NEWMAIL }, - { NULL } -}; - -static const EEventHookTargetMask emeh_composer_masks[] = { - { "sendoption", EM_EVENT_COMPOSER_SEND_OPTION }, - { NULL } -}; - -static const EEventHookTargetMask emeh_message_masks[] = { - { "replyall", EM_EVENT_MESSAGE_REPLY_ALL }, - { "reply", EM_EVENT_MESSAGE_REPLY }, - { NULL } -}; - -static const EEventHookTargetMask emeh_send_receive_masks[] = { - { "sendreceive", EM_EVENT_SEND_RECEIVE }, - { NULL } -}; - -static const EEventHookTargetMask emeh_custom_icon_masks[] = { - { "customicon", EM_EVENT_CUSTOM_ICON }, - { NULL } -}; - -static const EEventHookTargetMap emeh_targets[] = { - { "folder", EM_EVENT_TARGET_FOLDER, emeh_folder_masks }, - { "message", EM_EVENT_TARGET_MESSAGE, emeh_message_masks }, - { "composer", EM_EVENT_TARGET_COMPOSER, emeh_composer_masks}, - { "sendreceive", EM_EVENT_TARGET_SEND_RECEIVE, emeh_send_receive_masks}, - { "customicon", EM_EVENT_TARGET_CUSTOM_ICON, emeh_custom_icon_masks}, - { NULL } -}; - -static void -emeh_finalise(GObject *o) -{ - /*EPluginHook *eph = (EPluginHook *)o;*/ - - ((GObjectClass *)emeh_parent_class)->finalize(o); -} - -static void -emeh_class_init(EPluginHookClass *klass) -{ - gint i; - - ((GObjectClass *)klass)->finalize = emeh_finalise; - ((EPluginHookClass *)klass)->id = "org.gnome.evolution.mail.events:1.0"; - - for (i=0;emeh_targets[i].type;i++) - e_event_hook_class_add_target_map((EEventHookClass *)klass, &emeh_targets[i]); - - ((EEventHookClass *)klass)->event = (EEvent *)em_event_peek(); -} - -GType -em_event_hook_get_type(void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EMEventHookClass), NULL, NULL, (GClassInitFunc) emeh_class_init, NULL, NULL, - sizeof(EMEventHook), 0, (GInstanceInitFunc) NULL, - }; - - emeh_parent_class = g_type_class_ref(e_event_hook_get_type()); - type = g_type_register_static(e_event_hook_get_type(), "EMEventHook", &info, 0); - } - - return type; -} diff --git a/mail/em-event.h b/mail/em-event.h index d653e35093..6f1366ae5f 100644 --- a/mail/em-event.h +++ b/mail/em-event.h @@ -141,21 +141,6 @@ EMEventTargetMessage *em_event_target_new_message(EMEvent *emp, CamelFolder *fol EMEventTargetSendReceive * em_event_target_new_send_receive(EMEvent *eme, GtkWidget *table, gpointer data, gint row, guint32 flags); EMEventTargetCustomIcon * em_event_target_new_custom_icon(EMEvent *eme, GtkTreeStore *store, GtkTreeIter *iter, const gchar *uri, guint32 flags); -/* ********************************************************************** */ - -typedef struct _EMEventHook EMEventHook; -typedef struct _EMEventHookClass EMEventHookClass; - -struct _EMEventHook { - EEventHook hook; -}; - -struct _EMEventHookClass { - EEventHookClass hook_class; -}; - -GType em_event_hook_get_type(void); - G_END_DECLS #endif /* __EM_EVENT_H__ */ diff --git a/mail/em-junk-hook.c b/mail/em-junk-hook.c deleted file mode 100644 index d032823bed..0000000000 --- a/mail/em-junk-hook.c +++ /dev/null @@ -1,440 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Vivek Jain <jvivek@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <stdlib.h> -#include <glib.h> -#include "em-junk-hook.h" -#include "mail-session.h" -#include "e-util/e-error.h" -#include "em-utils.h" -#include <camel/camel-junk-plugin.h> -#include <glib/gi18n.h> - -static GHashTable *emjh_types; -static GObjectClass *parent_class = NULL; - -static gpointer emjh_parent_class; -static GObjectClass *emj_parent; -#define emjh ((EMJunkHook *)eph) - -#define d(x) - -static const EPluginHookTargetKey emjh_flag_map[] = { - { NULL } -}; - -/* ********************************************************************** */ - -/* Mail junk plugin */ - -/* - <hook class="org.gnome.evolution.mail.junk:1.0"> - <group id="EMJunk"> - <item check_junk="sa_check_junk" - report_junk="sa_report_junk" - report_non_junk="sa_report_non_junk" - commit_reports = "sa_commit_reports"/> - </group> - </hook> - -*/ - -static void manage_error (const gchar *msg, GError *error); - -GQuark -em_junk_error_quark (void) -{ - return g_quark_from_static_string ("em-junk-error-quark"); -} - -static const gchar * -em_junk_get_name (CamelJunkPlugin *csp); - -static void -em_junk_init(CamelJunkPlugin *csp) -{ - struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - - ((EPluginClass *)G_OBJECT_GET_CLASS(item->hook->hook.plugin))->enable(item->hook->hook.plugin, 1); -} - -static const gchar * -em_junk_get_name (CamelJunkPlugin *csp) -{ - struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - - if (item->hook && item->hook->hook.plugin->enabled) { - return (item->hook->hook.plugin->name); - } else - return _("None"); - -} - -static gboolean -em_junk_check_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) -{ - struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - - if (item->hook && item->hook->hook.plugin->enabled) { - gboolean res; - EMJunkHookTarget target = { - m, - NULL - }; - - res = e_plugin_invoke(item->hook->hook.plugin, item->check_junk, &target) != NULL; - - manage_error ("mail:junk-check-error", target.error); - - return res; - } - - return FALSE; -} - -static void -em_junk_report_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) -{ - struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - - if (item->hook && item->hook->hook.plugin->enabled) { - EMJunkHookTarget target = { - m, - NULL - }; - - e_plugin_invoke(item->hook->hook.plugin, item->report_junk, &target); - - manage_error ("mail:junk-report-error", target.error); - } -} - -static void -em_junk_report_non_junk(CamelJunkPlugin *csp, CamelMimeMessage *m) -{ - struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - - if (item->hook && item->hook->hook.plugin->enabled) { - EMJunkHookTarget target = { - m, - NULL - }; - e_plugin_invoke(item->hook->hook.plugin, item->report_non_junk, &target); - manage_error ("mail:junk-not-report-error", target.error); - } -} - -static void -em_junk_commit_reports(CamelJunkPlugin *csp) -{ - struct _EMJunkHookItem *item = (EMJunkHookItem *)csp; - - if (item->hook && item->hook->hook.plugin->enabled) - e_plugin_invoke(item->hook->hook.plugin, item->commit_reports, NULL); - -} - -static void -emj_dispose (GObject *object) -{ - if (parent_class->dispose) - parent_class->dispose (object); -} - -static void -emj_finalize (GObject *object) -{ - if (parent_class->finalize) - parent_class->finalize (object); -} - -static void -emjh_free_item(EMJunkHookItem *item) -{ - g_free (item->check_junk); - g_free (item->report_junk); - g_free (item->report_non_junk); - g_free (item->commit_reports); - g_free(item); -} - -static void -emjh_free_group(EMJunkHookGroup *group) -{ - g_slist_foreach(group->items, (GFunc)emjh_free_item, NULL); - g_slist_free(group->items); - - g_free(group->id); - g_free(group); -} - -static struct _EMJunkHookItem * -emjh_construct_item(EPluginHook *eph, EMJunkHookGroup *group, xmlNodePtr root) -{ - struct _EMJunkHookItem *item; - CamelJunkPlugin junk_plugin = { - em_junk_get_name, - 1, - em_junk_check_junk, - em_junk_report_junk, - em_junk_report_non_junk, - em_junk_commit_reports, - em_junk_init, - }; - - d(printf(" loading group item\n")); - item = g_malloc0(sizeof(*item)); - item->csp = junk_plugin; - item->check_junk = e_plugin_xml_prop(root, "check_junk"); - item->report_junk = e_plugin_xml_prop(root, "report_junk"); - item->report_non_junk = e_plugin_xml_prop(root, "report_non_junk"); - item->commit_reports = e_plugin_xml_prop(root, "commit_reports"); - item->validate_binary = e_plugin_xml_prop(root, "validate_binary"); - - item->plugin_name = e_plugin_xml_prop(root, "name"); - item->hook = emjh; - - if (item->check_junk == NULL || item->report_junk == NULL || item->report_non_junk == NULL || item->commit_reports == NULL) - goto error; - - /* Add the plugin to the session plugin list*/ - mail_session_add_junk_plugin (item->plugin_name, CAMEL_JUNK_PLUGIN (&(item->csp))); - - return item; -error: - printf ("ERROR"); - emjh_free_item (item); - return NULL; -} - -static struct _EMJunkHookGroup * -emjh_construct_group(EPluginHook *eph, xmlNodePtr root) -{ - struct _EMJunkHookGroup *group; - xmlNodePtr node; - - d(printf(" loading group\n")); - group = g_malloc0(sizeof(*group)); - - group->id = e_plugin_xml_prop(root, "id"); - if (group->id == NULL) - goto error; - - node = root->children; - - /* We'll processs only the first item from xml file*/ - while (node) { - if (0 == strcmp((gchar *)node->name, "item")) { - struct _EMJunkHookItem *item; - - item = emjh_construct_item(eph, group, node); - if (item) - group->items = g_slist_append(group->items, item); - break; - } - - node = node->next; - } - - return group; -error: - emjh_free_group(group); - - return NULL; -} - -static gint -emjh_construct(EPluginHook *eph, EPlugin *ep, xmlNodePtr root) -{ - xmlNodePtr node; - - d(printf("loading junk hook\n")); - - if (((EPluginHookClass *)emjh_parent_class)->construct(eph, ep, root) == -1) - return -1; - - if (!ep->enabled) { - g_warning ("ignored this junk plugin: not enabled"); - return -1; - } - - node = root->children; - while (node) { - if (strcmp((gchar *)node->name, "group") == 0) { - struct _EMJunkHookGroup *group; - - group = emjh_construct_group(eph, node); - if (group) { - emjh->groups = g_slist_append(emjh->groups, group); - } - } - node = node->next; - } - - eph->plugin = ep; - - return 0; -} - -struct manage_error_idle_data -{ - const gchar *msg; - GError *error; -}; - -static void -free_mei (gpointer data) -{ - struct manage_error_idle_data *mei = (struct manage_error_idle_data*) data; - - if (!mei) - return; - - g_error_free (mei->error); - g_free (mei); -} - -static gboolean -manage_error_idle (gpointer data) -{ - GtkWidget *w; - struct manage_error_idle_data *mei = (struct manage_error_idle_data *) data; - - if (!mei) - return FALSE; - - w = e_error_new (NULL, mei->msg, mei->error->message, NULL); - em_utils_show_error_silent (w); - - return FALSE; -} - -static void -manage_error (const gchar *msg, GError *error) -{ - struct manage_error_idle_data *mei; - - if (!error) - return; - - mei = g_new0 (struct manage_error_idle_data, 1); - mei->msg = msg; /* it's a static string, should be safe to use it as this */ - mei->error = error; - - g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, manage_error_idle, mei, free_mei); -} - -/*XXX: don't think we need here*/ -static void -emjh_enable(EPluginHook *eph, gint state) -{ - GSList *g; - - g = emjh->groups; - if (emjh_types == NULL) - return; - -} - -static void -emjh_finalise(GObject *o) -{ - EPluginHook *eph = (EPluginHook *)o; - - g_slist_foreach(emjh->groups, (GFunc)emjh_free_group, NULL); - g_slist_free(emjh->groups); - - ((GObjectClass *)emjh_parent_class)->finalize(o); -} - -static void -emjh_class_init(EPluginHookClass *klass) -{ - ((GObjectClass *)klass)->finalize = emjh_finalise; - klass->construct = emjh_construct; - klass->enable = emjh_enable; - klass->id = "org.gnome.evolution.mail.junk:1.0"; -} - -GType -em_junk_hook_get_type(void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EMJunkHookClass), NULL, NULL, (GClassInitFunc) emjh_class_init, NULL, NULL, - sizeof(EMJunkHook), 0, (GInstanceInitFunc) NULL, - }; - - emjh_parent_class = g_type_class_ref(e_plugin_hook_get_type()); - type = g_type_register_static(e_plugin_hook_get_type(), "EMJunkHook", &info, 0); - } - - return type; -} - -static void -emj_class_init (EMJunkClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->dispose = emj_dispose; - object_class->finalize = emj_finalize; -} - -GType -emj_get_type(void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EMJunkClass), NULL, NULL, (GClassInitFunc) emj_class_init, NULL, NULL, - sizeof(EMJunk), 0, (GInstanceInitFunc) NULL, - }; - - emj_parent = g_type_class_ref(G_TYPE_OBJECT); - type = g_type_register_static(G_TYPE_OBJECT, "EMJunk", &info, 0); - } - - return type; -} - -void -em_junk_hook_register_type(GType type) -{ - EMJunk *klass; - - if (emjh_types == NULL) - emjh_types = g_hash_table_new(g_str_hash, g_str_equal); - - d(printf("registering junk plugin type '%s'\n", g_type_name(type))); - - klass = g_type_class_ref(type); - g_hash_table_insert(emjh_types, (gpointer)g_type_name(type), klass); -} diff --git a/mail/em-junk-hook.h b/mail/em-junk-hook.h deleted file mode 100644 index 39d18421ef..0000000000 --- a/mail/em-junk-hook.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Vivek Jain <jvivek@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef __EM_JUNK_HOOK_H__ -#define __EM_JUNK_HOOK_H__ - -#include "e-util/e-plugin.h" - -#include <camel/camel-junk-plugin.h> -#include <camel/camel-mime-message.h> - -G_BEGIN_DECLS - -typedef struct _EMJunkHookItem EMJunkHookItem; -typedef struct _EMJunkHookGroup EMJunkHookGroup; -typedef struct _EMJunkHook EMJunkHook; -typedef struct _EMJunkHookClass EMJunkHookClass; -typedef struct _EMJunk EMJunk; -typedef struct _EMJunkClass EMJunkClass; - -typedef struct _EMJunkHookTarget EMJunkHookTarget; - -typedef void (*EMJunkHookFunc)(struct _EPlugin *plugin, EMJunkHookTarget *data); - -GQuark em_junk_error_quark (void); - -#define EM_JUNK_ERROR em_junk_error_quark () - -struct _EMJunkHookTarget { - CamelMimeMessage *m; - GError *error; -}; - -struct _EMJunkHookItem { - CamelJunkPlugin csp; - struct _EMJunkHook *hook; /* parent pointer */ - gchar *check_junk; - gchar *report_junk; - gchar *report_non_junk; - gchar *commit_reports; - gchar *validate_binary; - gchar *plugin_name; -}; - -struct _EMJunkHookGroup { - struct _EMJunkHook *hook; /* parent pointer */ - gchar *id; /* target id */ - GSList *items; /* items to consider */ -}; - -struct _EMJunkHook { - EPluginHook hook; - GSList *groups; -}; - -struct _EMJunkHookClass { - EPluginHookClass hook_class; - - /* which class to add matching items to */ - GHashTable *junk_classes; -}; - -GType em_junk_hook_get_type(void); -void em_junk_hook_register_type(GType type); - -struct _EMJunk { - GObject object; - - CamelJunkPlugin csp; -}; - -struct _EMJunkClass { - GObjectClass parent_class; - /* which class to add matching items to */ - GHashTable *junk_classes; -}; - -GType emj_get_type(void); - -G_END_DECLS - -#endif /* __EM_JUNK_HOOK_H__ */ diff --git a/mail/em-junk.c b/mail/em-junk.c new file mode 100644 index 0000000000..6af215ed7a --- /dev/null +++ b/mail/em-junk.c @@ -0,0 +1,31 @@ +/* + * em-junk.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Authors: + * Vivek Jain <jvivek@novell.com> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "em-junk.h" + +GQuark +em_junk_error_quark (void) +{ + return g_quark_from_static_string ("em-junk-error-quark"); +} diff --git a/mail/em-junk.h b/mail/em-junk.h new file mode 100644 index 0000000000..79493caf2f --- /dev/null +++ b/mail/em-junk.h @@ -0,0 +1,66 @@ +/* + * em-junk.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Authors: + * Vivek Jain <jvivek@novell.com> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef EM_JUNK_H +#define EM_JUNK_H + +#include <e-util/e-plugin.h> +#include <camel/camel-junk-plugin.h> +#include <camel/camel-mime-message.h> + +#define EM_JUNK_ERROR (em_junk_error_quark ()) + +G_BEGIN_DECLS + +typedef struct _EMJunkTarget EMJunkTarget; +typedef struct _EMJunkInterface EMJunkInterface; + +typedef void (*EMJunkHookFunc) (EPlugin *plugin, EMJunkTarget *data); + +struct _EMJunkTarget { + CamelMimeMessage *m; + GError *error; +}; + +struct _EMJunkInterface { + CamelJunkPlugin camel; + + /* The hook forwards calls from Camel to the EPlugin. */ + EPluginHook *hook; + + /* These are symbol names in the EPlugin. */ + gchar *check_junk; + gchar *report_junk; + gchar *report_notjunk; + gchar *commit_reports; + gchar *validate_binary; + + gchar *plugin_name; +}; + +GQuark em_junk_error_quark (void); + +G_END_DECLS + +#endif /* EM_JUNK_H */ |