Patch: fix purging attachments in maildir folders



	Hi,

	This patch fixes the method rewrite_cache in CamelMaildirFolder. This
is used to write an updated version of a message with purged messages
removed.

	The problem was that we were using the uid as the expected filename to
replace in maildir, when it's not true now because the filename includes
the flags.

-- 
Jose Dapena Paz <jdapena igalia com>
Igalia
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2960)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2007-11-16  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-folder.c:
+	Now rewrite folder gets the filename of the messages to rewrite from the
+	message info instead of using simply the message uid.
+
 2007-11-16  Philip Van Hoof  <pvanhoof gnome org>
 
 	* Bugfix in TnyGtkFolderStoreTreeModel: the signals where not being
Index: libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-folder.c	(revision 2960)
+++ libtinymail-camel/camel-lite/camel/providers/local/camel-maildir-folder.c	(working copy)
@@ -293,9 +293,18 @@
 	char *name = NULL;
 	CamelStream *output_stream = NULL;
 	char *dest = NULL;
+	CamelMessageInfo *info;
+	CamelMaildirMessageInfo *mdi;
 
+	/* get the message summary info */
+	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
+		return;
+	}
+
+	mdi = (CamelMaildirMessageInfo *)info;
+
 	/* write it out to tmp, use the uid we got from the summary */
-	name = g_strdup_printf ("%s/tmp/%s", lf->folder_path, uid);
+	name = g_strdup_printf("%s/tmp/%s", lf->folder_path, camel_maildir_info_filename(mdi));
 	output_stream = camel_stream_fs_new_with_name (name, O_WRONLY|O_CREAT, 0600);
 	if (output_stream == NULL)
 		goto fail_write;
@@ -305,16 +314,18 @@
 		goto fail_write;
 
 	/* now move from tmp to cur (bypass new, does it matter?) */
-	dest = g_strdup_printf("%s/cur/%s", lf->folder_path, uid);
+	dest = g_strdup_printf("%s/cur/%s", lf->folder_path, camel_maildir_info_filename(mdi));
 	if (rename (name, dest) == -1)
 		goto fail_write;
 
 	g_free (dest);
 	g_free (name);
-
+	camel_message_info_free(info);
+	
 	return;
 
  fail_write:
+	camel_message_info_free(info);
 	g_free (name);
 	g_free (dest);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]