Bug #652914 - IMAP: moving mail puts a copy into real Trash too
authorMilan Crha <mcrha@redhat.com>
Wed, 24 Aug 2011 11:38:14 +0000 (13:38 +0200)
committerMilan Crha <mcrha@redhat.com>
Wed, 24 Aug 2011 11:38:14 +0000 (13:38 +0200)
Also fixes issue when CamelSettings are populated too late for
the initable.

camel/camel-service.c
camel/providers/imap/camel-imap-folder.c

index 03b03b8..e761d5b 100644 (file)
@@ -908,6 +908,7 @@ camel_service_set_settings (CamelService *service,
                                class->settings_type,
                                CAMEL_TYPE_SETTINGS));
                settings = g_object_new (class->settings_type, NULL);
+               camel_settings_load_from_url (settings, camel_service_get_camel_url (service));
        }
 
        if (service->priv->settings != NULL)
index b7b65b7..b32969b 100644 (file)
@@ -2865,7 +2865,7 @@ do_copy (CamelFolder *source,
                        camel_imap_response_free (store, response);
                }
 
-               if (local_error == NULL && delete_originals) {
+               if (local_error == NULL && delete_originals && (mark_moved || !trash_path)) {
                        for (i = last; i < uid; i++) {
                                camel_folder_delete_message (
                                        source, uids->pdata[i]);
@@ -2886,6 +2886,14 @@ do_copy (CamelFolder *source,
                return FALSE;
        }
 
+       /* There is a real trash folder set, which is not on a google account
+          and copied messages should be deleted, thus do not move them into
+          a trash folder, but just expunge them, because the copy part of
+          the operation was successful.
+       */
+       if (trash_path && !mark_moved && delete_originals)
+               camel_imap_expunge_uids_only (source, uids, cancellable, NULL);
+
        return TRUE;
 }