aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-vtrash-folder.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-04-09 21:45:44 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-04-09 21:45:44 +0800
commitd89f072f8d45dd65ad62188a9e8b5f903ea2faf5 (patch)
tree76247ba6842f7b4c690244038142f7dc22dc0a0c /camel/camel-vtrash-folder.c
parentb2c4de41b127c433577cc886b54ad0caa9a9787d (diff)
downloadgsoc2013-evolution-d89f072f8d45dd65ad62188a9e8b5f903ea2faf5.tar
gsoc2013-evolution-d89f072f8d45dd65ad62188a9e8b5f903ea2faf5.tar.gz
gsoc2013-evolution-d89f072f8d45dd65ad62188a9e8b5f903ea2faf5.tar.bz2
gsoc2013-evolution-d89f072f8d45dd65ad62188a9e8b5f903ea2faf5.tar.lz
gsoc2013-evolution-d89f072f8d45dd65ad62188a9e8b5f903ea2faf5.tar.xz
gsoc2013-evolution-d89f072f8d45dd65ad62188a9e8b5f903ea2faf5.tar.zst
gsoc2013-evolution-d89f072f8d45dd65ad62188a9e8b5f903ea2faf5.zip
If we get multiple Content-Type header values, change subsequent headers
2002-04-09 Not Zed <NotZed@Ximian.com> * camel-mime-part.c (construct_from_parser): If we get multiple Content-Type header values, change subsequent headers to X-Invalid-Content-Type so it doesn't wreck processing. This fixes the reported case in #18929, but i dont know if it fixes the original posters problems. 2002-04-08 Not Zed <NotZed@Ximian.com> * camel-vtrash-folder.c (vtrash_move_messages_to): If we find we're moving from the vtrash to another folder, we need to convert the uid from a vfolder uid to the source uid (+8). Fix for #20886. Also changed to batch multiple moves to different folders so they are done as efficiently as possible rather than one at a time. * camel-mime-utils.c (base64_decode_step): If we only get passed '=', we back track only if we actually output any data. Fix for #21716. (quoted_decode): Pass out size_t instead of int, and use 0 instead of -1 for error since its not signed. This will fix similar bug to above in different circumstances since the result is taken as unsigned. This is only an internal func. (quoted_encode): Return size_t just for consistency. * camel-block-file.c (block_file_validate_root): Comment out the debug and move it into a warning when the validation fails. svn path=/trunk/; revision=16394
Diffstat (limited to 'camel/camel-vtrash-folder.c')
-rw-r--r--camel/camel-vtrash-folder.c57
1 files changed, 48 insertions, 9 deletions
diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c
index 06764af674..cb390eacda 100644
--- a/camel/camel-vtrash-folder.c
+++ b/camel/camel-vtrash-folder.c
@@ -117,12 +117,34 @@ vtrash_copy_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest
_("You cannot copy messages from this trash folder."));
}
+struct _move_data {
+ CamelFolder *folder;
+ CamelFolder *dest;
+ GPtrArray *uids;
+};
+
+static void
+move_messages(CamelFolder *folder, struct _move_data *md, CamelException *ex)
+{
+ int i;
+
+ camel_folder_move_messages_to(md->folder, md->uids, md->dest, ex);
+ for (i=0;i<md->uids->len;i++)
+ g_free(md->uids->pdata[i]);
+ g_ptr_array_free(md->uids, TRUE);
+ camel_object_unref((CamelObject *)md->folder);
+ g_free(md);
+}
+
static void
vtrash_move_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, CamelException *ex)
{
CamelVeeMessageInfo *mi;
int i;
-
+ GHashTable *batch = NULL;
+ const char *tuid;
+ struct _move_data *md;
+
for (i = 0; i < uids->len; i++) {
mi = (CamelVeeMessageInfo *)camel_folder_get_message_info (source, uids->pdata[i]);
if (mi == NULL) {
@@ -135,15 +157,32 @@ vtrash_move_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest
camel_folder_set_message_flags (source, uids->pdata[i], CAMEL_MESSAGE_DELETED, 0);
} else {
/* This means that the user is trying to move the message
- from the vTrash to a folder other than the original. */
- GPtrArray *tuids;
-
- tuids = g_ptr_array_new ();
- g_ptr_array_add (tuids, uids->pdata[i]);
- camel_folder_move_messages_to (mi->folder, tuids, dest, ex);
- g_ptr_array_free (tuids, TRUE);
+ from the vTrash to a folder other than the original.
+ We batch them up as much as we can */
+
+ if (batch == NULL)
+ batch = g_hash_table_new(NULL, NULL);
+ md = g_hash_table_lookup(batch, mi->folder);
+ if (md == NULL) {
+ md = g_malloc0(sizeof(*md));
+ md->folder = mi->folder;
+ camel_object_ref((CamelObject *)md->folder);
+ md->uids = g_ptr_array_new();
+ md->dest = dest;
+ g_hash_table_insert(batch, mi->folder, md);
+ }
+
+ tuid = uids->pdata[i];
+ if (strlen(tuid)>8)
+ tuid += 8;
+ printf("moving message uid '%s'\n", tuid);
+ g_ptr_array_add(md->uids, g_strdup(tuid));
}
-
camel_folder_free_message_info (source, (CamelMessageInfo *)mi);
}
+
+ if (batch) {
+ g_hash_table_foreach(batch, (GHFunc)move_messages, ex);
+ g_hash_table_destroy(batch);
+ }
}