From eec65a9ce0b99846ada81959bb5136074703ffd2 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 7 Sep 2000 03:15:35 +0000 Subject: New async function to filter messages on demand. (do_fetch_mail): Updated 2000-09-06 Jeffrey Stedfast * 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 --- mail/mail-tools.c | 97 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 95 deletions(-) (limited to 'mail/mail-tools.c') 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 @@ -447,116 +447,23 @@ mail_tool_make_message_attachment (CamelMimeMessage *message) return part; } -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; } -- cgit v1.2.3