]> granicus.if.org Git - neomutt/commitdiff
mailbox: drop unnec function
authorRichard Russon <rich@flatcap.org>
Fri, 9 Nov 2018 00:20:00 +0000 (00:20 +0000)
committerRichard Russon <rich@flatcap.org>
Fri, 9 Nov 2018 00:26:53 +0000 (00:26 +0000)
Fixes #1388

Thanks to @alyssais and @puckipedia.

mailbox.c
mailbox.h
mx.c

index 429f93ae95c42cfccfd106b49097688b4f8687f9..f00ca00307284196c5b16dc7a2f9592ef295ee87 100644 (file)
--- a/mailbox.c
+++ b/mailbox.c
@@ -410,38 +410,6 @@ static void mailbox_check(struct Mailbox *m, struct stat *ctx_sb, bool check_sta
     MailboxNotify++;
 }
 
-/**
- * mailbox_get - Fetch mailbox object for given path, if present
- * @param path Path to the mailbox
- * @retval ptr Mailbox for the path
- */
-static struct Mailbox *mailbox_get(const char *path)
-{
-  if (!path)
-    return NULL;
-
-  char *epath = mutt_str_strdup(path);
-  if (!epath)
-    return NULL;
-
-  mutt_expand_path(epath, mutt_str_strlen(epath));
-
-  struct MailboxNode *np = NULL;
-  STAILQ_FOREACH(np, &AllMailboxes, entries)
-  {
-    /* must be done late because e.g. IMAP delimiter may change */
-    mutt_expand_path(np->m->path, sizeof(np->m->path));
-    if (mutt_str_strcmp(np->m->path, path) == 0)
-    {
-      FREE(&epath);
-      return np->m;
-    }
-  }
-
-  FREE(&epath);
-  return NULL;
-}
-
 /**
  * mutt_mailbox_cleanup - Restore the timestamp of a mailbox
  * @param path Path to the mailbox
@@ -897,11 +865,10 @@ bool mutt_mailbox_list(void)
 
 /**
  * mutt_mailbox_setnotified - Note when the user was last notified of new mail
- * @param path Path to the mailbox
+ * @param m Mailbox
  */
-void mutt_mailbox_setnotified(const char *path)
+void mutt_mailbox_setnotified(struct Mailbox *m)
 {
-  struct Mailbox *m = mailbox_get(path);
   if (!m)
     return;
 
index 4de35c19820548bf357d0fe8348eaf7d1dd6fcca..92ef85b2a9bd31e19c20b78256d4a0d61d0d0611 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -152,7 +152,7 @@ void mutt_update_mailbox(struct Mailbox *m);
 void mutt_mailbox_cleanup(const char *path, struct stat *st);
 
 /** mark mailbox just left as already notified */
-void mutt_mailbox_setnotified(const char *path);
+void mutt_mailbox_setnotified(struct Mailbox *m);
 
 /* force flags passed to mutt_mailbox_check() */
 #define MUTT_MAILBOX_CHECK_FORCE       (1 << 0)
diff --git a/mx.c b/mx.c
index 4db425553906067432faa457a585231572b34472..d6d94f04de7c6606b9189b8605b643d7c305e7a5 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -392,7 +392,7 @@ void mx_fastclose_mailbox(struct Context *ctx)
   /* never announce that a mailbox we've just left has new mail. #3290
    * TODO: really belongs in mx_mbox_close, but this is a nice hook point */
   if (!ctx->peekonly)
-    mutt_mailbox_setnotified(ctx->mailbox->path);
+    mutt_mailbox_setnotified(ctx->mailbox);
 
   if (ctx->mailbox->mx_ops)
     ctx->mailbox->mx_ops->mbox_close(ctx);