]> granicus.if.org Git - neomutt/commitdiff
notmuch: replace hard-coded maildir flags
authorAustin Ray <austin@austinray.io>
Fri, 2 Nov 2018 23:02:11 +0000 (19:02 -0400)
committerRichard Russon <rich@flatcap.org>
Sat, 10 Nov 2018 11:30:31 +0000 (11:30 +0000)
Replaced the hard-coded maildir flags unread, flagged, and replied with
variables NmUnreadTag, NmFlaggedTag, and NmRepliedTag.

Since unread and flagged may be different from the maildir flag, we do
not want to limit to using "unread", "flagged", or "unread" when
modifying tags. The user can specify which tags they use for the maildir
flags, and the subsystem will update maildir flags correctly.

init.h
notmuch/mutt_notmuch.c
notmuch/mutt_notmuch.h

diff --git a/init.h b/init.h
index d22dc84990a3b98c9d05f61e277a686812b67c56..c71fb2591941b54dec7b52b8d22b6d6932580cf3 100644 (file)
--- a/init.h
+++ b/init.h
@@ -2186,15 +2186,22 @@ struct ConfigDef MuttVars[] = {
   /*
   ** .pp
   ** This variable specifies notmuch tag which is used for unread messages. The
-  ** variable is used to count unread messages in DB only. All other NeoMutt commands
-  ** use standard (e.g. maildir) flags.
+  ** variable is used to count unread messages in DB and set the unread flag when
+  ** modifiying tags. All other NeoMutt commands use standard (e.g. maildir) flags.
   */
   { "nm_flagged_tag", DT_STRING, R_NONE, &NmFlaggedTag, IP "flagged" },
   /*
   ** .pp
   ** This variable specifies notmuch tag which is used for flagged messages. The
-  ** variable is used to count flagged messages in DB only. All other NeoMutt commands
-  ** use standard (e.g. maildir) flags.
+  ** variable is used to count flagged messages in DB and set the flagged flag when
+  ** modifying tags. All other NeoMutt commands use standard (e.g. maildir) flags.
+  */
+  { "nm_replied_tag", DT_STRING, R_NONE, &NmRepliedTag, IP "replied" },
+  /*
+  ** .pp
+  ** This variable specifies notmuch tag which is used for replied messages. The
+  ** variable is used to set the replied flag when modifiying tags. All other NeoMutt
+  ** commands use standard (e.g. maildir) flags.
   */
 #endif
 #ifdef USE_NNTP
index 0bbd6a99024a94e9bd33ce6e135e341972a17f37..505bfac5e222c8b1dce3663a8249f86df16c61a4 100644 (file)
@@ -86,6 +86,7 @@ char *NmQueryWindowTimebase; ///< Config: (notmuch) Units for the time duration
 char *NmRecordTags; ///< Config: (notmuch) Tags to apply to the 'record' mailbox (sent mail)
 char *NmUnreadTag;  ///< Config: (notmuch) Tag to use for unread messages
 char *NmFlaggedTag; ///< Config: (notmuch) Tag to use for flagged messages
+char *NmRepliedTag; ///< Config: (notmuch) Tag to use for replied messages
 
 /**
  * string_to_query_type - Lookup a query type
@@ -1249,21 +1250,21 @@ static int update_email_flags(struct Context *ctx, struct Email *e, const char *
     if (*tag == '-')
     {
       tag = tag + 1;
-      if (strcmp(tag, "unread") == 0)
+      if (strcmp(tag, NmUnreadTag) == 0)
         mutt_set_flag(ctx, e, MUTT_READ, 1);
-      else if (strcmp(tag, "replied") == 0)
+      else if (strcmp(tag, NmRepliedTag) == 0)
         mutt_set_flag(ctx, e, MUTT_REPLIED, 0);
-      else if (strcmp(tag, "flagged") == 0)
+      else if (strcmp(tag, NmFlaggedTag) == 0)
         mutt_set_flag(ctx, e, MUTT_FLAG, 0);
     }
     else
     {
       tag = (*tag == '+') ? tag + 1 : tag;
-      if (strcmp(tag, "unread") == 0)
+      if (strcmp(tag, NmUnreadTag) == 0)
         mutt_set_flag(ctx, e, MUTT_READ, 0);
-      else if (strcmp(tag, "replied") == 0)
+      else if (strcmp(tag, NmRepliedTag) == 0)
         mutt_set_flag(ctx, e, MUTT_REPLIED, 1);
-      else if (strcmp(tag, "flagged") == 0)
+      else if (strcmp(tag, NmFlaggedTag) == 0)
         mutt_set_flag(ctx, e, MUTT_FLAG, 1);
     }
     end = NULL;
index ba12760b2b6de4502df1d28d4dccb578db01da5b..d058be1dedcd979cfc2dcb861df34f79a28b8d28 100644 (file)
@@ -52,6 +52,7 @@ extern char *NmQueryWindowTimebase;
 extern char *NmRecordTags;
 extern char *NmUnreadTag;
 extern char *NmFlaggedTag;
+extern char *NmRepliedTag;
 
 extern struct MxOps mx_notmuch_ops;