diff options
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 9aef60cc29..bcb171db80 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -277,6 +277,21 @@ fetch_mail_fetch (struct _mail_msg *mm) * exception, save the UID cache */ if (!fm->delete || camel_exception_is_set (&mm->ex)) camel_uid_cache_save (cache); + + /* if we are deleting off the server an no exception occured + * then iterate through the folder uids and mark them all + * for deletion. */ + if (fm->delete && !camel_exception_is_set (&mm->ex)) { + camel_folder_freeze (folder); + + for (i = 0; i < folder_uids->len; i++) + camel_folder_delete_message (folder, folder_uids->pdata[i]); + + /* sync and expunge */ + camel_folder_sync (folder, TRUE, &mm->ex); + + camel_folder_thaw (folder); + } } camel_uid_cache_destroy (cache); camel_folder_free_uids (folder, folder_uids); |