diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-06-03 02:09:18 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-06-03 02:09:18 +0800 |
commit | 4cf5bbfa5a228f47256e74a7a11180e2d512561b (patch) | |
tree | 102fe3a9d0607fe08e971e11ac6f7bc13ec2bf15 /camel/camel-mime-utils.c | |
parent | db7feeef33e7d9beb72ededf321acc11fe471c96 (diff) | |
download | gsoc2013-evolution-4cf5bbfa5a228f47256e74a7a11180e2d512561b.tar.gz gsoc2013-evolution-4cf5bbfa5a228f47256e74a7a11180e2d512561b.tar.zst gsoc2013-evolution-4cf5bbfa5a228f47256e74a7a11180e2d512561b.zip |
If we get a funny result, just throw it out. Basically a fix for the one
2000-06-02 Not Zed <NotZed@HelixCode.com>
* camel-mime-utils.c (header_decode_date): If we get a funny
result, just throw it out. Basically a fix for the one true
broken TradeClient.
2000-06-01 Not Zed <NotZed@HelixCode.com>
* camel-folder-summary.c (message_info_free): Free
references/messsage id.
(message_info_save): Save them.
(message_info_load): Load them.
(message_info_new): And get them from the new message.
(CAMEL_FOLDER_SUMMARY_VERSION): Bumped for new changes.
* camel-folder-summary.h: Added references and messageid to
summary.
svn path=/trunk/; revision=3391
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r-- | camel/camel-mime-utils.c | 89 |
1 files changed, 81 insertions, 8 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index af7e9356e1..c893c10050 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -1505,17 +1505,14 @@ header_decode_address(const char **in) return addr; } -char * -header_msgid_decode(const char *in) +static char * +header_msgid_decode_internal(const char **in) { - const char *inptr = in; + const char *inptr = *in; char *msgid = NULL; d(printf("decoding Message-ID: '%s'\n", in)); - if (in == NULL) - return NULL; - header_decode_lwsp(&inptr); if (*inptr == '<') { inptr++; @@ -1534,10 +1531,82 @@ header_msgid_decode(const char *in) } else { w(g_warning("missing opening '<' on message id: %s", in)); } + *in = inptr; return msgid; } +char * +header_msgid_decode(const char *in) +{ + if (in == NULL) + return NULL; + + return header_msgid_decode_internal(&in); +} + +void +header_references_list_append_asis(struct _header_references **list, char *ref) +{ + struct _header_references *w = (struct _header_references *)list, *n; + while (w->next) + w = w->next; + n = g_malloc(sizeof(*n)); + n->id = ref; + n->next = 0; + w->next = n; +} + +int +header_references_list_size(struct _header_references **list) +{ + int count = 0; + struct _header_references *w = *list; + while (w) { + count++; + w = w->next; + } + return count; +} + +void +header_references_list_clear(struct _header_references **list) +{ + struct _header_references *w = *list, *n; + while (w) { + n = w->next; + g_free(w->id); + g_free(w); + w = n; + } + *list = NULL; +} + +/* generate a list of references, from most recent up */ +struct _header_references * +header_references_decode(const char *in) +{ + const char *inptr = in, *intmp; + struct _header_references *head = NULL, *node; + char *id, *last; + + if (in == NULL) + return NULL; + + do { + last = inptr; + id = header_msgid_decode_internal(&inptr); + if (id) { + node = g_malloc(sizeof(*node)); + node->next = head; + head = node; + node->id = id; + } + } while (last != inptr); + + return head; +} + struct _header_address * header_mailbox_decode(const char *in) { @@ -1891,8 +1960,12 @@ header_decode_date(const char *in, int *saveoffset) header_decode_lwsp(&inptr); if (*inptr == ',') inptr++; - else - w(g_warning("day not followed by ','")); + else { + w(g_warning("day not followed by ',' its probably a broken TradeClient, so we'll ignore its date entirely")); + if (saveoffset) + *saveoffset = 0; + return 0; + } } } tm.tm_mday = header_decode_int(&inptr); |