diff options
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 009581b6d9..dd365b3fb5 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -866,7 +866,19 @@ transfer_messages_transfer (struct _mail_msg *mm) void (*func) (CamelFolder *, GPtrArray *, CamelFolder *, CamelException *); - + + dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &mm->ex); + if (camel_exception_is_set (&mm->ex)) + return; + + if (dest == m->source) { + camel_object_unref((CamelObject *)dest); + camel_exception_setv(&mm->ex, CAMEL_EXCEPTION_FOLDER_INVALID, + _("Cannot copy a folder `%s' to itself"), + m->dest_uri); + return; + } + if (m->delete) { func = camel_folder_move_messages_to; desc = _("Moving"); @@ -875,10 +887,6 @@ transfer_messages_transfer (struct _mail_msg *mm) desc = _("Copying"); } - dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &mm->ex); - if (camel_exception_is_set (&mm->ex)) - return; - camel_folder_freeze (m->source); camel_folder_freeze (dest); |