diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-09-07 11:15:35 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-09-07 11:15:35 +0800 |
commit | eec65a9ce0b99846ada81959bb5136074703ffd2 (patch) | |
tree | 76b8552b6ebfd8e23ee677603631baa09752d4d5 | |
parent | 534b71582b08ff42de90a434aa1ce04587b1e0f8 (diff) | |
download | gsoc2013-evolution-eec65a9ce0b99846ada81959bb5136074703ffd2.tar.gz gsoc2013-evolution-eec65a9ce0b99846ada81959bb5136074703ffd2.tar.zst gsoc2013-evolution-eec65a9ce0b99846ada81959bb5136074703ffd2.zip |
New async function to filter messages on demand. (do_fetch_mail): Updated
2000-09-06 Jeffrey Stedfast <fejj@helixcode.com>
* mail-ops.c (mail_do_filter_ondemand): New async function to
filter messages on demand.
(do_fetch_mail): Updated to filter 1 message at a time using the
new filter-driver code
* mail-callbacks.c (composer_postpone_cb): Send NULL as the
message info.
(run_filter_ondemand): Use mail_do_filter_ondemand instead of
filter_driver_run
* mail-tools.c: Removed mail_tool_filter_contents_into and
mail_tool_fetch_mail_into_searchable as they have now been
deprecated.
svn path=/trunk/; revision=5225
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/mail-callbacks.c | 114 | ||||
-rw-r--r-- | mail/mail-ops.c | 217 | ||||
-rw-r--r-- | mail/mail-ops.h | 3 | ||||
-rw-r--r-- | mail/mail-tools.c | 97 | ||||
-rw-r--r-- | mail/mail-tools.h | 12 |
6 files changed, 273 insertions, 186 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index d9fc802c43..99b238e33c 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,19 @@ +2000-09-06 Jeffrey Stedfast <fejj@helixcode.com> + + * mail-ops.c (mail_do_filter_ondemand): New async function to + filter messages on demand. + (do_fetch_mail): Updated to filter 1 message at a time using the + new filter-driver code + + * mail-callbacks.c (composer_postpone_cb): Send NULL as the + message info. + (run_filter_ondemand): Use mail_do_filter_ondemand instead of + filter_driver_run + + * mail-tools.c: Removed mail_tool_filter_contents_into and + mail_tool_fetch_mail_into_searchable as they have now been + deprecated. + 2000-09-06 Dan Winship <danw@helixcode.com> * message-list.c (clear_tree): set the data to NULL for the tree diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index e0338eda5f..aede7f2e65 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -2,9 +2,10 @@ /* mail-ops.c: callbacks for the mail toolbar/menus */ /* - * Author : + * Authors: * Dan Winship <danw@helixcode.com> * Peter Williams <peterw@helixcode.com> + * Jeffrey Stedfast <fejj@helixcode.com> * * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) * @@ -291,7 +292,6 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data) /* FIXME: do we want to use post_send_data to set flags and stuff? */ extern CamelFolder *outbox_folder; CamelMimeMessage *message; - CamelMessageInfo *info; const char *subject; /* Get the message */ @@ -307,10 +307,7 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data) } /* Save the message in Outbox */ - info = g_new0 (CamelMessageInfo, 1); - info->flags = 0; - mail_do_append_mail (outbox_folder, message, info); - g_free (info); + mail_do_append_mail (outbox_folder, message, NULL); gtk_widget_destroy (GTK_WIDGET (composer)); } @@ -321,21 +318,21 @@ create_msg_composer (const char *url) gboolean send_html; gchar *sig_file = NULL; GtkWidget *composer_widget; - + id = mail_config_get_default_identity (); send_html = mail_config_send_html (); - + if (id) sig_file = id->sig; - + if (url != NULL) composer_widget = e_msg_composer_new_from_url (url); else composer_widget = e_msg_composer_new_with_sig_file (sig_file); - + e_msg_composer_set_send_html (E_MSG_COMPOSER (composer_widget), send_html); - + return composer_widget; } @@ -383,28 +380,28 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, gboolea { EMsgComposer *composer; struct post_send_data *psd; - + /* FIXME: I just don't feel like implementing the folder-browser-passing * garbage. */ if (!check_send_configuration (NULL) || !folder || !msg || !uid) return; - + psd = g_new (struct post_send_data, 1); psd->folder = folder; camel_object_ref (CAMEL_OBJECT (psd->folder)); psd->uid = g_strdup (uid); psd->flags = CAMEL_MESSAGE_ANSWERED; - + composer = mail_generate_reply (msg, to_all); - + gtk_signal_connect (GTK_OBJECT (composer), "send", GTK_SIGNAL_FUNC (composer_send_cb), psd); gtk_signal_connect (GTK_OBJECT (composer), "postpone", GTK_SIGNAL_FUNC (composer_postpone_cb), psd); gtk_signal_connect (GTK_OBJECT (composer), "destroy", GTK_SIGNAL_FUNC (free_psd), psd); - + gtk_widget_show (GTK_WIDGET (composer)); } @@ -412,7 +409,7 @@ void reply_to_sender (GtkWidget *widget, gpointer user_data) { FolderBrowser *fb = FOLDER_BROWSER (user_data); - + mail_reply (fb->folder, fb->mail_display->current_message, fb->message_list->cursor_uid, FALSE); } @@ -421,7 +418,7 @@ void reply_to_all (GtkWidget *widget, gpointer user_data) { FolderBrowser *fb = FOLDER_BROWSER (user_data); - + mail_reply (fb->folder, fb->mail_display->current_message, fb->message_list->cursor_uid, TRUE); } @@ -440,21 +437,21 @@ forward_msg (GtkWidget *widget, gpointer user_data) EMsgComposer *composer; CamelMimeMessage *cursor_msg; GPtrArray *uids; - + cursor_msg = fb->mail_display->current_message; if (!check_send_configuration (fb) || !cursor_msg) return; - + composer = E_MSG_COMPOSER (e_msg_composer_new ()); - + uids = g_ptr_array_new(); message_list_foreach (fb->message_list, enumerate_msg, uids); - + gtk_signal_connect (GTK_OBJECT (composer), "send", GTK_SIGNAL_FUNC (composer_send_cb), NULL); gtk_signal_connect (GTK_OBJECT (composer), "postpone", GTK_SIGNAL_FUNC (composer_postpone_cb), NULL); - + mail_do_forward_message (cursor_msg, fb->message_list->folder, uids, @@ -472,28 +469,28 @@ transfer_msg (GtkWidget *widget, gpointer user_data, gboolean delete_from_source const char *allowed_types[] = { "mail", NULL }; extern EvolutionShellClient *global_shell_client; static char *last = NULL; - + if (last == NULL) last = g_strdup (""); - + if (delete_from_source) desc = _("Move message(s) to"); else desc = _("Copy message(s) to"); - + evolution_shell_client_user_select_folder (global_shell_client, desc, last, allowed_types, &uri, &physical); if (!uri) return; - + path = strchr (uri, '/'); if (path && strcmp (last, path) != 0) { g_free (last); last = g_strdup (path); } g_free (uri); - + uids = g_ptr_array_new (); message_list_foreach (ml, enumerate_msg, uids); mail_do_transfer_messages (ml->folder, uids, delete_from_source, physical); @@ -516,10 +513,10 @@ mark_all_seen (BonoboUIHandler *uih, void *user_data, const char *path) { FolderBrowser *fb = FOLDER_BROWSER(user_data); MessageList *ml = fb->message_list; - + if (ml->folder == NULL) return; - + mail_do_flag_all_messages (ml->folder, FALSE, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); } @@ -529,10 +526,10 @@ mark_all_deleted (BonoboUIHandler *uih, void *user_data, const char *path) { FolderBrowser *fb = FOLDER_BROWSER (user_data); MessageList *ml = fb->message_list; - + if (ml->folder == NULL) return; - + mail_do_flag_all_messages (ml->folder, FALSE, CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED); } @@ -570,13 +567,13 @@ delete_msg (GtkWidget *button, gpointer user_data) FolderBrowser *fb = user_data; MessageList *ml = fb->message_list; GPtrArray *uids; - + uids = g_ptr_array_new (); message_list_foreach (ml, enumerate_msg, uids); if (uids->len == 1) { guint32 flags; char *uid = uids->pdata[0]; - + mail_tool_camel_lock_up (); flags = camel_folder_get_message_flags (ml->folder, uid); camel_folder_set_message_flags (ml->folder, uid, @@ -594,9 +591,9 @@ void expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path) { FolderBrowser *fb = FOLDER_BROWSER(user_data); - + e_table_model_pre_change (fb->message_list->table_model); - + if (fb->message_list->folder) mail_do_expunge_folder (fb->message_list->folder); } @@ -605,10 +602,10 @@ static void filter_druid_clicked (GtkWidget *w, int button, FolderBrowser *fb) { FilterContext *fc; - + if (button == 0) { char *user; - + fc = gtk_object_get_data (GTK_OBJECT (w), "context"); user = g_strdup_printf ("%s/filters.xml", evolution_dir); rule_context_save ((RuleContext *)fc, user); @@ -627,18 +624,18 @@ filter_edit (BonoboUIHandler *uih, void *user_data, const char *path) FilterContext *fc; char *user, *system; GtkWidget *w; - + fc = filter_context_new(); user = g_strdup_printf ("%s/filters.xml", evolution_dir); system = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); rule_context_load ((RuleContext *)fc, system, user, NULL, NULL); g_free (user); g_free (system); - + if (((RuleContext *)fc)->error) { GtkWidget *dialog; gchar *err; - + err = g_strdup_printf (_("Error loading filter information:\n" "%s"), ((RuleContext *)fc)->error); dialog = gnome_warning_dialog (err); @@ -647,7 +644,7 @@ filter_edit (BonoboUIHandler *uih, void *user_data, const char *path) gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); return; } - + w = filter_editor_construct (fc); gtk_object_set_data_full (GTK_OBJECT (w), "context", fc, (GtkDestroyNotify)gtk_object_unref); gtk_signal_connect (GTK_OBJECT (w), "clicked", filter_druid_clicked, fb); @@ -658,7 +655,7 @@ void vfolder_edit_vfolders (BonoboUIHandler *uih, void *user_data, const char *path) { void vfolder_edit(void); - + vfolder_edit(); } @@ -674,16 +671,16 @@ mail_print_msg (MailDisplay *md) GnomePrintMaster *print_master; GnomePrintContext *print_context; GtkWidget *preview; - + print_master = gnome_print_master_new (); - + print_context = gnome_print_master_get_context (print_master); gtk_html_print (md->html, print_context); - + preview = GTK_WIDGET (gnome_print_master_preview_new ( print_master, "Mail Print Preview")); gtk_widget_show (preview); - + gtk_object_unref (GTK_OBJECT (print_master)); } @@ -691,7 +688,7 @@ void print_msg (GtkWidget *button, gpointer user_data) { FolderBrowser *fb = user_data; - + mail_print_msg (fb->mail_display); } @@ -699,7 +696,7 @@ void configure_folder(BonoboUIHandler *uih, void *user_data, const char *path) { FolderBrowser *fb = FOLDER_BROWSER(user_data); - + local_reconfigure_folder(fb); } @@ -708,10 +705,10 @@ view_msg (GtkWidget *widget, gpointer user_data) { FolderBrowser *fb = user_data; GPtrArray *uids; - + if (!fb->folder) return; - + uids = g_ptr_array_new (); message_list_foreach (fb->message_list, enumerate_msg, uids); mail_do_view_messages (fb->folder, uids, fb); @@ -734,16 +731,19 @@ run_filter_ondemand (BonoboUIHandler *uih, gpointer user_data, const char *path) { struct fb_ondemand_closure *oc = (struct fb_ondemand_closure *) user_data; FilterDriver *d; - + if (oc->fb->folder == NULL) return; - + printf ("Running filter \"%s\"\n", oc->rule->name); - + d = filter_driver_new (oc->fb->filter_context, mail_tool_filter_get_folder_func, NULL); - filter_driver_run (d, oc->fb->folder, oc->fb->folder, - FILTER_SOURCE_DEMAND, TRUE, - NULL, NULL, NULL); + + mail_do_filter_ondemand (d, oc->fb->folder, oc->fb->folder); + + /*filter_driver_run (d, oc->fb->folder, oc->fb->folder, + FILTER_SOURCE_DEMAND, TRUE, + NULL, NULL, NULL);*/ } diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 03b6ce1a58..8a18bd8ea5 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -107,28 +107,24 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) { fetch_mail_input_t *input = (fetch_mail_input_t *) in_data; fetch_mail_data_t *data = (fetch_mail_data_t *) op_data; - - CamelFolder *search_folder = NULL; - + CamelFolder *folder = NULL; + /* If using IMAP, don't do anything... */ - if (!strncmp (input->source_url, "imap:", 5)) { data->empty = FALSE; return; } - + if (input->destination == NULL) { input->destination = mail_tool_get_local_inbox (ex); - + if (input->destination == NULL) return; } - - search_folder = - mail_tool_fetch_mail_into_searchable (input->source_url, - input->keep_on_server, ex); - - if (search_folder == NULL) { + + folder = mail_tool_get_inbox (input->source_url, ex); + + if (folder == NULL) { /* This happens with an IMAP source and on error * and on "no new mail" */ @@ -137,20 +133,59 @@ do_fetch_mail (gpointer in_data, gpointer op_data, CamelException *ex) data->empty = TRUE; return; } - + mail_tool_camel_lock_up (); - if (camel_folder_get_message_count (search_folder) == 0) { + if (camel_folder_get_message_count (folder) == 0) { data->empty = TRUE; } else { - mail_tool_filter_contents_into (search_folder, input->destination, - TRUE, - input->hook_func, input->hook_data, - ex); + gchar *userrules; + gchar *systemrules; + FilterContext *fc; + FilterDriver *filter; + GPtrArray *uids; + int i; + + userrules = g_strdup_printf ("%s/filters.xml", evolution_dir); + systemrules = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); + fc = filter_context_new(); + rule_context_load ((RuleContext *)fc, systemrules, userrules, NULL, NULL); + g_free (userrules); + g_free (systemrules); + + filter = filter_driver_new (fc, mail_tool_filter_get_folder_func, 0); + + if (input->hook_func) + camel_object_hook_event (CAMEL_OBJECT (input->destination), "folder_changed", + input->hook_func, input->hook_data); + + uids = camel_folder_get_uids (folder); + for (i = 0; i < uids->len; i++) { + CamelMimeMessage *message; + + message = camel_folder_get_message (folder, uids->pdata[i], ex); + filter_driver_run (filter, message, input->destination, + FILTER_SOURCE_INCOMING, TRUE, + input->hook_func, input->hook_data); + + if (!input->keep_on_server) { + guint32 flags; + + flags = camel_folder_get_message_flags (folder, uids->pdata[i]); + camel_folder_set_message_flags (folder, uids->pdata[i], + CAMEL_MESSAGE_DELETED, + ~flags); + } + camel_object_unref (CAMEL_OBJECT (message)); + g_free (uids->pdata[i]); + } + + g_ptr_array_free (uids, TRUE); + data->empty = FALSE; } mail_tool_camel_lock_down (); - - camel_object_unref (CAMEL_OBJECT (search_folder)); + + camel_object_unref (CAMEL_OBJECT (folder)); } static void @@ -189,17 +224,155 @@ mail_do_fetch_mail (const gchar *source_url, gboolean keep_on_server, gpointer hook_func, gpointer hook_data) { fetch_mail_input_t *input; - + input = g_new (fetch_mail_input_t, 1); input->source_url = g_strdup (source_url); input->keep_on_server = keep_on_server; input->destination = destination; input->hook_func = hook_func; input->hook_data = hook_data; - + mail_operation_queue (&op_fetch_mail, input, TRUE); } +/* ** FILTER ON DEMAND ********************************************************** */ + +typedef struct filter_ondemand_input_s +{ + FilterDriver *driver; + CamelFolder *source; + CamelFolder *destination; +} filter_ondemand_input_t; + +typedef struct filter_ondemand_data_s { + gboolean empty; +} filter_ondemand_data_t; + +static gchar *describe_filter_ondemand (gpointer in_data, gboolean gerund); +static void setup_filter_ondemand (gpointer in_data, gpointer op_data, + CamelException *ex); +static void do_filter_ondemand (gpointer in_data, gpointer op_data, + CamelException *ex); +static void cleanup_filter_ondemand (gpointer in_data, gpointer op_data, + CamelException *ex); + +static gchar * +describe_filter_ondemand (gpointer in_data, gboolean gerund) +{ + /*filter_ondemand_input_t *input = (filter_ondemand_input_t *) in_data;*/ + + if (gerund) + return g_strdup_printf (_("Filtering email on demand")); + else + return g_strdup_printf (_("Filter email on demand")); +} + +static void +setup_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex) +{ + filter_ondemand_input_t *input = (filter_ondemand_input_t *) in_data; + filter_ondemand_data_t *data = (filter_ondemand_data_t *) op_data; + + if (!IS_FILTER_DRIVER (input->driver)) { + camel_exception_set (ex, CAMEL_EXCEPTION_INVALID_PARAM, + _("Bad filter driver specified")); + return; + } + + if (input->source == NULL) + return; + + if (!CAMEL_IS_FOLDER (input->source)) { + camel_exception_set (ex, CAMEL_EXCEPTION_INVALID_PARAM, + _("Bad input source defined for filtering")); + return; + } + + if (input->destination == NULL) + return; + + if (!CAMEL_IS_FOLDER (input->destination)) { + camel_exception_set (ex, CAMEL_EXCEPTION_INVALID_PARAM, + _("Bad default destination folder")); + return; + } + + data->empty = FALSE; + + gtk_object_ref (GTK_OBJECT (input->driver)); + camel_object_ref (CAMEL_OBJECT (input->source)); + camel_object_ref (CAMEL_OBJECT (input->destination)); +} + +static void +do_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex) +{ + filter_ondemand_input_t *input = (filter_ondemand_input_t *) in_data; + filter_ondemand_data_t *data = (filter_ondemand_data_t *) op_data; + + mail_tool_camel_lock_up (); + if (camel_folder_get_message_count (input->source) == 0) { + data->empty = TRUE; + } else { + GPtrArray *uids; + int i; + + uids = camel_folder_get_uids (input->source); + for (i = 0; i < uids->len; i++) { + CamelMimeMessage *message; + + message = camel_folder_get_message (input->source, uids->pdata[i], ex); + filter_driver_run (input->driver, message, input->destination, + FILTER_SOURCE_DEMAND, TRUE, NULL, NULL); + + camel_object_unref (CAMEL_OBJECT (message)); + g_free (uids->pdata[i]); + } + + g_ptr_array_free (uids, TRUE); + + data->empty = FALSE; + } + mail_tool_camel_lock_down (); +} + +static void +cleanup_filter_ondemand (gpointer in_data, gpointer op_data, CamelException *ex) +{ + filter_ondemand_input_t *input = (filter_ondemand_input_t *) in_data; + /*filter_ondemand_data_t *data = (filter_ondemand_data_t *) op_data;*/ + + if (input->source) + camel_object_unref (CAMEL_OBJECT (input->source)); + + if (input->destination) + camel_object_unref (CAMEL_OBJECT (input->destination)); + + if (input->driver) + gtk_object_unref (GTK_OBJECT (input->driver)); +} + +static const mail_operation_spec op_filter_ondemand = { + describe_filter_ondemand, + sizeof (filter_ondemand_data_t), + setup_filter_ondemand, + do_filter_ondemand, + cleanup_filter_ondemand +}; + +void +mail_do_filter_ondemand (FilterDriver *driver, CamelFolder *source, CamelFolder *destination) +{ + filter_ondemand_input_t *input; + + input = g_new (filter_ondemand_input_t, 1); + input->driver = driver; + input->source = source; + input->destination = destination; + + mail_operation_queue (&op_filter_ondemand, input, TRUE); +} + /* ** SEND MAIL *********************************************************** */ typedef struct send_mail_input_s diff --git a/mail/mail-ops.h b/mail/mail-ops.h index 9321f8807a..ae2a1ed353 100644 --- a/mail/mail-ops.h +++ b/mail/mail-ops.h @@ -23,6 +23,7 @@ */ #include <camel/camel.h> +#include <filter/filter-driver.h> #include "mail-threads.h" #include "evolution-storage.h" /*EvolutionStorage */ #include "composer/e-msg-composer.h" /*EMsgComposer */ @@ -31,6 +32,8 @@ void mail_do_fetch_mail (const gchar *source_url, gboolean keep_on_server, CamelFolder *destination, gpointer hook_func, gpointer hook_data); +void mail_do_filter_ondemand (FilterDriver *driver, CamelFolder *source, + CamelFolder *destination); void mail_do_send_mail (const char *xport_uri, CamelMimeMessage *message, CamelFolder *done_folder, diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 7a86ab49f1..6c28372541 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -448,115 +448,22 @@ mail_tool_make_message_attachment (CamelMimeMessage *message) } CamelFolder * -mail_tool_fetch_mail_into_searchable (const char *source_url, gboolean keep_on_server, CamelException *ex) -{ - CamelFolder *search_folder = NULL; - CamelFolder *spool_folder = NULL; - - /* If fetching mail from an mbox store, safely copy it to a - * temporary store first. - */ - - if (!strncmp (source_url, "mbox:", 5)) - spool_folder = mail_tool_do_movemail (source_url, ex); - else - spool_folder = mail_tool_get_inbox (source_url, ex); - - /* No new mail */ - if (spool_folder == NULL) - return NULL; - - if (camel_exception_is_set (ex)) - goto cleanup; - - /* can we perform filtering on this source? */ - - if (!(spool_folder->has_summary_capability - && spool_folder->has_search_capability)) { - - /* no :-(. Copy the messages to a local tempbox - * so that the folder browser can search it. */ - gchar *url; - - url = mail_tool_get_local_movemail_url(); - search_folder = mail_tool_get_folder_from_urlname (url, "movemail", TRUE, ex); - g_free (url); - if (camel_exception_is_set (ex)) - goto cleanup; - - mail_tool_move_folder_contents (spool_folder, search_folder, keep_on_server, ex); - if (camel_exception_is_set (ex)) - goto cleanup; - - } else { - /* we can search! don't bother movemailing */ - search_folder = spool_folder; - mail_tool_camel_lock_up(); - camel_object_ref (CAMEL_OBJECT (search_folder)); - mail_tool_camel_lock_down(); - } - - cleanup: - mail_tool_camel_lock_up(); - camel_object_unref (CAMEL_OBJECT (spool_folder)); - mail_tool_camel_lock_down(); - return search_folder; -} - -CamelFolder * mail_tool_filter_get_folder_func (FilterDriver *d, const char *uri, void *data) { return mail_tool_uri_to_folder_noex (uri); } -void -mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest, - gboolean delete_source, - gpointer hook_func, gpointer hook_data, - CamelException *ex) -{ - gchar *userrules; - gchar *systemrules; - FilterContext *fc; - FilterDriver *filter; - gchar *unlink; - - userrules = g_strdup_printf ("%s/filters.xml", evolution_dir); - systemrules = g_strdup_printf ("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); - fc = filter_context_new(); - rule_context_load ((RuleContext *)fc, systemrules, userrules, NULL, NULL); - g_free (userrules); - g_free (systemrules); - - filter = filter_driver_new (fc, mail_tool_filter_get_folder_func, 0); - - if (hook_func) - camel_object_hook_event (CAMEL_OBJECT (dest), "folder_changed", - hook_func, hook_data); - - if (delete_source) - unlink = mail_tool_get_local_movemail_path(); - else - unlink = NULL; - - filter_driver_run (filter, source, dest, FILTER_SOURCE_INCOMING, - TRUE, hook_func, hook_data, unlink); - - if (unlink) - g_free (unlink); -} - CamelFolder * mail_tool_get_root_of_store (const char *source_uri, CamelException *ex) { CamelStore *store; CamelFolder *folder; - mail_tool_camel_lock_up(); + mail_tool_camel_lock_up (); store = camel_session_get_store (session, source_uri, ex); if (!store) { - mail_tool_camel_lock_down(); + mail_tool_camel_lock_down (); return NULL; } diff --git a/mail/mail-tools.h b/mail/mail-tools.h index ea89916a90..ee2af84a5a 100644 --- a/mail/mail-tools.h +++ b/mail/mail-tools.h @@ -79,18 +79,6 @@ mail_tool_send_via_transport (CamelTransport *transport, CamelMedium *medium, Ca CamelMimePart * mail_tool_make_message_attachment (CamelMimeMessage *message); -/* Fetch mail from the source URL's inbox into a searchable folder. - * (not guaranteed to be local). Returns the searchable folder. */ -CamelFolder * -mail_tool_fetch_mail_into_searchable (const char *source_url, gboolean keep_on_server, CamelException *ex); - -/* Filter source into dest using the default filters. */ -void -mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest, - gboolean delete_source, - gpointer hook_func, gpointer hook_data, - CamelException *ex); - /* Get the root folder of the store specified by @source_uri */ CamelFolder * mail_tool_get_root_of_store (const char *source_uri, CamelException *ex); |