/* if mailbox has at least 1 new message, sets mtime > atime of mailbox * so buffy check reports new mail */ void mbox_reset_atime(CONTEXT *ctx, struct stat *st) { struct utimbuf utimebuf; struct stat _st; if (!st) { if (stat(ctx->path, &_st) < 0) return; st = &_st; } utimebuf.actime = st->st_atime; utimebuf.modtime = st->st_mtime; /* * When $mbox_check_recent is set, existing new mail is ignored, so do not * reset the atime to mtime-1 to signal new mail. */ if (!globals.has_option(OPTMAILCHECKRECENT) && (utimebuf.actime >= utimebuf.modtime) && mbox_has_new(ctx)) utimebuf.actime = utimebuf.modtime - 1; utime(ctx->path, &utimebuf); }
/** * mbox_reset_atime - Reset the access time on the mailbox file * @param m Mailbox * @param st Timestamp * * if mailbox has at least 1 new message, sets mtime > atime of mailbox so * mailbox check reports new mail */ void mbox_reset_atime(struct Mailbox *m, struct stat *st) { struct utimbuf utimebuf; struct stat st2; if (!st) { if (stat(m->path, &st2) < 0) return; st = &st2; } utimebuf.actime = st->st_atime; utimebuf.modtime = st->st_mtime; /* When $mbox_check_recent is set, existing new mail is ignored, so do not * reset the atime to mtime-1 to signal new mail. */ if (!C_MailCheckRecent && (utimebuf.actime >= utimebuf.modtime) && mbox_has_new(m)) { utimebuf.actime = utimebuf.modtime - 1; } utime(m->path, &utimebuf); }