aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author5 <NotZed@Ximian.com>2001-10-06 02:52:21 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-06 02:52:21 +0800
commit796292fb21af04117f0f84e161a9588fc528d939 (patch)
treefb6ccf9e87e27ae7643d1a77950aeaf56d43109b
parentb459329067b9bab7d08ccec9ba22f8d9ea7f25c8 (diff)
downloadgsoc2013-evolution-796292fb21af04117f0f84e161a9588fc528d939.tar
gsoc2013-evolution-796292fb21af04117f0f84e161a9588fc528d939.tar.gz
gsoc2013-evolution-796292fb21af04117f0f84e161a9588fc528d939.tar.bz2
gsoc2013-evolution-796292fb21af04117f0f84e161a9588fc528d939.tar.lz
gsoc2013-evolution-796292fb21af04117f0f84e161a9588fc528d939.tar.xz
gsoc2013-evolution-796292fb21af04117f0f84e161a9588fc528d939.tar.zst
gsoc2013-evolution-796292fb21af04117f0f84e161a9588fc528d939.zip
Try harder to get broken names out of addresses. Unencoded ,'s in names
2001-10-05 <NotZed@Ximian.com> * camel-mime-utils.c (header_decode_mailbox): Try harder to get broken names out of addresses. Unencoded ,'s in names will still break it, but well what can you do eh? (header_decode_mailbox): Always add .'s into address we've scanned past a '.', even if we can't decode the next part. Fix for some annoying bug #. svn path=/trunk/; revision=13453
-rw-r--r--camel/ChangeLog9
-rw-r--r--camel/camel-mime-utils.c44
2 files changed, 46 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index db705d2b8e..25a6108174 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,12 @@
+2001-10-05 <NotZed@Ximian.com>
+
+ * camel-mime-utils.c (header_decode_mailbox): Try harder to get
+ broken names out of addresses. Unencoded ,'s in names will still
+ break it, but well what can you do eh?
+ (header_decode_mailbox): Always add .'s into address we've scanned
+ past a '.', even if we can't decode the next part. Fix for some
+ annoying bug #.
+
2001-10-04 <NotZed@Ximian.com>
* camel-store.c (camel_store_delete_folder): Change the order of
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 38b932a280..d5ca9b436b 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -2330,10 +2330,9 @@ header_decode_mailbox(const char **in)
inptr++;
g_free(pre);
pre = header_decode_word(&inptr);
- if (pre) {
- addr = g_string_append_c(addr, '.');
+ addr = g_string_append_c(addr, '.');
+ if (pre)
addr = g_string_append(addr, pre);
- }
comment = inptr;
header_decode_lwsp(&inptr);
}
@@ -2352,10 +2351,41 @@ header_decode_mailbox(const char **in)
} else {
/* If we get a <, the address was probably a name part, lets try again shall we? */
/* Another fix for seriously-broken-mailers */
- if (name == NULL && *inptr == '<') {
- name = addr;
- addr = g_string_new("");
- closeme = TRUE;
+ if (*inptr && *inptr != ',') {
+ char *text;
+
+ g_warning("We didn't get an '@' where we expected in '%s', trying again", *in);
+ g_warning("Name is '%s', Addr is '%s' we're at '%s'\n", name?name->str:"<UNSET>", addr->str, inptr);
+
+ /* need to keep *inptr, as try_address_again will drop the current character */
+ if (*inptr == '<')
+ closeme = TRUE;
+ else
+ g_string_append_c(addr, *inptr);
+
+ /* check for address is encoded word ... */
+ text = header_decode_string(addr->str, NULL);
+ if (name == NULL) {
+ name = addr;
+ addr = g_string_new("");
+ if (text) {
+ g_string_truncate(name, 0);
+ g_string_append(name, text);
+ }
+ } else {
+ g_string_append(name, text?text:addr->str);
+ g_string_truncate(addr, 0);
+ }
+ g_free(text);
+
+ /* or maybe that we've added up a bunch of broken bits to make an encoded word */
+ text = header_decode_string(name->str, NULL);
+ if (text) {
+ g_string_truncate(name, 0);
+ g_string_append(name, text);
+ g_free(text);
+ }
+
goto try_address_again;
}
w(g_warning("invalid address, no '@' domain part at %c: %s", *inptr, *in));