From 90f1194b43faa8dba68271439c20607f3a723187 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 29 Mar 2001 02:03:06 +0000 Subject: Access the folder directly from the message info. 2001-03-29 Not Zed * camel-vtrash-folder.c (vtrash_move_messages_to): Access the folder directly from the message info. (vtrash_move_messages_to): I think we also need to call the real move_messages_to, and not try and bypass the lock, since we dont have the lock for that folder. * camel-vee-folder.h: Move CamelVeeMessageInfo to public, so subclasses can get to it. * camel-vee-folder.c (camel_vee_folder_add_folder): Dont let you add a vfolder to itself. (folder_changed): (vee_folder_remove_folder): (vee_folder_build_folder): Copy changes before triggering changed events, so we can do them outside of locks. (camel_vee_folder_get_message_folder): Removed function. (camel_vee_folder_hash_folder): Made public (renamed from hash_folder), simply for subclasses (probably not needed). svn path=/trunk/; revision=9004 --- camel/camel-vtrash-folder.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'camel/camel-vtrash-folder.c') diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c index acaa9c5b34..ed8e9f0765 100644 --- a/camel/camel-vtrash-folder.c +++ b/camel/camel-vtrash-folder.c @@ -112,27 +112,31 @@ vtrash_copy_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest static void vtrash_move_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, CamelException *ex) { - CamelFolder *original; + CamelVeeMessageInfo *mi; int i; for (i = 0; i < uids->len; i++) { - original = camel_vee_folder_get_message_folder (CAMEL_VEE_FOLDER (source), uids->pdata[i]); - - if (dest == original) { + mi = (CamelVeeMessageInfo *)camel_folder_get_message_info(source, uids->pdata[i]); + if (mi == NULL) { + g_warning("Cannot find uid %s in source folder during move_to", (char *)uids->pdata[i]); + continue; + } + + if (dest == mi->folder) { /* Just undelete the original message */ CAMEL_FOLDER_CLASS (dest)->set_message_flags (dest, uids->pdata[i], CAMEL_MESSAGE_DELETED, 0); - } else if (original) { + } else { /* This means that the user is trying to move the message from the vTrash to a folder other than the original. */ GPtrArray *tuids; tuids = g_ptr_array_new (); g_ptr_array_add (tuids, uids->pdata[i]); - CAMEL_FOLDER_CLASS (original)->move_messages_to (original, tuids, dest, ex); + /*CAMEL_FOLDER_CLASS (mi->folder)->move_messages_to (mi->folder, tuids, dest, ex);*/ + camel_folder_move_messages_to(mi->folder, tuids, dest, ex); g_ptr_array_free (tuids, TRUE); } - - if (original) - camel_object_unref (CAMEL_OBJECT (original)); + + camel_folder_free_message_info(source, (CamelMessageInfo *)mi); } } -- cgit