From: Richard Russon Date: Fri, 12 Jul 2019 13:17:06 +0000 (+0100) Subject: mailbox: rename desc to name X-Git-Tag: 2019-10-25~139^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e0b6b279df69ff5ecd586c0521257d92e1d8051;p=neomutt mailbox: rename desc to name --- diff --git a/browser.c b/browser.c index 23c0dc80b..dc64e3baf 100644 --- a/browser.c +++ b/browser.c @@ -869,13 +869,13 @@ static int examine_mailboxes(struct Menu *menu, struct BrowserState *state) { case MUTT_IMAP: case MUTT_POP: - add_folder(menu, state, mutt_b2s(mailbox), np->mailbox->desc, NULL, + add_folder(menu, state, mutt_b2s(mailbox), np->mailbox->name, NULL, np->mailbox, NULL); continue; case MUTT_NOTMUCH: case MUTT_NNTP: add_folder(menu, state, mutt_b2s(np->mailbox->pathbuf), - np->mailbox->desc, NULL, np->mailbox, NULL); + np->mailbox->name, NULL, np->mailbox, NULL); continue; default: /* Continue */ break; @@ -901,7 +901,7 @@ static int examine_mailboxes(struct Menu *menu, struct BrowserState *state) s.st_mtime = st2.st_mtime; } - add_folder(menu, state, mutt_b2s(mailbox), np->mailbox->desc, &s, np->mailbox, NULL); + add_folder(menu, state, mutt_b2s(mailbox), np->mailbox->name, &s, np->mailbox, NULL); } neomutt_mailboxlist_clear(&ml); } diff --git a/doc/manual.xml.head b/doc/manual.xml.head index 596ea9c2c..dc6e98d03 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -760,7 +760,7 @@ set sidebar_divider_char = '│' # Pretty line %D - Description of the mailbox + Descriptive name of the mailbox diff --git a/index.c b/index.c index ab9d45744..fc7575440 100644 --- a/index.c +++ b/index.c @@ -625,7 +625,7 @@ static int main_change_folder(struct Menu *menu, int op, struct Mailbox *m, { // Try to see if the buffer matches a description before we bail. // We'll receive a non-null pointer if there is a corresponding mailbox. - m = mutt_mailbox_find_desc(buf); + m = mutt_mailbox_find_name(buf); if (m) { mutt_str_strfcpy(buf, mutt_b2s(m->pathbuf), buflen); @@ -686,7 +686,7 @@ static int main_change_folder(struct Menu *menu, int op, struct Mailbox *m, * mutt_push/pop_current_menu() functions. If that changes, the menu * would need to be reset here, and the pager cleanup code after the * switch statement would need to be run. */ - mutt_folder_hook(buf, m ? m->desc : NULL); + mutt_folder_hook(buf, m ? m->name : NULL); const int flags = (C_ReadOnly || (op == OP_MAIN_CHANGE_FOLDER_READONLY) #ifdef USE_NOTMUCH diff --git a/init.c b/init.c index 37c8938fb..6f7b2e7cb 100644 --- a/init.c +++ b/init.c @@ -1325,7 +1325,7 @@ static enum CommandResult parse_mailboxes(struct Buffer *buf, struct Buffer *s, mutt_extract_token(buf, s, MUTT_TOKEN_NO_FLAGS); if (buf->data && (*buf->data != '\0')) { - m->desc = mutt_str_strdup(buf->data); + m->name = mutt_str_strdup(buf->data); } else { @@ -2405,7 +2405,7 @@ static enum CommandResult parse_unmailboxes(struct Buffer *buf, struct Buffer *s { clear_this = (mutt_str_strcasecmp(mutt_b2s(buf), mutt_b2s(np->mailbox->pathbuf)) == 0) || - (mutt_str_strcasecmp(mutt_b2s(buf), np->mailbox->desc) == 0); + (mutt_str_strcasecmp(mutt_b2s(buf), np->mailbox->name) == 0); } if (clear_this) diff --git a/mailbox.c b/mailbox.c index d0505ee05..7df01e93a 100644 --- a/mailbox.c +++ b/mailbox.c @@ -65,7 +65,7 @@ void mailbox_free(struct Mailbox **ptr) notify_free(&m->notify); mutt_buffer_free(&m->pathbuf); - FREE(&m->desc); + FREE(&m->name); if (m->mdata && m->free_mdata) m->free_mdata(&m->mdata); FREE(&m->realpath); @@ -160,14 +160,16 @@ struct Mailbox *mutt_mailbox_find(const char *path) } /** - * mutt_mailbox_find_desc - Find the mailbox with a given description - * @param desc Description to match + * mutt_mailbox_find_name - Find the mailbox with a given name + * @param name Name to match * @retval ptr Matching Mailbox * @retval NULL No matching mailbox found + * + * @note This searches across all Accounts */ -struct Mailbox *mutt_mailbox_find_desc(const char *desc) +struct Mailbox *mutt_mailbox_find_name(const char *name) { - if (!desc) + if (!name) return NULL; struct MailboxList ml = neomutt_mailboxlist_get_all(NeoMutt, MUTT_MAILBOX_ANY); @@ -175,7 +177,7 @@ struct Mailbox *mutt_mailbox_find_desc(const char *desc) struct Mailbox *m = NULL; STAILQ_FOREACH(np, &ml, entries) { - if (np->mailbox->desc && (mutt_str_strcmp(np->mailbox->desc, desc) == 0)) + if (mutt_str_strcmp(np->mailbox->name, name) == 0) { m = np->mailbox; break; diff --git a/mailbox.h b/mailbox.h index 4b9b78876..43f21513b 100644 --- a/mailbox.h +++ b/mailbox.h @@ -94,7 +94,7 @@ struct Mailbox { struct Buffer *pathbuf; char *realpath; ///< used for duplicate detection, context comparison, and the sidebar - char *desc; + char *name; struct ConfigSubset *sub; ///< Inherited config items off_t size; bool has_new; /**< mailbox has new mail */ @@ -182,7 +182,7 @@ struct Mailbox *mailbox_new (void); void mutt_mailbox_changed (struct Mailbox *m, enum MailboxNotification action); void mutt_mailbox_cleanup (const char *path, struct stat *st); struct Mailbox *mutt_mailbox_find (const char *path); -struct Mailbox *mutt_mailbox_find_desc (const char *desc); +struct Mailbox *mutt_mailbox_find_name (const char *name); void mutt_mailbox_size_add (struct Mailbox *m, const struct Email *e); void mutt_mailbox_size_sub (struct Mailbox *m, const struct Email *e); void mutt_mailbox_update (struct Mailbox *m); diff --git a/main.c b/main.c index 397a60bb4..3fedd5148 100644 --- a/main.c +++ b/main.c @@ -1173,7 +1173,7 @@ int main(int argc, char *argv[], char *envp[]) if (C_Spoolfile) { // Check if C_Spoolfile corresponds a mailboxes' description. - struct Mailbox *m_desc = mutt_mailbox_find_desc(C_Spoolfile); + struct Mailbox *m_desc = mutt_mailbox_find_name(C_Spoolfile); if (m_desc) mutt_buffer_strcpy(folder, m_desc->realpath); else diff --git a/sidebar.c b/sidebar.c index f7fe92c20..78b056395 100644 --- a/sidebar.c +++ b/sidebar.c @@ -151,8 +151,8 @@ static const char *sidebar_format_str(char *buf, size_t buflen, size_t col, int break; case 'D': - if (sbe->mailbox->desc) - mutt_format_s(buf, buflen, prec, sbe->mailbox->desc); + if (sbe->mailbox->name) + mutt_format_s(buf, buflen, prec, sbe->mailbox->name); else mutt_format_s(buf, buflen, prec, sbe->box); break; @@ -320,7 +320,7 @@ static int cb_qsort_sbe(const void *a, const void *b) rc = (m2->msg_unread - m1->msg_unread); break; case SORT_DESC: - rc = mutt_str_strcmp(m1->desc, m2->desc); + rc = mutt_str_strcmp(m1->name, m2->name); break; case SORT_FLAGGED: if (m2->msg_flagged == m1->msg_flagged) @@ -384,7 +384,7 @@ static void update_entries_visibility(void) } if (mutt_list_find(&SidebarWhitelist, mutt_b2s(sbe->mailbox->pathbuf)) || - mutt_list_find(&SidebarWhitelist, sbe->mailbox->desc)) + mutt_list_find(&SidebarWhitelist, sbe->mailbox->name)) { /* Explicitly asked to be visible */ continue; @@ -921,9 +921,9 @@ static void draw_sidebar(int num_rows, int num_cols, int div_width) else sidebar_folder_name = mutt_b2s(m->pathbuf) + maildir_is_prefix * (maildirlen + 1); - if (m->desc) + if (m->name) { - sidebar_folder_name = m->desc; + sidebar_folder_name = m->name; } else if (maildir_is_prefix && C_SidebarFolderIndent) { diff --git a/status.c b/status.c index fb2b3a885..c6028f0b1 100644 --- a/status.c +++ b/status.c @@ -124,10 +124,10 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c case 'D': { struct Mailbox *m = Context ? Context->mailbox : NULL; - // If there's a description, use it. Otherwise, fall-through - if (m && m->desc) + // If there's a descriptive name, use it. Otherwise, fall-through + if (m && m->name) { - mutt_str_strfcpy(tmp, m->desc, sizeof(tmp)); + mutt_str_strfcpy(tmp, m->name, sizeof(tmp)); snprintf(fmt, sizeof(fmt), "%%%ss", prec); snprintf(buf, buflen, fmt, tmp); break; @@ -146,9 +146,9 @@ static const char *status_format_str(char *buf, size_t buflen, size_t col, int c } else #endif - if (m && (m->magic == MUTT_NOTMUCH) && m->desc) + if (m && (m->magic == MUTT_NOTMUCH) && m->name) { - mutt_str_strfcpy(tmp, m->desc, sizeof(tmp)); + mutt_str_strfcpy(tmp, m->name, sizeof(tmp)); } else if (m && !mutt_buffer_is_empty(m->pathbuf)) {