]> granicus.if.org Git - neomutt/commitdiff
Fix inbox-first functionality when using mutt_pretty_mailbox (#490)
authorPietro Cerutti <gahr@gahr.ch>
Tue, 28 Mar 2017 13:23:28 +0000 (14:23 +0100)
committerGitHub <noreply@github.com>
Tue, 28 Mar 2017 13:23:28 +0000 (14:23 +0100)
Fix inbox-first functionality when using mutt_pretty_mailbox

Fixes #489

lib.c

diff --git a/lib.c b/lib.c
index 7e565f87a79082f2bb6cc67ea5ea283663055939..451c6707ec563dd7253218c5d2cc712b00af5f51 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -1132,9 +1132,15 @@ int mutt_atoi (const char *str, int *dst)
  *   mutt_inbox_cmp("/foo/bar",      "/foo/baz") --> 0
  *   mutt_inbox_cmp("/foo/bar/",     "/foo/bar/inbox") --> 0
  *   mutt_inbox_cmp("/foo/bar/sent", "/foo/bar/inbox") --> 1
+ *   mutt_inbox_cmp("=INBOX",        "=Drafts") --> -1
  */
 int mutt_inbox_cmp (const char *a, const char *b)
 {
+  /* fast-track in case the paths have been mutt_pretty_mailbox'ified */
+  if (a[0] == '=' && b[0] == '=')
+    return (mutt_strcasecmp(a+1, "inbox") == 0) ? -1 :
+           (mutt_strcasecmp(b+1, "inbox") == 0) ?  1 : 0;
+
   const char *a_end = strrchr (a, '/');
   const char *b_end = strrchr (b, '/');