X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-mime%2Frfc822address.c;h=a76fd25d2d74c9be77905d5e539c2bac8a889c06;hb=7c6a042ca1bccde0ed39d2499e9272f963025e75;hp=9009d4072ba0df7d843e1dc9149ea1faa6fff876;hpb=b934795055e8c16e6cb7c9687a4dce815cb300e6;p=apps%2Fmadmutt.git diff --git a/lib-mime/rfc822address.c b/lib-mime/rfc822address.c index 9009d40..a76fd25 100644 --- a/lib-mime/rfc822address.c +++ b/lib-mime/rfc822address.c @@ -37,14 +37,6 @@ #include "mutt_idna.h" -void address_wipe(address_t *addr) -{ - p_delete(&addr->personal); - p_delete(&addr->mailbox); - address_delete(&addr->next); -} - - void rfc822_qualify(address_t *addr, const char *host) { char *p; @@ -59,7 +51,7 @@ void rfc822_qualify(address_t *addr, const char *host) } } -address_t *address_dup(address_t *addr) +address_t *address_dup(const address_t *addr) { address_t *res = address_new(); @@ -69,7 +61,7 @@ address_t *address_dup(address_t *addr) return res; } -address_t *address_list_dup(address_t *addr) +address_t *address_list_dup(const address_t *addr) { address_t *res = NULL, **resp = &res; @@ -258,7 +250,7 @@ address_t **rfc822_eotoken(address_t **last, static_buf *phrase, static_buf *com s = parse_address(phrase->buf, comment, cur); if (s && *s && *s != ',' && *s != ';') { - address_delete(&cur); + address_list_wipe(&cur); return last; } @@ -289,7 +281,7 @@ address_t *rfc822_parse_adrlist(address_t *top, const char *s) stbuf_append_sp(&phrase); s = next_phrase(s, &phrase); if (!s) { - address_delete(&top); + address_list_wipe(&top); return NULL; } continue; @@ -298,7 +290,7 @@ address_t *rfc822_parse_adrlist(address_t *top, const char *s) stbuf_append_sp(&comment); s = parse_comment(s + 1, &comment); if (!s) { - address_delete(&top); + address_list_wipe(&top); return NULL; } continue; @@ -313,8 +305,8 @@ address_t *rfc822_parse_adrlist(address_t *top, const char *s) s = parse_address(skipspaces(s + 1), &comment, cur); if (!s || *s != '>' || !cur->mailbox) { - address_delete(&top); - address_delete(&cur); + address_list_wipe(&top); + address_list_wipe(&cur); return NULL; } @@ -470,3 +462,22 @@ rfc822_write_address(char *buf, ssize_t buflen, address_t *addr, int display) return pos; } +address_t *mutt_parse_adrlist(address_t *p, const char *s) +{ + /* check for a simple whitespace separated list of addresses */ + char *q = strpbrk(s, "\"<>():;,\\"); + char tmp[HUGE_STRING]; + + if (q) + return rfc822_parse_adrlist(p, s); + + m_strcpy(tmp, sizeof(tmp), s); + q = tmp; + while ((q = strtok(q, " \t"))) { + p = rfc822_parse_adrlist(p, q); + q = NULL; + } + + return p; +} +