From 7404de7250e09e94cd369df5a389400fee7d181b Mon Sep 17 00:00:00 2001 From: Not Zed Date: Sat, 6 Jan 2001 02:25:04 +0000 Subject: Dont try and unref a messageinfo that wasn't there, and use the right free 2001-01-06 Not Zed * providers/vee/camel-vee-folder.c (vee_folder_build_folder): Dont try and unref a messageinfo that wasn't there, and use the right free function too. Modified patch from Iain. (vee_move_message_to): New method, call the real folders' move_message_to method. svn path=/trunk/; revision=7278 --- camel/providers/vee/camel-vee-folder.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c index 7bfbd6d052..9e01cd5a14 100644 --- a/camel/providers/vee/camel-vee-folder.c +++ b/camel/providers/vee/camel-vee-folder.c @@ -52,6 +52,7 @@ static void vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex) static void vee_expunge (CamelFolder *folder, CamelException *ex); static CamelMimeMessage *vee_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex); +static void vee_move_message_to(CamelFolder *source, const char *uid, CamelFolder *dest, CamelException *ex); static GPtrArray *vee_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex); @@ -99,6 +100,7 @@ camel_vee_folder_class_init (CamelVeeFolderClass *klass) folder_class->expunge = vee_expunge; folder_class->get_message = vee_get_message; + folder_class->move_message_to = vee_move_message_to; folder_class->search_by_expression = vee_search_by_expression; @@ -586,6 +588,23 @@ vee_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name } } +static void +vee_move_message_to(CamelFolder *folder, const char *uid, CamelFolder *dest, CamelException *ex) +{ + CamelVeeMessageInfo *mi; + + mi = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, uid); + if (mi) { + /* noop if it we're moving from the same vfolder (uh, which should't happen but who knows) */ + if (folder != mi->folder) { + camel_folder_move_message_to(mi->folder, strchr(camel_message_info_uid(mi), ':')+1, dest, ex); + } + camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi); + } else { + camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID, _("No such message: %s"), uid); + } +} + /* need incremental update, based on folder. Need to watch folders for changes and update accordingly. @@ -631,13 +650,15 @@ vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException count = camel_folder_summary_count(folder->summary); for (i=0;isummary, i); - if (mi && mi->folder == source) { - const char *uid = camel_message_info_uid(mi); - camel_folder_change_info_add_source(vf->changes, uid); - camel_folder_summary_remove(folder->summary, (CamelMessageInfo *)mi); - i--; + if (mi) { + if (mi->folder == source) { + const char *uid = camel_message_info_uid(mi); + camel_folder_change_info_add_source(vf->changes, uid); + camel_folder_summary_remove(folder->summary, (CamelMessageInfo *)mi); + i--; + } + camel_folder_summary_info_free(folder->summary, (CamelMessageInfo *)mi); } - camel_message_info_free((CamelMessageInfo *)mi); } matches = camel_folder_search_by_expression(f, vf->expression, ex); -- cgit v1.2.3