*/
struct Context
{
- struct timespec mtime;
off_t vsize;
char *pattern; /**< limit pattern string */
struct Pattern *limit_pattern; /**< compiled limit pattern */
mailbox->msg_count = ctx->mailbox->msg_count;
mailbox->msg_unread = ctx->mailbox->msg_unread;
mailbox->msg_flagged = ctx->mailbox->msg_flagged;
- mailbox->stats_last_checked = ctx->mtime;
+ mailbox->stats_last_checked = ctx->mailbox->mtime;
mx_mbox_close(&ctx, NULL);
}
}
bool notified; /**< user has been notified */
enum MailboxType magic; /**< mailbox type */
bool newly_created; /**< mbox or mmdf just popped into existence */
+ struct timespec mtime;
struct timespec last_visited; /**< time of last exit from this mailbox */
struct timespec stats_last_checked; /**< mtime of mailbox the last time stats where checked. */
}
if (stat(buf, &st) == 0)
- mutt_get_stat_timespec(&ctx->mtime, &st, MUTT_STAT_MTIME);
+ mutt_get_stat_timespec(&ctx->mailbox->mtime, &st, MUTT_STAT_MTIME);
}
/**
return -1;
/* determine which subdirectories need to be scanned */
- if (mutt_stat_timespec_compare(&st_new, MUTT_STAT_MTIME, &ctx->mtime) > 0)
+ if (mutt_stat_timespec_compare(&st_new, MUTT_STAT_MTIME, &ctx->mailbox->mtime) > 0)
changed = 1;
if (mutt_stat_timespec_compare(&st_cur, MUTT_STAT_MTIME, &data->mtime_cur) > 0)
changed |= 2;
#endif
{
mutt_get_stat_timespec(&data->mtime_cur, &st_cur, MUTT_STAT_MTIME);
- mutt_get_stat_timespec(&ctx->mtime, &st_new, MUTT_STAT_MTIME);
+ mutt_get_stat_timespec(&ctx->mailbox->mtime, &st_new, MUTT_STAT_MTIME);
}
/* do a fast scan of just the filenames in
if (i == -1 && stat(buf, &st_cur) == -1)
modified = true;
- if ((mutt_stat_timespec_compare(&st, MUTT_STAT_MTIME, &ctx->mtime) > 0) ||
+ if ((mutt_stat_timespec_compare(&st, MUTT_STAT_MTIME, &ctx->mailbox->mtime) > 0) ||
(mutt_stat_timespec_compare(&st_cur, MUTT_STAT_MTIME, &data->mtime_cur) > 0))
{
modified = true;
#endif
{
mutt_get_stat_timespec(&data->mtime_cur, &st_cur, MUTT_STAT_MTIME);
- mutt_get_stat_timespec(&ctx->mtime, &st, MUTT_STAT_MTIME);
+ mutt_get_stat_timespec(&ctx->mailbox->mtime, &st, MUTT_STAT_MTIME);
}
md = NULL;
#include "alias.h"
#include "browser.h"
#include "color.h"
+#include "context.h"
#include "curs_lib.h"
#include "curs_main.h"
#include "globals.h"
return -1;
}
mutt_get_stat_timespec(&mdata->atime, &sb, MUTT_STAT_ATIME);
- mutt_get_stat_timespec(&ctx->mtime, &sb, MUTT_STAT_MTIME);
+ mutt_get_stat_timespec(&ctx->mailbox->mtime, &sb, MUTT_STAT_MTIME);
ctx->mailbox->size = sb.st_size;
buf[sizeof(buf) - 1] = '\0';
}
ctx->mailbox->size = sb.st_size;
- mutt_get_stat_timespec(&ctx->mtime, &sb, MUTT_STAT_MTIME);
+ mutt_get_stat_timespec(&ctx->mailbox->mtime, &sb, MUTT_STAT_MTIME);
mutt_get_stat_timespec(&mdata->atime, &sb, MUTT_STAT_ATIME);
if (!ctx->mailbox->readonly)
/* fix up the times so mailbox won't get confused */
if (ctx->peekonly && ctx->mailbox->path &&
- (mutt_timespec_compare(&ctx->mtime, &mdata->atime) > 0))
+ (mutt_timespec_compare(&ctx->mailbox->mtime, &mdata->atime) > 0))
{
#ifdef HAVE_UTIMENSAT
struct timespec ts[2];
ts[0] = mdata->atime;
- ts[1] = ctx->mtime;
+ ts[1] = ctx->mailbox->mtime;
utimensat(0, ctx->mailbox->path, ts, 0);
#else
struct utimbuf ut;
ut.actime = mdata->atime.tv_sec;
- ut.modtime = ctx->mtime.tv_sec;
+ ut.modtime = ctx->mailbox->mtime.tv_sec;
utime(ctx->mailbox->path, &ut);
#endif
}
if (stat(ctx->mailbox->path, &st) == 0)
{
- if ((mutt_stat_timespec_compare(&st, MUTT_STAT_MTIME, &ctx->mtime) == 0) &&
+ if ((mutt_stat_timespec_compare(&st, MUTT_STAT_MTIME, &ctx->mailbox->mtime) == 0) &&
st.st_size == ctx->mailbox->size)
{
return 0;
if (st.st_size == ctx->mailbox->size)
{
/* the file was touched, but it is still the same length, so just exit */
- mutt_get_stat_timespec(&ctx->mtime, &st, MUTT_STAT_MTIME);
+ mutt_get_stat_timespec(&ctx->mailbox->mtime, &st, MUTT_STAT_MTIME);
return 0;
}
struct Context;
struct Header;
+struct Mailbox;
struct MuttThread;
/* These Config Variables are only used in mutt_thread.c */
notmuch_query_set_sort(q, NOTMUCH_SORT_NEWEST_FIRST);
read_threads_query(ctx, q, true, 0);
- ctx->mtime.tv_sec = time(NULL);
- ctx->mtime.tv_nsec = 0;
+ ctx->mailbox->mtime.tv_sec = time(NULL);
+ ctx->mailbox->mtime.tv_nsec = 0;
rc = 0;
if (ctx->mailbox->msg_count > data->oldmsgcount)
release_db(data);
if (hdr->changed)
{
- ctx->mtime.tv_sec = time(NULL);
- ctx->mtime.tv_nsec = 0;
+ ctx->mailbox->mtime.tv_sec = time(NULL);
+ ctx->mailbox->mtime.tv_nsec = 0;
}
mutt_debug(1, "nm: tags modify done [rc=%d]\n", rc);
return rc;
if (!is_longrun(data))
release_db(data);
- ctx->mtime.tv_sec = time(NULL);
- ctx->mtime.tv_nsec = 0;
+ ctx->mailbox->mtime.tv_sec = time(NULL);
+ ctx->mailbox->mtime.tv_nsec = 0;
return rc;
}
if (!is_longrun(data))
release_db(data);
- ctx->mtime.tv_sec = time(NULL);
- ctx->mtime.tv_nsec = 0;
+ ctx->mailbox->mtime.tv_sec = time(NULL);
+ ctx->mailbox->mtime.tv_nsec = 0;
mx_update_context(ctx, ctx->mailbox->msg_count);
data->oldmsgcount = 0;
if (!data || (get_database_mtime(data, &mtime) != 0))
return -1;
- if (ctx->mtime.tv_sec >= mtime)
+ if (ctx->mailbox->mtime.tv_sec >= mtime)
{
- mutt_debug(2, "nm: check unnecessary (db=%lu ctx=%lu)\n", mtime, ctx->mtime);
+ mutt_debug(2, "nm: check unnecessary (db=%lu ctx=%lu)\n", mtime,
+ ctx->mailbox->mtime);
return 0;
}
- mutt_debug(1, "nm: checking (db=%lu ctx=%lu)\n", mtime, ctx->mtime);
+ mutt_debug(1, "nm: checking (db=%lu ctx=%lu)\n", mtime, ctx->mailbox->mtime);
q = get_query(data, false);
if (!q)
if (!is_longrun(data))
release_db(data);
- ctx->mtime.tv_sec = time(NULL);
- ctx->mtime.tv_nsec = 0;
+ ctx->mailbox->mtime.tv_sec = time(NULL);
+ ctx->mailbox->mtime.tv_nsec = 0;
mutt_debug(1, "nm: ... check done [count=%d, new_flags=%d, occult=%d]\n",
ctx->mailbox->msg_count, new_flags, occult);
release_db(data);
if (changed)
{
- ctx->mtime.tv_sec = time(NULL);
- ctx->mtime.tv_nsec = 0;
+ ctx->mailbox->mtime.tv_sec = time(NULL);
+ ctx->mailbox->mtime.tv_nsec = 0;
}
mutt_debug(1, "nm: .... sync done [rc=%d]\n", rc);