diff options
-rw-r--r-- | camel/ChangeLog | 8 | ||||
-rw-r--r-- | camel/providers/vee/camel-vee-folder.c | 33 |
2 files changed, 35 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 90ab2c8269..4e70ef551d 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2001-01-06 Not Zed <NotZed@HelixCode.com> + + * 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. + 2001-01-04 JP Rosevear <jpr@helixcode.com> * tests/lib/Makefile.am: fix includes for compilation 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;i<count;i++) { CamelVeeMessageInfo *mi = (CamelVeeMessageInfo *)camel_folder_summary_index(folder->summary, 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); |