[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:25326] Re: [PATCH] do not use US-ASCII if there are
From:       Antony Dovgal <tony2001 () phpclub ! net>
Date:       2005-07-08 22:47:31
Message-ID: 20050709024731.564a91f5.tony2001 () phpclub ! net
[Download RAW message or body]

Also, starting from the same moment(?), non-ASCII "to" & "reply-to" headers 
are garbled by sylpheed when I click Reply/Reply to All.
All non-ASCII letters there just turn into '_', while body is fine 
(and subject is fine too, after the patch =)). 

From what I can see, this happens because compose_parse_header() calls 
conv_unmime_header() with NULL encoding, which is of course wrong, as 
the original letter I'm replying to has it's own character set and I'd 
like to see it working =)

So, another one patch attached (not-so-small this time).
It accumulates previous patch related to the subject issue.

One more question: 
does anybody mind if I add --enable-debug switch to the configure ?
It's quite unconvenient to edit src/Makefile to get "-02" removed and get "-Wall" inserted.
Also, it would be nice to have several levels of debug which would differ by they debug output.

Any thoughts?

-- 
Wbr, 
Antony Dovgal

["subject_and_to.diff" (application/octet-stream)]

Index: src/compose.c
===================================================================
--- src/compose.c	(revision 414)
+++ src/compose.c	(working copy)
@@ -1229,9 +1229,12 @@
 	};
 
 	FILE *fp;
+	MimeInfo *mimeinfo;
 
 	g_return_val_if_fail(msginfo != NULL, -1);
 
+	mimeinfo = procmsg_mimeinfo_get(msginfo);
+
 	if ((fp = procmsg_open_message(msginfo)) == NULL) return -1;
 	procheader_get_header_fields(fp, hentry);
 	fclose(fp);
@@ -1240,13 +1243,13 @@
 		if (hentry[H_REPLY_TO].body[0] != '\0') {
 			compose->replyto =
 				conv_unmime_header(hentry[H_REPLY_TO].body,
-						   NULL);
+						   mimeinfo ? mimeinfo->charset : NULL);
 		}
 		g_free(hentry[H_REPLY_TO].body);
 		hentry[H_REPLY_TO].body = NULL;
 	}
 	if (hentry[H_CC].body != NULL) {
-		compose->cc = conv_unmime_header(hentry[H_CC].body, NULL);
+		compose->cc = conv_unmime_header(hentry[H_CC].body, mimeinfo ? mimeinfo->charset : NULL);
 		g_free(hentry[H_CC].body);
 		hentry[H_CC].body = NULL;
 	}
@@ -1263,7 +1266,7 @@
 	if (hentry[H_BCC].body != NULL) {
 		if (compose->mode == COMPOSE_REEDIT)
 			compose->bcc =
-				conv_unmime_header(hentry[H_BCC].body, NULL);
+				conv_unmime_header(hentry[H_BCC].body, mimeinfo ? mimeinfo->charset : NULL);
 		g_free(hentry[H_BCC].body);
 		hentry[H_BCC].body = NULL;
 	}
@@ -1275,7 +1278,7 @@
 		if (hentry[H_FOLLOWUP_TO].body[0] != '\0') {
 			compose->followup_to =
 				conv_unmime_header(hentry[H_FOLLOWUP_TO].body,
-						   NULL);
+						   mimeinfo ? mimeinfo->charset : NULL);
 		}
 		g_free(hentry[H_FOLLOWUP_TO].body);
 		hentry[H_FOLLOWUP_TO].body = NULL;
@@ -1295,6 +1298,8 @@
 		g_free(hentry[H_LIST_POST].body);
 		hentry[H_LIST_POST].body = NULL;
 	}
+	
+	procmime_mimeinfo_free_all(mimeinfo);
 
 	if (compose->mode == COMPOSE_REEDIT) {
 		if (msginfo->inreplyto && *msginfo->inreplyto)
@@ -2635,6 +2640,7 @@
 	gchar *canon_buf;
 	const gchar *out_charset;
 	const gchar *body_charset;
+	const gchar *subject_chars;
 	const gchar *src_charset = CS_INTERNAL;
 	EncodingType encoding;
 	gint line;
@@ -2663,7 +2669,8 @@
 	gtk_text_buffer_get_start_iter(buffer, &start);
 	gtk_text_buffer_get_end_iter(buffer, &end);
 	chars = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
-	if (is_ascii_str(chars)) {
+	subject_chars = gtk_entry_get_text(GTK_ENTRY(compose->subject_entry));
+	if (is_ascii_str(chars) && is_ascii_str(subject_chars)) {
 		buf = chars;
 		chars = NULL;
 		body_charset = CS_US_ASCII;
Index: src/procmsg.c
===================================================================
--- src/procmsg.c	(revision 414)
+++ src/procmsg.c	(working copy)
@@ -1465,6 +1465,21 @@
 	return full_msginfo;
 }
 
+MimeInfo *procmsg_mimeinfo_get(MsgInfo *msginfo)
+{
+	FILE *fp;
+	MimeInfo *mimeinfo;
+	
+	if (msginfo == NULL) return NULL;
+	
+	if ((fp = procmsg_open_message(msginfo)) == NULL) return NULL;
+
+	mimeinfo = procmime_scan_mime_header(fp);
+	fclose(fp);
+
+	return mimeinfo;
+}
+
 gboolean procmsg_msginfo_equal(MsgInfo *msginfo_a, MsgInfo *msginfo_b)
 {
 	if (!msginfo_a || !msginfo_b)
Index: src/procmsg.h
===================================================================
--- src/procmsg.h	(revision 414)
+++ src/procmsg.h	(working copy)
@@ -277,6 +277,7 @@
 
 MsgInfo *procmsg_msginfo_copy		(MsgInfo	*msginfo);
 MsgInfo *procmsg_msginfo_get_full_info	(MsgInfo	*msginfo);
+MimeInfo *procmsg_mimeinfo_get(MsgInfo *msginfo);
 gboolean procmsg_msginfo_equal		(MsgInfo	*msginfo_a,
 					 MsgInfo	*msginfo_b);
 void	 procmsg_msginfo_free		(MsgInfo	*msginfo);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic