diff options
author | 8 <NotZed@Ximian.com> | 2001-10-28 13:11:53 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-28 13:11:53 +0800 |
commit | 4689dccf16912b7f9f8db5eade1d506f725024f9 (patch) | |
tree | fd17e4a5fa30832519dbef1a651569ee46c42923 /mail/mail-local.c | |
parent | 78b66af8ce96ab41e476d3ebf36cd85fced6d781 (diff) | |
download | gsoc2013-evolution-4689dccf16912b7f9f8db5eade1d506f725024f9.tar.gz gsoc2013-evolution-4689dccf16912b7f9f8db5eade1d506f725024f9.tar.zst gsoc2013-evolution-4689dccf16912b7f9f8db5eade1d506f725024f9.zip |
Implemented. (mail_vfolder_rename_uri): We do want to check renamed uri's
2001-10-28 <NotZed@Ximian.com>
* mail-vfolder.c (mail_vfolder_rename_uri): Implemented.
(mail_vfolder_rename_uri): We do want to check renamed uri's from
vstores.
(mail_vfolder_delete_uri): Same.
(store_folder_renamed): Fix the folder hash at the same time.
* mail-folder-cache.c (real_flush_updates): Pass the rename event
to vfolder rename uri.
* mail-local.c (mail_local_folder_reconfigure): Change the store
path to be same as parent + mbox to be full path.
(mls_delete_folder): Change store path to be parent path, and mbox
to be full path.
(mail_local_folder_reconfigure): Fix a leak of tmpname.
* component-factory.c (xfer_folder): Only do a rename if we have
remove set, cleaned up logic a bit.
(idle_quit): Put the components still active check last last of
all.
(storage_create_folder): IF we have a fragment, use that as part
part for parent.
svn path=/trunk/; revision=14276
Diffstat (limited to 'mail/mail-local.c')
-rw-r--r-- | mail/mail-local.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/mail/mail-local.c b/mail/mail-local.c index ffaa890e9a..8f43497ce4 100644 --- a/mail/mail-local.c +++ b/mail/mail-local.c @@ -605,11 +605,12 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int CamelStore *fromstore = NULL; CamelFolder *fromfolder = NULL; char *oldformat = NULL; - char *tmpname; char *store_uri; GPtrArray *uids; int real_folder_frozen = FALSE; int format_change, index_changed; + char *tmpname = NULL; + char *mbox = NULL; format_change = strcmp(mlf->meta->format, new_format) != 0; index_changed = mlf->meta->indexed != index_body; @@ -639,8 +640,7 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int goto cleanup; } - store_uri = g_strdup_printf("%s:%s%s", mlf->meta->format, - ((CamelService *)((CamelFolder *)mlf)->parent_store)->url->path, mlf->real_path); + store_uri = g_strdup_printf("%s:%s", mlf->meta->format, ((CamelService *)((CamelFolder *)mlf)->parent_store)->url->path); fromstore = camel_session_get_store(session, store_uri, ex); g_free(store_uri); if (fromstore == NULL) @@ -650,10 +650,11 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int mlf->meta->format = g_strdup(new_format); /* rename the old mbox and open it again, without indexing */ - tmpname = g_strdup_printf ("%s_reconfig", mlf->meta->name); - d(printf("renaming %s to %s, and opening it\n", mlf->meta->name, tmpname)); + tmpname = g_strdup_printf ("%s/%s_reconfig", mlf->real_path, mlf->meta->name); + mbox = g_strdup_printf("%s/%s", mlf->real_path, mlf->meta->name); + d(printf("renaming %s to %s, and opening it\n", mbox, tmpname)); - camel_store_rename_folder(fromstore, mlf->meta->name, tmpname, ex); + camel_store_rename_folder(fromstore, mbox, tmpname, ex); if (camel_exception_is_set(ex)) goto cleanup; @@ -662,7 +663,7 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int if (fromfolder == NULL || camel_exception_is_set(ex)) { /* try and recover ... */ camel_exception_clear(ex); - camel_store_rename_folder(fromstore, tmpname, mlf->meta->name, ex); + camel_store_rename_folder(fromstore, tmpname, mbox, ex); goto cleanup; } @@ -673,7 +674,7 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int d(printf("cannot open destination folder\n")); /* try and recover ... */ camel_exception_clear(ex); - camel_store_rename_folder(fromstore, tmpname, mlf->meta->name, ex); + camel_store_rename_folder(fromstore, tmpname, mbox, ex); goto cleanup; } @@ -716,6 +717,9 @@ mail_local_folder_reconfigure (MailLocalFolder *mlf, const char *new_format, int if (fromstore) camel_object_unref((CamelObject *)fromstore); + g_free(tmpname); + g_free(mbox); + LOCAL_FOLDER_UNLOCK (mlf); if (real_folder_frozen) @@ -765,7 +769,7 @@ static void mls_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) { CamelStore *real_store; - char *metapath, *uri; + char *metapath, *uri, *mbox; CamelException local_ex; struct _local_meta *meta; @@ -776,7 +780,7 @@ mls_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex /* find the real store for this folder, and proxy the call */ metapath = g_strdup_printf("%s%s/local-metadata.xml", ((CamelService *)store)->url->path, folder_name); meta = load_metainfo(metapath); - uri = g_strdup_printf("%s:%s%s", meta->format, ((CamelService *)store)->url->path, folder_name); + uri = g_strdup_printf("%s:%s", meta->format, ((CamelService *)store)->url->path); real_store = (CamelStore *)camel_session_get_service(session, uri, CAMEL_PROVIDER_STORE, ex); g_free(uri); if (real_store == NULL) { @@ -785,7 +789,9 @@ mls_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex return; } - camel_store_delete_folder(real_store, meta->name, &local_ex); + mbox = g_strdup_printf("%s/%s", folder_name, meta->name); + camel_store_delete_folder(real_store, mbox, &local_ex); + g_free(mbox); if (camel_exception_is_set(&local_ex)) { camel_exception_xfer(ex, &local_ex); g_free(metapath); |