NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.h File Reference

Mbox local mailbox type. More...

#include <stdbool.h>
#include <stdio.h>
#include <time.h>
#include "core/lib.h"
+ Include dependency graph for lib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  MboxAccountData
 Mbox-specific Account data -. More...
 

Macros

#define MMDF_SEP   "\001\001\001\001\n"
 

Functions

enum MxStatus mbox_check (struct Mailbox *m, struct stat *st, bool check_stats)
 
enum MailboxType mbox_path_probe (const char *path, const struct stat *st)
 Is this an mbox Mailbox? - Implements MxOps::path_probe() -.
 
void mbox_reset_atime (struct Mailbox *m, struct stat *st)
 Reset the access time on the mailbox file.
 

Variables

const struct MxOps MxMboxOps
 Mbox Mailbox - Implements MxOps -.
 
const struct MxOps MxMmdfOps
 MMDF Mailbox - Implements MxOps -.
 

Detailed Description

Mbox local mailbox type.

Authors
  • Richard Russon
  • Pietro Cerutti

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file lib.h.

Macro Definition Documentation

◆ MMDF_SEP

#define MMDF_SEP   "\001\001\001\001\n"

Definition at line 62 of file lib.h.

Function Documentation

◆ mbox_check()

enum MxStatus mbox_check ( struct Mailbox m,
struct stat *  st,
bool  check_stats 
)

◆ mbox_reset_atime()

void mbox_reset_atime ( struct Mailbox m,
struct stat *  st 
)

Reset the access time on the mailbox file.

Parameters
mMailbox
stTimestamp

if mailbox has at least 1 new message, sets mtime > atime of mailbox so mailbox check reports new mail

Definition at line 748 of file mbox.c.

749{
750 struct stat st2 = { 0 };
751 if (!st)
752 {
753 if (stat(mailbox_path(m), &st2) < 0)
754 return;
755 st = &st2;
756 }
757
758 struct utimbuf utimebuf = { 0 };
759 utimebuf.actime = st->st_atime;
760 utimebuf.modtime = st->st_mtime;
761
762 /* When $mbox_check_recent is set, existing new mail is ignored, so do not
763 * reset the atime to mtime-1 to signal new mail. */
764 const bool c_mail_check_recent = cs_subset_bool(NeoMutt->sub, "mail_check_recent");
765 if (!c_mail_check_recent && (utimebuf.actime >= utimebuf.modtime) && mbox_has_new(m))
766 {
767 utimebuf.actime = utimebuf.modtime - 1;
768 }
769
770 utime(mailbox_path(m), &utimebuf);
771}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:47
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:223
static bool mbox_has_new(struct Mailbox *m)
Does the mailbox have new mail.
Definition: mbox.c:727
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function: