59 struct stat *st1,
struct stat *st2)
73 return ((st1->st_dev == st2->st_dev) && (st1->st_ino == st2->st_ino));
86 struct stat st = { 0 };
91 if ((m_cur == m_check) && c_mail_check_recent)
100 m_check->
type = mb_type;
104 ((m_check->
type ==
MUTT_UNKNOWN) && S_ISREG(st.st_mode) && (st.st_size == 0)) ||
123 switch (m_check->
type)
144 m_check->
size = (off_t) st.st_size;
186 (c_mail_check_stats && ((t -
MailboxStatsTime) >= c_mail_check_stats_interval)))
197 struct stat st_cur = { 0 };
259 bool any_new =
false;
325 for (
int pass = 0; pass < 2; pass++)
335 if ((found || (pass > 0)) && (find_new ? m_cur->
has_new : m_cur->
msg_unread > 0))
410 struct timespec ts[2] = { { 0 }, { 0 } };
412 struct utimbuf ut = { 0 };
416 if (c_check_mbox_size)
425 if (st->st_mtime > st->st_atime)
429 ts[0].tv_nsec = UTIME_OMIT;
431 ts[1].tv_nsec = UTIME_NOW;
432 utimensat(AT_FDCWD, buf, ts, 0);
434 ut.actime = st->st_atime;
443 ts[0].tv_nsec = UTIME_NOW;
445 ts[1].tv_nsec = UTIME_NOW;
446 utimensat(AT_FDCWD, buf, ts, 0);
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
void mailbox_update(struct Mailbox *m)
Get the mailbox's current size.
struct Mailbox * mailbox_find(const char *path)
Find the mailbox with a given path.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
MailboxType
Supported mailbox formats.
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
@ MUTT_MMDF
'mmdf' Mailbox type
@ MUTT_POP
'POP3' Mailbox type
@ MUTT_MH
'MH' Mailbox type
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
@ MUTT_IMAP
'IMAP' Mailbox type
@ MUTT_MBOX
'mbox' Mailbox type
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
@ MUTT_MAILDIR
'Maildir' Mailbox type
#define mutt_message(...)
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
void mutt_time_now(struct timespec *tp)
Set the provided time field to the current time.
Convenience wrapper for the library headers.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
static time_t MailboxStatsTime
last time we check performed mail_check_stats
static short MailboxCount
how many boxes with new mail
static short MailboxNotify
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
void mutt_mailbox_set_notified(struct Mailbox *m)
Note when the user was last notified of new mail.
struct Mailbox * mutt_mailbox_next_unread(struct Mailbox *m_cur, struct Buffer *s)
Find next mailbox with unread mail.
bool mutt_mailbox_notify(struct Mailbox *m_cur)
Notify the user if there's new mail.
struct Mailbox * mutt_mailbox_next(struct Mailbox *m_cur, struct Buffer *s)
Incoming folders completion routine.
bool mutt_mailbox_list(void)
Show a message with the list of mailboxes with new mail.
static bool is_same_mailbox(struct Mailbox *m1, struct Mailbox *m2, struct stat *st1, struct stat *st2)
Compare two Mailboxes to see if they're equal.
static struct Mailbox * find_next_mailbox(struct Buffer *s, bool find_new)
Find the next mailbox with new or unread mail.
static void mailbox_check(struct Mailbox *m_cur, struct Mailbox *m_check, struct stat *st_cur, CheckStatsFlags flags)
Check a mailbox for new mail.
static time_t MailboxTime
last time we started checking for mail
void mailbox_restore_timestamp(const char *path, struct stat *st)
Restore the timestamp of a mailbox.
Mailbox helper functions.
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Some miscellaneous functions.
enum MxStatus mx_mbox_check_stats(struct Mailbox *m, uint8_t flags)
Check the statistics for a mailbox - Wrapper for MxOps::mbox_check_stats()
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
#define MUTT_MAILBOX_CHECK_NO_FLAGS
No flags are set.
#define MUTT_MAILBOX_CHECK_STATS
Ignore mail_check_stats and calculate statistics (used by <check-stats>)
#define MUTT_MAILBOX_CHECK_POSTPONED
Make sure the number of postponed messages is updated.
uint8_t CheckStatsFlags
Flags for mutt_mailbox_check.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
void mutt_update_num_postponed(void)
Force the update of the number of postponed messages.
#define STAILQ_HEAD_INITIALIZER(head)
#define STAILQ_FOREACH(var, head, field)
#define TAILQ_EMPTY(head)
String manipulation buffer.
struct Mailbox * mailbox
Mailbox in the list.
bool has_new
Mailbox has new mail.
bool first_check_stats_done
True when the check have been done at least one time.
enum MailboxType type
Mailbox type.
bool newly_created
Mbox or mmdf just popped into existence.
bool poll_new_mail
Check for new mail.
bool notify_user
Notify the user of new mail.
struct Buffer pathbuf
Path of the Mailbox.
bool notified
User has been notified.
off_t size
Size of the Mailbox.
bool visible
True if a result of "mailboxes".
struct timespec last_visited
Time of last exit from this mailbox.
int msg_unread
Number of unread messages.
Container for Accounts, Notifications.
struct AccountList accounts
List of all Accounts.
struct ConfigSubset * sub
Inherited config items.