aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 3c8818020d..e6c516a46e 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -35,6 +35,7 @@
#include <gal/widgets/e-unicode.h>
#include <camel/camel-mime-filter-from.h>
#include <camel/camel-operation.h>
+#include <camel/camel-vtrash-folder.h>
#include "mail.h"
#include "mail-tools.h"
#include "mail-ops.h"
@@ -893,7 +894,7 @@ transfer_messages_transfer (struct _mail_msg *mm)
void (*func) (CamelFolder *, GPtrArray *,
CamelFolder *,
CamelException *);
-
+
if (m->delete) {
func = camel_folder_move_messages_to;
desc = _("Moving");
@@ -901,20 +902,30 @@ transfer_messages_transfer (struct _mail_msg *mm)
func = camel_folder_copy_messages_to;
desc = _("Copying");
}
-
+
dest = mail_tool_uri_to_folder (m->dest_uri, &mm->ex);
if (camel_exception_is_set (&mm->ex))
return;
-
+
camel_folder_freeze (m->source);
camel_folder_freeze (dest);
- (func) (m->source, m->uids, dest, &mm->ex);
+ if (CAMEL_IS_VTRASH_FOLDER (dest)) {
+ if (m->delete) {
+ int i;
+
+ for (i = 0; i < m->uids->len; i++)
+ camel_folder_delete_message (m->source, m->uids->pdata[i]);
+ } else {
+ /* no-op - can't copy messages to*/
+ }
+ } else
+ (func) (m->source, m->uids, dest, &mm->ex);
- camel_folder_thaw(m->source);
- camel_folder_thaw(dest);
- camel_folder_sync(dest, FALSE, NULL);
- camel_object_unref((CamelObject *)dest);
+ camel_folder_thaw (m->source);
+ camel_folder_thaw (dest);
+ camel_folder_sync (dest, FALSE, NULL);
+ camel_object_unref (CAMEL_OBJECT (dest));
}
static void