]> granicus.if.org Git - neomutt/commitdiff
standardise naming in MailboxNode
authorRichard Russon <rich@flatcap.org>
Fri, 18 Jan 2019 02:07:17 +0000 (02:07 +0000)
committerRichard Russon <rich@flatcap.org>
Fri, 8 Feb 2019 17:03:33 +0000 (17:03 +0000)
12 files changed:
account.c
browser.c
compress.c
imap/browse.c
imap/imap.c
init.c
mailbox.c
mailbox.h
mbox/mbox.c
mx.c
notmuch/mutt_notmuch.c
sidebar.c

index 7b1fd4894a9f390d154a40997b141a03272f7b1d..6d181ab62bc72a1a30866a526ed553a70ca15c35 100644 (file)
--- a/account.c
+++ b/account.c
@@ -54,7 +54,7 @@ void account_remove_mailbox(struct Account *a, struct Mailbox *m)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &a->mailboxes, entries)
   {
-    if (np->m == m)
+    if (np->mailbox == m)
     {
       STAILQ_REMOVE(&a->mailboxes, np, MailboxNode, entries);
       break;
index c4d064466a0645c63682cb5e233cf8c3779e802c..806d276370f2135147fe420f85c6af2b9ed64dfe 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -767,17 +767,17 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state,
       struct MailboxNode *np = NULL;
       STAILQ_FOREACH(np, &AllMailboxes, entries)
       {
-        if (mutt_str_strcmp(buffer, np->m->path) != 0)
+        if (mutt_str_strcmp(buffer, np->mailbox->path) != 0)
           break;
       }
 
       if (np && Context &&
-          (mutt_str_strcmp(np->m->realpath, Context->mailbox->realpath) == 0))
+          (mutt_str_strcmp(np->mailbox->realpath, Context->mailbox->realpath) == 0))
       {
-        np->m->msg_count = Context->mailbox->msg_count;
-        np->m->msg_unread = Context->mailbox->msg_unread;
+        np->mailbox->msg_count = Context->mailbox->msg_count;
+        np->mailbox->msg_unread = Context->mailbox->msg_unread;
       }
-      add_folder(menu, state, de->d_name, NULL, &s, np ? np->m : NULL, NULL);
+      add_folder(menu, state, de->d_name, NULL, &s, np ? np->mailbox : NULL, NULL);
     }
     closedir(dp);
   }
@@ -824,53 +824,53 @@ static int examine_mailboxes(struct Menu *menu, struct BrowserState *state)
     struct MailboxNode *np = NULL;
     STAILQ_FOREACH(np, &AllMailboxes, entries)
     {
-      if (Context && (mutt_str_strcmp(np->m->realpath, Context->mailbox->realpath) == 0))
+      if (Context && (mutt_str_strcmp(np->mailbox->realpath, Context->mailbox->realpath) == 0))
       {
-        np->m->msg_count = Context->mailbox->msg_count;
-        np->m->msg_unread = Context->mailbox->msg_unread;
+        np->mailbox->msg_count = Context->mailbox->msg_count;
+        np->mailbox->msg_unread = Context->mailbox->msg_unread;
       }
 
       char buffer[PATH_MAX];
-      mutt_str_strfcpy(buffer, np->m->path, sizeof(buffer));
+      mutt_str_strfcpy(buffer, np->mailbox->path, sizeof(buffer));
       if (BrowserAbbreviateMailboxes)
         mutt_pretty_mailbox(buffer, sizeof(buffer));
 
-      switch (np->m->magic)
+      switch (np->mailbox->magic)
       {
         case MUTT_IMAP:
         case MUTT_POP:
-          add_folder(menu, state, buffer, np->m->desc, NULL, np->m, NULL);
+          add_folder(menu, state, buffer, np->mailbox->desc, NULL, np->mailbox, NULL);
           continue;
         case MUTT_NOTMUCH:
         case MUTT_NNTP:
-          add_folder(menu, state, np->m->path, np->m->desc, NULL, np->m, NULL);
+          add_folder(menu, state, np->mailbox->path, np->mailbox->desc, NULL, np->mailbox, NULL);
           continue;
         default: /* Continue */
           break;
       }
 
-      if (lstat(np->m->path, &s) == -1)
+      if (lstat(np->mailbox->path, &s) == -1)
         continue;
 
       if ((!S_ISREG(s.st_mode)) && (!S_ISDIR(s.st_mode)) && (!S_ISLNK(s.st_mode)))
         continue;
 
-      if (np->m->magic == MUTT_MAILDIR)
+      if (np->mailbox->magic == MUTT_MAILDIR)
       {
         struct stat st2;
         char md[PATH_MAX];
 
-        snprintf(md, sizeof(md), "%s/new", np->m->path);
+        snprintf(md, sizeof(md), "%s/new", np->mailbox->path);
         if (stat(md, &s) < 0)
           s.st_mtime = 0;
-        snprintf(md, sizeof(md), "%s/cur", np->m->path);
+        snprintf(md, sizeof(md), "%s/cur", np->mailbox->path);
         if (stat(md, &st2) < 0)
           st2.st_mtime = 0;
         if (st2.st_mtime > s.st_mtime)
           s.st_mtime = st2.st_mtime;
       }
 
-      add_folder(menu, state, buffer, np->m->desc, &s, np->m, NULL);
+      add_folder(menu, state, buffer, np->mailbox->desc, &s, np->mailbox, NULL);
     }
   }
   browser_sort(state);
index 8d5e2e66c4d00b077e361a350287b80995f79401..13a3aa8224f7ddf292f204b9899a3154798a8579 100644 (file)
@@ -443,7 +443,7 @@ int comp_ac_add(struct Account *a, struct Mailbox *m)
   m->account = a;
 
   struct MailboxNode *np = mutt_mem_calloc(1, sizeof(*np));
-  np->m = m;
+  np->mailbox = m;
   STAILQ_INSERT_TAIL(&a->mailboxes, np, entries);
   return 0;
 }
index 5eeffbb41c37afeb46118bbd5ef465dbc9cdba98..d7aa07e7edf1171d3e04b53fa7aad5d68fb4dda2 100644 (file)
@@ -116,16 +116,16 @@ static void add_folder(char delim, char *folder, bool noselect, bool noinferiors
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
-    if (mutt_str_strcmp(tmp, np->m->path) == 0)
+    if (mutt_str_strcmp(tmp, np->mailbox->path) == 0)
       break;
   }
 
   if (np)
   {
     (state->entry)[state->entrylen].has_mailbox = true;
-    (state->entry)[state->entrylen].new = np->m->has_new;
-    (state->entry)[state->entrylen].msg_count = np->m->msg_count;
-    (state->entry)[state->entrylen].msg_unread = np->m->msg_unread;
+    (state->entry)[state->entrylen].new = np->mailbox->has_new;
+    (state->entry)[state->entrylen].msg_count = np->mailbox->msg_count;
+    (state->entry)[state->entrylen].msg_unread = np->mailbox->msg_unread;
   }
 
   (state->entrylen)++;
@@ -208,10 +208,10 @@ int imap_browse(char *path, struct BrowserState *state)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
-    if (np->m->magic != MUTT_IMAP)
+    if (np->mailbox->magic != MUTT_IMAP)
       continue;
 
-    adata = imap_adata_get(np->m);
+    adata = imap_adata_get(np->mailbox);
     // Pick first mailbox connected on the same server
     if (imap_account_match(&adata->conn_account, &conn_account))
       break;
index 4d32c0499577df354db697d2985e8356426a0459..1fa6413ab8f67cd13cdeebcf09d272a053a22640 100644 (file)
@@ -519,16 +519,16 @@ static int complete_hosts(char *buf, size_t buflen)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
-    if (!mutt_str_startswith(np->m->path, buf, CASE_MATCH))
+    if (!mutt_str_startswith(np->mailbox->path, buf, CASE_MATCH))
       continue;
 
     if (rc)
     {
-      mutt_str_strfcpy(buf, np->m->path, buflen);
+      mutt_str_strfcpy(buf, np->mailbox->path, buflen);
       rc = 0;
     }
     else
-      longest_common_prefix(buf, np->m->path, matchlen, buflen);
+      longest_common_prefix(buf, np->mailbox->path, matchlen, buflen);
   }
 
 #if 0
diff --git a/init.c b/init.c
index 23309fed30e7f3c0cef21a20149d2d06674b2ab1..50e26f385a3a410b6bba1198747b29d04f58fac8 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1380,7 +1380,7 @@ static enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s,
           old_m->flags = MB_NORMAL;
           mutt_sb_notify_mailbox(old_m, true);
           struct MailboxNode *mn = mutt_mem_calloc(1, sizeof(*mn));
-          mn->m = old_m;
+          mn->mailbox = old_m;
           STAILQ_INSERT_TAIL(&AllMailboxes, mn, entries);
         }
         mailbox_free(&m);
@@ -1396,7 +1396,7 @@ static enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s,
     }
 
     struct MailboxNode *mn = mutt_mem_calloc(1, sizeof(*mn));
-    mn->m = m;
+    mn->mailbox = m;
     STAILQ_INSERT_TAIL(&AllMailboxes, mn, entries);
 
 #ifdef USE_SIDEBAR
@@ -2411,33 +2411,33 @@ static enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s
     STAILQ_FOREACH_SAFE(np, &AllMailboxes, entries, nptmp)
     {
       /* Decide whether to delete all normal mailboxes or all virtual */
-      bool virt = ((np->m->magic == MUTT_NOTMUCH) && (data & MUTT_VIRTUAL));
-      bool norm = ((np->m->magic != MUTT_NOTMUCH) && !(data & MUTT_VIRTUAL));
+      bool virt = ((np->mailbox->magic == MUTT_NOTMUCH) && (data & MUTT_VIRTUAL));
+      bool norm = ((np->mailbox->magic != MUTT_NOTMUCH) && !(data & MUTT_VIRTUAL));
       bool clear_this = clear_all && (virt || norm);
 
       /* Compare against path or desc? Ensure 'tmp' is valid */
       if (!clear_this && tmp_valid)
       {
-        clear_this = (mutt_str_strcasecmp(tmp, np->m->path) == 0) ||
-                     (mutt_str_strcasecmp(tmp, np->m->desc) == 0);
+        clear_this = (mutt_str_strcasecmp(tmp, np->mailbox->path) == 0) ||
+                     (mutt_str_strcasecmp(tmp, np->mailbox->desc) == 0);
       }
 
       if (clear_this)
       {
 #ifdef USE_SIDEBAR
-        mutt_sb_notify_mailbox(np->m, false);
+        mutt_sb_notify_mailbox(np->mailbox, false);
 #endif
 #ifdef USE_INOTIFY
-        mutt_monitor_remove(np->m);
+        mutt_monitor_remove(np->mailbox);
 #endif
-        if (Context && (Context->mailbox == np->m))
+        if (Context && (Context->mailbox == np->mailbox))
         {
-          np->m->flags |= MB_HIDDEN;
+          np->mailbox->flags |= MB_HIDDEN;
         }
         else
         {
-          mx_ac_remove(np->m);
-          mailbox_free(&np->m);
+          mx_ac_remove(np->mailbox);
+          mailbox_free(&np->mailbox);
         }
         STAILQ_REMOVE(&AllMailboxes, np, MailboxNode, entries);
         FREE(&np);
@@ -3253,9 +3253,9 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands)
     struct MailboxNode *mp = NULL;
     STAILQ_FOREACH(mp, &AllMailboxes, entries)
     {
-      if (mp->m->magic == MUTT_NOTMUCH)
+      if (mp->mailbox->magic == MUTT_NOTMUCH)
       {
-        cs_str_string_set(Config, "spoolfile", mp->m->path, NULL);
+        cs_str_string_set(Config, "spoolfile", mp->mailbox->path, NULL);
         break;
       }
     }
index 4ebef89b85eca46a4a16821cf582e4eee30dcceb..df245bea688595cbed317a781c93a2822fa98b9a 100644 (file)
--- a/mailbox.c
+++ b/mailbox.c
@@ -271,10 +271,10 @@ struct Mailbox *mutt_find_mailbox(const char *path)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
-    if ((stat(np->m->path, &tmp_sb) == 0) && (sb.st_dev == tmp_sb.st_dev) &&
+    if ((stat(np->mailbox->path, &tmp_sb) == 0) && (sb.st_dev == tmp_sb.st_dev) &&
         (sb.st_ino == tmp_sb.st_ino))
     {
-      return np->m;
+      return np->mailbox;
     }
   }
 
@@ -295,8 +295,8 @@ struct Mailbox *mutt_find_mailbox_desc(const char *desc)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
-    if (np->m->desc && mutt_str_strcmp(np->m->desc, desc) == 0)
-      return np->m;
+    if (np->mailbox->desc && mutt_str_strcmp(np->mailbox->desc, desc) == 0)
+      return np->mailbox;
   }
 
   return NULL;
@@ -379,9 +379,9 @@ int mutt_mailbox_check(struct Mailbox *m_cur, int force)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
-    mailbox_check(m_cur, np->m, &contex_sb,
-                  check_stats || (!np->m->first_check_stats_done && MailCheckStats));
-    np->m->first_check_stats_done = true;
+    mailbox_check(m_cur, np->mailbox, &contex_sb,
+                  check_stats || (!np->mailbox->first_check_stats_done && MailCheckStats));
+    np->mailbox->first_check_stats_done = true;
   }
 
   return MailboxCount;
@@ -406,10 +406,10 @@ bool mutt_mailbox_list(void)
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
     /* Is there new mail in this mailbox? */
-    if (!np->m->has_new || (have_unnotified && np->m->notified))
+    if (!np->mailbox->has_new || (have_unnotified && np->mailbox->notified))
       continue;
 
-    mutt_str_strfcpy(path, np->m->path, sizeof(path));
+    mutt_str_strfcpy(path, np->mailbox->path, sizeof(path));
     mutt_pretty_mailbox(path, sizeof(path));
 
     if (!first && (MuttMessageWindow->cols >= 7) &&
@@ -422,10 +422,10 @@ bool mutt_mailbox_list(void)
       pos += strlen(strncat(mailboxlist + pos, ", ", sizeof(mailboxlist) - 1 - pos));
 
     /* Prepend an asterisk to mailboxes not already notified */
-    if (!np->m->notified)
+    if (!np->mailbox->notified)
     {
       /* pos += strlen (strncat(mailboxlist + pos, "*", sizeof(mailboxlist)-1-pos)); */
-      np->m->notified = true;
+      np->mailbox->notified = true;
       MailboxNotify--;
     }
     pos += strlen(strncat(mailboxlist + pos, path, sizeof(mailboxlist) - 1 - pos));
@@ -500,16 +500,16 @@ void mutt_mailbox(struct Mailbox *m_cur, char *s, size_t slen)
       struct MailboxNode *np = NULL;
       STAILQ_FOREACH(np, &AllMailboxes, entries)
       {
-        if (np->m->magic == MUTT_NOTMUCH) /* only match real mailboxes */
+        if (np->mailbox->magic == MUTT_NOTMUCH) /* only match real mailboxes */
           continue;
-        mutt_expand_path(np->m->path, sizeof(np->m->path));
-        if ((found || pass) && np->m->has_new)
+        mutt_expand_path(np->mailbox->path, sizeof(np->mailbox->path));
+        if ((found || pass) && np->mailbox->has_new)
         {
-          mutt_str_strfcpy(s, np->m->path, slen);
+          mutt_str_strfcpy(s, np->mailbox->path, slen);
           mutt_pretty_mailbox(s, slen);
           return;
         }
-        if (mutt_str_strcmp(s, np->m->path) == 0)
+        if (mutt_str_strcmp(s, np->mailbox->path) == 0)
           found = 1;
       }
     }
index cb779f088978918f32af2bc8ade897e2933c19db..f4fcdd4e7e4904f13eec12a9da16c72285dfbc4b 100644 (file)
--- a/mailbox.h
+++ b/mailbox.h
@@ -147,7 +147,7 @@ struct Mailbox
  */
 struct MailboxNode
 {
-  struct Mailbox *m;
+  struct Mailbox *mailbox;
   STAILQ_ENTRY(MailboxNode) entries;
 };
 
index 76f836bd024f54981ce53ec41c571bdff9598e07..5b7f821e4608f34c1277cca08112da57b01844ec 100644 (file)
@@ -901,7 +901,7 @@ struct Account *mbox_ac_find(struct Account *a, const char *path)
   if (!np)
     return NULL;
 
-  if (mutt_str_strcmp(np->m->path, path) != 0)
+  if (mutt_str_strcmp(np->mailbox->path, path) != 0)
     return NULL;
 
   return a;
diff --git a/mx.c b/mx.c
index d5cc8316ba3bada7bb6b7d20f246b6e835a09e37..af0fa4d0f3bafbfbd119dac263ab043f0f0c85d7 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1475,8 +1475,8 @@ struct Mailbox *mx_mbox_find(struct Account *a, const char *path)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &a->mailboxes, entries)
   {
-    if (mutt_str_strcmp(np->m->realpath, path) == 0)
-      return np->m;
+    if (mutt_str_strcmp(np->mailbox->realpath, path) == 0)
+      return np->mailbox;
   }
 
   return NULL;
@@ -1540,7 +1540,7 @@ int mx_ac_add(struct Account *a, struct Mailbox *m)
 
   m->account = a;
   struct MailboxNode *np = mutt_mem_calloc(1, sizeof(*np));
-  np->m = m;
+  np->mailbox = m;
   STAILQ_INSERT_TAIL(&a->mailboxes, np, entries);
   return 0;
 }
index bcb31d3d00c9da52297325754f807d2e725fa690..6750a995d6f83bcc9505c8fea56fe06331e3c097 100644 (file)
@@ -1951,9 +1951,9 @@ int nm_description_to_path(const char *desc, char *buf, size_t buflen)
   struct MailboxNode *np = NULL;
   STAILQ_FOREACH(np, &AllMailboxes, entries)
   {
-    if ((np->m->magic == MUTT_NOTMUCH) && np->m->desc && (strcmp(desc, np->m->desc) == 0))
+    if ((np->mailbox->magic == MUTT_NOTMUCH) && np->mailbox->desc && (strcmp(desc, np->mailbox->desc) == 0))
     {
-      mutt_str_strfcpy(buf, np->m->path, buflen);
+      mutt_str_strfcpy(buf, np->mailbox->path, buflen);
       buf[buflen - 1] = '\0';
       return 0;
     }
index fcc98aee46f7fa02234f71ea2f45559eae7649ab..4ba04740ac2c74bc33beb259b1ebe255314fbe51 100644 (file)
--- a/sidebar.c
+++ b/sidebar.c
@@ -402,7 +402,7 @@ static void unsort_entries(void)
       break;
 
     int j = i;
-    while ((j < EntryCount) && (Entries[j]->mailbox != np->m))
+    while ((j < EntryCount) && (Entries[j]->mailbox != np->mailbox))
       j++;
     if (j < EntryCount)
     {
@@ -973,7 +973,7 @@ void mutt_sb_draw(void)
     struct MailboxNode *np = NULL;
     STAILQ_FOREACH(np, &AllMailboxes, entries)
     {
-      mutt_sb_notify_mailbox(np->m, true);
+      mutt_sb_notify_mailbox(np->mailbox, true);
     }
   }