]> granicus.if.org Git - neomutt/commitdiff
Imap: tidy
authorRichard Russon <rich@flatcap.org>
Tue, 23 Oct 2018 22:25:15 +0000 (23:25 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 25 Oct 2018 20:38:43 +0000 (21:38 +0100)
imap/command.c
imap/imap.c

index acf92924503e563945c7a86e0241f8b54e8ce826..2f484d7b9b71ffe3c6dfbc4e3212129d03519cf6 100644 (file)
@@ -1086,6 +1086,9 @@ int imap_cmd_start(struct ImapAccountData *adata, const char *cmdstr)
  */
 int imap_cmd_step(struct ImapAccountData *adata)
 {
+  if (!adata)
+    return -1;
+
   size_t len = 0;
   int c;
   int rc;
@@ -1313,6 +1316,9 @@ int imap_exec(struct ImapAccountData *adata, const char *cmdstr, int flags)
  */
 void imap_cmd_finish(struct ImapAccountData *adata)
 {
+  if (!adata)
+    return;
+
   if (adata->status == IMAP_FATAL)
   {
     cmd_handle_fatal(adata);
index 04cae31707e8bd0a1c38d8849435996b9d42b3ae..467581e480757163b691690ede5cef302a0f6fed 100644 (file)
@@ -948,9 +948,9 @@ struct ImapAccountData *imap_conn_find(const struct ConnAccount *account, int fl
       else if (adata->state < IMAP_AUTHENTICATED)
         continue;
     }
-    if (flags & MUTT_IMAP_CONN_NOSELECT && adata && adata->state >= IMAP_SELECTED)
+    if ((flags & MUTT_IMAP_CONN_NOSELECT) && adata && (adata->state >= IMAP_SELECTED))
       continue;
-    if (adata && adata->status == IMAP_FATAL)
+    if (adata && (adata->status == IMAP_FATAL))
       continue;
     break;
   }
@@ -981,7 +981,7 @@ struct ImapAccountData *imap_conn_find(const struct ConnAccount *account, int fl
     else
       mutt_account_unsetpass(&adata->conn->account);
   }
-  if (new && adata->state == IMAP_AUTHENTICATED)
+  if (new && (adata->state == IMAP_AUTHENTICATED))
   {
     /* capabilities may have changed */
     imap_exec(adata, "CAPABILITY", IMAP_CMD_QUEUE);
@@ -1384,6 +1384,9 @@ int imap_check_mailbox(struct Mailbox *mailbox, bool force)
  */
 int imap_check(struct ImapAccountData *adata, bool force)
 {
+  if (!adata)
+    return -1;
+
   /* overload keyboard timeout to avoid many mailbox checks in a row.
    * Most users don't like having to wait exactly when they press a key. */
   int result = 0;
@@ -1488,7 +1491,7 @@ int imap_mailbox_check(bool check_stats)
       continue;
     }
 
-    if (lastdata && adata != lastdata)
+    if (lastdata && (adata != lastdata))
     {
       /* Send commands to previous server. Sorting the mailbox list
        * may prevent some infelicitous interleavings */