+2011-01-06 [colin] 3.7.8cvs31
+
+ * src/addrharvest.c
+ * src/codeconv.c
+ * src/codeconv.h
+ * src/compose.c
+ * src/news.c
+ * src/procheader.c
+ * src/procmime.c
+ * src/unmime.c
+ * src/unmime.h
+ Unmime headers differently whether they're addresses or not:
+ It's useless to quote things containing commas if it's in
+ subject, for example. (introduced in 3.7.8cvs26)
+
2011-01-06 [colin] 3.7.8cvs30
* src/gtk/gtkaspell.c
( cvs diff -u -r 1.8.2.29 -r 1.8.2.30 src/export.c; cvs diff -u -r 1.13.2.28 -r 1.13.2.29 src/import.c; cvs diff -u -r 1.94.2.210 -r 1.94.2.211 src/messageview.c; cvs diff -u -r 1.60.2.71 -r 1.60.2.72 src/prefs_actions.c; cvs diff -u -r 1.49.2.134 -r 1.49.2.135 src/procmime.c; cvs diff -u -r 1.9.2.70 -r 1.9.2.71 src/gtk/gtkaspell.c; cvs diff -u -r 1.1.2.45 -r 1.1.2.46 src/plugins/pgpinline/pgpinline.c; cvs diff -u -r 1.1.2.56 -r 1.1.2.57 src/plugins/pgpmime/pgpmime.c; cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/plugins/smime/smime.c; ) > 3.7.8cvs28.patchset
( cvs diff -u -r 1.100.2.76 -r 1.100.2.77 AUTHORS; cvs diff -u -r 1.654.2.4177 -r 1.654.2.4178 configure.ac; diff -u /dev/null po/lt.po; cvs diff -u -r 1.1.2.70 -r 1.1.2.71 src/gtk/authors.h; ) > 3.7.8cvs29.patchset
( cvs diff -u -r 1.94.2.211 -r 1.94.2.212 src/messageview.c; cvs diff -u -r 1.9.2.71 -r 1.9.2.72 src/gtk/gtkaspell.c; cvs diff -u -r 1.1.2.46 -r 1.1.2.47 src/plugins/pgpinline/pgpinline.c; ) > 3.7.8cvs30.patchset
+( cvs diff -u -r 1.6.10.23 -r 1.6.10.24 src/addrharvest.c; cvs diff -u -r 1.65.2.70 -r 1.65.2.71 src/codeconv.c; cvs diff -u -r 1.15.2.24 -r 1.15.2.25 src/codeconv.h; cvs diff -u -r 1.382.2.565 -r 1.382.2.566 src/compose.c; cvs diff -u -r 1.101.2.62 -r 1.101.2.63 src/news.c; cvs diff -u -r 1.47.2.52 -r 1.47.2.53 src/procheader.c; cvs diff -u -r 1.49.2.135 -r 1.49.2.136 src/procmime.c; cvs diff -u -r 1.8.2.16 -r 1.8.2.17 src/unmime.c; cvs diff -u -r 1.2.10.7 -r 1.2.10.8 src/unmime.h; ) > 3.7.8cvs31.patchset
MICRO_VERSION=8
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=30
+EXTRA_VERSION=31
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
}
else {
name = buffer;
- name = conv_unmime_header(buffer, NULL);
+ name = conv_unmime_header(buffer, NULL, TRUE);
}
/* Insert into address book */
return is_ja_locale != 0;
}
-gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding)
+gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding,
+ gboolean addr_field)
{
gchar buf[BUFFSIZE];
if (is_ascii_str(str))
- return unmime_header(str);
+ return unmime_header(str, addr_field);
if (default_encoding) {
gchar *utf8_buf;
if (utf8_buf) {
gchar *decoded_str;
- decoded_str = unmime_header(utf8_buf);
+ decoded_str = unmime_header(utf8_buf, addr_field);
g_free(utf8_buf);
return decoded_str;
}
else
conv_localetodisp(buf, sizeof(buf), str);
- return unmime_header(buf);
+ return unmime_header(buf, addr_field);
}
#define MAX_LINELEN 76
const gchar *conv_get_current_locale (void);
gchar *conv_unmime_header (const gchar *str,
- const gchar *default_encoding);
+ const gchar *default_encoding,
+ gboolean addr_field);
void conv_encode_header (gchar *dest,
gint len,
const gchar *src,
if (hentry[H_REPLY_TO].body[0] != '\0') {
compose->replyto =
conv_unmime_header(hentry[H_REPLY_TO].body,
- NULL);
+ NULL, TRUE);
}
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, NULL, TRUE);
g_free(hentry[H_CC].body);
hentry[H_CC].body = NULL;
}
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, NULL, TRUE);
g_free(hentry[H_BCC].body);
hentry[H_BCC].body = NULL;
}
if (hentry[H_FOLLOWUP_TO].body[0] != '\0') {
compose->followup_to =
conv_unmime_header(hentry[H_FOLLOWUP_TO].body,
- NULL);
+ NULL, TRUE);
}
g_free(hentry[H_FOLLOWUP_TO].body);
hentry[H_FOLLOWUP_TO].body = NULL;
msginfo->date = g_strdup(item->ovr_date);
msginfo->date_t = procheader_date_parse(NULL, item->ovr_date, 0);
- msginfo->from = conv_unmime_header(item->ovr_author, NULL);
+ msginfo->from = conv_unmime_header(item->ovr_author, NULL, TRUE);
msginfo->fromname = procheader_get_fromname(msginfo->from);
- msginfo->subject = conv_unmime_header(item->ovr_subject, NULL);
+ msginfo->subject = conv_unmime_header(item->ovr_subject, NULL, TRUE);
remove_return(msginfo->from);
remove_return(msginfo->fromname);
header->name = "From:"
header->body = "dinh@enseirb.fr"
*/
+static gboolean header_is_addr_field(const gchar *hdr)
+{
+ static char *addr_headers[] = {
+ "To:",
+ "Cc:",
+ "Bcc:",
+ "From:",
+ "Reply-To:",
+ "Followup-To:",
+ "Followup-and-Reply-To:",
+ "Disposition-Notification-To:",
+ "Return-Receipt-To:",
+ NULL};
+ int i;
+
+ if (!hdr)
+ return FALSE;
+
+ for (i = 0; addr_headers[i] != NULL; i++)
+ if (!strcasecmp(hdr, addr_headers[i]))
+ return FALSE;
+
+ return FALSE;
+}
Header * procheader_parse_header(gchar * buf)
{
gchar *p = buf;
Header * header;
+ gboolean addr_field = FALSE;
if ((*buf == ':') || (*buf == ' '))
return NULL;
if ((*p == ':') || (*p == ' ')) {
header = g_new(Header, 1);
header->name = g_strndup(buf, p - buf + 1);
+ addr_field = header_is_addr_field(header->name);
p++;
while (*p == ' ' || *p == '\t') p++;
- header->body = conv_unmime_header(p, NULL);
+ header->body = conv_unmime_header(p, NULL, addr_field);
return header;
}
}
break;
case H_FROM:
if (msginfo->from) break;
- msginfo->from = conv_unmime_header(hp, NULL);
+ msginfo->from = conv_unmime_header(hp, NULL, TRUE);
msginfo->fromname = procheader_get_fromname(msginfo->from);
remove_return(msginfo->from);
remove_return(msginfo->fromname);
break;
case H_TO:
- tmp = conv_unmime_header(hp, NULL);
+ tmp = conv_unmime_header(hp, NULL, TRUE);
remove_return(tmp);
if (msginfo->to) {
p = msginfo->to;
g_free(tmp);
break;
case H_CC:
- tmp = conv_unmime_header(hp, NULL);
+ tmp = conv_unmime_header(hp, NULL, TRUE);
remove_return(tmp);
if (msginfo->cc) {
p = msginfo->cc;
break;
case H_SUBJECT:
if (msginfo->subject) break;
- msginfo->subject = conv_unmime_header(hp, NULL);
+ msginfo->subject = conv_unmime_header(hp, NULL, FALSE);
unfold_line(msginfo->subject);
break;
case H_MSG_ID:
fseek(fp, mimeinfo->offset, SEEK_SET);
procheader_get_header_fields(fp, hentry);
if (hentry[0].body != NULL) {
- tmp = conv_unmime_header(hentry[0].body, NULL);
+ tmp = conv_unmime_header(hentry[0].body, NULL, FALSE);
g_free(hentry[0].body);
hentry[0].body = tmp;
}
if (hentry[2].body != NULL) {
- tmp = conv_unmime_header(hentry[2].body, NULL);
+ tmp = conv_unmime_header(hentry[2].body, NULL, FALSE);
g_free(hentry[2].body);
hentry[2].body = tmp;
}
if (hentry[4].body != NULL) {
- tmp = conv_unmime_header(hentry[4].body, NULL);
+ tmp = conv_unmime_header(hentry[4].body, NULL, FALSE);
g_free(hentry[4].body);
hentry[4].body = tmp;
}
if (hentry[5].body != NULL) {
- tmp = conv_unmime_header(hentry[5].body, NULL);
+ tmp = conv_unmime_header(hentry[5].body, NULL, FALSE);
g_free(hentry[5].body);
hentry[5].body = tmp;
}
if (hentry[7].body != NULL) {
- tmp = conv_unmime_header(hentry[7].body, NULL);
+ tmp = conv_unmime_header(hentry[7].body, NULL, FALSE);
g_free(hentry[7].body);
hentry[7].body = tmp;
}
if (hentry[8].body != NULL) {
- tmp = conv_unmime_header(hentry[8].body, NULL);
+ tmp = conv_unmime_header(hentry[8].body, NULL, FALSE);
g_free(hentry[8].body);
hentry[8].body = tmp;
}
#define GET_HEADERS() { \
procheader_get_header_fields(fp, hentry); \
if (hentry[0].body != NULL) { \
- tmp = conv_unmime_header(hentry[0].body, NULL); \
+ tmp = conv_unmime_header(hentry[0].body, NULL, FALSE); \
g_free(hentry[0].body); \
hentry[0].body = tmp; \
} \
if (hentry[2].body != NULL) { \
- tmp = conv_unmime_header(hentry[2].body, NULL); \
+ tmp = conv_unmime_header(hentry[2].body, NULL, FALSE); \
g_free(hentry[2].body); \
hentry[2].body = tmp; \
} \
if (hentry[4].body != NULL) { \
- tmp = conv_unmime_header(hentry[4].body, NULL); \
+ tmp = conv_unmime_header(hentry[4].body, NULL, FALSE); \
g_free(hentry[4].body); \
hentry[4].body = tmp; \
} \
if (hentry[5].body != NULL) { \
- tmp = conv_unmime_header(hentry[5].body, NULL); \
+ tmp = conv_unmime_header(hentry[5].body, NULL, FALSE); \
g_free(hentry[5].body); \
hentry[5].body = tmp; \
} \
if (hentry[6].body != NULL) { \
- tmp = conv_unmime_header(hentry[6].body, NULL); \
+ tmp = conv_unmime_header(hentry[6].body, NULL, FALSE); \
g_free(hentry[6].body); \
hentry[6].body = tmp; \
} \
if (hentry[7].body != NULL) { \
- tmp = conv_unmime_header(hentry[7].body, NULL); \
+ tmp = conv_unmime_header(hentry[7].body, NULL, FALSE); \
g_free(hentry[7].body); \
hentry[7].body = tmp; \
} \
/* Decodes headers based on RFC2045 and RFC2047. */
-gchar *unmime_header(const gchar *encoded_str)
+gchar *unmime_header(const gchar *encoded_str, gboolean addr_field)
{
const gchar *p = encoded_str;
const gchar *eword_begin_p, *encoding_begin_p, *text_begin_p,
* We check there are no quotes just to be sure. If there
* are, well, the comma won't pose a problem, probably.
*/
- if (strchr(decoded_text, ',') && !in_quote) {
+ if (addr_field && strchr(decoded_text, ',') && !in_quote) {
gchar *tmp = g_strdup_printf("\"%s\"", decoded_text);
g_free(decoded_text);
decoded_text = tmp;
#include <glib.h>
-gchar *unmime_header (const gchar *encoded_str);
+gchar *unmime_header (const gchar *encoded_str, gboolean addr_field);
#endif /* __UNMIME_H__ */