From 94399b6169b1e21bed4bdebbdd58ad031c675612 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 7 Sep 2018 19:22:49 +0100 Subject: [PATCH] Mailbox doesn't begin with 'b' --- browser.c | 66 ++++++++++---------- curs_main.c | 8 +-- imap/browse.c | 8 +-- imap/command.c | 18 +++--- imap/imap.c | 22 +++---- init.c | 4 +- mailbox.c | 118 +++++++++++++++++------------------ mailbox.h | 6 +- maildir/mh.c | 18 +++--- mbox/mbox.c | 2 +- monitor.h | 4 +- notmuch/mutt_notmuch.c | 8 +-- sidebar.c | 138 ++++++++++++++++++++--------------------- sidebar.h | 2 +- 14 files changed, 211 insertions(+), 211 deletions(-) diff --git a/browser.c b/browser.c index 26150e113..a7a97a9b8 100644 --- a/browser.c +++ b/browser.c @@ -704,25 +704,25 @@ static const char *group_index_format_str(char *buf, size_t buflen, size_t col, /** * add_folder - Add a folder to the browser list - * @param m Menu to use + * @param menu Menu to use * @param state Browser state * @param name Name of folder * @param desc Description of folder * @param s stat info for the folder - * @param b Mailbox + * @param m Mailbox * @param data Data to associate with the folder */ -static void add_folder(struct Menu *m, struct BrowserState *state, +static void add_folder(struct Menu *menu, struct BrowserState *state, const char *name, const char *desc, const struct stat *s, - struct Mailbox *b, void *data) + struct Mailbox *m, void *data) { if (state->entrylen == state->entrymax) { /* need to allocate more space */ mutt_mem_realloc(&state->entry, sizeof(struct FolderFile) * (state->entrymax += 256)); memset(&state->entry[state->entrylen], 0, sizeof(struct FolderFile) * 256); - if (m) - m->data = state->entry; + if (menu) + menu->data = state->entry; } if (s) @@ -739,12 +739,12 @@ static void add_folder(struct Menu *m, struct BrowserState *state, else (state->entry)[state->entrylen].local = false; - if (b) + if (m) { (state->entry)[state->entrylen].has_mailbox = true; - (state->entry)[state->entrylen].new = b->new; - (state->entry)[state->entrylen].msg_count = b->msg_count; - (state->entry)[state->entrylen].msg_unread = b->msg_unread; + (state->entry)[state->entrylen].new = m->has_new; + (state->entry)[state->entrylen].msg_count = m->msg_count; + (state->entry)[state->entrylen].msg_unread = m->msg_unread; } (state->entry)[state->entrylen].name = mutt_str_strdup(name); @@ -881,17 +881,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->b->path) != 0) + if (mutt_str_strcmp(buffer, np->m->path) != 0) break; } if (np && Context && - (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0)) + (mutt_str_strcmp(np->m->realpath, Context->mailbox->realpath) == 0)) { - np->b->msg_count = Context->mailbox->msg_count; - np->b->msg_unread = Context->mailbox->msg_unread; + np->m->msg_count = Context->mailbox->msg_count; + np->m->msg_unread = Context->mailbox->msg_unread; } - add_folder(menu, state, de->d_name, NULL, &s, np ? np->b : NULL, NULL); + add_folder(menu, state, de->d_name, NULL, &s, np ? np->m : NULL, NULL); } closedir(dp); } @@ -919,10 +919,10 @@ static int examine_vfolders(struct Menu *menu, struct BrowserState *state) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (nm_path_probe(np->b->path, NULL) == MUTT_NOTMUCH) + if (nm_path_probe(np->m->path, NULL) == MUTT_NOTMUCH) { - nm_nonctx_get_count(np->b->path, &np->b->msg_count, &np->b->msg_unread); - add_folder(menu, state, np->b->path, np->b->desc, NULL, np->b, NULL); + nm_nonctx_get_count(np->m->path, &np->m->msg_count, &np->m->msg_unread); + add_folder(menu, state, np->m->path, np->m->desc, NULL, np->m, NULL); continue; } } @@ -972,60 +972,60 @@ 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->b->realpath, Context->mailbox->realpath) == 0)) + if (Context && (mutt_str_strcmp(np->m->realpath, Context->mailbox->realpath) == 0)) { - np->b->msg_count = Context->mailbox->msg_count; - np->b->msg_unread = Context->mailbox->msg_unread; + np->m->msg_count = Context->mailbox->msg_count; + np->m->msg_unread = Context->mailbox->msg_unread; } char buffer[PATH_MAX]; - mutt_str_strfcpy(buffer, np->b->path, sizeof(buffer)); + mutt_str_strfcpy(buffer, np->m->path, sizeof(buffer)); if (BrowserAbbreviateMailboxes) mutt_pretty_mailbox(buffer, sizeof(buffer)); #ifdef USE_IMAP - if (imap_path_probe(np->b->path, NULL) == MUTT_IMAP) + if (imap_path_probe(np->m->path, NULL) == MUTT_IMAP) { - add_folder(menu, state, buffer, NULL, NULL, np->b, NULL); + add_folder(menu, state, buffer, NULL, NULL, np->m, NULL); continue; } #endif #ifdef USE_POP - if (pop_path_probe(np->b->path, NULL) == MUTT_POP) + if (pop_path_probe(np->m->path, NULL) == MUTT_POP) { - add_folder(menu, state, buffer, NULL, NULL, np->b, NULL); + add_folder(menu, state, buffer, NULL, NULL, np->m, NULL); continue; } #endif #ifdef USE_NNTP - if (nntp_path_probe(np->b->path, NULL) == MUTT_NNTP) + if (nntp_path_probe(np->m->path, NULL) == MUTT_NNTP) { - add_folder(menu, state, np->b->path, NULL, NULL, np->b, NULL); + add_folder(menu, state, np->m->path, NULL, NULL, np->m, NULL); continue; } #endif - if (lstat(np->b->path, &s) == -1) + if (lstat(np->m->path, &s) == -1) continue; if ((!S_ISREG(s.st_mode)) && (!S_ISDIR(s.st_mode)) && (!S_ISLNK(s.st_mode))) continue; - if (maildir_path_probe(np->b->path, NULL) == MUTT_MAILDIR) + if (maildir_path_probe(np->m->path, NULL) == MUTT_MAILDIR) { struct stat st2; char md[PATH_MAX]; - snprintf(md, sizeof(md), "%s/new", np->b->path); + snprintf(md, sizeof(md), "%s/new", np->m->path); if (stat(md, &s) < 0) s.st_mtime = 0; - snprintf(md, sizeof(md), "%s/cur", np->b->path); + snprintf(md, sizeof(md), "%s/cur", np->m->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, NULL, &s, np->b, NULL); + add_folder(menu, state, buffer, NULL, &s, np->m, NULL); } } browser_sort(state); diff --git a/curs_main.c b/curs_main.c index c4fb790ae..947cf99f2 100644 --- a/curs_main.c +++ b/curs_main.c @@ -1568,10 +1568,10 @@ int mutt_index_menu(void) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - fprintf(fp, "path: %s\n", np->b->path); - fprintf(fp, "size: %ld\n", np->b->size); - // fprintf(fp, "realpath: %s\n", np->b->realpath); - // fprintf(fp, "desc: %s\n", np->b->desc); + fprintf(fp, "path: %s\n", np->m->path); + fprintf(fp, "size: %ld\n", np->m->size); + // fprintf(fp, "realpath: %s\n", np->m->realpath); + // fprintf(fp, "desc: %s\n", np->m->desc); fprintf(fp, "\n"); } diff --git a/imap/browse.c b/imap/browse.c index a523619ff..a935a1026 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->b->path) == 0) + if (mutt_str_strcmp(tmp, np->m->path) == 0) break; } if (np) { (state->entry)[state->entrylen].has_mailbox = true; - (state->entry)[state->entrylen].new = np->b->new; - (state->entry)[state->entrylen].msg_count = np->b->msg_count; - (state->entry)[state->entrylen].msg_unread = np->b->msg_unread; + (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->entrylen)++; diff --git a/imap/command.c b/imap/command.c index 4adbfd866..b7c97a15c 100644 --- a/imap/command.c +++ b/imap/command.c @@ -863,12 +863,12 @@ static void cmd_parse_status(struct ImapData *idata, char *s) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (np->b->magic != MUTT_IMAP) + if (np->m->magic != MUTT_IMAP) continue; - if (imap_parse_path(np->b->path, &mx) < 0) + if (imap_parse_path(np->m->path, &mx) < 0) { - mutt_debug(1, "Error parsing mailbox %s, skipping\n", np->b->path); + mutt_debug(1, "Error parsing mailbox %s, skipping\n", np->m->path); continue; } @@ -907,18 +907,18 @@ static void cmd_parse_status(struct ImapData *idata, char *s) new = (status->unseen > 0); #ifdef USE_SIDEBAR - if ((np->b->new != new) || (np->b->msg_count != status->messages) || - (np->b->msg_unread != status->unseen)) + if ((np->m->has_new != new) || (np->m->msg_count != status->messages) || + (np->m->msg_unread != status->unseen)) { mutt_menu_set_current_redraw(REDRAW_SIDEBAR); } #endif - np->b->new = new; + np->m->has_new = new; if (new_msg_count) - np->b->msg_count = status->messages; - np->b->msg_unread = status->unseen; + np->m->msg_count = status->messages; + np->m->msg_unread = status->unseen; - if (np->b->new) + if (np->m->has_new) { /* force back to keep detecting new mail until the mailbox is opened */ diff --git a/imap/imap.c b/imap/imap.c index fe4302ddf..ec5d5cf14 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -547,16 +547,16 @@ static int complete_hosts(char *buf, size_t buflen) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (mutt_str_strncmp(buf, np->b->path, matchlen) != 0) + if (mutt_str_strncmp(buf, np->m->path, matchlen) != 0) continue; if (rc) { - mutt_str_strfcpy(buf, np->b->path, buflen); + mutt_str_strfcpy(buf, np->m->path, buflen); rc = 0; } else - longest_common_prefix(buf, np->b->path, matchlen, buflen); + longest_common_prefix(buf, np->m->path, matchlen, buflen); } TAILQ_FOREACH(conn, mutt_socket_head(), entries) @@ -1454,18 +1454,18 @@ int imap_mailbox_check(bool check_stats) STAILQ_FOREACH(np, &AllMailboxes, entries) { /* Init newly-added mailboxes */ - if (np->b->magic == MUTT_UNKNOWN) + if (np->m->magic == MUTT_UNKNOWN) { - if (imap_path_probe(np->b->path, NULL) == MUTT_IMAP) - np->b->magic = MUTT_IMAP; + if (imap_path_probe(np->m->path, NULL) == MUTT_IMAP) + np->m->magic = MUTT_IMAP; } - if (np->b->magic != MUTT_IMAP) + if (np->m->magic != MUTT_IMAP) continue; - if (get_mailbox(np->b->path, &idata, name, sizeof(name)) < 0) + if (get_mailbox(np->m->path, &idata, name, sizeof(name)) < 0) { - np->b->new = false; + np->m->has_new = false; continue; } @@ -1475,7 +1475,7 @@ int imap_mailbox_check(bool check_stats) * mailbox's, and shouldn't expand to INBOX in that case. #3216. */ if (idata->mailbox && (imap_mxcmp(name, idata->mailbox) == 0)) { - np->b->new = false; + np->m->has_new = false; continue; } @@ -1527,7 +1527,7 @@ int imap_mailbox_check(bool check_stats) /* collect results */ STAILQ_FOREACH(np, &AllMailboxes, entries) { - if ((np->b->magic == MUTT_IMAP) && np->b->new) + if ((np->m->magic == MUTT_IMAP) && np->m->has_new) buffies++; } diff --git a/init.c b/init.c index 792c22ac9..f81261ed7 100644 --- a/init.c +++ b/init.c @@ -3085,9 +3085,9 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands) struct MailboxNode *mp = NULL; STAILQ_FOREACH(mp, &AllMailboxes, entries) { - if (mp->b->magic == MUTT_NOTMUCH) + if (mp->m->magic == MUTT_NOTMUCH) { - cs_str_string_set(Config, "spoolfile", mp->b->path, NULL); + cs_str_string_set(Config, "spoolfile", mp->m->path, NULL); mutt_sb_toggle_virtual(); break; } diff --git a/mailbox.c b/mailbox.c index 0a7aeab20..92e1441d7 100644 --- a/mailbox.c +++ b/mailbox.c @@ -289,7 +289,7 @@ static int mailbox_maildir_check_dir(struct Mailbox *mailbox, const char *dir_na continue; } } - mailbox->new = true; + mailbox->has_new = true; rc = 1; check_new = false; if (!check_stats) @@ -360,7 +360,7 @@ static int mailbox_mbox_check(struct Mailbox *mailbox, struct stat *sb, bool che (mutt_stat_timespec_compare(sb, MUTT_STAT_MTIME, &mailbox->last_visited) > 0)) { rc = 1; - mailbox->new = true; + mailbox->has_new = true; } } else if (CheckMboxSize) @@ -407,7 +407,7 @@ static void mailbox_check(struct Mailbox *tmp, struct stat *contex_sb, bool chec memset(&sb, 0, sizeof(sb)); #ifdef USE_SIDEBAR - orig_new = tmp->new; + orig_new = tmp->has_new; orig_count = tmp->msg_count; orig_unread = tmp->msg_unread; orig_flagged = tmp->msg_flagged; @@ -415,7 +415,7 @@ static void mailbox_check(struct Mailbox *tmp, struct stat *contex_sb, bool chec if (tmp->magic != MUTT_IMAP) { - tmp->new = false; + tmp->has_new = false; #ifdef USE_POP if (pop_path_probe(tmp->path, NULL) == MUTT_POP) tmp->magic = MUTT_POP; @@ -482,7 +482,7 @@ static void mailbox_check(struct Mailbox *tmp, struct stat *contex_sb, bool chec if (tmp->msg_unread > 0) { MailboxCount++; - tmp->new = true; + tmp->has_new = true; } break; #endif @@ -493,14 +493,14 @@ static void mailbox_check(struct Mailbox *tmp, struct stat *contex_sb, bool chec tmp->size = (off_t) sb.st_size; /* update the size of current folder */ #ifdef USE_SIDEBAR - if ((orig_new != tmp->new) || (orig_count != tmp->msg_count) || + if ((orig_new != tmp->has_new) || (orig_count != tmp->msg_count) || (orig_unread != tmp->msg_unread) || (orig_flagged != tmp->msg_flagged)) { mutt_menu_set_current_redraw(REDRAW_SIDEBAR); } #endif - if (!tmp->new) + if (!tmp->has_new) tmp->notified = false; else if (!tmp->notified) MailboxNotify++; @@ -523,11 +523,11 @@ static struct Mailbox *mailbox_get(const char *path) STAILQ_FOREACH(np, &AllMailboxes, entries) { /* must be done late because e.g. IMAP delimiter may change */ - mutt_expand_path(np->b->path, sizeof(np->b->path)); - if (mutt_str_strcmp(np->b->path, path) == 0) + mutt_expand_path(np->m->path, sizeof(np->m->path)); + if (mutt_str_strcmp(np->m->path, path) == 0) { FREE(&epath); - return np->b; + return np->m; } } @@ -553,9 +553,9 @@ void mutt_mailbox_cleanup(const char *path, struct stat *st) if (CheckMboxSize) { - struct Mailbox *b = mutt_find_mailbox(path); - if (b && !b->new) - mutt_update_mailbox(b); + struct Mailbox *m = mutt_find_mailbox(path); + if (m && !m->has_new) + mutt_update_mailbox(m); } else { @@ -608,10 +608,10 @@ struct Mailbox *mutt_find_mailbox(const char *path) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if ((stat(np->b->path, &tmp_sb) == 0) && (sb.st_dev == tmp_sb.st_dev) && + if ((stat(np->m->path, &tmp_sb) == 0) && (sb.st_dev == tmp_sb.st_dev) && (sb.st_ino == tmp_sb.st_ino)) { - return np->b; + return np->m; } } @@ -620,19 +620,19 @@ struct Mailbox *mutt_find_mailbox(const char *path) /** * mutt_update_mailbox - Get the mailbox's current size - * @param b Mailbox to check + * @param m Mailbox to check */ -void mutt_update_mailbox(struct Mailbox *b) +void mutt_update_mailbox(struct Mailbox *m) { struct stat sb; - if (!b) + if (!m) return; - if (stat(b->path, &sb) == 0) - b->size = (off_t) sb.st_size; + if (stat(m->path, &sb) == 0) + m->size = (off_t) sb.st_size; else - b->size = 0; + m->size = 0; } /** @@ -689,9 +689,9 @@ int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (mutt_str_strcmp(p ? p : buf, np->b->realpath) == 0) + if (mutt_str_strcmp(p ? p : buf, np->m->realpath) == 0) { - mutt_debug(3, "mailbox '%s' already registered as '%s'\n", buf, np->b->path); + mutt_debug(3, "mailbox '%s' already registered as '%s'\n", buf, np->m->path); break; } } @@ -702,17 +702,17 @@ int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, continue; } - struct Mailbox *b = mailbox_new(buf); + struct Mailbox *m = mailbox_new(buf); - b->new = false; - b->notified = true; - b->newly_created = false; - b->desc = desc; + m->has_new = false; + m->notified = true; + m->newly_created = false; + m->desc = desc; #ifdef USE_NOTMUCH - if (nm_path_probe(b->path, NULL) == MUTT_NOTMUCH) + if (nm_path_probe(m->path, NULL) == MUTT_NOTMUCH) { - b->magic = MUTT_NOTMUCH; - b->size = 0; + m->magic = MUTT_NOTMUCH; + m->size = 0; } else #endif @@ -721,25 +721,25 @@ int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, * reading it), the size is set to 0 so that later when we check we see * that it increased. without check_mbox_size we probably don't care. */ - if (CheckMboxSize && stat(b->path, &sb) == 0 && !test_new_folder(b->path)) + if (CheckMboxSize && stat(m->path, &sb) == 0 && !test_new_folder(m->path)) { /* some systems out there don't have an off_t type */ - b->size = (off_t) sb.st_size; + m->size = (off_t) sb.st_size; } else - b->size = 0; + m->size = 0; } struct MailboxNode *mn = mutt_mem_calloc(1, sizeof(*mn)); - mn->b = b; + mn->m = m; STAILQ_INSERT_TAIL(&AllMailboxes, mn, entries); #ifdef USE_SIDEBAR - mutt_sb_notify_mailbox(b, true); + mutt_sb_notify_mailbox(m, true); #endif #ifdef USE_INOTIFY - b->magic = mx_path_probe(b->path, NULL); - mutt_monitor_add(b); + m->magic = mx_path_probe(m->path, NULL); + mutt_monitor_add(m); #endif } return 0; @@ -790,21 +790,21 @@ int mutt_parse_unmailboxes(struct Buffer *path, struct Buffer *s, STAILQ_FOREACH_SAFE(np, &AllMailboxes, entries, tmp) { /* Decide whether to delete all normal mailboxes or all virtual */ - bool virt = ((np->b->magic == MUTT_NOTMUCH) && (data & MUTT_VIRTUAL)); - bool norm = ((np->b->magic != MUTT_NOTMUCH) && !(data & MUTT_VIRTUAL)); + bool virt = ((np->m->magic == MUTT_NOTMUCH) && (data & MUTT_VIRTUAL)); + bool norm = ((np->m->magic != MUTT_NOTMUCH) && !(data & MUTT_VIRTUAL)); bool clear_this = clear_all && (virt || norm); - if (clear_this || (mutt_str_strcasecmp(buf, np->b->path) == 0) || - (mutt_str_strcasecmp(buf, np->b->desc) == 0)) + if (clear_this || (mutt_str_strcasecmp(buf, np->m->path) == 0) || + (mutt_str_strcasecmp(buf, np->m->desc) == 0)) { #ifdef USE_SIDEBAR - mutt_sb_notify_mailbox(np->b, false); + mutt_sb_notify_mailbox(np->m, false); #endif #ifdef USE_INOTIFY - mutt_monitor_remove(np->b); + mutt_monitor_remove(np->m); #endif STAILQ_REMOVE(&AllMailboxes, np, MailboxNode, entries); - mailbox_free(&np->b); + mailbox_free(&np->m); FREE(&np); continue; } @@ -875,7 +875,7 @@ int mutt_mailbox_check(int force) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - mailbox_check(np->b, &contex_sb, check_stats); + mailbox_check(np->m, &contex_sb, check_stats); } return MailboxCount; @@ -900,10 +900,10 @@ bool mutt_mailbox_list(void) STAILQ_FOREACH(np, &AllMailboxes, entries) { /* Is there new mail in this mailbox? */ - if (!np->b->new || (have_unnotified && np->b->notified)) + if (!np->m->has_new || (have_unnotified && np->m->notified)) continue; - mutt_str_strfcpy(path, np->b->path, sizeof(path)); + mutt_str_strfcpy(path, np->m->path, sizeof(path)); mutt_pretty_mailbox(path, sizeof(path)); if (!first && (MuttMessageWindow->cols >= 7) && @@ -916,10 +916,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->b->notified) + if (!np->m->notified) { /* pos += strlen (strncat(mailboxlist + pos, "*", sizeof(mailboxlist)-1-pos)); */ - np->b->notified = true; + np->m->notified = true; MailboxNotify--; } pos += strlen(strncat(mailboxlist + pos, path, sizeof(mailboxlist) - 1 - pos)); @@ -993,16 +993,16 @@ void mutt_mailbox(char *s, size_t slen) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (np->b->magic == MUTT_NOTMUCH) /* only match real mailboxes */ + if (np->m->magic == MUTT_NOTMUCH) /* only match real mailboxes */ continue; - mutt_expand_path(np->b->path, sizeof(np->b->path)); - if ((found || pass) && np->b->new) + mutt_expand_path(np->m->path, sizeof(np->m->path)); + if ((found || pass) && np->m->has_new) { - mutt_str_strfcpy(s, np->b->path, slen); + mutt_str_strfcpy(s, np->m->path, slen); mutt_pretty_mailbox(s, slen); return; } - if (mutt_str_strcmp(s, np->b->path) == 0) + if (mutt_str_strcmp(s, np->m->path) == 0) found = 1; } } @@ -1030,14 +1030,14 @@ void mutt_mailbox_vfolder(char *buf, size_t buflen) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (np->b->magic != MUTT_NOTMUCH) + if (np->m->magic != MUTT_NOTMUCH) continue; - if ((found || pass) && np->b->new) + if ((found || pass) && np->m->has_new) { - mutt_str_strfcpy(buf, np->b->desc, buflen); + mutt_str_strfcpy(buf, np->m->desc, buflen); return; } - if (mutt_str_strcmp(buf, np->b->path) == 0) + if (mutt_str_strcmp(buf, np->m->path) == 0) found = true; } } diff --git a/mailbox.h b/mailbox.h index 7c33bdffd..c103e900f 100644 --- a/mailbox.h +++ b/mailbox.h @@ -79,7 +79,7 @@ struct Mailbox * comparison, and the sidebar */ char *desc; off_t size; - bool new; /**< mailbox has new mail */ + bool has_new; /**< mailbox has new mail */ /* These next three are only set when MailCheckStats is set */ int msg_count; /**< total number of messages */ @@ -114,7 +114,7 @@ struct Mailbox */ struct MailboxNode { - struct Mailbox *b; + struct Mailbox *m; STAILQ_ENTRY(MailboxNode) entries; }; @@ -131,7 +131,7 @@ void mailbox_free(struct Mailbox **mailbox); void mutt_context_free(struct Context **ctx); struct Mailbox *mutt_find_mailbox(const char *path); -void mutt_update_mailbox(struct Mailbox *b); +void mutt_update_mailbox(struct Mailbox *m); void mutt_mailbox_cleanup(const char *path, struct stat *st); diff --git a/maildir/mh.c b/maildir/mh.c index 8183dfcfc..925513265 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -290,41 +290,41 @@ static inline mode_t mh_umask(struct Mailbox *mailbox) /** * mh_sequences_changed - Has the mailbox changed - * @param b Mailbox + * @param m Mailbox * @retval 1 mh_sequences last modification time is more recent than the last visit to this mailbox * @retval 0 modification time is older * @retval -1 Error */ -static int mh_sequences_changed(struct Mailbox *b) +static int mh_sequences_changed(struct Mailbox *m) { char path[PATH_MAX]; struct stat sb; - if ((snprintf(path, sizeof(path), "%s/.mh_sequences", b->path) < sizeof(path)) && + if ((snprintf(path, sizeof(path), "%s/.mh_sequences", m->path) < sizeof(path)) && (stat(path, &sb) == 0)) { - return (mutt_stat_timespec_compare(&sb, MUTT_STAT_MTIME, &b->last_visited) > 0); + return (mutt_stat_timespec_compare(&sb, MUTT_STAT_MTIME, &m->last_visited) > 0); } return -1; } /** * mh_already_notified - Has the message changed - * @param b Mailbox + * @param m Mailbox * @param msgno Message number * @retval 1 Modification time on the message file is older than the last visit to this mailbox * @retval 0 Modification time on the message file is newer * @retval -1 Error */ -static int mh_already_notified(struct Mailbox *b, int msgno) +static int mh_already_notified(struct Mailbox *m, int msgno) { char path[PATH_MAX]; struct stat sb; - if ((snprintf(path, sizeof(path), "%s/%d", b->path, msgno) < sizeof(path)) && + if ((snprintf(path, sizeof(path), "%s/%d", m->path, msgno) < sizeof(path)) && (stat(path, &sb) == 0)) { - return (mutt_stat_timespec_compare(&sb, MUTT_STAT_MTIME, &b->last_visited) <= 0); + return (mutt_stat_timespec_compare(&sb, MUTT_STAT_MTIME, &m->last_visited) <= 0); } return -1; } @@ -398,7 +398,7 @@ bool mh_mailbox(struct Mailbox *mailbox, bool check_stats) last visit, don't notify about it */ if (!MailCheckRecent || mh_already_notified(mailbox, i) == 0) { - mailbox->new = true; + mailbox->has_new = true; rc = true; } /* Because we are traversing from high to low, we can stop diff --git a/mbox/mbox.c b/mbox/mbox.c index de8f126a3..7fb1e207f 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -1442,7 +1442,7 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint) if (CheckMboxSize) { tmp = mutt_find_mailbox(ctx->mailbox->path); - if (tmp && !tmp->new) + if (tmp && !tmp->has_new) mutt_update_mailbox(tmp); } diff --git a/monitor.h b/monitor.h index dedc1bc1c..e5e365edb 100644 --- a/monitor.h +++ b/monitor.h @@ -28,8 +28,8 @@ extern int MonitorContextChanged; struct Mailbox; -int mutt_monitor_add(struct Mailbox *b); -int mutt_monitor_remove(struct Mailbox *b); +int mutt_monitor_add(struct Mailbox *m); +int mutt_monitor_remove(struct Mailbox *m); int mutt_monitor_poll(void); #endif /* MUTT_MONITOR_H */ diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 94a543a5e..8f903d32d 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -2289,8 +2289,8 @@ char *nm_get_description(struct Mailbox *mailbox) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (np->b->desc && (strcmp(np->b->path, mailbox->path) == 0)) - return np->b->desc; + if (np->m->desc && (strcmp(np->m->path, mailbox->path) == 0)) + return np->m->desc; } return NULL; @@ -2312,9 +2312,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->b->magic == MUTT_NOTMUCH) && np->b->desc && (strcmp(desc, np->b->desc) == 0)) + if ((np->m->magic == MUTT_NOTMUCH) && np->m->desc && (strcmp(desc, np->m->desc) == 0)) { - strncpy(buf, np->b->path, buflen); + strncpy(buf, np->m->path, buflen); buf[buflen - 1] = '\0'; return 0; } diff --git a/sidebar.c b/sidebar.c index 5ef4ae839..3d09d38da 100644 --- a/sidebar.c +++ b/sidebar.c @@ -135,11 +135,11 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int buf[0] = 0; /* Just in case there's nothing to do */ - struct Mailbox *b = sbe->mailbox; - if (!b) + struct Mailbox *m = sbe->mailbox; + if (!m) return src; - int c = Context && (mutt_str_strcmp(Context->mailbox->realpath, b->realpath) == 0); + int c = Context && (mutt_str_strcmp(Context->mailbox->realpath, m->realpath) == 0); optional = flags & MUTT_FORMAT_OPTIONAL; @@ -163,9 +163,9 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int if (!optional) { snprintf(fmt, sizeof(fmt), "%%%sd", prec); - snprintf(buf, buflen, fmt, b->msg_flagged); + snprintf(buf, buflen, fmt, m->msg_flagged); } - else if (b->msg_flagged == 0) + else if (m->msg_flagged == 0) optional = 0; break; @@ -173,9 +173,9 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int if (!optional) { snprintf(fmt, sizeof(fmt), "%%%sd", prec); - snprintf(buf, buflen, fmt, c ? Context->vcount : b->msg_count); + snprintf(buf, buflen, fmt, c ? Context->vcount : m->msg_count); } - else if ((c && Context->vcount == b->msg_count) || !c) + else if ((c && Context->vcount == m->msg_count) || !c) optional = 0; break; @@ -183,9 +183,9 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int if (!optional) { snprintf(fmt, sizeof(fmt), "%%%sd", prec); - snprintf(buf, buflen, fmt, b->msg_unread); + snprintf(buf, buflen, fmt, m->msg_unread); } - else if (b->msg_unread == 0) + else if (m->msg_unread == 0) optional = 0; break; @@ -193,9 +193,9 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int if (!optional) { snprintf(fmt, sizeof(fmt), "%%%sc", prec); - snprintf(buf, buflen, fmt, b->new ? 'N' : ' '); + snprintf(buf, buflen, fmt, m->has_new ? 'N' : ' '); } - else if (b->new == false) + else if (m->has_new == false) optional = 0; break; @@ -203,9 +203,9 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int if (!optional) { snprintf(fmt, sizeof(fmt), "%%%sd", prec); - snprintf(buf, buflen, fmt, b->msg_count); + snprintf(buf, buflen, fmt, m->msg_count); } - else if (b->msg_count == 0) + else if (m->msg_count == 0) optional = 0; break; @@ -220,15 +220,15 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int break; case '!': - if (b->msg_flagged == 0) + if (m->msg_flagged == 0) mutt_format_s(buf, buflen, prec, ""); - else if (b->msg_flagged == 1) + else if (m->msg_flagged == 1) mutt_format_s(buf, buflen, prec, "!"); - else if (b->msg_flagged == 2) + else if (m->msg_flagged == 2) mutt_format_s(buf, buflen, prec, "!!"); else { - snprintf(fmt, sizeof(fmt), "%d!", b->msg_flagged); + snprintf(fmt, sizeof(fmt), "%d!", m->msg_flagged); mutt_format_s(buf, buflen, prec, fmt); } break; @@ -302,39 +302,39 @@ static int cb_qsort_sbe(const void *a, const void *b) { const struct SbEntry *sbe1 = *(const struct SbEntry **) a; const struct SbEntry *sbe2 = *(const struct SbEntry **) b; - struct Mailbox *b1 = sbe1->mailbox; - struct Mailbox *b2 = sbe2->mailbox; + struct Mailbox *m1 = sbe1->mailbox; + struct Mailbox *m2 = sbe2->mailbox; int result = 0; switch ((SidebarSortMethod & SORT_MASK)) { case SORT_COUNT: - if (b2->msg_count == b1->msg_count) - result = mutt_str_strcoll(b1->path, b2->path); + if (m2->msg_count == m1->msg_count) + result = mutt_str_strcoll(m1->path, m2->path); else - result = (b2->msg_count - b1->msg_count); + result = (m2->msg_count - m1->msg_count); break; case SORT_UNREAD: - if (b2->msg_unread == b1->msg_unread) - result = mutt_str_strcoll(b1->path, b2->path); + if (m2->msg_unread == m1->msg_unread) + result = mutt_str_strcoll(m1->path, m2->path); else - result = (b2->msg_unread - b1->msg_unread); + result = (m2->msg_unread - m1->msg_unread); break; case SORT_DESC: - result = mutt_str_strcmp(b1->desc, b2->desc); + result = mutt_str_strcmp(m1->desc, m2->desc); break; case SORT_FLAGGED: - if (b2->msg_flagged == b1->msg_flagged) - result = mutt_str_strcoll(b1->path, b2->path); + if (m2->msg_flagged == m1->msg_flagged) + result = mutt_str_strcoll(m1->path, m2->path); else - result = (b2->msg_flagged - b1->msg_flagged); + result = (m2->msg_flagged - m1->msg_flagged); break; case SORT_PATH: { - result = mutt_inbox_cmp(b1->path, b2->path); + result = mutt_inbox_cmp(m1->path, m2->path); if (result == 0) - result = mutt_str_strcoll(b1->path, b2->path); + result = mutt_str_strcoll(m1->path, m2->path); break; } } @@ -379,7 +379,7 @@ static void update_entries_visibility(void) continue; if ((i == OpnIndex) || (sbe->mailbox->msg_unread > 0) || - sbe->mailbox->new || (sbe->mailbox->msg_flagged > 0)) + sbe->mailbox->has_new || (sbe->mailbox->msg_flagged > 0)) { continue; } @@ -415,7 +415,7 @@ static void unsort_entries(void) break; int j = i; - while ((j < EntryCount) && (Entries[j]->mailbox != np->b)) + while ((j < EntryCount) && (Entries[j]->mailbox != np->m)) j++; if (j < EntryCount) { @@ -499,7 +499,7 @@ static int select_next_new(void) } if (entry == HilIndex) return false; - } while (!Entries[entry]->mailbox->new && !Entries[entry]->mailbox->msg_unread); + } while (!Entries[entry]->mailbox->has_new && !Entries[entry]->mailbox->msg_unread); HilIndex = entry; return true; @@ -554,7 +554,7 @@ static bool select_prev_new(void) } if (entry == HilIndex) return false; - } while (!Entries[entry]->mailbox->new && !Entries[entry]->mailbox->msg_unread); + } while (!Entries[entry]->mailbox->has_new && !Entries[entry]->mailbox->msg_unread); HilIndex = entry; return true; @@ -819,7 +819,7 @@ static void fill_empty_space(int first_row, int num_rows, int div_width, int num static void draw_sidebar(int num_rows, int num_cols, int div_width) { struct SbEntry *entry = NULL; - struct Mailbox *b = NULL; + struct Mailbox *m = NULL; if (TopIndex < 0) return; @@ -830,7 +830,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) entry = Entries[entryidx]; if (entry->is_hidden) continue; - b = entry->mailbox; + m = entry->mailbox; if (entryidx == OpnIndex) { @@ -841,12 +841,12 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) } else if (entryidx == HilIndex) SETCOLOR(MT_COLOR_HIGHLIGHT); - else if ((b->msg_unread > 0) || (b->new)) + else if ((m->msg_unread > 0) || (m->has_new)) SETCOLOR(MT_COLOR_NEW); - else if (b->msg_flagged > 0) + else if (m->msg_flagged > 0) SETCOLOR(MT_COLOR_FLAGGED); else if ((ColorDefs[MT_COLOR_SB_SPOOLFILE] != 0) && - (mutt_str_strcmp(b->path, Spoolfile) == 0)) + (mutt_str_strcmp(m->path, Spoolfile) == 0)) { SETCOLOR(MT_COLOR_SB_SPOOLFILE); } @@ -864,18 +864,18 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) mutt_window_move(MuttSidebarWindow, row, col); if (Context && Context->mailbox->realpath && - (mutt_str_strcmp(b->realpath, Context->mailbox->realpath) == 0)) + (mutt_str_strcmp(m->realpath, Context->mailbox->realpath) == 0)) { #ifdef USE_NOTMUCH - if (b->magic == MUTT_NOTMUCH) - nm_nonctx_get_count(b->realpath, &b->msg_count, &b->msg_unread); + if (m->magic == MUTT_NOTMUCH) + nm_nonctx_get_count(m->realpath, &m->msg_count, &m->msg_unread); else #endif { - b->msg_unread = Context->mailbox->msg_unread; - b->msg_count = Context->mailbox->msg_count; + m->msg_unread = Context->mailbox->msg_unread; + m->msg_count = Context->mailbox->msg_count; } - b->msg_flagged = Context->mailbox->msg_flagged; + m->msg_flagged = Context->mailbox->msg_flagged; } /* compute length of Folder without trailing separator */ @@ -885,9 +885,9 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) /* check whether Folder is a prefix of the current folder's path */ bool maildir_is_prefix = false; - if ((mutt_str_strlen(b->path) > maildirlen) && - (mutt_str_strncmp(Folder, b->path, maildirlen) == 0) && - SidebarDelimChars && strchr(SidebarDelimChars, b->path[maildirlen])) + if ((mutt_str_strlen(m->path) > maildirlen) && + (mutt_str_strncmp(Folder, m->path, maildirlen) == 0) && + SidebarDelimChars && strchr(SidebarDelimChars, m->path[maildirlen])) { maildir_is_prefix = true; } @@ -898,7 +898,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) if (SidebarShortPath) { /* disregard a trailing separator, so strlen() - 2 */ - sidebar_folder_name = b->path; + sidebar_folder_name = m->path; for (int i = mutt_str_strlen(sidebar_folder_name) - 2; i >= 0; i--) { if (SidebarDelimChars && strchr(SidebarDelimChars, sidebar_folder_name[i])) @@ -910,7 +910,7 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) } else if ((SidebarComponentDepth > 0) && SidebarDelimChars) { - sidebar_folder_name = b->path + maildir_is_prefix * (maildirlen + 1); + sidebar_folder_name = m->path + maildir_is_prefix * (maildirlen + 1); for (int i = 0; i < SidebarComponentDepth; i++) { char *chars_after_delim = strpbrk(sidebar_folder_name, SidebarDelimChars); @@ -921,16 +921,16 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) } } else - sidebar_folder_name = b->path + maildir_is_prefix * (maildirlen + 1); + sidebar_folder_name = m->path + maildir_is_prefix * (maildirlen + 1); - if (b->desc) + if (m->desc) { - sidebar_folder_name = b->desc; + sidebar_folder_name = m->desc; } else if (maildir_is_prefix && SidebarFolderIndent) { int lastsep = 0; - const char *tmp_folder_name = b->path + maildirlen + 1; + const char *tmp_folder_name = m->path + maildirlen + 1; int tmplen = (int) mutt_str_strlen(tmp_folder_name) - 1; for (int i = 0; i < tmplen; i++) { @@ -993,7 +993,7 @@ void mutt_sb_draw(void) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - mutt_sb_notify_mailbox(np->b, true); + mutt_sb_notify_mailbox(np->m, true); } } @@ -1077,11 +1077,11 @@ void mutt_sb_set_mailbox_stats(const struct Context *ctx) struct MailboxNode *np = NULL; STAILQ_FOREACH(np, &AllMailboxes, entries) { - if (mutt_str_strcmp(np->b->realpath, ctx->mailbox->realpath) == 0) + if (mutt_str_strcmp(np->m->realpath, ctx->mailbox->realpath) == 0) { - np->b->msg_unread = ctx->mailbox->msg_unread; - np->b->msg_count = ctx->mailbox->msg_count; - np->b->msg_flagged = ctx->mailbox->msg_flagged; + np->m->msg_unread = ctx->mailbox->msg_unread; + np->m->msg_count = ctx->mailbox->msg_count; + np->m->msg_flagged = ctx->mailbox->msg_flagged; break; } } @@ -1130,7 +1130,7 @@ void mutt_sb_set_open_mailbox(void) /** * mutt_sb_notify_mailbox - The state of a Mailbox is about to change - * @param b Folder + * @param m Folder * @param created True if folder created, false if deleted * * We receive a notification: @@ -1139,9 +1139,9 @@ void mutt_sb_set_open_mailbox(void) * * Before a deletion, check that our pointers won't be invalidated. */ -void mutt_sb_notify_mailbox(struct Mailbox *b, bool created) +void mutt_sb_notify_mailbox(struct Mailbox *m, bool created) { - if (!b) + if (!m) return; /* Any new/deleted mailboxes will cause a refresh. As long as @@ -1155,14 +1155,14 @@ void mutt_sb_notify_mailbox(struct Mailbox *b, bool created) mutt_mem_realloc(&Entries, EntryLen * sizeof(struct SbEntry *)); } Entries[EntryCount] = mutt_mem_calloc(1, sizeof(struct SbEntry)); - Entries[EntryCount]->mailbox = b; + Entries[EntryCount]->mailbox = m; if (TopIndex < 0) TopIndex = EntryCount; if (BotIndex < 0) BotIndex = EntryCount; if ((OpnIndex < 0) && Context && - (mutt_str_strcmp(b->realpath, Context->mailbox->realpath) == 0)) + (mutt_str_strcmp(m->realpath, Context->mailbox->realpath) == 0)) OpnIndex = EntryCount; EntryCount++; @@ -1171,7 +1171,7 @@ void mutt_sb_notify_mailbox(struct Mailbox *b, bool created) { int del_index; for (del_index = 0; del_index < EntryCount; del_index++) - if (Entries[del_index]->mailbox == b) + if (Entries[del_index]->mailbox == m) break; if (del_index == EntryCount) return; @@ -1221,10 +1221,10 @@ void mutt_sb_toggle_virtual(void) STAILQ_FOREACH(np, &AllMailboxes, entries) { /* and reintroduce the ones that are visible */ - if (((np->b->magic == MUTT_NOTMUCH) && (sidebar_source == SB_SRC_VIRT)) || - ((np->b->magic != MUTT_NOTMUCH) && (sidebar_source == SB_SRC_INCOMING))) + if (((np->m->magic == MUTT_NOTMUCH) && (sidebar_source == SB_SRC_VIRT)) || + ((np->m->magic != MUTT_NOTMUCH) && (sidebar_source == SB_SRC_INCOMING))) { - mutt_sb_notify_mailbox(np->b, true); + mutt_sb_notify_mailbox(np->m, true); } } diff --git a/sidebar.h b/sidebar.h index cbbac200f..747c40155 100644 --- a/sidebar.h +++ b/sidebar.h @@ -45,7 +45,7 @@ extern short SidebarSortMethod; void mutt_sb_change_mailbox(int op); void mutt_sb_draw(void); const char *mutt_sb_get_highlight(void); -void mutt_sb_notify_mailbox(struct Mailbox *b, bool created); +void mutt_sb_notify_mailbox(struct Mailbox *m, bool created); void mutt_sb_set_mailbox_stats(const struct Context *ctx); void mutt_sb_set_open_mailbox(void); void mutt_sb_toggle_virtual(void); -- 2.40.0