diff options
author | Not Zed <NotZed@HelixCode.com> | 2001-01-06 10:25:04 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-01-06 10:25:04 +0800 |
commit | 7404de7250e09e94cd369df5a389400fee7d181b (patch) | |
tree | 9490875308a6d443fb88827998bb875e379c7616 /camel/providers/vee | |
parent | 40432fa8e1d493a7ab305b81dcfbd05dfddaea6e (diff) | |
download | gsoc2013-evolution-7404de7250e09e94cd369df5a389400fee7d181b.tar gsoc2013-evolution-7404de7250e09e94cd369df5a389400fee7d181b.tar.gz gsoc2013-evolution-7404de7250e09e94cd369df5a389400fee7d181b.tar.bz2 gsoc2013-evolution-7404de7250e09e94cd369df5a389400fee7d181b.tar.lz gsoc2013-evolution-7404de7250e09e94cd369df5a389400fee7d181b.tar.xz gsoc2013-evolution-7404de7250e09e94cd369df5a389400fee7d181b.tar.zst gsoc2013-evolution-7404de7250e09e94cd369df5a389400fee7d181b.zip |
Dont try and unref a messageinfo that wasn't there, and use the right free
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.
svn path=/trunk/; revision=7278
Diffstat (limited to 'camel/providers/vee')
-rw-r--r-- | camel/providers/vee/camel-vee-folder.c | 33 |
1 files changed, 27 insertions, 6 deletions
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); |