From: Richard Russon Date: Fri, 18 Jan 2019 02:07:17 +0000 (+0000) Subject: standardise naming in MailboxNode X-Git-Tag: 2019-10-25~372^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=696bf231e2d1ff55f96663f8833a5101750e183f;p=neomutt standardise naming in MailboxNode --- diff --git a/account.c b/account.c index 7b1fd4894..6d181ab62 100644 --- 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; diff --git a/browser.c b/browser.c index c4d064466..806d27637 100644 --- 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); diff --git a/compress.c b/compress.c index 8d5e2e66c..13a3aa822 100644 --- a/compress.c +++ b/compress.c @@ -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; } diff --git a/imap/browse.c b/imap/browse.c index 5eeffbb41..d7aa07e7e 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -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; diff --git a/imap/imap.c b/imap/imap.c index 4d32c0499..1fa6413ab 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -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 23309fed3..50e26f385 100644 --- 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; } } diff --git a/mailbox.c b/mailbox.c index 4ebef89b8..df245bea6 100644 --- 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; } } diff --git a/mailbox.h b/mailbox.h index cb779f088..f4fcdd4e7 100644 --- a/mailbox.h +++ b/mailbox.h @@ -147,7 +147,7 @@ struct Mailbox */ struct MailboxNode { - struct Mailbox *m; + struct Mailbox *mailbox; STAILQ_ENTRY(MailboxNode) entries; }; diff --git a/mbox/mbox.c b/mbox/mbox.c index 76f836bd0..5b7f821e4 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -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 d5cc8316b..af0fa4d0f 100644 --- 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; } diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index bcb31d3d0..6750a995d 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -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; } diff --git a/sidebar.c b/sidebar.c index fcc98aee4..4ba04740a 100644 --- 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); } }