rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | LICENSE

commit feb2c2261057045fb36ba1ba1d15a07482d027d9
parent 3e3a75bd6311c048d2d580334800e64a8d4552c0
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sat, 16 Aug 2014 18:27:14 +0200

List responses may contain atoms or strings.

Diffstat:
imap.c | 10++++++++--
imap.h | 2++
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/imap.c b/imap.c @@ -75,6 +75,12 @@ imap_die(imap_t *imap, char *fmt, ...) exit(1); } +int +imap_isstratom(char *key) +{ + return (!strcmp(key, "atom") | !strcmp(key, "string")); +} + llist_t * imap_llist2ids(char *cfgn, char *mailbox, llist_t *elems) { @@ -939,7 +945,7 @@ imap_status(imap_t *imap, char *mb) case 1: if (elem->key == NULL) goto imapstatusbadending; - if (strcmp(elem->key, "atom")) + if (!imap_isstratom(elem->key)) goto imapstatusbadending; llist_add(status, "mb", elem->data, elem->datalen); @@ -1008,7 +1014,7 @@ imap_listresponse(imap_t *imap, char *cmd) slist = (llist_t *)elem->data; if (slist->last->key == NULL) continue; - if (strcmp((char *)slist->last->key, "atom")) + if (!imap_isstratom((char *)slist->last->key)) continue; if (slist->last->data == NULL) continue; diff --git a/imap.h b/imap.h @@ -32,6 +32,8 @@ struct imap_t { imap_t *imap_new(char *netspec, char *user, char *pass); void imap_free(imap_t *imap); +int imap_isstratom(char *key); + void imap_die(imap_t *imap, char *fmt, ...); llist_t *imap_llist2ids(char *cfgn, char *mailbox, llist_t *ids);