[evolution-mapi/gnome-2-28] Bug #568419 - Crash on "Delete folder"/"Copy to Folder"
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-mapi/gnome-2-28] Bug #568419 - Crash on "Delete folder"/"Copy to Folder"
- Date: Thu, 21 Jan 2010 14:49:31 +0000 (UTC)
commit 80ce7dea10076917bf0e440e291361a60af7fa52
Author: Milan Crha <mcrha redhat com>
Date: Thu Jan 21 15:49:13 2010 +0100
Bug #568419 - Crash on "Delete folder"/"Copy to Folder"
src/camel/camel-mapi-folder.c | 4 +-
src/camel/camel-mapi-store.c | 67 ++++++++++++++++++++++++----------------
2 files changed, 42 insertions(+), 29 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 0604035..5238528 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -1915,12 +1915,12 @@ mapi_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
folder_id = camel_mapi_store_folder_id_lookup (mapi_store, source->full_name) ;
exchange_mapi_util_mapi_id_from_string (folder_id, &src_fid);
- folder_id = camel_mapi_store_folder_id_lookup (mapi_store, destination->full_name) ;
+ folder_id = camel_mapi_store_folder_id_lookup (mapi_store, destination->full_name);
exchange_mapi_util_mapi_id_from_string (folder_id, &dest_fid);
for (i=0; i < uids->len; i++) {
mapi_id_t *mid = g_new0 (mapi_id_t, 1); /* FIXME : */
- if (!exchange_mapi_util_mapi_ids_from_uid (g_ptr_array_index (uids, i), &src_fid, mid))
+ if (!exchange_mapi_util_mapi_ids_from_uid (g_ptr_array_index (uids, i), &src_fid, mid))
continue;
src_msg_ids = g_slist_prepend (src_msg_ids, mid);
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 71bafb8..1e874fb 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -432,10 +432,38 @@ mapi_get_folder(CamelStore *store, const char *folder_name, guint32 flags, Camel
{
CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (store);
CamelMapiStorePrivate *priv = mapi_store->priv;
+ CamelMapiStoreInfo *si;
CamelFolder *folder;
- char *storage_path = NULL;
+ gchar *storage_path = NULL;
+
+ si = camel_mapi_store_summary_full_name (mapi_store->summary, folder_name);
+ if (!si && (flags & CAMEL_STORE_FOLDER_CREATE) == CAMEL_STORE_FOLDER_CREATE) {
+ gchar *name, *tmp;
+ const gchar *parent;
+ CamelFolderInfo *folder_info;
+
+ tmp = g_strdup (folder_name);
+ if (!(name = strrchr (tmp, '/'))) {
+ name = tmp;
+ parent = "";
+ } else {
+ *name++ = '\0';
+ parent = tmp;
+ }
+
+ folder_info = mapi_create_folder (store, parent, name, ex);
+ g_free (tmp);
+
+ if (!folder_info)
+ return NULL;
- storage_path = g_strdup_printf("%s/folders", priv->storage_path);
+ camel_store_free_folder_info (store, folder_info);
+ }
+
+ if (si)
+ camel_store_summary_info_free ((CamelStoreSummary *)mapi_store->summary, (CamelStoreInfo *)si);
+
+ storage_path = g_strdup_printf ("%s/folders", priv->storage_path);
folder = camel_mapi_folder_new (store, folder_name, storage_path, flags, ex);
g_free (storage_path);
@@ -462,7 +490,7 @@ mapi_create_folder(CamelStore *store, const char *parent_name, const char *folde
folder_name);
return NULL;
}
-
+
if (parent_name && (strlen(parent_name) > 0) )
parent_id = g_strdup (g_hash_table_lookup (priv->name_hash, parent_name));
else
@@ -486,7 +514,7 @@ mapi_create_folder(CamelStore *store, const char *parent_name, const char *folde
si = camel_mapi_store_summary_add_from_full(mapi_store->summary, root->full_name, '/', fid, parent_id);
camel_store_summary_save((CamelStoreSummary *)mapi_store->summary);
- mapi_update_folder_hash_tables (mapi_store, folder_name, fid, parent_id);
+ mapi_update_folder_hash_tables (mapi_store, root->full_name, fid, parent_id);
camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", root);
}
@@ -1142,15 +1170,10 @@ mapi_folders_update_hash_tables_from_cache (CamelMapiStore *store)
for (i = 0; i < summary_count; i++) {
CamelMapiStoreInfo *si = (CamelMapiStoreInfo *) camel_store_summary_index(summary, i);
- gchar *name;
if (si == NULL) continue;
- name = g_strrstr(si->full_name, "/");
- name ? ++name : si->full_name;
-
- mapi_update_folder_hash_tables (store, name, si->folder_id, si->parent_id);
-
+ mapi_update_folder_hash_tables (store, si->full_name, si->folder_id, si->parent_id);
}
}
@@ -1268,14 +1291,14 @@ mapi_folders_sync (CamelMapiStore *store, const char *top, guint32 flags, CamelE
/*populate the hash table for finding the mapping from container id <-> folder name*/
for (;temp_list != NULL ; temp_list = g_slist_next (temp_list) ) {
- const char *name;
+ const char *full_name;
gchar *fid = NULL, *parent_id = NULL;
- name = exchange_mapi_folder_get_name ((ExchangeMAPIFolder *)(temp_list->data));
+ full_name = exchange_mapi_folder_get_name ((ExchangeMAPIFolder *)(temp_list->data));
fid = g_strdup_printf ("%016" G_GINT64_MODIFIER "X", exchange_mapi_folder_get_fid((ExchangeMAPIFolder *)(temp_list->data)));
parent_id = g_strdup_printf ("%016" G_GINT64_MODIFIER "X", exchange_mapi_folder_get_parent_id ((ExchangeMAPIFolder *)(temp_list->data)));
- mapi_update_folder_hash_tables (store, name, fid, parent_id);
+ mapi_update_folder_hash_tables (store, full_name, fid, parent_id);
if (((ExchangeMAPIFolder *)(temp_list->data))->is_default) {
guint *type = g_new0 (guint, 1);
@@ -1418,7 +1441,6 @@ mapi_subscribe_folder(CamelStore *store, const char *folder_name, CamelException
CamelStoreInfo *si = NULL;
gchar *parent_name = NULL;
gchar *f_name = NULL;
- CamelURL *url;
/* TODO : exchange_mapi_add_to_favorites (); */
si = camel_store_summary_path((CamelStoreSummary *)mapi_store->summary, folder_name);
@@ -1441,18 +1463,14 @@ mapi_subscribe_folder(CamelStore *store, const char *folder_name, CamelException
return;
}
- fi = mapi_build_folder_info(mapi_store, parent_name, g_strdup (folder_name)); /* FIXME */
-
- url = camel_url_new(mapi_store->priv->base_url,NULL);
- url->path = g_strdup_printf("/%s", camel_store_info_path((CamelStoreSummary *)mapi_store->summary, si));
- g_free (fi->uri);
- fi->uri = camel_url_to_string(url,CAMEL_URL_HIDE_ALL);
+ fi = mapi_build_folder_info (mapi_store, parent_name, folder_name);
fi->flags |= CAMEL_FOLDER_SUBSCRIBED;
fi->flags |= CAMEL_FOLDER_NOCHILDREN;
fi->flags |= CAMEL_STORE_INFO_FOLDER_SUBSCRIBED;
camel_object_trigger_event (CAMEL_OBJECT (store), "folder_subscribed", fi);
+ camel_folder_info_free (fi);
}
static gboolean
@@ -1477,7 +1495,6 @@ mapi_unsubscribe_folder(CamelStore *store, const char *folder_name, CamelExcepti
CamelStoreInfo *si;
gchar *parent_name = NULL;
gchar *f_name = NULL;
- CamelURL *url;
CamelMapiStore *mapi_store = CAMEL_MAPI_STORE (store);
@@ -1501,14 +1518,10 @@ mapi_unsubscribe_folder(CamelStore *store, const char *folder_name, CamelExcepti
return;
}
- fi = mapi_build_folder_info(mapi_store, parent_name, g_strdup (folder_name)); /* FIXME */
-
- url = camel_url_new(mapi_store->priv->base_url,NULL);
- url->path = g_strdup_printf("/%s", camel_store_info_path((CamelStoreSummary *)mapi_store->summary, si));
- g_free (fi->uri);
- fi->uri = camel_url_to_string(url,CAMEL_URL_HIDE_ALL);
+ fi = mapi_build_folder_info (mapi_store, parent_name, folder_name);
camel_object_trigger_event (CAMEL_OBJECT (store), "folder_unsubscribed", fi);
+ camel_folder_info_free (fi);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]