tAdd nostarttls and fix some 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 3e3a75bd6311c048d2d580334800e64a8d4552c0
 (DIR) parent b51e362bd39ee1d1e61584e02c74d2f66c5c34ff
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Sat, 16 Aug 2014 18:21:18 +0200
       
       Add nostarttls and fix some strings.
       
       Diffstat:
         imap.c                              |      10 +++++++---
         imap.h                              |       2 ++
         net.c                               |       3 +++
         net.h                               |       1 +
       
       4 files changed, 13 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/imap.c b/imap.c
       t@@ -29,6 +29,7 @@ imap_new(char *netspec, char *user, char *pass)
                imap->netspec = memdup(netspec, strlen(netspec)+1);
                imap->user = memdup(user, strlen(user)+1);
                imap->pass = memdup(pass, strlen(pass)+1);
       +        imap->starttls = 1;
        
                return imap;
        }
       t@@ -574,6 +575,9 @@ imap_connect(imap_t *imap)
                if (imap->fd == NULL)
                        return 1;
        
       +        if (imap->fd->options && strstr(imap->fd->options, "nostarttls"))
       +                imap->starttls = 0;
       +
                if (net_connect(imap->fd)) {
                        net_free(imap->fd);
                        imap->fd = NULL;
       t@@ -664,7 +668,7 @@ imap_init(imap_t *imap)
                        return 1;
        
                result = llist_get(imap->caps, "STARTTLS");
       -        if (result != NULL) {
       +        if (result != NULL && imap->starttls) {
                        if (imap_starttls(imap))
                                return 1;
                }
       t@@ -935,7 +939,7 @@ imap_status(imap_t *imap, char *mb)
                                case 1:
                                        if (elem->key == NULL)
                                                goto imapstatusbadending;
       -                                if (strcmp(elem->key, "string"))
       +                                if (strcmp(elem->key, "atom"))
                                                goto imapstatusbadending;
                                        llist_add(status, "mb", elem->data,
                                                        elem->datalen);
       t@@ -1004,7 +1008,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, "string"))
       +                if (strcmp((char *)slist->last->key, "atom"))
                                continue;
                        if (slist->last->data == NULL)
                                continue;
 (DIR) diff --git a/imap.h b/imap.h
       t@@ -23,6 +23,8 @@ struct imap_t {
        
                char *selected;
        
       +        int starttls;
       +
                llist_t *caps;
                parser_t *parser;
        };
 (DIR) diff --git a/net.c b/net.c
       t@@ -77,6 +77,9 @@ net_new(char *desc)
                        case 2:
                                ret->service = memdup(tok, strlen(tok)+1);
                                break;
       +                case 3:
       +                        ret->options = memdup(tok, strlen(tok)+1);
       +                        break;
                        default:
                                break;
                        }
 (DIR) diff --git a/net.h b/net.h
       t@@ -13,6 +13,7 @@ struct net_t {
                char *net;
                char *addr;
                char *service;
       +        char *options;
                int type;
        
                void *data[2];