/**
* 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)
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);
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);
}
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;
}
}
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);
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");
}
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)++;
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;
}
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 */
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)
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;
}
* 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;
}
/* 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++;
}
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;
}
continue;
}
}
- mailbox->new = true;
+ mailbox->has_new = true;
rc = 1;
check_new = false;
if (!check_stats)
(mutt_stat_timespec_compare(sb, MUTT_STAT_MTIME, &mailbox->last_visited) > 0))
{
rc = 1;
- mailbox->new = true;
+ mailbox->has_new = true;
}
}
else if (CheckMboxSize)
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;
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;
if (tmp->msg_unread > 0)
{
MailboxCount++;
- tmp->new = true;
+ tmp->has_new = true;
}
break;
#endif
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++;
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;
}
}
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
{
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;
}
}
/**
* 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;
}
/**
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;
}
}
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
* 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;
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;
}
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;
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) &&
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));
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;
}
}
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;
}
}
* 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 */
*/
struct MailboxNode
{
- struct Mailbox *b;
+ struct Mailbox *m;
STAILQ_ENTRY(MailboxNode) entries;
};
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);
/**
* 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;
}
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
if (CheckMboxSize)
{
tmp = mutt_find_mailbox(ctx->mailbox->path);
- if (tmp && !tmp->new)
+ if (tmp && !tmp->has_new)
mutt_update_mailbox(tmp);
}
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 */
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;
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;
}
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;
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;
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;
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;
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;
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;
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;
{
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;
}
}
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;
}
break;
int j = i;
- while ((j < EntryCount) && (Entries[j]->mailbox != np->b))
+ while ((j < EntryCount) && (Entries[j]->mailbox != np->m))
j++;
if (j < EntryCount)
{
}
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;
}
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;
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;
entry = Entries[entryidx];
if (entry->is_hidden)
continue;
- b = entry->mailbox;
+ m = entry->mailbox;
if (entryidx == OpnIndex)
{
}
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);
}
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 */
/* 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;
}
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]))
}
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);
}
}
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++)
{
struct MailboxNode *np = NULL;
STAILQ_FOREACH(np, &AllMailboxes, entries)
{
- mutt_sb_notify_mailbox(np->b, true);
+ mutt_sb_notify_mailbox(np->m, true);
}
}
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;
}
}
/**
* 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:
*
* 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
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++;
{
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;
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);
}
}
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);