From d639971d8a52635c6edf63d4f1851b5bc049f895 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 5 Feb 2004 05:14:59 +0000 Subject: call abort before we unref, aid debugging if we hit it. 2004-02-05 Not Zed * em-folder-tree.c (em_folder_tree_create_folder): call abort before we unref, aid debugging if we hit it. * mail-vfolder.c (uri_is_spethal): check for vfolder/vtrash folders. Based on name check and store options. svn path=/trunk/; revision=24626 --- mail/ChangeLog | 8 ++++++++ mail/em-folder-tree.c | 2 +- mail/mail-component.c | 2 +- mail/mail-tools.c | 3 ++- mail/mail-vfolder.c | 34 +++++++++++++++++++++++++++++++--- 5 files changed, 43 insertions(+), 6 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index 47f43c2914..11837b9b81 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2004-02-05 Not Zed + + * em-folder-tree.c (em_folder_tree_create_folder): call abort + before we unref, aid debugging if we hit it. + + * mail-vfolder.c (uri_is_spethal): check for vfolder/vtrash + folders. Based on name check and store options. + 2004-02-04 Jeffrey Stedfast * em-folder-tree-model.c (em_folder_tree_model_row_drop_target): diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 2fdd2ff5b9..4436cc46d1 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -1219,8 +1219,8 @@ em_folder_tree_create_folder (EMFolderTree *emft, const char *path, const char * goto exception; if (!(si = g_hash_table_lookup (priv->model->store_hash, store))) { + abort(); camel_object_unref (store); - g_assert_not_reached (); goto exception; } diff --git a/mail/mail-component.c b/mail/mail-component.c index 9a4a556bf3..53dbe55484 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -710,7 +710,7 @@ mail_component_add_store (MailComponent *component, CamelStore *store, const cha char *service_name = NULL; MAIL_COMPONENT_DEFAULT(component); - + if (name == NULL) name = service_name = camel_service_get_name ((CamelService *) store, TRUE); diff --git a/mail/mail-tools.c b/mail/mail-tools.c index 2e797f2ee5..60474d2cfb 100644 --- a/mail/mail-tools.c +++ b/mail/mail-tools.c @@ -306,7 +306,8 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex) char *curi = NULL; g_return_val_if_fail (uri != NULL, NULL); - + + /* TODO: vtrash and vjunk are no longer used for these uri's */ if (!strncmp (uri, "vtrash:", 7)) offset = 7; else if (!strncmp (uri, "vjunk:", 6)) diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 80331e70e4..ed5f9dd031 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -43,6 +43,7 @@ #include "camel/camel.h" #include "camel/camel-vee-folder.h" #include "camel/camel-vee-store.h" +#include "camel/camel-vtrash-folder.h" #include "filter/vfolder-context.h" #include "filter/vfolder-editor.h" @@ -334,6 +335,33 @@ uri_is_ignore(const char *uri, GCompareFunc uri_cmp) return found; } +/* so special we never use it */ +static int +uri_is_spethal(CamelStore *store, const char *uri) +{ + CamelURL *url; + int res; + + /* This is a bit of a hack, but really the only way it can be done at the moment. */ + + if ((store->flags & (CAMEL_STORE_VTRASH|CAMEL_STORE_VJUNK)) == 0) + return FALSE; + + url = camel_url_new(uri, NULL); + if (url == NULL) + return TRUE; + + /* don't use strcasecmp here */ + res = url->path + && (((store->flags & CAMEL_STORE_VTRASH) + && strcmp(url->path, "/" CAMEL_VTRASH_NAME) == 0) + || ((store->flags & CAMEL_STORE_VJUNK) + && strcmp(url->path, "/" CAMEL_VJUNK_NAME) == 0)); + camel_url_free(url); + + return res; +} + /* called when a new uri becomes (un)available */ void mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove) @@ -348,7 +376,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove) char *uri; uri = em_uri_from_camel(curi); - if (!strncmp(curi, "vtrash:", 7) || !strncmp(curi, "vjunk:", 6) || context == NULL) { + if (context == NULL || uri_is_spethal(store, curi)) { g_free(uri); return; } @@ -443,7 +471,7 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi) char *uri; GList *link; - if (context == NULL || !strncmp(curi, "vtrash:", 7) || !strncmp(curi, "vjunk:", 6)) + if (context == NULL || uri_is_spethal(store, curi)) return; uri = em_uri_from_camel(curi); @@ -524,7 +552,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto) d(printf("vfolder rename uri: %s to %s\n", from, to)); - if (context == NULL || !strncmp(cfrom, "vtrash:", 7) || !strncmp(cto, "vtrash:", 7) || !strncmp(cfrom, "vjunk:", 6) || !strncmp(cto, "vjunk:", 6)) + if (context == NULL || uri_is_spethal(store, cfrom) || uri_is_spethal(store, cto)) return; g_assert(pthread_self() == mail_gui_thread); -- cgit v1.2.3