From: Richard Russon Date: Fri, 3 Aug 2018 14:08:36 +0000 (+0100) Subject: rename Buffy X-Git-Tag: 2019-10-25~713^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ba9c69a685c81a7633abe95536ae758142d88a3;p=neomutt rename Buffy --- diff --git a/browser.c b/browser.c index d29ad5b7e..9003e37f4 100644 --- a/browser.c +++ b/browser.c @@ -727,8 +727,9 @@ static const char *group_index_format_str(char *buf, size_t buflen, size_t col, } #endif /* USE_NNTP */ -static void add_folder(struct Menu *m, struct BrowserState *state, const char *name, - const char *desc, const struct stat *s, struct Buffy *b, void *data) +static void add_folder(struct Menu *m, struct BrowserState *state, + const char *name, const char *desc, const struct stat *s, + struct Mailbox *b, void *data) { if (state->entrylen == state->entrymax) { @@ -892,8 +893,8 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, else if (!S_ISREG(s.st_mode)) continue; - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (mutt_str_strcmp(buffer, np->b->path) != 0) break; @@ -922,15 +923,15 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state, */ static int examine_vfolders(struct Menu *menu, struct BrowserState *state) { - if (STAILQ_EMPTY(&BuffyList)) + if (STAILQ_EMPTY(&AllMailboxes)) return -1; mutt_buffy_check(0); init_state(state, menu); - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (mx_is_notmuch(np->b->path)) { @@ -978,12 +979,12 @@ static int examine_mailboxes(struct Menu *menu, struct BrowserState *state) { init_state(state, menu); - if (STAILQ_EMPTY(&BuffyList)) + if (STAILQ_EMPTY(&AllMailboxes)) return -1; mutt_buffy_check(0); - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (Context && (mutt_str_strcmp(np->b->realpath, Context->realpath) == 0)) { diff --git a/commands.c b/commands.c index 1fe27687a..36556404e 100644 --- a/commands.c +++ b/commands.c @@ -991,7 +991,7 @@ int mutt_save_message(struct Header *h, bool delete, bool decode, bool decrypt) #ifdef USE_COMPRESSED /* If we're saving to a compressed mailbox, the stats won't be updated * until the next open. Until then, improvise. */ - struct Buffy *cm = NULL; + struct Mailbox *cm = NULL; if (ctx.compress_info) cm = mutt_find_mailbox(ctx.realpath); /* We probably haven't been opened yet */ diff --git a/imap/browse.c b/imap/browse.c index 6aaef412d..366bed5c9 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -113,8 +113,8 @@ static void add_folder(char delim, char *folder, int noselect, int noinferiors, (state->entry)[state->entrylen].selectable = !noselect; (state->entry)[state->entrylen].inferiors = !noinferiors; - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (mutt_str_strcmp(tmp, np->b->path) == 0) break; diff --git a/imap/command.c b/imap/command.c index 81f2dc25b..94cf1ce82 100644 --- a/imap/command.c +++ b/imap/command.c @@ -711,8 +711,8 @@ static void cmd_parse_status(struct ImapData *idata, char *s) mutt_debug(3, "Running default STATUS handler\n"); /* should perhaps move this code back to imap_buffy_check */ - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (np->b->magic != MUTT_IMAP) continue; diff --git a/imap/imap.c b/imap/imap.c index 8c28ca138..dc6663920 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -542,8 +542,8 @@ static int complete_hosts(char *buf, size_t buflen) size_t matchlen; matchlen = mutt_str_strlen(buf); - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (mutt_str_strncmp(buf, np->b->path, matchlen) != 0) continue; @@ -1430,8 +1430,8 @@ int imap_buffy_check(int check_stats) char munged[LONG_STRING]; int buffies = 0; - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { /* Init newly-added mailboxes */ if (!np->b->magic) @@ -1505,7 +1505,7 @@ int imap_buffy_check(int check_stats) } /* collect results */ - STAILQ_FOREACH(np, &BuffyList, entries) + STAILQ_FOREACH(np, &AllMailboxes, entries) { if ((np->b->magic == MUTT_IMAP) && np->b->new) buffies++; diff --git a/init.c b/init.c index 1460f4df2..1e0f4dfe7 100644 --- a/init.c +++ b/init.c @@ -3309,12 +3309,12 @@ int mutt_init(bool skip_sys_rc, struct ListHead *commands) if (VirtualSpoolfile) { /* Find the first virtual folder and open it */ - struct BuffyNode *bp = NULL; - STAILQ_FOREACH(bp, &BuffyList, entries) + struct MailboxNode *mp = NULL; + STAILQ_FOREACH(mp, &AllMailboxes, entries) { - if (bp->b->magic == MUTT_NOTMUCH) + if (mp->b->magic == MUTT_NOTMUCH) { - cs_str_string_set(Config, "spoolfile", bp->b->path, NULL); + cs_str_string_set(Config, "spoolfile", mp->b->path, NULL); mutt_sb_toggle_virtual(); break; } diff --git a/mailbox.c b/mailbox.c index fc2f0b510..c7fb3bb24 100644 --- a/mailbox.c +++ b/mailbox.c @@ -59,13 +59,12 @@ bool MailCheckStats; ///< Config: Periodically check for new mail short MailCheckStatsInterval; ///< Config: How often to check for new mail bool MaildirCheckCur; ///< Config: Check both 'new' and 'cur' directories for new mail -static time_t BuffyTime = 0; /**< last time we started checking for mail */ -static time_t BuffyStatsTime = 0; /**< last time we check performed mail_check_stats */ -time_t BuffyDoneTime = 0; /**< last time we knew for sure how much mail there was. */ -static short BuffyCount = 0; /**< how many boxes with new mail */ -static short BuffyNotify = 0; /**< # of unnotified new boxes */ +static time_t MailboxTime = 0; /**< last time we started checking for mail */ +static time_t MailboxStatsTime = 0; /**< last time we check performed mail_check_stats */ +static short MailboxCount = 0; /**< how many boxes with new mail */ +static short MailboxNotify = 0; /**< # of unnotified new boxes */ -struct BuffyList BuffyList = STAILQ_HEAD_INITIALIZER(BuffyList); +struct MailboxList AllMailboxes = STAILQ_HEAD_INITIALIZER(AllMailboxes); /** * fseek_last_message - Find the last message in the file @@ -171,15 +170,15 @@ static bool test_new_folder(const char *path) } /** - * buffy_new - Create a new Buffy (mailbox) + * buffy_new - Create a new Maibox * @param path Path to the mailbox - * @retval ptr New Buffy + * @retval ptr New Mailbox */ -static struct Buffy *buffy_new(const char *path) +static struct Mailbox *buffy_new(const char *path) { char rp[PATH_MAX] = ""; - struct Buffy *buffy = mutt_mem_calloc(1, sizeof(struct Buffy)); + struct Mailbox *buffy = mutt_mem_calloc(1, sizeof(struct Mailbox)); mutt_str_strfcpy(buffy->path, path, sizeof(buffy->path)); char *r = realpath(path, rp); mutt_str_strfcpy(buffy->realpath, r ? rp : path, sizeof(buffy->realpath)); @@ -189,10 +188,10 @@ static struct Buffy *buffy_new(const char *path) } /** - * buffy_free - Free a Buffy (mailbox) - * @param mailbox Buffy to free + * buffy_free - Free a Mailbox + * @param mailbox Mailbox to free */ -static void buffy_free(struct Buffy **mailbox) +static void buffy_free(struct Mailbox **mailbox) { if (mailbox && *mailbox) FREE(&(*mailbox)->desc); @@ -209,7 +208,7 @@ static void buffy_free(struct Buffy **mailbox) * * Checks the specified maildir subdir (cur or new) for new mail or mail counts. */ -static int buffy_maildir_check_dir(struct Buffy *mailbox, const char *dir_name, +static int buffy_maildir_check_dir(struct Mailbox *mailbox, const char *dir_name, bool check_new, bool check_stats) { char path[PATH_MAX]; @@ -292,7 +291,7 @@ static int buffy_maildir_check_dir(struct Buffy *mailbox, const char *dir_name, * @param check_stats if true, also count total, new, and flagged messages * @retval 1 if the mailbox has new mail */ -static int buffy_maildir_check(struct Buffy *mailbox, bool check_stats) +static int buffy_maildir_check(struct Mailbox *mailbox, bool check_stats) { int rc = 1; bool check_new = true; @@ -321,7 +320,7 @@ static int buffy_maildir_check(struct Buffy *mailbox, bool check_stats) * @param check_stats if true, also count total, new, and flagged messages * @retval 1 if the mailbox has new mail */ -static int buffy_mbox_check(struct Buffy *mailbox, struct stat *sb, bool check_stats) +static int buffy_mbox_check(struct Mailbox *mailbox, struct stat *sb, bool check_stats) { int rc = 0; int new_or_changed; @@ -375,7 +374,7 @@ static int buffy_mbox_check(struct Buffy *mailbox, struct stat *sb, bool check_s * @param contex_sb stat() info for the current mailbox (Context) * @param check_stats If true, also count the total, new and flagged messages */ -static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, bool check_stats) +static void buffy_check(struct Mailbox *tmp, struct stat *contex_sb, bool check_stats) { struct stat sb; #ifdef USE_SIDEBAR @@ -439,17 +438,17 @@ static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, bool check_st case MUTT_MBOX: case MUTT_MMDF: if (buffy_mbox_check(tmp, &sb, check_stats) > 0) - BuffyCount++; + MailboxCount++; break; case MUTT_MAILDIR: if (buffy_maildir_check(tmp, check_stats) > 0) - BuffyCount++; + MailboxCount++; break; case MUTT_MH: if (mh_buffy(tmp, check_stats)) - BuffyCount++; + MailboxCount++; break; #ifdef USE_NOTMUCH case MUTT_NOTMUCH: @@ -459,7 +458,7 @@ static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, bool check_st nm_nonctx_get_count(tmp->path, &tmp->msg_count, &tmp->msg_unread); if (tmp->msg_unread > 0) { - BuffyCount++; + MailboxCount++; tmp->new = true; } break; @@ -480,15 +479,15 @@ static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, bool check_st if (!tmp->new) tmp->notified = false; else if (!tmp->notified) - BuffyNotify++; + MailboxNotify++; } /** * buffy_get - Fetch buffy object for given path, if present * @param path Path to the mailbox - * @retval ptr Buffy for the mailbox + * @retval ptr Mailbox for the path */ -static struct Buffy *buffy_get(const char *path) +static struct Mailbox *buffy_get(const char *path) { if (!path) return NULL; @@ -496,8 +495,8 @@ static struct Buffy *buffy_get(const char *path) char *epath = mutt_str_strdup(path); mutt_expand_path(epath, mutt_str_strlen(epath)); - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + 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)); @@ -526,7 +525,7 @@ void mutt_buffy_cleanup(const char *path, struct stat *st) if (CheckMboxSize) { - struct Buffy *b = mutt_find_mailbox(path); + struct Mailbox *b = mutt_find_mailbox(path); if (b && !b->new) mutt_update_mailbox(b); } @@ -547,9 +546,9 @@ void mutt_buffy_cleanup(const char *path, struct stat *st) /** * mutt_find_mailbox - Find the mailbox with a given path * @param path Path to match - * @retval ptr Matching Buffy + * @retval ptr Matching Mailbox */ -struct Buffy *mutt_find_mailbox(const char *path) +struct Mailbox *mutt_find_mailbox(const char *path) { if (!path) return NULL; @@ -560,8 +559,8 @@ struct Buffy *mutt_find_mailbox(const char *path) if (stat(path, &sb) != 0) return NULL; - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if ((stat(np->b->path, &tmp_sb) == 0) && (sb.st_dev == tmp_sb.st_dev) && (sb.st_ino == tmp_sb.st_ino)) @@ -577,7 +576,7 @@ struct Buffy *mutt_find_mailbox(const char *path) * mutt_update_mailbox - Get the mailbox's current size * @param b Mailbox to check */ -void mutt_update_mailbox(struct Buffy *b) +void mutt_update_mailbox(struct Mailbox *b) { struct stat sb; @@ -641,8 +640,8 @@ int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, /* avoid duplicates */ p = realpath(buf, f1); - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (mutt_str_strcmp(p ? p : buf, np->b->realpath) == 0) { @@ -657,7 +656,7 @@ int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, continue; } - struct Buffy *b = buffy_new(buf); + struct Mailbox *b = buffy_new(buf); b->new = false; b->notified = true; @@ -685,9 +684,9 @@ int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, b->size = 0; } - struct BuffyNode *bn = mutt_mem_calloc(1, sizeof(*bn)); - bn->b = b; - STAILQ_INSERT_TAIL(&BuffyList, bn, entries); + struct MailboxNode *mn = mutt_mem_calloc(1, sizeof(*mn)); + mn->b = b; + STAILQ_INSERT_TAIL(&AllMailboxes, mn, entries); #ifdef USE_SIDEBAR mutt_sb_notify_mailbox(b, 1); @@ -736,9 +735,9 @@ int mutt_parse_unmailboxes(struct Buffer *path, struct Buffer *s, } } - struct BuffyNode *np = NULL; - struct BuffyNode *tmp = NULL; - STAILQ_FOREACH_SAFE(np, &BuffyList, entries, tmp) + struct MailboxNode *np = NULL; + struct MailboxNode *tmp = NULL; + 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)); @@ -751,7 +750,7 @@ int mutt_parse_unmailboxes(struct Buffer *path, struct Buffer *s, #ifdef USE_SIDEBAR mutt_sb_notify_mailbox(np->b, 0); #endif - STAILQ_REMOVE(&BuffyList, np, BuffyNode, entries); + STAILQ_REMOVE(&AllMailboxes, np, MailboxNode, entries); buffy_free(&np->b); FREE(&np); continue; @@ -762,15 +761,15 @@ int mutt_parse_unmailboxes(struct Buffer *path, struct Buffer *s, } /** - * mutt_buffy_check - Check all BuffyList for new mail + * mutt_buffy_check - Check all AllMailboxes for new mail * @param force Force flags, see below * @retval num Number of mailboxes with new mail * * The force argument may be any combination of the following values: - * - MUTT_BUFFY_CHECK_FORCE ignore BuffyTimeout and check for new mail - * - MUTT_BUFFY_CHECK_FORCE_STATS ignore BuffyTimeout and calculate statistics + * - MUTT_BUFFY_CHECK_FORCE ignore MailboxTime and check for new mail + * - MUTT_BUFFY_CHECK_FORCE_STATS ignore MailboxTime and calculate statistics * - * Check all BuffyList for new mail and total/new/flagged messages + * Check all AllMailboxes for new mail and total/new/flagged messages */ int mutt_buffy_check(int force) { @@ -787,26 +786,26 @@ int mutt_buffy_check(int force) #endif /* fastest return if there are no mailboxes */ - if (STAILQ_EMPTY(&BuffyList)) + if (STAILQ_EMPTY(&AllMailboxes)) return 0; t = time(NULL); - if (!force && (t - BuffyTime < MailCheck)) - return BuffyCount; + if (!force && (t - MailboxTime < MailCheck)) + return MailboxCount; if ((force & MUTT_BUFFY_CHECK_FORCE_STATS) || - (MailCheckStats && ((t - BuffyStatsTime) >= MailCheckStatsInterval))) + (MailCheckStats && ((t - MailboxStatsTime) >= MailCheckStatsInterval))) { check_stats = true; - BuffyStatsTime = t; + MailboxStatsTime = t; } - BuffyTime = t; - BuffyCount = 0; - BuffyNotify = 0; + MailboxTime = t; + MailboxCount = 0; + MailboxNotify = 0; #ifdef USE_IMAP - BuffyCount += imap_buffy_check(check_stats); + MailboxCount += imap_buffy_check(check_stats); #endif /* check device ID and serial number instead of comparing paths */ @@ -820,14 +819,13 @@ int mutt_buffy_check(int force) contex_sb.st_ino = 0; } - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { buffy_check(np->b, &contex_sb, check_stats); } - BuffyDoneTime = BuffyTime; - return BuffyCount; + return MailboxCount; } /** @@ -841,12 +839,12 @@ bool mutt_buffy_list(void) size_t pos = 0; int first = 1; - int have_unnotified = BuffyNotify; + int have_unnotified = MailboxNotify; buffylist[0] = '\0'; pos += strlen(strncat(buffylist, _("New mail in "), sizeof(buffylist) - 1 - pos)); - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { /* Is there new mail in this mailbox? */ if (!np->b->new || (have_unnotified && np->b->notified)) @@ -869,7 +867,7 @@ bool mutt_buffy_list(void) { /* pos += strlen (strncat(buffylist + pos, "*", sizeof(buffylist)-1-pos)); */ np->b->notified = true; - BuffyNotify--; + MailboxNotify--; } pos += strlen(strncat(buffylist + pos, path, sizeof(buffylist) - 1 - pos)); first = 0; @@ -885,9 +883,9 @@ bool mutt_buffy_list(void) return true; } /* there were no mailboxes needing to be notified, so clean up since - * BuffyNotify has somehow gotten out of sync + * MailboxNotify has somehow gotten out of sync */ - BuffyNotify = 0; + MailboxNotify = 0; return false; } @@ -897,7 +895,7 @@ bool mutt_buffy_list(void) */ void mutt_buffy_setnotified(const char *path) { - struct Buffy *buffy = buffy_get(path); + struct Mailbox *buffy = buffy_get(path); if (!buffy) return; @@ -911,7 +909,7 @@ void mutt_buffy_setnotified(const char *path) */ bool mutt_buffy_notify(void) { - if (mutt_buffy_check(0) && BuffyNotify) + if (mutt_buffy_check(0) && MailboxNotify) { return mutt_buffy_list(); } @@ -934,8 +932,8 @@ void mutt_buffy(char *s, size_t slen) int found = 0; for (int pass = 0; pass < 2; pass++) { - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (np->b->magic == MUTT_NOTMUCH) /* only match real mailboxes */ continue; @@ -971,8 +969,8 @@ void mutt_buffy_vfolder(char *buf, size_t buflen) bool found = false; for (int pass = 0; pass < 2; pass++) { - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (np->b->magic != MUTT_NOTMUCH) continue; @@ -986,7 +984,7 @@ void mutt_buffy_vfolder(char *buf, size_t buflen) } } - mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE); /* buffy was wrong - resync things */ + mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE); /* Mailbox was wrong - resync things */ } /* no folders with new mail */ diff --git a/mailbox.h b/mailbox.h index 84f407483..b218fe521 100644 --- a/mailbox.h +++ b/mailbox.h @@ -20,8 +20,8 @@ * this program. If not, see . */ -#ifndef _MUTT_BUFFY_H -#define _MUTT_BUFFY_H +#ifndef _MUTT_MAILBOX_H +#define _MUTT_MAILBOX_H #include #include @@ -44,9 +44,9 @@ extern bool MaildirCheckCur; #define MUTT_VIRTUAL 2 /** - * struct Buffy - A mailbox + * struct Mailbox - A mailbox */ -struct Buffy +struct Mailbox { char path[PATH_MAX]; char realpath[PATH_MAX]; /**< used for duplicate detection, context @@ -67,24 +67,22 @@ struct Buffy time_t stats_last_checked; /**< mtime of mailbox the last time stats where checked. */ }; -struct BuffyNode +struct MailboxNode { - struct Buffy *b; - STAILQ_ENTRY(BuffyNode) entries; + struct Mailbox *b; + STAILQ_ENTRY(MailboxNode) entries; }; -STAILQ_HEAD(BuffyList, BuffyNode); +STAILQ_HEAD(MailboxList, MailboxNode); -extern struct BuffyList BuffyList; +extern struct MailboxList AllMailboxes; #ifdef USE_NOTMUCH void mutt_buffy_vfolder(char *buf, size_t buflen); #endif -extern time_t BuffyDoneTime; /**< last time we knew for sure how much mail there was */ - -struct Buffy *mutt_find_mailbox(const char *path); -void mutt_update_mailbox(struct Buffy *b); +struct Mailbox *mutt_find_mailbox(const char *path); +void mutt_update_mailbox(struct Mailbox *b); void mutt_buffy_cleanup(const char *path, struct stat *st); @@ -102,4 +100,4 @@ bool mutt_buffy_notify(void); int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, unsigned long data, struct Buffer *err); int mutt_parse_unmailboxes(struct Buffer *path, struct Buffer *s, unsigned long data, struct Buffer *err); -#endif /* _MUTT_BUFFY_H */ +#endif /* _MUTT_MAILBOX_H */ diff --git a/maildir/maildir.h b/maildir/maildir.h index 25bd5adac..d19988ba8 100644 --- a/maildir/maildir.h +++ b/maildir/maildir.h @@ -40,7 +40,7 @@ #include "hcache/hcache.h" #endif -struct Buffy; +struct Mailbox; struct Context; struct Header; @@ -63,7 +63,7 @@ struct Header *maildir_parse_message(int magic, const char *fname, bool is_old, struct Header *maildir_parse_stream(int magic, FILE *f, const char *fname, bool is_old, struct Header *h); bool maildir_update_flags(struct Context *ctx, struct Header *o, struct Header *n); -bool mh_buffy(struct Buffy *mailbox, bool check_stats); +bool mh_buffy(struct Mailbox *mailbox, bool check_stats); int mh_check_empty(const char *path); bool mx_is_maildir(const char *path); diff --git a/maildir/mh.c b/maildir/mh.c index 9352b9817..39acb30a3 100644 --- a/maildir/mh.c +++ b/maildir/mh.c @@ -292,7 +292,7 @@ static inline mode_t mh_umask(struct Context *ctx) * @retval 0 modification time is older * @retval -1 Error */ -static int mh_sequences_changed(struct Buffy *b) +static int mh_sequences_changed(struct Mailbox *b) { char path[PATH_MAX]; struct stat sb; @@ -313,7 +313,7 @@ static int mh_sequences_changed(struct Buffy *b) * @retval 0 Modification time on the message file is newer * @retval -1 Error */ -static int mh_already_notified(struct Buffy *b, int msgno) +static int mh_already_notified(struct Mailbox *b, int msgno) { char path[PATH_MAX]; struct stat sb; @@ -352,7 +352,7 @@ static bool mh_valid_message(const char *s) * @param check_stats Also count total, new, and flagged messages * @retval true if the mailbox has new mail */ -bool mh_buffy(struct Buffy *mailbox, bool check_stats) +bool mh_buffy(struct Mailbox *mailbox, bool check_stats) { struct MhSequences mhs = { 0 }; bool check_new = true; diff --git a/main.c b/main.c index 3a6b5e903..9b6c8a254 100644 --- a/main.c +++ b/main.c @@ -1139,7 +1139,7 @@ int main(int argc, char *argv[], char *envp[]) } else #endif - if (STAILQ_EMPTY(&BuffyList)) + if (STAILQ_EMPTY(&AllMailboxes)) { mutt_error(_("No incoming mailboxes defined.")); goto main_curses; // TEST39: neomutt -n -F /dev/null -y diff --git a/mbox/mbox.c b/mbox/mbox.c index 66b7b49b2..719aa048a 100644 --- a/mbox/mbox.c +++ b/mbox/mbox.c @@ -967,7 +967,7 @@ static int mbox_mbox_sync(struct Context *ctx, int *index_hint) FILE *fp = NULL; struct Progress progress; char msgbuf[PATH_MAX + 64]; - struct Buffy *tmp = NULL; + struct Mailbox *tmp = NULL; /* sort message by their position in the mailbox on disk */ if (Sort != SORT_ORDER) diff --git a/notmuch/mutt_notmuch.c b/notmuch/mutt_notmuch.c index 200a40ef2..711ca12f0 100644 --- a/notmuch/mutt_notmuch.c +++ b/notmuch/mutt_notmuch.c @@ -2276,8 +2276,8 @@ done: */ char *nm_get_description(struct Context *ctx) { - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (np->b->desc && (strcmp(np->b->path, ctx->path) == 0)) return np->b->desc; @@ -2299,8 +2299,8 @@ int nm_description_to_path(const char *desc, char *buf, size_t buflen) if (!desc || !buf || (buflen == 0)) return -EINVAL; - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if ((np->b->magic == MUTT_NOTMUCH) && np->b->desc && (strcmp(desc, np->b->desc) == 0)) { diff --git a/sidebar.c b/sidebar.c index 8d7c6e0a2..592d8bce1 100644 --- a/sidebar.c +++ b/sidebar.c @@ -73,9 +73,9 @@ static short PreviousSort = SORT_ORDER; /* sidebar_sort_method */ */ struct SbEntry { - char box[STRING]; /**< formatted mailbox name */ - struct Buffy *buffy; /**< Mailbox this represents */ - bool is_hidden; /**< Don't show, e.g. $sidebar_new_mail_only */ + char box[STRING]; /**< formatted mailbox name */ + struct Mailbox *buffy; /**< Mailbox this represents */ + bool is_hidden; /**< Don't show, e.g. $sidebar_new_mail_only */ }; static int EntryCount = 0; @@ -149,7 +149,7 @@ 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 Buffy *b = sbe->buffy; + struct Mailbox *b = sbe->buffy; if (!b) return src; @@ -316,8 +316,8 @@ 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 Buffy *b1 = sbe1->buffy; - struct Buffy *b2 = sbe2->buffy; + struct Mailbox *b1 = sbe1->buffy; + struct Mailbox *b2 = sbe2->buffy; int result = 0; @@ -422,8 +422,8 @@ static void unsort_entries(void) { int i = 0; - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (i >= EntryCount) break; @@ -817,7 +817,7 @@ static void fill_empty_space(int first_row, int num_rows, int div_width, int num * Display a list of mailboxes in a panel on the left. What's displayed will * depend on our index markers: TopBuffy, OpnBuffy, HilBuffy, BotBuffy. * On the first run they'll be NULL, so we display the top of NeoMutt's list - * (BuffyList). + * (AllMailboxes). * * * TopBuffy - first visible mailbox * * BotBuffy - last visible mailbox @@ -832,7 +832,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 Buffy *b = NULL; + struct Mailbox *b = NULL; if (TopIndex < 0) return; @@ -1003,8 +1003,8 @@ void mutt_sb_draw(void) if (!Entries) { - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { mutt_sb_notify_mailbox(np->b, 1); } @@ -1087,8 +1087,8 @@ void mutt_sb_set_buffystats(const struct Context *ctx) return; /* Even if the sidebar's hidden, we should take note of the new data. */ - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { if (mutt_str_strcmp(np->b->realpath, ctx->realpath) == 0) { @@ -1152,7 +1152,7 @@ void mutt_sb_set_open_buffy(void) * * Before a deletion, check that our pointers won't be invalidated. */ -void mutt_sb_notify_mailbox(struct Buffy *b, int created) +void mutt_sb_notify_mailbox(struct Mailbox *b, int created) { if (!b) return; @@ -1229,8 +1229,8 @@ void mutt_sb_toggle_virtual(void) EntryCount = 0; FREE(&Entries); EntryLen = 0; - struct BuffyNode *np = NULL; - STAILQ_FOREACH(np, &BuffyList, entries) + struct MailboxNode *np = NULL; + STAILQ_FOREACH(np, &AllMailboxes, entries) { /* and reintroduce the ones that are visible */ if (((np->b->magic == MUTT_NOTMUCH) && (sidebar_source == SB_SRC_VIRT)) || diff --git a/sidebar.h b/sidebar.h index a681dd248..ec7b926bc 100644 --- a/sidebar.h +++ b/sidebar.h @@ -27,7 +27,7 @@ #include -struct Buffy; +struct Mailbox; struct Context; /* These Config Variables are only used in sidebar.c */ @@ -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 Buffy *b, int created); +void mutt_sb_notify_mailbox(struct Mailbox *b, int created); void mutt_sb_set_buffystats(const struct Context *ctx); void mutt_sb_set_open_buffy(void); void mutt_sb_toggle_virtual(void);