#endif /* USE_NNTP */
static void add_folder(MUTTMENU *m, struct browser_state *state, const char *name,
- const char *desc, const struct stat *s, BUFFY *b, void *data)
+ const char *desc, const struct stat *s, struct Buffy *b, void *data)
{
if (state->entrylen == state->entrymax)
{
DIR *dp = NULL;
struct dirent *de = NULL;
char buffer[_POSIX_PATH_MAX + SHORT_STRING];
- BUFFY *tmp = NULL;
+ struct Buffy *tmp = NULL;
while (stat(d, &s) == -1)
{
#ifdef USE_NOTMUCH
static int examine_vfolders(MUTTMENU *menu, struct browser_state *state)
{
- BUFFY *tmp = VirtIncoming;
+ struct Buffy *tmp = VirtIncoming;
if (!VirtIncoming)
return -1;
else
#endif
{
- BUFFY *tmp = Incoming;
+ struct Buffy *tmp = Incoming;
if (!Incoming)
return -1;
return rc;
}
-static BUFFY *buffy_new(const char *path)
+static struct Buffy *buffy_new(const char *path)
{
- BUFFY *buffy = NULL;
+ struct Buffy *buffy = NULL;
char rp[PATH_MAX] = "";
char *r = NULL;
- buffy = safe_calloc(1, sizeof(BUFFY));
+ buffy = safe_calloc(1, sizeof(struct Buffy));
strfcpy(buffy->path, path, sizeof(buffy->path));
r = realpath(path, rp);
strfcpy(buffy->realpath, r ? rp : path, sizeof(buffy->realpath));
return buffy;
}
-static void buffy_free(BUFFY **mailbox)
+static void buffy_free(struct Buffy **mailbox)
{
if (mailbox && *mailbox)
FREE(&(*mailbox)->desc);
* check_stats: if true, count total, new, and flagged messages.
* Returns 1 if the dir has new mail.
*/
-static int buffy_maildir_check_dir(BUFFY *mailbox, const char *dir_name,
+static int buffy_maildir_check_dir(struct Buffy *mailbox, const char *dir_name,
int check_new, int check_stats)
{
char path[_POSIX_PATH_MAX];
* check_stats: if true, also count total, new, and flagged messages.
* Returns 1 if the mailbox has new mail.
*/
-static int buffy_maildir_check(BUFFY *mailbox, int check_stats)
+static int buffy_maildir_check(struct Buffy *mailbox, int check_stats)
{
int rc, check_new = 1;
* check_stats: if true, also count total, new, and flagged messages.
* Returns 1 if the mailbox has new mail.
*/
-static int buffy_mbox_check(BUFFY *mailbox, struct stat *sb, int check_stats)
+static int buffy_mbox_check(struct Buffy *mailbox, struct stat *sb, int check_stats)
{
int rc = 0;
int new_or_changed;
return rc;
}
-static void buffy_check(BUFFY *tmp, struct stat *contex_sb, int check_stats)
+static void buffy_check(struct Buffy *tmp, struct stat *contex_sb, int check_stats)
{
struct stat sb;
#ifdef USE_SIDEBAR
}
/* fetch buffy object for given path, if present */
-static BUFFY *buffy_get(const char *path)
+static struct Buffy *buffy_get(const char *path)
{
- BUFFY *cur = NULL;
+ struct Buffy *cur = NULL;
char *epath = NULL;
if (!path)
void mutt_buffy_cleanup(const char *buf, struct stat *st)
{
struct utimbuf ut;
- BUFFY *tmp = NULL;
+ struct Buffy *tmp = NULL;
if (option(OPTCHECKMBOXSIZE))
{
}
}
-BUFFY *mutt_find_mailbox(const char *path)
+struct Buffy *mutt_find_mailbox(const char *path)
{
- BUFFY *tmp = NULL;
+ struct Buffy *tmp = NULL;
struct stat sb;
struct stat tmp_sb;
return tmp;
}
-void mutt_update_mailbox(BUFFY *b)
+void mutt_update_mailbox(struct Buffy *b)
{
struct stat sb;
int mutt_parse_mailboxes(struct Buffer *path, struct Buffer *s, unsigned long data, struct Buffer *err)
{
- BUFFY **tmp = NULL, *tmp1 = NULL;
+ struct Buffy **tmp = NULL, *tmp1 = NULL;
char buf[_POSIX_PATH_MAX];
struct stat sb;
char f1[PATH_MAX];
if (!path || !s)
return -1;
- BUFFY **tmp;
+ struct Buffy **tmp;
char buf[_POSIX_PATH_MAX + LONG_STRING + 32]; /* path to DB + query + URI "decoration" */
while (MoreArgs(s))
int mutt_parse_unvirtual_mailboxes(struct Buffer *path, struct Buffer *s, unsigned long data, struct Buffer *err)
{
- BUFFY **tmp = NULL, *tmp1 = NULL;
+ struct Buffy **tmp = NULL, *tmp1 = NULL;
while (MoreArgs(s))
{
*/
int mutt_buffy_check(int force)
{
- BUFFY *tmp = NULL;
+ struct Buffy *tmp = NULL;
struct stat contex_sb;
time_t t;
int check_stats = 0;
int mutt_buffy_list(void)
{
- BUFFY *tmp = NULL;
+ struct Buffy *tmp = NULL;
char path[_POSIX_PATH_MAX];
char buffylist[2 * STRING];
size_t pos = 0;
void mutt_buffy_setnotified(const char *path)
{
- BUFFY *buffy = NULL;
+ struct Buffy *buffy = NULL;
buffy = buffy_get(path);
if (!buffy)
*/
void mutt_buffy(char *s, size_t slen)
{
- BUFFY *tmp = Incoming;
+ struct Buffy *tmp = Incoming;
int pass, found = 0;
mutt_expand_path(s, slen);
#ifdef USE_NOTMUCH
void mutt_buffy_vfolder(char *s, size_t slen)
{
- BUFFY *tmp = NULL;
+ struct Buffy *tmp = NULL;
int pass, found = 0;
if (mutt_buffy_check(0))
#define MUTT_MAILBOXES 1
#define MUTT_UNMAILBOXES 2
-typedef struct buffy_t
+struct Buffy
{
char path[_POSIX_PATH_MAX];
char realpath[_POSIX_PATH_MAX]; /* used for duplicate detection, context comparison,
and the sidebar */
char *desc;
off_t size;
- struct buffy_t *next;
+ struct Buffy *next;
bool new; /* mailbox has new mail */
/* These next three are only set when OPTMAILCHECKSTATS is set */
bool newly_created; /* mbox or mmdf just popped into existence */
time_t last_visited; /* time of last exit from this mailbox */
time_t stats_last_checked; /* mtime of mailbox the last time stats where checked. */
-} BUFFY;
+};
-WHERE BUFFY *Incoming INITVAL(0);
+WHERE struct Buffy *Incoming INITVAL(0);
WHERE short BuffyTimeout INITVAL(3);
WHERE short BuffyCheckStatsInterval INITVAL(60);
#ifdef USE_NOTMUCH
-WHERE BUFFY *VirtIncoming INITVAL(0);
+WHERE struct Buffy *VirtIncoming INITVAL(0);
void mutt_buffy_vfolder(char *s, size_t slen);
#endif
extern time_t BuffyDoneTime; /* last time we knew for sure how much mail there was */
-BUFFY *mutt_find_mailbox(const char *path);
-void mutt_update_mailbox(BUFFY *b);
+struct Buffy *mutt_find_mailbox(const char *path);
+void mutt_update_mailbox(struct Buffy *b);
/* fixes up atime + mtime after mbox/mmdf mailbox was modified
according to stat() info taken before a modification */
/* mark mailbox just left as already notified */
void mutt_buffy_setnotified(const char *path);
-int mh_buffy(BUFFY *mailbox, int check_stats);
+int mh_buffy(struct Buffy *mailbox, int check_stats);
#endif /* _MUTT_BUFFY_H */
#ifdef USE_COMPRESSED
/* If we're saving to a compressed mailbox, the stats won't be updated
* until the next open. Until then, improvise. */
- BUFFY *cm = NULL;
+ struct Buffy *cm = NULL;
if (ctx.compress_info)
cm = mutt_find_mailbox(ctx.realpath);
/* We probably haven't been opened yet */
char tmp[LONG_STRING];
char relpath[LONG_STRING];
IMAP_MBOX mx;
- BUFFY *b = NULL;
+ struct Buffy *b = NULL;
if (imap_parse_path(state->folder, &mx))
return;
{
char *mailbox = NULL;
char *value = NULL;
- BUFFY *inc = NULL;
+ struct Buffy *inc = NULL;
IMAP_MBOX mx;
int count;
IMAP_STATUS *status = NULL;
{
IMAP_DATA *idata = NULL;
IMAP_DATA *lastdata = NULL;
- BUFFY *mailbox = NULL;
+ struct Buffy *mailbox = NULL;
char name[LONG_STRING];
char command[LONG_STRING];
char munged[LONG_STRING];
* to complete over open connections and account/folder hooks too. */
static int imap_complete_hosts(char *dest, size_t len)
{
- BUFFY *mailbox = NULL;
+ struct Buffy *mailbox = NULL;
CONNECTION *conn = NULL;
int rc = -1;
int matchlen;
FILE *fp = NULL;
progress_t progress;
char msgbuf[STRING];
- BUFFY *tmp = NULL;
+ struct Buffy *tmp = NULL;
/* sort message by their position in the mailbox on disk */
if (Sort != SORT_ORDER)
* Returns 0 if the modification time is older
* Returns -1 on error
*/
-static int mh_sequences_changed(BUFFY *b)
+static int mh_sequences_changed(struct Buffy *b)
{
char path[_POSIX_PATH_MAX];
struct stat sb;
* Returns 0 if the modtime is newer
* Returns -1 on error
*/
-static int mh_already_notified(BUFFY *b, int msgno)
+static int mh_already_notified(struct Buffy *b, int msgno)
{
char path[_POSIX_PATH_MAX];
struct stat sb;
* check_stats: if true, also count total, new, and flagged messages.
* Returns 1 if the mailbox has new mail.
*/
-int mh_buffy(BUFFY *mailbox, int check_stats)
+int mh_buffy(struct Buffy *mailbox, int check_stats)
{
int i;
struct mh_sequences mhs;
char *nm_get_description(CONTEXT *ctx)
{
- BUFFY *p = NULL;
+ struct Buffy *p = NULL;
for (p = VirtIncoming; p; p = p->next)
if (p->desc && (strcmp(p->path, ctx->path) == 0))
int nm_description_to_path(const char *desc, char *buf, size_t bufsz)
{
- BUFFY *p = NULL;
+ struct Buffy *p = NULL;
if (!desc || !buf || !bufsz)
return -EINVAL;
typedef struct sidebar_entry
{
char box[STRING]; /* formatted mailbox name */
- BUFFY *buffy;
+ struct Buffy *buffy;
short is_hidden;
} SBENTRY;
};
static int sidebar_source = SB_SRC_NONE;
-static BUFFY *get_incoming(void)
+static struct Buffy *get_incoming(void)
{
switch (sidebar_source)
{
dest[0] = 0; /* Just in case there's nothing to do */
- BUFFY *b = sbe->buffy;
+ struct Buffy *b = sbe->buffy;
if (!b)
return src;
{
const SBENTRY *sbe1 = *(const SBENTRY **) a;
const SBENTRY *sbe2 = *(const SBENTRY **) b;
- BUFFY *b1 = sbe1->buffy;
- BUFFY *b2 = sbe2->buffy;
+ struct Buffy *b1 = sbe1->buffy;
+ struct Buffy *b2 = sbe2->buffy;
int result = 0;
* update_entries_visibility - Should a sidebar_entry be displayed in the sidebar
*
* For each SBENTRY in the Entries array, check whether we should display it.
- * This is determined by several criteria. If the BUFFY:
+ * This is determined by several criteria. If the Buffy:
* is the currently open mailbox
* is the currently highlighted mailbox
* has unread messages
*/
static void unsort_entries(void)
{
- BUFFY *cur = get_incoming();
+ struct Buffy *cur = get_incoming();
int i = 0, j;
SBENTRY *tmp = NULL;
{
int entryidx;
SBENTRY *entry = NULL;
- BUFFY *b = NULL;
+ struct Buffy *b = NULL;
if (TopIndex < 0)
return;
* mutt_sb_draw - Completely redraw the sidebar
*
* Completely refresh the sidebar region. First draw the divider; then, for
- * each BUFFY, call make_sidebar_entry; finally blank out any remaining space.
+ * each Buffy, call make_sidebar_entry; finally blank out any remaining space.
*/
void mutt_sb_draw(void)
{
int div_width = draw_divider(num_rows, num_cols);
- BUFFY *b = NULL;
+ struct Buffy *b = NULL;
if (Entries == NULL)
for (b = get_incoming(); b; b = b->next)
mutt_sb_notify_mailbox(b, 1);
}
/**
- * mutt_sb_set_buffystats - Update the BUFFY's message counts from the CONTEXT
+ * mutt_sb_set_buffystats - Update the Buffy's message counts from the CONTEXT
* @ctx: A mailbox CONTEXT
*
- * Given a mailbox CONTEXT, find a matching mailbox BUFFY and copy the message
+ * Given a mailbox CONTEXT, find a matching mailbox Buffy and copy the message
* counts into it.
*/
void mutt_sb_set_buffystats(const CONTEXT *ctx)
{
/* Even if the sidebar's hidden,
* we should take note of the new data. */
- BUFFY *b = get_incoming();
+ struct Buffy *b = get_incoming();
if (!ctx || !b)
return;
}
/**
- * mutt_sb_get_highlight - Get the BUFFY that's highlighted in the sidebar
+ * mutt_sb_get_highlight - Get the Buffy that's highlighted in the sidebar
*
* Get the path of the mailbox that's highlighted in the sidebar.
*
/**
* mutt_sb_set_open_buffy - Set the OpnBuffy based on the global Context
*
- * Search through the list of mailboxes. If a BUFFY has a matching path, set
+ * Search through the list of mailboxes. If a Buffy has a matching path, set
* OpnBuffy to it.
*/
void mutt_sb_set_open_buffy(void)
}
/**
- * mutt_sb_notify_mailbox - The state of a BUFFY is about to change
+ * mutt_sb_notify_mailbox - The state of a Buffy is about to change
*
* We receive a notification:
- * After a new BUFFY has been created
- * Before a BUFFY is deleted
+ * After a new Buffy has been created
+ * Before a Buffy is deleted
*
* Before a deletion, check that our pointers won't be invalidated.
*/
-void mutt_sb_notify_mailbox(BUFFY *b, int created)
+void mutt_sb_notify_mailbox(struct Buffy *b, int created)
{
int del_index;
HilIndex = -1;
BotIndex = -1;
- BUFFY *b = NULL;
+ struct Buffy *b = NULL;
EntryCount = 0;
FREE(&Entries);
void mutt_sb_change_mailbox(int op);
void mutt_sb_draw(void);
const char *mutt_sb_get_highlight(void);
-void mutt_sb_notify_mailbox(BUFFY *b, int created);
+void mutt_sb_notify_mailbox(struct Buffy *b, int created);
void mutt_sb_set_buffystats(const CONTEXT *ctx);
void mutt_sb_set_open_buffy(void);
void mutt_sb_toggle_virtual(void);