[evolution-patches] 61940, replying loses charset override




this doesn't fix the forward-quoted or forward-inline cases.  but well, they're busted anyway.

and it doesn't work for the popup menu, but there's no way to get that context currently

--
Michael Zucchi <notzed ximian com>
"born to die, live to work, it's all downhill from here"
Novell's Evolution and Free Software Developer
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3422
diff -u -3 -r1.3422 ChangeLog
--- mail/ChangeLog	28 Jul 2004 02:55:52 -0000	1.3422
+++ mail/ChangeLog	28 Jul 2004 07:55:45 -0000
@@ -1,3 +1,14 @@
+2004-07-28  Not Zed  <NotZed Ximian com>
+
+	** See #61940.
+
+	* em-composer-utils.c (composer_set_body): add emformat source arg.
+	(em_utils_reply_to_message): take source arg.  Fixed callers.
+
+	* em-utils.c (em_utils_message_to_html): take a source formatter
+	argument, so we can copy/honour settings from it.
+	(em_utils_part_to_html): similar.
+
 2004-07-27  Not Zed  <NotZed Ximian com>
 
 	** See #57972.
Index: mail/em-composer-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-utils.c,v
retrieving revision 1.19
diff -u -3 -r1.19 em-composer-utils.c
--- mail/em-composer-utils.c	27 Jul 2004 16:52:33 -0000	1.19
+++ mail/em-composer-utils.c	28 Jul 2004 07:55:45 -0000
@@ -886,7 +886,7 @@
 		message = messages->pdata[i];
 		subject = mail_tool_generate_forward_subject (message);
 		
-		text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len);
+		text = em_utils_message_to_html (message, _("-------- Forwarded Message --------"), flags, &len, NULL);
 		
 		if (text) {
 			composer = create_new_composer (subject, fromuri);
@@ -1660,7 +1660,7 @@
 }
 
 static void
-composer_set_body (EMsgComposer *composer, CamelMimeMessage *message)
+composer_set_body (EMsgComposer *composer, CamelMimeMessage *message, EMFormat *source)
 {
 	char *text, *credits;
 	CamelMimePart *part;
@@ -1683,7 +1683,7 @@
 	default:
 		/* do what any sane user would want when replying... */
 		credits = attribution_format (ATTRIBUTION, message);
-		text = em_utils_message_to_html(message, credits, EM_FORMAT_QUOTE_CITE, &len);
+		text = em_utils_message_to_html(message, credits, EM_FORMAT_QUOTE_CITE, &len, source);
 		g_free (credits);
 		e_msg_composer_set_body_text(composer, text, len);
 		g_free (text);
@@ -1693,11 +1693,21 @@
 	e_msg_composer_drop_editor_undo (composer);
 }
 
+struct _reply_data {
+	EMFormat *source;
+	int mode;
+};
+
 static void
 reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, void *user_data)
 {
+	struct _reply_data *rd = user_data;
+
 	if (message != NULL)
-		em_utils_reply_to_message(folder, uid, message, GPOINTER_TO_INT(user_data));
+		em_utils_reply_to_message(folder, uid, message, rd->mode, rd->source);
+
+	g_object_unref(rd->source);
+	g_free(rd);
 }
 
 /**
@@ -1706,6 +1716,7 @@
  * @uid: optional uid
  * @message: message to reply to, optional
  * @mode: reply mode
+ * @source: source to inherit view settings from
  *
  * Creates a new composer ready to reply to @message.
  *
@@ -1717,7 +1728,7 @@
  * been replied to.
  **/
 void
-em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, int mode)
+em_utils_reply_to_message(CamelFolder *folder, const char *uid, CamelMimeMessage *message, int mode, EMFormat *source)
 {
 	CamelInternetAddress *to = NULL, *cc = NULL;
 	EMsgComposer *composer;
@@ -1726,7 +1737,13 @@
 	guint32 flags;
 
 	if (folder && uid && message == NULL) {
-		mail_get_message(folder, uid, reply_to_message, GINT_TO_POINTER(mode), mail_thread_new);
+		struct _reply_data *rd = g_malloc0(sizeof(*rd));
+
+		rd->mode = mode;
+		rd->source = source;
+		g_object_ref(rd->source);
+		mail_get_message(folder, uid, reply_to_message, rd, mail_thread_new);
+
 		return;
 	}
 
@@ -1764,7 +1781,7 @@
 	if (cc != NULL)
 		camel_object_unref (cc);
 	
-	composer_set_body (composer, message);
+	composer_set_body (composer, message, source);
 	
 	em_composer_utils_setup_callbacks (composer, folder, uid, flags, flags, NULL, NULL);
 	
@@ -1843,7 +1860,7 @@
 	if (to != NULL)
 		camel_object_unref (to);
 	
-	composer_set_body (composer, message);
+	composer_set_body (composer, message, NULL);
 	
 	em_composer_utils_setup_callbacks (composer, folder, uid, flags, flags, NULL, NULL);
 	
Index: mail/em-composer-utils.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-utils.h,v
retrieving revision 1.6
diff -u -3 -r1.6 em-composer-utils.h
--- mail/em-composer-utils.h	26 Jul 2004 06:33:23 -0000	1.6
+++ mail/em-composer-utils.h	28 Jul 2004 07:55:45 -0000
@@ -33,6 +33,7 @@
 struct _CamelFolder;
 struct _CamelMimeMessage;
 struct _EMsgComposer;
+struct _EMFormat;
 
 void em_composer_utils_setup_callbacks (struct _EMsgComposer *composer, struct _CamelFolder *folder, const char *uid,
 					guint32 flags, guint32 set, struct _CamelFolder *drafts, const char *drafts_uid);
@@ -68,7 +69,7 @@
 	REPLY_MODE_LIST
 };
 
-void em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode);
+void em_utils_reply_to_message (struct _CamelFolder *, const char *uid, struct _CamelMimeMessage *message, int mode, struct _EMFormat *source);
 
 void em_utils_post_reply_to_message_by_uid (struct _CamelFolder *folder, const char *uid);
 
Index: mail/em-folder-view.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-folder-view.c,v
retrieving revision 1.84
diff -u -3 -r1.84 em-folder-view.c
--- mail/em-folder-view.c	28 Jul 2004 02:55:52 -0000	1.84
+++ mail/em-folder-view.c	28 Jul 2004 07:55:46 -0000
@@ -1266,15 +1266,15 @@
 						    ((GString *)state->user_data)->str,
 						    ((GString *)state->user_data)->len,
 						    "text/html");
-			em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, msg, mode);
+			em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, msg, mode, NULL);
 			camel_object_unref(msg);
 		} else {
-			em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, NULL, mode);
+			em_utils_reply_to_message (emfv->folder, emfv->list->cursor_uid, NULL, mode, (EMFormat *)emfv->preview);
 		}
 
 		html_engine_save_buffer_free(state);
 	} else {
-		em_utils_reply_to_message(emfv->folder, emfv->list->cursor_uid, NULL, mode);
+		em_utils_reply_to_message(emfv->folder, emfv->list->cursor_uid, NULL, mode, (EMFormat *)emfv->preview);
 	}
 }
 
Index: mail/em-popup.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-popup.c,v
retrieving revision 1.25
diff -u -3 -r1.25 em-popup.c
--- mail/em-popup.c	26 Jul 2004 06:33:23 -0000	1.25
+++ mail/em-popup.c	28 Jul 2004 07:55:46 -0000
@@ -772,7 +772,7 @@
 	CamelMimeMessage *message;
 	
 	message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
-	em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_SENDER);
+	em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_SENDER, NULL);
 }
 
 static void
@@ -781,7 +781,7 @@
 	CamelMimeMessage *message;
 	
 	message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
-	em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_LIST);
+	em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_LIST, NULL);
 }
 
 static void
@@ -790,7 +790,7 @@
 	CamelMimeMessage *message;
 	
 	message = (CamelMimeMessage *) camel_medium_get_content_object ((CamelMedium *) t->data.part.part);
-	em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_ALL);
+	em_utils_reply_to_message (NULL, NULL, message, REPLY_MODE_ALL, NULL);
 }
 
 static void
Index: mail/em-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.c,v
retrieving revision 1.46
diff -u -3 -r1.46 em-utils.c
--- mail/em-utils.c	27 Jul 2004 16:52:33 -0000	1.46
+++ mail/em-utils.c	28 Jul 2004 07:55:47 -0000
@@ -1365,7 +1365,7 @@
  * Return Value: The part in displayable html format.
  **/
 char *
-em_utils_part_to_html(CamelMimePart *part, ssize_t *len)
+em_utils_part_to_html(CamelMimePart *part, ssize_t *len, EMFormat *source)
 {
 	EMFormatQuote *emfq;
 	CamelStreamMem *mem;
@@ -1378,6 +1378,13 @@
 	
 	emfq = em_format_quote_new(NULL, (CamelStream *)mem, 0);
 	em_format_set_session((EMFormat *)emfq, session);
+	if (source) {
+		/* copy over things we can, other things are internal, perhaps need different api than 'clone' */
+		if (source->default_charset)
+			em_format_set_default_charset((EMFormat *)emfq, source->default_charset);
+		if (source->charset)
+			em_format_set_default_charset((EMFormat *)emfq, source->charset);
+	}
 	em_format_part((EMFormat *) emfq, (CamelStream *) mem, part);
 	g_object_unref (emfq);
 	
@@ -1395,6 +1402,7 @@
 /**
  * em_utils_message_to_html:
  * @message: 
+ * @source:
  * @credits: 
  * @flags: EMFormatQuote flags
  *
@@ -1404,7 +1412,7 @@
  * Return value: The html version.
  **/
 char *
-em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags, ssize_t *len)
+em_utils_message_to_html(CamelMimeMessage *message, const char *credits, guint32 flags, ssize_t *len, EMFormat *source)
 {
 	EMFormatQuote *emfq;
 	CamelStreamMem *mem;
@@ -1417,7 +1425,7 @@
 	
 	emfq = em_format_quote_new(credits, (CamelStream *)mem, flags);
 	em_format_set_session((EMFormat *)emfq, session);
-	em_format_format((EMFormat *)emfq, NULL, NULL, message);
+	em_format_format_clone((EMFormat *)emfq, NULL, NULL, message, source);
 	g_object_unref (emfq);
 	
 	camel_stream_write ((CamelStream *) mem, "", 1);
Index: mail/em-utils.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-utils.h,v
retrieving revision 1.15
diff -u -3 -r1.15 em-utils.h
--- mail/em-utils.h	27 Jul 2004 16:52:33 -0000	1.15
+++ mail/em-utils.h	28 Jul 2004 07:55:47 -0000
@@ -40,6 +40,7 @@
 struct _GtkSelectionData;
 struct _GtkAdjustment;
 struct _CamelException;
+struct _EMFormat;
 
 gboolean em_utils_prompt_user(struct _GtkWindow *parent, const char *promptkey, const char *tag, const char *arg0, ...);
 
@@ -84,8 +85,8 @@
 char *em_utils_get_proxy_uri(void);
 
 /* FIXME: should this have an override charset? */
-char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len);
-char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len);
+char *em_utils_part_to_html(struct _CamelMimePart *part, ssize_t *len, struct _EMFormat *source);
+char *em_utils_message_to_html(struct _CamelMimeMessage *msg, const char *credits, guint32 flags, ssize_t *len, struct _EMFormat *source);
 
 void em_utils_expunge_folder (struct _GtkWidget *parent, struct _CamelFolder *folder);
 void em_utils_empty_trash (struct _GtkWidget *parent);


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