[evolution-patches] fix for bug #45523



just copy/pasted the mail_tool_quote_message() code that strips the
signature into mail_tool_forward_message()... except that in order for
this to work, I had to not allow mail_get_message_body() quote the
message.

Instead of using mail_get_message_body() to quote the message text, use
the same method we use for replying (which does the special gtkhtml
quoting thing).

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? 42630.patch
? 45523.patch
? 45617.patch
? crash.txt
? mb.patch
? message-tree.c
? message-tree.h
? strftime-fixes.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2762
diff -u -r1.2762 ChangeLog
--- ChangeLog	1 Jul 2003 18:43:21 -0000	1.2762
+++ ChangeLog	2 Jul 2003 21:20:42 -0000
@@ -1,3 +1,18 @@
+2003-07-02  Jeffrey Stedfast  <fejj ximian com>
+
+	* mail-tools.c (mail_tool_forward_message): Strip the signature
+	from the body text. Fixes bug #45523. While we're here, also fix
+	the code to quote exactly the same way as the
+	mail_tool_quote_message() function.
+	(mail_tool_quote_message): The last arg should not be
+	'want_plain', because that arg is for whether or not the body
+	should be quoted.
+
+	* folder-browser.c (message_list_drag_data_get): Apply a
+	From-filter when dragging as a test/uri-list and
+	message/rfc822. Fixes bug #45617. Also free the uids ptrarray for
+	the text/uri-list case.
+
 2003-06-27  Jeffrey Stedfast  <fejj ximian com>
 
 	* message-list.c (filter_date): Use the newer utf8 versions of the
Index: folder-browser.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/folder-browser.c,v
retrieving revision 1.347
diff -u -r1.347 folder-browser.c
--- folder-browser.c	23 Jun 2003 16:56:26 -0000	1.347
+++ folder-browser.c	2 Jul 2003 21:20:43 -0000
@@ -317,6 +317,8 @@
 	{
 		const char *filename, *tmpdir;
 		CamelMimeMessage *message;
+		CamelMimeFilter *filter;
+		CamelStream *fstream;
 		CamelStream *stream;
 		char *uri_list;
 		int fd;
@@ -351,7 +353,7 @@
 		fd = open (uri_list + 7, O_WRONLY | O_CREAT | O_EXCL, 0600);
 		if (fd == -1) {
 			/* cleanup and abort */
-			camel_object_unref (CAMEL_OBJECT (message));
+			camel_object_unref (message);
 			for (i = 1; i < uids->len; i++)
 				g_free (uids->pdata[i]);
 			g_ptr_array_free (uids, TRUE);
@@ -359,20 +361,28 @@
 			return;
 		}
 		
-		stream = camel_stream_fs_new_with_fd (fd);
+		fstream = camel_stream_fs_new_with_fd (fd);
 		
-		camel_stream_write (stream, "From - \n", 8);
+		stream = camel_stream_filter_new_with_stream (fstream);
+		filter = camel_mime_filter_from_new ();
+		camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), filter);
+		camel_object_unref (filter);
+		
+		camel_stream_write (fstream, "From - \n", 8);
 		camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream);
-		camel_object_unref (CAMEL_OBJECT (message));
+		camel_object_unref (message);
 		for (i = 1; i < uids->len; i++) {
 			message = camel_folder_get_message (fb->folder, uids->pdata[i], NULL);
-			camel_stream_write (stream, "From - \n", 8);
+			camel_stream_write (fstream, "From - \n", 8);
 			camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream);
-			camel_object_unref (CAMEL_OBJECT (message));
+			camel_object_unref (message);
 			g_free (uids->pdata[i]);
 		}
 		
-		camel_object_unref (CAMEL_OBJECT (stream));
+		g_ptr_array_free (uids, TRUE);
+		
+		camel_object_unref (stream);
+		camel_object_unref (fstream);
 		
 		gtk_selection_data_set (selection_data, selection_data->target, 8,
 					uri_list, strlen (uri_list));
@@ -381,13 +391,16 @@
 	break;
 	case DND_TARGET_TYPE_MESSAGE_RFC822:
 	{
-		/* FIXME: this'll be fucking slow for the user... pthread this? */
+		CamelMimeFilter *filter;
 		CamelStream *stream;
-		GByteArray *bytes;
+		CamelStream *mem;
+		
+		mem = camel_stream_mem_new ();
 		
-		bytes = g_byte_array_new ();
-		stream = camel_stream_mem_new ();
-		camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), bytes);
+		stream = camel_stream_filter_new_with_stream (mem);
+		filter = camel_mime_filter_from_new ();
+		camel_stream_filter_add (CAMEL_STREAM_FILTER (stream), filter);
+		camel_object_unref (filter);
 		
 		for (i = 0; i < uids->len; i++) {
 			CamelMimeMessage *message;
@@ -398,17 +411,18 @@
 			if (message) {			
 				camel_stream_write (stream, "From - \n", 8);
 				camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream);
-				camel_object_unref (CAMEL_OBJECT (message));
+				camel_object_unref (message);
 			}
 		}
 		
 		g_ptr_array_free (uids, TRUE);
-		camel_object_unref (CAMEL_OBJECT (stream));
+		camel_object_unref (stream);
 		
 		gtk_selection_data_set (selection_data, selection_data->target, 8,
-					bytes->data, bytes->len);
+					CAMEL_STREAM_MEM (mem)->buffer->data,
+					CAMEL_STREAM_MEM (mem)->buffer->len);
 		
-		g_byte_array_free (bytes, TRUE);
+		camel_object_unref (mem);
 	}
 	break;
 	case DND_TARGET_TYPE_X_EVOLUTION_MESSAGE:
Index: mail-tools.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-tools.c,v
retrieving revision 1.116
diff -u -r1.116 mail-tools.c
--- mail-tools.c	11 Jun 2003 16:19:36 -0000	1.116
+++ mail-tools.c	2 Jul 2003 21:20:43 -0000
@@ -372,7 +372,7 @@
 	 * am sure --Larry
 	 */
 	want_plain = FALSE;
-	text = mail_get_message_body (contents, want_plain, want_plain);
+	text = mail_get_message_body (contents, want_plain, FALSE);
 	
 	/* Set the quoted reply text. */
 	if (text) {
@@ -427,19 +427,51 @@
 gchar *
 mail_tool_forward_message (CamelMimeMessage *message, gboolean quoted)
 {
-	char *title, *body, *ret;
-	gboolean send_html;
 	GConfClient *gconf;
+	char *text;
 	
 	gconf = mail_config_get_gconf_client ();
-	send_html = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/send_html", NULL);
 	
-	body = mail_get_message_body (CAMEL_DATA_WRAPPER (message), !send_html, quoted);
-	title = _("Forwarded Message");
-	ret = g_strdup_printf ("-----%s-----<br>%s", title, body ? body : "");
-	g_free (body);
+	text = mail_get_message_body (CAMEL_DATA_WRAPPER (message), FALSE, FALSE);
 	
-	return ret;
+	if (text != NULL) {
+		char *sig, *p, *ret_text;
+		
+		/* FIXME: this code should be merged with the quote_message() code above somehow... */
+		
+		/* look for the signature and strip it off */
+		sig = text;
+	        while ((p = strstr (sig, "\n-- \n")))
+			sig = p + 1;
+		
+		if (sig != text)
+			*sig = '\0';
+		
+		if (quoted) {
+			char *colour;
+			
+			colour = gconf_client_get_string (gconf, "/apps/evolution/mail/display/citation_colour", NULL);
+			
+			ret_text = g_strdup_printf ("-----%s-----<br>"
+						    "<!--+GtkHTML:<DATA class=\"ClueFlow\" key=\"orig\" value=\"1\">-->"
+						    "<font color=\"%s\">\n%s%s%s</font>"
+						    "<!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">-->",
+						    _("Forwarded Message"),
+						    colour ? colour : "#737373",
+						    "<blockquote type=cite><i>", text,
+						    "</i></blockquote>");
+			
+			g_free (colour);
+		} else {
+			ret_text = g_strdup_printf ("-----%s-----<br>%s", _("Forwarded Message"), text ? text : "");
+		}
+		
+		g_free (text);
+		
+		return ret_text;
+	}
+	
+	return NULL;
 }
 
 


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