tList responses may contain atoms or strings. - rohrpost - A commandline mail client to change the world as we see it.
 (HTM) git clone git://r-36.net/rohrpost
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit feb2c2261057045fb36ba1ba1d15a07482d027d9
 (DIR) parent 3e3a75bd6311c048d2d580334800e64a8d4552c0
 (HTM) 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(-)
       ---
 (DIR) diff --git a/imap.c b/imap.c
       t@@ -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)
        {
       t@@ -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);
       t@@ -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;
 (DIR) diff --git a/imap.h b/imap.h
       t@@ -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);