2011-01-06 [colin] 3.7.8cvs31
authorColin Leroy <colin@colino.net>
Thu, 6 Jan 2011 15:38:07 +0000 (15:38 +0000)
committerColin Leroy <colin@colino.net>
Thu, 6 Jan 2011 15:38:07 +0000 (15:38 +0000)
* 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)

12 files changed:
ChangeLog
PATCHSETS
configure.ac
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

index 4df7e310e2cc6bc6c79dd0bcd7ed6d79b67c545b..81e9ca840481da90bcb6c14952beed57a901b57b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+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
 2011-01-06 [colin]     3.7.8cvs30
 
        * src/gtk/gtkaspell.c
index 5f7d981920d74f9612d70f7b2d6a2d80e47b47a3..1b73e6d69702106369becd8b65cd1e5d7007439a 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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.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
index 4f1ecad70ee11c874bf896e73897af2b599c2fbf..151f5ec999fb1386eaa7b2751004eb2e9bf0bf95 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=30
+EXTRA_VERSION=31
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 02919f598fd1b88ce33ccd3bf4e4469432a25f25..1e4dcfe96d1873a4224d4fa0c6e8c684324e26f0 100644 (file)
@@ -529,7 +529,7 @@ static void addrharvest_parse_address(
                        }
                        else {
                                name = buffer;
                        }
                        else {
                                name = buffer;
-                               name = conv_unmime_header(buffer, NULL);
+                               name = conv_unmime_header(buffer, NULL, TRUE);
                        }
 
                        /* Insert into address book */
                        }
 
                        /* Insert into address book */
index 629e88ad59722f9b892a2b25bfedeb76cebc94ff..b1666c0497b2e0ff31cd8de2eb02de2f1974441a 100644 (file)
@@ -1502,12 +1502,13 @@ static gboolean conv_is_ja_locale(void)
        return is_ja_locale != 0;
 }
 
        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))
 {
        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 (default_encoding) {
                gchar *utf8_buf;
@@ -1517,7 +1518,7 @@ gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding)
                if (utf8_buf) {
                        gchar *decoded_str;
 
                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;
                }
                        g_free(utf8_buf);
                        return decoded_str;
                }
@@ -1528,7 +1529,7 @@ gchar *conv_unmime_header(const gchar *str, const gchar *default_encoding)
        else
                conv_localetodisp(buf, sizeof(buf), str);
 
        else
                conv_localetodisp(buf, sizeof(buf), str);
 
-       return unmime_header(buf);
+       return unmime_header(buf, addr_field);
 }
 
 #define MAX_LINELEN            76
 }
 
 #define MAX_LINELEN            76
index 5856d876ecf21fa246f21033a33806e5bbff54c0..de7cbc5fac3cf0736826db307bc466eed3b91e95 100644 (file)
@@ -196,7 +196,8 @@ const gchar *conv_get_outgoing_charset_str  (void);
 const gchar *conv_get_current_locale           (void);
 
 gchar *conv_unmime_header              (const gchar    *str,
 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,
 void conv_encode_header                        (gchar          *dest,
                                         gint            len,
                                         const gchar    *src,
index ca3532d6f4e5adef07414ff28a1148f79439c4d5..f9a51f6520a7af720c3e576522be6bf52a2f0d19 100644 (file)
@@ -2745,13 +2745,13 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
                if (hentry[H_REPLY_TO].body[0] != '\0') {
                        compose->replyto =
                                conv_unmime_header(hentry[H_REPLY_TO].body,
                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) {
                }
                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;
        }
                g_free(hentry[H_CC].body);
                hentry[H_CC].body = NULL;
        }
@@ -2768,7 +2768,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
        if (hentry[H_BCC].body != NULL) {
                if (compose->mode == COMPOSE_REEDIT)
                        compose->bcc =
        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;
        }
                g_free(hentry[H_BCC].body);
                hentry[H_BCC].body = NULL;
        }
@@ -2780,7 +2780,7 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
                if (hentry[H_FOLLOWUP_TO].body[0] != '\0') {
                        compose->followup_to =
                                conv_unmime_header(hentry[H_FOLLOWUP_TO].body,
                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;
                }
                g_free(hentry[H_FOLLOWUP_TO].body);
                hentry[H_FOLLOWUP_TO].body = NULL;
index 5457efa0c11899db6c99c87d62e1b21b4a117bb3..040d1507310645bac577c6c2798f3d77cd9153d1 100644 (file)
@@ -800,10 +800,10 @@ static MsgInfo *news_parse_xover(struct newsnntp_xover_resp_item *item)
        msginfo->date = g_strdup(item->ovr_date);
        msginfo->date_t = procheader_date_parse(NULL, item->ovr_date, 0);
 
        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->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);
 
        remove_return(msginfo->from);
        remove_return(msginfo->fromname);
index 7520135113122287f70b62f8e2b07b06f53e3c59..e14953ad60bd083033ec0b1a3be06b3a4d6e2852 100644 (file)
@@ -256,11 +256,36 @@ gboolean procheader_headername_equal(char * hdr1, char * hdr2)
   header->name = "From:"
   header->body = "dinh@enseirb.fr"
  */
   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;
 
 Header * procheader_parse_header(gchar * buf)
 {
        gchar *p = buf;
        Header * header;
+       gboolean addr_field = FALSE;
 
        if ((*buf == ':') || (*buf == ' '))
                return NULL;
 
        if ((*buf == ':') || (*buf == ' '))
                return NULL;
@@ -269,9 +294,10 @@ Header * procheader_parse_header(gchar * buf)
                if ((*p == ':') || (*p == ' ')) {
                        header = g_new(Header, 1);
                        header->name = g_strndup(buf, p - buf + 1);
                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++;
                        p++;
                        while (*p == ' ' || *p == '\t') p++;
-                        header->body = conv_unmime_header(p, NULL);
+                       header->body = conv_unmime_header(p, NULL, addr_field);
                        return header;
                }
        }
                        return header;
                }
        }
@@ -510,13 +536,13 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
                        break;
                case H_FROM:
                        if (msginfo->from) break;
                        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:
                        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;
                        remove_return(tmp);
                        if (msginfo->to) {
                                p = msginfo->to;
@@ -528,7 +554,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
                         g_free(tmp);                                
                        break;
                case H_CC:
                         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;
                        remove_return(tmp);
                        if (msginfo->cc) {
                                p = msginfo->cc;
@@ -550,7 +576,7 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
                        break;
                case H_SUBJECT:
                        if (msginfo->subject) break;
                        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:
                        unfold_line(msginfo->subject);
                        break;
                case H_MSG_ID:
index eaec403b87b8876fcddfaf6d721c8687cacea0b0..4b13271ff879f755d372373577c4acae7a344309 100644 (file)
@@ -1386,32 +1386,32 @@ static void procmime_parse_message_rfc822(MimeInfo *mimeinfo, gboolean short_sca
        fseek(fp, mimeinfo->offset, SEEK_SET);
        procheader_get_header_fields(fp, hentry);
        if (hentry[0].body != NULL) {
        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) {
                 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) {
                 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) {
                 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) {
                 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) {
                 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;
         }
                 g_free(hentry[8].body);
                 hentry[8].body = tmp;
         }
@@ -1509,32 +1509,32 @@ bail:
 #define GET_HEADERS() {                                                \
        procheader_get_header_fields(fp, hentry);               \
         if (hentry[0].body != NULL) {                          \
 #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) {                          \
                 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) {                          \
                 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) {                          \
                 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) {                           \
                 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) {                           \
                 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;                          \
         }                                                      \
                 g_free(hentry[7].body);                                \
                 hentry[7].body = tmp;                          \
         }                                                      \
index adb40f2a3028c6a61a67a4c07506348130489615..6feb016fd076648c366db81819f1a0e4086d5cfb 100644 (file)
@@ -34,7 +34,7 @@
 
 /* Decodes headers based on RFC2045 and RFC2047. */
 
 
 /* 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,
 {
        const gchar *p = encoded_str;
        const gchar *eword_begin_p, *encoding_begin_p, *text_begin_p,
@@ -133,7 +133,7 @@ gchar *unmime_header(const gchar *encoded_str)
                 * We check there are no quotes just to be sure. If there
                 * are, well, the comma won't pose a problem, probably.
                 */
                 * 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;
                        gchar *tmp = g_strdup_printf("\"%s\"", decoded_text);
                        g_free(decoded_text);
                        decoded_text = tmp;
index abba6c7f36f32496176a1036875929c3874d9717..ff725cf4795a3e44de502e2de5373585c65fbf00 100644 (file)
@@ -22,6 +22,6 @@
 
 #include <glib.h>
 
 
 #include <glib.h>
 
-gchar *unmime_header   (const gchar    *encoded_str);
+gchar *unmime_header   (const gchar *encoded_str, gboolean addr_field);
 
 #endif /* __UNMIME_H__ */
 
 #endif /* __UNMIME_H__ */