]> granicus.if.org Git - neomutt/commitdiff
notmuch: remove all unneeded #ifdef USE_NOTMUCH
authorAustin Ray <austin@austinray.io>
Sun, 4 Nov 2018 00:03:48 +0000 (20:03 -0400)
committerRichard Russon <rich@flatcap.org>
Sat, 10 Nov 2018 11:30:31 +0000 (11:30 +0000)
Removed all unnecessary #ifdef USE_NOTMUCH. The remaining #ifdef
USE_NOTMUCH statements gate notmuch-specific calls that are not covered
by an interface.

The notmuch implementation of `mx_path_canon(...)` has been replaced with a
call to `nm_normalize_uri(...)` since that already canonizes notmuch
queries.

email/url.c
mailbox.c
mailbox.h
mutt.h
muttlib.c
status.c

index 177fa0b2fecd77032540d64026c04f9f9e2ab591..f4995f603b496741b9085148eefd6cc65afe861a 100644 (file)
@@ -193,11 +193,7 @@ int url_parse(struct Url *u, char *src)
   src += 2;
 
   /* Notmuch and mailto schemes can include a query */
-#ifdef USE_NOTMUCH
   if ((u->scheme == U_NOTMUCH) || (u->scheme == U_MAILTO))
-#else
-  if (u->scheme == U_MAILTO)
-#endif
   {
     t = strrchr(src, '?');
     if (t)
index ed9aaaeb661e3384cb4076dba9b90ff18f9bdb40..fa83bd8c3524b3b1805c455a5fce79347c567cdd 100644 (file)
--- a/mailbox.c
+++ b/mailbox.c
@@ -342,14 +342,8 @@ static void mailbox_check(struct Mailbox *m, struct stat *ctx_sb, bool check_sta
 
   /* check to see if the folder is the currently selected folder before polling */
   if (!Context || (Context->mailbox->path[0] == '\0') ||
-      ((m->magic == MUTT_IMAP ||
-#ifdef USE_NNTP
-        m->magic == MUTT_NNTP ||
-#endif
-#ifdef USE_NOTMUCH
-        m->magic == MUTT_NOTMUCH ||
-#endif
-        m->magic == MUTT_POP) ?
+      ((m->magic == MUTT_IMAP || m->magic == MUTT_NNTP ||
+        m->magic == MUTT_NOTMUCH || m->magic == MUTT_POP) ?
            (mutt_str_strcmp(m->path, Context->mailbox->path) != 0) :
            (sb.st_dev != ctx_sb->st_dev || sb.st_ino != ctx_sb->st_ino)))
   {
@@ -927,42 +921,6 @@ void mutt_mailbox(char *s, size_t slen)
   *s = '\0';
 }
 
-#ifdef USE_NOTMUCH
-/**
- * mutt_mailbox_vfolder - Find the first virtual folder with new mail
- * @param buf    Buffer for the folder name
- * @param buflen Length of the buffer
- */
-void mutt_mailbox_vfolder(char *buf, size_t buflen)
-{
-  if (mutt_mailbox_check(0))
-  {
-    bool found = false;
-    for (int pass = 0; pass < 2; pass++)
-    {
-      struct MailboxNode *np = NULL;
-      STAILQ_FOREACH(np, &AllMailboxes, entries)
-      {
-        if (np->m->magic != MUTT_NOTMUCH)
-          continue;
-        if ((found || pass) && np->m->has_new)
-        {
-          mutt_str_strfcpy(buf, np->m->desc, buflen);
-          return;
-        }
-        if (mutt_str_strcmp(buf, np->m->path) == 0)
-          found = true;
-      }
-    }
-
-    mutt_mailbox_check(MUTT_MAILBOX_CHECK_FORCE); /* Mailbox was wrong - resync things */
-  }
-
-  /* no folders with new mail */
-  *buf = '\0';
-}
-#endif
-
 /**
  * mutt_context_free - Free a Context
  * @param ctx Context to free
index 65507c168e67f049cb2485ebb4fdcaa0248e1244..7841a74629fc37fcb405348e87a817cbf13251a4 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -139,10 +139,6 @@ STAILQ_HEAD(MailboxList, MailboxNode);
 
 extern struct MailboxList AllMailboxes;
 
-#ifdef USE_NOTMUCH
-void mutt_mailbox_vfolder(char *buf, size_t buflen);
-#endif
-
 struct Mailbox *mailbox_new(void);
 void            mailbox_free(struct Mailbox **m);
 void            mutt_context_free(struct Context **ctx);
diff --git a/mutt.h b/mutt.h
index 75bdfa946ba7cc2f7e40e4823cace3f6518780a7..45c2216ff90e1f484d1d5610c09afd3ad1de4c76 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -87,10 +87,8 @@ enum MuttStatType
 #define MUTT_COMMAND  (1 << 6)  /**< do command completion */
 #define MUTT_PATTERN  (1 << 7)  /**< pattern mode - only used for history classes */
 #define MUTT_LABEL    (1 << 8)  /**< do label completion */
-#ifdef USE_NOTMUCH
 #define MUTT_NM_QUERY (1 << 9)  /**< Notmuch query mode. */
 #define MUTT_NM_TAG   (1 << 10) /**< Notmuch tag +/- mode. */
-#endif
 
 /* flags for mutt_extract_token() */
 #define MUTT_TOKEN_EQUAL         (1<<0)  /**< treat '=' as a special */
index 18ab8ced2dda5dd355854afacb7c97511be2689e..0100aa5b7dad0597caf952e1e3ad749aa959ae9b 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
@@ -57,9 +57,6 @@
 #ifdef USE_IMAP
 #include "imap/imap.h"
 #endif
-#ifdef USE_NOTMUCH
-#include "notmuch/mutt_notmuch.h"
-#endif
 
 /* These Config Variables are only used in muttlib.c */
 struct Regex *GecosMask; ///< Config: Regex for parsing GECOS field of /etc/passwd
@@ -553,18 +550,14 @@ void mutt_pretty_mailbox(char *buf, size_t buflen)
 
   scheme = url_check_scheme(buf);
 
-#ifdef USE_IMAP
   if (scheme == U_IMAP || scheme == U_IMAPS)
   {
     imap_pretty_mailbox(buf, Folder);
     return;
   }
-#endif
 
-#ifdef USE_NOTMUCH
   if (scheme == U_NOTMUCH)
     return;
-#endif
 
   /* if buf is an url, only collapse path component */
   if (scheme != U_UNKNOWN)
index 83466e7312594db44ec62677694ca46e2cb982c2..279f29213a55f2e7e8908ffa63119b4155a21a84 100644 (file)
--- a/status.c
+++ b/status.c
@@ -40,9 +40,6 @@
 #include "options.h"
 #include "protos.h"
 #include "sort.h"
-#ifdef USE_NOTMUCH
-#include "notmuch/mutt_notmuch.h"
-#endif
 
 /* These Config Variables are only used in status.c */
 struct MbTable *StatusChars; ///< Config: Indicator characters for the status bar
@@ -138,20 +135,20 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c
     case 'f':
     {
       struct Mailbox *m = Context ? Context->mailbox : NULL;
-#ifdef USE_NOTMUCH
-      if (m && (m->magic == MUTT_NOTMUCH) && m->desc)
-        mutt_str_strfcpy(tmp, m->desc, sizeof(tmp));
-      else
-#endif
+
 #ifdef USE_COMPRESSED
-          if (m && m->compress_info && (m->realpath[0] != '\0'))
+      if (m && m->compress_info && (m->realpath[0] != '\0'))
       {
         mutt_str_strfcpy(tmp, m->realpath, sizeof(tmp));
         mutt_pretty_mailbox(tmp, sizeof(tmp));
       }
       else
 #endif
-          if (m && (m->path[0] != '\0'))
+          if (m && (m->magic == MUTT_NOTMUCH) && m->desc)
+      {
+        mutt_str_strfcpy(tmp, m->desc, sizeof(tmp));
+      }
+      else if (m && (m->path[0] != '\0'))
       {
         mutt_str_strfcpy(tmp, m->path, sizeof(tmp));
         mutt_pretty_mailbox(tmp, sizeof(tmp));