From 130bb0e5710983ce14d1151f2611beaff6891379 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 22 Aug 2000 20:09:11 +0000 Subject: Automatically connect services when given a valid URL (should hopefully disconnect, too); remove the old movemail folder correctly. svn path=/trunk/; revision=4965 --- mail/ChangeLog | 10 ++++++++ mail/mail-callbacks.c | 8 +++---- mail/mail-config-gui.c | 9 +++---- mail/mail-tools.c | 64 ++++++++++++++++++++++---------------------------- mail/message-thread.h | 1 + 5 files changed, 48 insertions(+), 44 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index ff02ff09cd..7782416393 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -9,6 +9,16 @@ * folder-browser.c: (fb_resize_cb) Added function to monitor resize of the e_paned in the main view. +2000-08-18 Peter Williams + + * mail-tools.c (mail_tool_filter_contents_into): Fix a race. filter_driver_run is an + async operation so it won't even be started by the time we sync the folders and check + for the movemailbox to be emtpy. Thus the empty check for the movemail would fail + 99% of the time. + + * mail-callbacks.c (run_filter_ondemand): Pass he new argument to the ever-mushrooming + filter_driver_run. + 2000-08-17 Peter Williams * folder-browser-factory.c (control_activate): Fix menu item names. diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c index 33b44c1c6c..2739c40c93 100644 --- a/mail/mail-callbacks.c +++ b/mail/mail-callbacks.c @@ -136,9 +136,9 @@ ask_confirm_for_empty_subject (EMsgComposer *composer) GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL); - GDK_THREADS_ENTER (); + /*GDK_THREADS_ENTER ();*/ button = gnome_dialog_run_and_close (GNOME_DIALOG (message_box)); - GDK_THREADS_LEAVE (); + /*GDK_THREADS_LEAVE ();*/ if (button == 0) return TRUE; @@ -250,7 +250,7 @@ create_msg_composer (const char *url) if (id) sig_file = id->sig; - + if (url != NULL) composer_widget = e_msg_composer_new_from_url (url); else @@ -650,5 +650,5 @@ run_filter_ondemand (BonoboUIHandler *uih, gpointer user_data, const char *path) NULL); filter_driver_run (d, oc->fb->folder, oc->fb->folder, FILTER_SOURCE_DEMAND, TRUE, - NULL, NULL); + NULL, NULL, NULL); } diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c index 955c457e7c..c757c65904 100644 --- a/mail/mail-config-gui.c +++ b/mail/mail-config-gui.c @@ -2222,11 +2222,12 @@ static void do_test_service (gpointer in_data, gpointer op_data, CamelException if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { data->success = FALSE; - } else if (camel_service_connect (service, ex)) { - camel_service_disconnect (service, ex); - data->success = TRUE; + /*} else if (camel_service_connect (service, ex)) { + *camel_service_disconnect (service, ex); + *data->success = TRUE; + */ } else { - data->success = FALSE; + data->success = TRUE; } camel_object_unref (CAMEL_OBJECT (service)); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 2d10411f91..97bc4259af 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -101,12 +101,13 @@ mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name, return NULL; } - camel_service_connect (CAMEL_SERVICE (store), ex); - if (camel_exception_is_set (ex)) { - camel_object_unref (CAMEL_OBJECT (store)); - mail_tool_camel_lock_down(); - return NULL; - } + /*camel_service_connect (CAMEL_SERVICE (store), ex); + *if (camel_exception_is_set (ex)) { + * camel_object_unref (CAMEL_OBJECT (store)); + * mail_tool_camel_lock_down(); + * return NULL; + *} + */ folder = camel_store_get_folder (store, name, create, ex); camel_object_unref (CAMEL_OBJECT (store)); @@ -392,14 +393,16 @@ mail_tool_send_via_transport (CamelTransport *transport, CamelMedium *medium, Ca { mail_tool_camel_lock_up(); - camel_service_connect (CAMEL_SERVICE (transport), ex); + /*camel_service_connect (CAMEL_SERVICE (transport), ex);*/ + if (camel_exception_is_set (ex)) goto cleanup; camel_transport_send (transport, medium, ex); - camel_service_disconnect (CAMEL_SERVICE (transport), - camel_exception_is_set (ex) ? NULL : ex); + /*camel_service_disconnect (CAMEL_SERVICE (transport), + *camel_exception_is_set (ex) ? NULL : ex);*/ + cleanup: mail_tool_camel_lock_down(); } @@ -503,6 +506,7 @@ mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest, 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); @@ -517,29 +521,16 @@ mail_tool_filter_contents_into (CamelFolder *source, CamelFolder *dest, camel_object_hook_event (CAMEL_OBJECT (dest), "folder_changed", hook_func, hook_data); - filter_driver_run (filter, source, dest, FILTER_SOURCE_INCOMING, - TRUE, hook_func, hook_data); - - camel_folder_sync (CAMEL_FOLDER (source), TRUE, ex); - camel_folder_sync (CAMEL_FOLDER (dest), TRUE, ex); - - if (delete_source) { - gchar *path = mail_tool_get_local_movemail_path(); - struct stat sb; - - if (stat (path, &sb) < 0) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Couldn't stat(2) movemail folder %s"), - path); - g_free (path); - return; - } + if (delete_source) + unlink = mail_tool_get_local_movemail_path(); + else + unlink = NULL; - if (sb.st_size == 0) - unlink (path); + filter_driver_run (filter, source, dest, FILTER_SOURCE_INCOMING, + TRUE, hook_func, hook_data, unlink); - g_free (path); - } + if (unlink) + g_free (unlink); } CamelFolder * @@ -556,12 +547,13 @@ mail_tool_get_root_of_store (const char *source_uri, CamelException *ex) return NULL; } - camel_service_connect (CAMEL_SERVICE (store), ex); - if (camel_exception_is_set (ex)) { - camel_object_unref (CAMEL_OBJECT (store)); - mail_tool_camel_lock_down(); - return NULL; - } + /*camel_service_connect (CAMEL_SERVICE (store), ex); + *if (camel_exception_is_set (ex)) { + * camel_object_unref (CAMEL_OBJECT (store)); + * mail_tool_camel_lock_down(); + * return NULL; + *} + */ folder = camel_store_get_root_folder (store, ex); camel_object_unref (CAMEL_OBJECT (store)); diff --git a/mail/message-thread.h b/mail/message-thread.h index 5c4be91ade..daff7451d4 100644 --- a/mail/message-thread.h +++ b/mail/message-thread.h @@ -5,6 +5,7 @@ #include "message-list.h" struct _container { + /* Next must be the first member */ struct _container *next, *parent, *child; -- cgit v1.2.3