diff options
author | Not Zed <NotZed@Ximian.com> | 2004-03-22 15:26:59 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-03-22 15:26:59 +0800 |
commit | a6d5b77cf93d138233b913b99fc6d612563408f4 (patch) | |
tree | 0b50402bcfa2d68e3c6630564b8c45a968de0fac /camel/camel-mime-utils.c | |
parent | 8d422f78c2583f77f1bc61834553db268e7ad7be (diff) | |
download | gsoc2013-evolution-a6d5b77cf93d138233b913b99fc6d612563408f4.tar.gz gsoc2013-evolution-a6d5b77cf93d138233b913b99fc6d612563408f4.tar.zst gsoc2013-evolution-a6d5b77cf93d138233b913b99fc6d612563408f4.zip |
decode newsgroups header into a list of newsgroups.
2004-03-22 Not Zed <NotZed@Ximian.com>
* camel-mime-utils.c (camel_header_newsgroups_decode)
(camel_header_newsgroups_free): decode newsgroups header into a
list of newsgroups.
** See #55887.
* providers/nntp/camel-nntp-summary.c (camel_nntp_summary_check):
NOOP if we're offline.
* providers/nntp/camel-nntp-store.c (nntp_connected): spit a
warning if we try to do stuff whilst offline, rather than crash.
svn path=/trunk/; revision=25142
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r-- | camel/camel-mime-utils.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 56a9c4bfe2..6d1f6c3b46 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -2759,6 +2759,7 @@ header_references_decode_single (const char **in, struct _camel_header_reference *in = inptr; } +/* TODO: why is this needed? Can't the other interface also work? */ struct _camel_header_references * camel_header_references_inreplyto_decode (const char *in) { @@ -2849,6 +2850,48 @@ camel_header_address_decode(const char *in, const char *charset) return list; } +struct _camel_header_newsgroup * +camel_header_newsgroups_decode(const char *in) +{ + const char *inptr = in; + register char c; + struct _camel_header_newsgroup *head, *last, *ng; + + head = NULL; + last = (struct _camel_header_newsgroup *)&head; + + c = *in; + while (c) { + const char *start; + + header_decode_lwsp(&inptr); + start = in; + while ((c = *in++) && !camel_mime_is_lwsp(c) && c != ',') + ; + if (start != in) { + ng = g_malloc(sizeof(*ng)); + ng->newsgroup = g_strndup(start, in-start); + ng->next = NULL; + last->next = ng; + last = ng; + } + } + + return head; +} + +void +camel_header_newsgroups_free(struct _camel_header_newsgroup *ng) +{ + while (ng) { + struct _camel_header_newsgroup *nng = ng->next; + + g_free(ng->newsgroup); + g_free(ng); + ng = nng; + } +} + /* this must be kept in sync with the header */ static const char *encodings[] = { "", |