]> granicus.if.org Git - neomutt/commitdiff
imap: remove useless imap_check
authorMehdi Abaakouk <sileht@sileht.net>
Fri, 7 Dec 2018 19:40:34 +0000 (20:40 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 8 Dec 2018 12:23:59 +0000 (12:23 +0000)
imap_check_mailbox and imap_check are the same with different signature.

This change just use the one signature everywhere.

imap/imap.c
imap/imap_private.h
imap/util.c

index 8d759084b519656ab2aea7d95837ef3a574ce00c..cdf5c6adbe90a1adbd8ce658c3ad66e298a02f2d 100644 (file)
@@ -1190,23 +1190,12 @@ int imap_sync_message_for_copy(struct ImapAccountData *adata, struct Email *e,
  */
 int imap_check_mailbox(struct Mailbox *m, bool force)
 {
-  struct ImapAccountData *adata = imap_adata_get(m);
-  return imap_check(adata, m->mdata, force);
-}
-
-/**
- * imap_check - Check for new mail
- * @param adata Imap Account data
- * @param mdata Imap Mailbox data
- * @param force Force a refresh
- * @retval >0 Success, e.g. #MUTT_REOPENED
- * @retval -1 Failure
- */
-int imap_check(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool force)
-{
-  if (!adata || !adata->conn || !mdata)
+  if (!m || !m->account)
     return -1;
 
+  struct ImapAccountData *adata = imap_adata_get(m);
+  struct ImapMboxData *mdata = imap_mdata_get(m);
+
   /* 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;
@@ -1653,7 +1642,7 @@ int imap_sync_mailbox(struct Context *ctx, bool expunge, bool close)
   struct Mailbox *m = ctx->mailbox;
 
   struct ImapAccountData *adata = imap_adata_get(m);
-  struct ImapMboxData *mdata = adata->mailbox->mdata;
+  struct ImapMboxData *mdata = imap_mdata_get(m);
 
   if (adata->state < IMAP_SELECTED)
   {
@@ -1665,7 +1654,7 @@ int imap_sync_mailbox(struct Context *ctx, bool expunge, bool close)
    * to be changed. */
   imap_allow_reopen(m);
 
-  rc = imap_check(adata, mdata, false);
+  rc = imap_check_mailbox(m, false);
   if (rc != 0)
     return rc;
 
@@ -2238,8 +2227,7 @@ static int imap_mbox_check(struct Context *ctx, int *index_hint)
   struct Mailbox *m = ctx->mailbox;
 
   imap_allow_reopen(m);
-  struct ImapAccountData *adata = imap_adata_get(m);
-  int rc = imap_check(adata, m->mdata, false);
+  int rc = imap_check_mailbox(m, false);
   /* NOTE - ctx might have been changed at this point. In particular,
    * m could be NULL. Beware. */
   imap_disallow_reopen(m);
index bf8512f51acd36326529193db0381a8b39b7af06..9c73a03fa5cfbfa8103dfb25971f93d74ed70226 100644 (file)
@@ -273,7 +273,6 @@ struct SeqsetIterator
 
 /* -- private IMAP functions -- */
 /* imap.c */
-int imap_check(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool force);
 int imap_create_mailbox(struct ImapAccountData *adata, char *mailbox);
 int imap_rename_mailbox(struct ImapAccountData *adata, char *oldname, const char *newname);
 int imap_exec_msgset(struct ImapAccountData *adata, const char *pre, const char *post,
index 712eba3b1b8fa255d9da616807d8bafe0130b98c..8cf4cc1dcf724dcd5f6df26faf60ef5ce046bd07 100644 (file)
@@ -1074,10 +1074,7 @@ void imap_keepalive(void)
       continue;
 
     if ((adata->state >= IMAP_AUTHENTICATED) && (now >= (adata->lastread + ImapKeepalive)))
-    {
-      struct ImapMboxData *mdata = adata->mailbox->mdata;
-      imap_check(adata, mdata, true);
-    }
+      imap_check_mailbox(adata->mailbox, true);
   }
 }