NeoMutt  2024-04-25-1-g3de005
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
shared.h File Reference

Maildir shared functions. More...

#include <stdbool.h>
#include <stdio.h>
#include <sys/types.h>
+ Include dependency graph for shared.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void maildir_canon_filename (struct Buffer *dest, const char *src)
 Generate the canonical filename for a Maildir folder.
 
mode_t maildir_umask (struct Mailbox *m)
 Create a umask from the mailbox directory.
 
bool maildir_update_flags (struct Mailbox *m, struct Email *e_old, struct Email *e_new)
 Update the mailbox flags.
 
struct Emailmaildir_email_new (void)
 Create a Maildir Email.
 
void maildir_gen_flags (char *dest, size_t destlen, struct Email *e)
 Generate the Maildir flags for an email.
 
bool maildir_msg_open_new (struct Mailbox *m, struct Message *msg, const struct Email *e)
 Open a new message in a Mailbox - Implements MxOps::msg_open_new() -.
 
FILE * maildir_open_find_message (const char *folder, const char *msg, char **newname)
 Find a message by name.
 
void maildir_parse_flags (struct Email *e, const char *path)
 Parse Maildir file flags.
 
bool maildir_parse_message (const char *fname, bool is_old, struct Email *e)
 Actually parse a maildir message.
 
bool maildir_parse_stream (FILE *fp, const char *fname, bool is_old, struct Email *e)
 Parse a Maildir message.
 
int maildir_path_is_empty (struct Buffer *path)
 Is the mailbox empty.
 
int maildir_rewrite_message (struct Mailbox *m, struct Email *e)
 Sync a message in an Maildir folder.
 
bool maildir_sync_mailbox_message (struct Mailbox *m, struct Email *e, struct HeaderCache *hc)
 Save changes to the mailbox.
 
void maildir_update_mtime (struct Mailbox *m)
 Update our record of the Maildir modification time.
 

Detailed Description

Maildir shared functions.

Authors
  • Richard Russon

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 shared.h.

Function Documentation

◆ maildir_canon_filename()

void maildir_canon_filename ( struct Buffer dest,
const char *  src 
)

Generate the canonical filename for a Maildir folder.

Parameters
destBuffer for the result
srcBuffer containing source filename
Note
maildir filename is defined as: <base filename>:2,<flags> but <base filename> may contain additional comma separated fields. Additionally, : may be replaced as the field delimiter by a user defined alternative.

Definition at line 73 of file shared.c.

74{
75 if (!dest || !src)
76 return;
77
78 char *t = strrchr(src, '/');
79 if (t)
80 src = t + 1;
81
82 buf_strcpy(dest, src);
83
84 const char c_maildir_field_delimiter = *cc_maildir_field_delimiter();
85
86 char searchable_bytes[8] = { 0 };
87 snprintf(searchable_bytes, sizeof(searchable_bytes), ",%c", c_maildir_field_delimiter);
88 char *u = strpbrk(dest->data, searchable_bytes);
89
90 if (u)
91 {
92 *u = '\0';
93 dest->dptr = u;
94 }
95}
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:394
const char * cc_maildir_field_delimiter(void)
Get the cached value of $maildir_field_delimiter.
Definition: config_cache.c:131
char * dptr
Current read/write position.
Definition: buffer.h:38
char * data
Pointer to data.
Definition: buffer.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_umask()

mode_t maildir_umask ( struct Mailbox m)

Create a umask from the mailbox directory.

Parameters
mMailbox
Return values
numUmask

Definition at line 47 of file shared.c.

48{
50 if (mdata && mdata->umask)
51 return mdata->umask;
52
53 struct stat st = { 0 };
54 if (stat(mailbox_path(m), &st) != 0)
55 {
56 mutt_debug(LL_DEBUG1, "stat failed on %s\n", mailbox_path(m));
57 return 077;
58 }
59
60 return 0777 & ~st.st_mode;
61}
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition: mailbox.h:223
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
struct MaildirMboxData * maildir_mdata_get(struct Mailbox *m)
Get the private data for this Mailbox.
Definition: mdata.c:60
void * mdata
Driver specific data.
Definition: mailbox.h:132
Maildir-specific Mailbox data -.
Definition: mdata.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_update_flags()

bool maildir_update_flags ( struct Mailbox m,
struct Email e_old,
struct Email e_new 
)

Update the mailbox flags.

Parameters
mMailbox
e_oldOld Email
e_newNew Email
Return values
trueThe flags changed
falseOtherwise

Definition at line 105 of file shared.c.

106{
107 if (!m)
108 return false;
109
110 /* save the global state here so we can reset it at the
111 * end of list block if required. */
112 bool context_changed = m->changed;
113
114 /* user didn't modify this message. alter the flags to match the
115 * current state on disk. This may not actually do
116 * anything. mutt_set_flag() will just ignore the call if the status
117 * bits are already properly set, but it is still faster not to pass
118 * through it */
119 if (e_old->flagged != e_new->flagged)
120 mutt_set_flag(m, e_old, MUTT_FLAG, e_new->flagged, true);
121 if (e_old->replied != e_new->replied)
122 mutt_set_flag(m, e_old, MUTT_REPLIED, e_new->replied, true);
123 if (e_old->read != e_new->read)
124 mutt_set_flag(m, e_old, MUTT_READ, e_new->read, true);
125 if (e_old->old != e_new->old)
126 mutt_set_flag(m, e_old, MUTT_OLD, e_new->old, true);
127
128 /* mutt_set_flag() will set this, but we don't need to
129 * sync the changes we made because we just updated the
130 * context to match the current on-disk state of the
131 * message. */
132 bool header_changed = e_old->changed;
133 e_old->changed = false;
134
135 /* if the mailbox was not modified before we made these
136 * changes, unset the changed flag since nothing needs to
137 * be synchronized. */
138 if (!context_changed)
139 m->changed = false;
140
141 return header_changed;
142}
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
Definition: flags.c:57
@ MUTT_READ
Messages that have been read.
Definition: mutt.h:73
@ MUTT_OLD
Old messages.
Definition: mutt.h:71
@ MUTT_FLAG
Flagged messages.
Definition: mutt.h:79
@ MUTT_REPLIED
Messages that have been replied to.
Definition: mutt.h:72
bool read
Email is read.
Definition: email.h:50
bool old
Email is seen, but unread.
Definition: email.h:49
bool changed
Email has been edited.
Definition: email.h:77
bool flagged
Marked important?
Definition: email.h:47
bool replied
Email has been replied to.
Definition: email.h:51
bool changed
Mailbox has been modified.
Definition: mailbox.h:110
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_email_new()

struct Email * maildir_email_new ( void  )

Create a Maildir Email.

Return values
ptrNewly created Email

Create a new Email and attach MaildirEmailData.

Note
This should be freed using email_free()

Definition at line 68 of file mailbox.c.

69{
70 struct Email *e = email_new();
73
74 return e;
75}
struct Email * email_new(void)
Create a new Email.
Definition: email.c:80
void maildir_edata_free(void **ptr)
Free the private Email data - Implements Email::edata_free() -.
Definition: edata.c:38
struct MaildirEmailData * maildir_edata_new(void)
Create a new MaildirEmailData object.
Definition: edata.c:53
The envelope/body of an email.
Definition: email.h:39
void * edata
Driver-specific data.
Definition: email.h:74
void(* edata_free)(void **ptr)
Definition: email.h:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_gen_flags()

void maildir_gen_flags ( char *  dest,
size_t  destlen,
struct Email e 
)

Generate the Maildir flags for an email.

Parameters
destBuffer for the result
destlenLength of buffer
eEmail

Definition at line 72 of file message.c.

73{
74 *dest = '\0';
75
76 const char *flags = NULL;
77
79 if (edata)
80 flags = edata->custom_flags;
81
82 /* The maildir specification requires that all files in the cur
83 * subdirectory have the :unique string appended, regardless of whether
84 * or not there are any flags. If .old is set, we know that this message
85 * will end up in the cur directory, so we include it in the following
86 * test even though there is no associated flag. */
87
88 if (e->flagged || e->replied || e->read || e->deleted || e->old || flags)
89 {
90 char tmp[1024] = { 0 };
91 snprintf(tmp, sizeof(tmp), "%s%s%s%s%s", e->flagged ? "F" : "", e->replied ? "R" : "",
92 e->read ? "S" : "", e->deleted ? "T" : "", NONULL(flags));
93 if (flags)
94 mutt_qsort_r(tmp, strlen(tmp), 1, maildir_sort_flags, NULL);
95
96 const char c_maildir_field_delimiter = *cc_maildir_field_delimiter();
97 snprintf(dest, destlen, "%c2,%s", c_maildir_field_delimiter, tmp);
98 }
99}
static int maildir_sort_flags(const void *a, const void *b, void *sdata)
Compare two flag characters - Implements sort_t -.
Definition: message.c:61
struct MaildirEmailData * maildir_edata_get(struct Email *e)
Get the private data for this Email.
Definition: edata.c:64
void mutt_qsort_r(void *base, size_t nmemb, size_t size, sort_t compar, void *sdata)
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
Definition: qsort_r.c:67
#define NONULL(x)
Definition: string2.h:37
bool deleted
Email is deleted.
Definition: email.h:78
Maildir-specific Email data -.
Definition: edata.h:32
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_open_find_message()

FILE * maildir_open_find_message ( const char *  folder,
const char *  msg,
char **  newname 
)

Find a message by name.

Parameters
[in]folderMaildir path
[in]msgEmail path
[out]newnameNew name, if it has moved
Return values
ptrFile handle

Definition at line 169 of file message.c.

170{
171 static unsigned int new_hits = 0, cur_hits = 0; /* simple dynamic optimization */
172
173 struct Buffer *unique = buf_pool_get();
174 maildir_canon_filename(unique, msg);
175
176 FILE *fp = maildir_open_find_message_dir(folder, buf_string(unique),
177 (new_hits > cur_hits) ? "new" : "cur", newname);
178 if (fp || (errno != ENOENT))
179 {
180 if ((new_hits < UINT_MAX) && (cur_hits < UINT_MAX))
181 {
182 new_hits += ((new_hits > cur_hits) ? 1 : 0);
183 cur_hits += ((new_hits > cur_hits) ? 0 : 1);
184 }
185
186 goto cleanup;
187 }
188 fp = maildir_open_find_message_dir(folder, buf_string(unique),
189 (new_hits > cur_hits) ? "cur" : "new", newname);
190 if (fp || (errno != ENOENT))
191 {
192 if ((new_hits < UINT_MAX) && (cur_hits < UINT_MAX))
193 {
194 new_hits += ((new_hits > cur_hits) ? 0 : 1);
195 cur_hits += ((new_hits > cur_hits) ? 1 : 0);
196 }
197
198 goto cleanup;
199 }
200
201 fp = NULL;
202
203cleanup:
204 buf_pool_release(&unique);
205
206 return fp;
207}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
static FILE * maildir_open_find_message_dir(const char *folder, const char *unique, const char *subfolder, char **newname)
Find a message in a maildir folder.
Definition: message.c:113
void maildir_canon_filename(struct Buffer *dest, const char *src)
Generate the canonical filename for a Maildir folder.
Definition: shared.c:73
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
String manipulation buffer.
Definition: buffer.h:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_parse_flags()

void maildir_parse_flags ( struct Email e,
const char *  path 
)

Parse Maildir file flags.

Parameters
eEmail
pathPath to email file

Definition at line 82 of file mailbox.c.

83{
84 char *q = NULL;
85
86 e->flagged = false;
87 e->read = false;
88 e->replied = false;
89
91
92 const char c_maildir_field_delimiter = *cc_maildir_field_delimiter();
93 char *p = strrchr(path, c_maildir_field_delimiter);
94 if (p && mutt_str_startswith(p + 1, "2,"))
95 {
96 p += 3;
97
98 mutt_str_replace(&edata->custom_flags, p);
99 q = edata->custom_flags;
100
101 while (*p)
102 {
103 switch (*p)
104 {
105 case 'F': // Flagged
106 e->flagged = true;
107 break;
108
109 case 'R': // Replied
110 e->replied = true;
111 break;
112
113 case 'S': // Seen
114 e->read = true;
115 break;
116
117 case 'T': // Trashed
118 {
119 const bool c_flag_safe = cs_subset_bool(NeoMutt->sub, "flag_safe");
120 if (!e->flagged || !c_flag_safe)
121 {
122 e->trash = true;
123 e->deleted = true;
124 }
125 break;
126 }
127
128 default:
129 *q++ = *p;
130 break;
131 }
132 p++;
133 }
134 }
135
136 if (q == edata->custom_flags)
137 FREE(&edata->custom_flags);
138 else if (q)
139 *q = '\0';
140}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
#define FREE(x)
Definition: memory.h:45
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition: string.c:230
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition: string.c:274
char * path
Path of Email (for local Mailboxes)
Definition: email.h:70
bool trash
Message is marked as trashed on disk (used by the maildir_trash option)
Definition: email.h:53
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_parse_message()

bool maildir_parse_message ( const char *  fname,
bool  is_old,
struct Email e 
)

Actually parse a maildir message.

Parameters
fnameMessage filename
is_oldtrue, if the email is old (read)
eEmail to populate
Return values
trueSuccess

This may also be used to fill out a fake header structure generated by lazy maildir parsing.

Definition at line 190 of file mailbox.c.

191{
192 if (!fname || !e)
193 return false;
194
195 FILE *fp = mutt_file_fopen(fname, "r");
196 if (!fp)
197 return false;
198
199 bool rc = maildir_parse_stream(fp, fname, is_old, e);
200 mutt_file_fclose(&fp);
201 return rc;
202}
#define mutt_file_fclose(FP)
Definition: file.h:147
#define mutt_file_fopen(PATH, MODE)
Definition: file.h:146
bool maildir_parse_stream(FILE *fp, const char *fname, bool is_old, struct Email *e)
Parse a Maildir message.
Definition: mailbox.c:153
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_parse_stream()

bool maildir_parse_stream ( FILE *  fp,
const char *  fname,
bool  is_old,
struct Email e 
)

Parse a Maildir message.

Parameters
fpMessage file handle
fnameMessage filename
is_oldtrue, if the email is old (read)
eEmail
Return values
trueSuccess

Actually parse a maildir message. This may also be used to fill out a fake header structure generated by lazy maildir parsing.

Definition at line 153 of file mailbox.c.

154{
155 if (!fp || !fname || !e)
156 return false;
157
158 const long size = mutt_file_get_size_fp(fp);
159 if (size == 0)
160 return false;
161
162 e->env = mutt_rfc822_read_header(fp, e, false, false);
163
164 if (e->received == 0)
165 e->received = e->date_sent;
166
167 /* always update the length since we have fresh information available. */
168 e->body->length = size - e->body->offset;
169
170 e->index = -1;
171
172 /* maildir stores its flags in the filename, so ignore the
173 * flags in the header of the message */
174 e->old = is_old;
175 maildir_parse_flags(e, fname);
176
177 return e;
178}
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
Definition: parse.c:1200
long mutt_file_get_size_fp(FILE *fp)
Get the size of a file.
Definition: file.c:1534
void maildir_parse_flags(struct Email *e, const char *path)
Parse Maildir file flags.
Definition: mailbox.c:82
LOFF_T offset
offset where the actual data begins
Definition: body.h:52
LOFF_T length
length (in bytes) of attachment
Definition: body.h:53
struct Envelope * env
Envelope information.
Definition: email.h:68
struct Body * body
List of MIME parts.
Definition: email.h:69
time_t date_sent
Time when the message was sent (UTC)
Definition: email.h:60
int index
The absolute (unsorted) message number.
Definition: email.h:113
time_t received
Time when the message was placed in the mailbox.
Definition: email.h:61
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_path_is_empty()

int maildir_path_is_empty ( struct Buffer path)

Is the mailbox empty.

Parameters
pathMailbox to check
Return values
1Mailbox is empty
0Mailbox contains mail
-1Error

Definition at line 57 of file path.c.

58{
59 DIR *dir = NULL;
60 struct dirent *de = NULL;
61 int rc = 1; /* assume empty until we find a message */
62 char realpath[PATH_MAX] = { 0 };
63 int iter = 0;
64
65 /* Strategy here is to look for any file not beginning with a period */
66
67 do
68 {
69 /* we do "cur" on the first iteration since it's more likely that we'll
70 * find old messages without having to scan both subdirs */
71 snprintf(realpath, sizeof(realpath), "%s/%s", buf_string(path),
72 (iter == 0) ? "cur" : "new");
74 if (!dir)
75 return -1;
76 while ((de = readdir(dir)))
77 {
78 if (*de->d_name != '.')
79 {
80 rc = 0;
81 break;
82 }
83 }
84 closedir(dir);
85 iter++;
86 } while (rc && iter < 2);
87
88 return rc;
89}
DIR * mutt_file_opendir(const char *path, enum MuttOpenDirMode mode)
Open a directory.
Definition: file.c:640
@ MUTT_OPENDIR_CREATE
Create the directory if it doesn't exist.
Definition: file.h:75
#define PATH_MAX
Definition: mutt.h:42
+ Here is the call graph for this function:

◆ maildir_rewrite_message()

int maildir_rewrite_message ( struct Mailbox m,
struct Email e 
)

Sync a message in an Maildir folder.

Parameters
mMailbox
eEmail
Return values
0Success
-1Error

Definition at line 453 of file message.c.

454{
455 if (!m || !e)
456 return -1;
457
458 bool restore = true;
459
460 long old_body_offset = e->body->offset;
461 long old_body_length = e->body->length;
462 long old_hdr_lines = e->lines;
463
464 struct Message *src = mx_msg_open(m, e);
465 struct Message *dest = mx_msg_open_new(m, e, MUTT_MSG_NO_FLAGS);
466 if (!src || !dest)
467 return -1;
468
469 int rc = mutt_copy_message(dest->fp, e, src, MUTT_CM_UPDATE, CH_UPDATE | CH_UPDATE_LEN, 0);
470 if (rc == 0)
471 {
472 char oldpath[PATH_MAX] = { 0 };
473 char partpath[PATH_MAX] = { 0 };
474 snprintf(oldpath, sizeof(oldpath), "%s/%s", mailbox_path(m), e->path);
475 mutt_str_copy(partpath, e->path, sizeof(partpath));
476
477 rc = maildir_commit_message(m, dest, e);
478
479 if (rc == 0)
480 {
481 unlink(oldpath);
482 restore = false;
483 }
484 }
485 mx_msg_close(m, &src);
486 mx_msg_close(m, &dest);
487
488 if ((rc == -1) && restore)
489 {
490 e->body->offset = old_body_offset;
491 e->body->length = old_body_length;
492 e->lines = old_hdr_lines;
493 }
494
496 return rc;
497}
int mutt_copy_message(FILE *fp_out, struct Email *e, struct Message *msg, CopyMessageFlags cmflags, CopyHeaderFlags chflags, int wraplen)
Copy a message from a Mailbox.
Definition: copy.c:907
#define MUTT_CM_UPDATE
Update structs on sync.
Definition: copy.h:42
#define CH_UPDATE
Update the status and x-status fields?
Definition: copy.h:54
#define CH_UPDATE_LEN
Update Lines: and Content-Length:
Definition: copy.h:64
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition: body.c:58
static int maildir_commit_message(struct Mailbox *m, struct Message *msg, struct Email *e)
Commit a message to a maildir folder.
Definition: message.c:360
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:575
int mx_msg_close(struct Mailbox *m, struct Message **ptr)
Close a message.
Definition: mx.c:1178
struct Message * mx_msg_open(struct Mailbox *m, struct Email *e)
Return a stream pointer for a message.
Definition: mx.c:1132
struct Message * mx_msg_open_new(struct Mailbox *m, const struct Email *e, MsgOpenFlags flags)
Open a new message.
Definition: mx.c:1038
#define MUTT_MSG_NO_FLAGS
No flags are set.
Definition: mx.h:39
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:72
int lines
How many lines in the body of this message?
Definition: email.h:62
A local copy of an email.
Definition: message.h:34
FILE * fp
pointer to the message data
Definition: message.h:35
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_sync_mailbox_message()

bool maildir_sync_mailbox_message ( struct Mailbox m,
struct Email e,
struct HeaderCache hc 
)

Save changes to the mailbox.

Parameters
mMailbox
eEmail
hcHeader cache handle
Return values
trueSuccess
falseError

Definition at line 311 of file message.c.

312{
313 if (!e)
314 return false;
315
316 const bool c_maildir_trash = cs_subset_bool(NeoMutt->sub, "maildir_trash");
317 if (e->deleted && !c_maildir_trash)
318 {
319 char path[PATH_MAX] = { 0 };
320 snprintf(path, sizeof(path), "%s/%s", mailbox_path(m), e->path);
322 unlink(path);
323 }
324 else if (e->changed || e->attach_del ||
325 ((c_maildir_trash || e->trash) && (e->deleted != e->trash)))
326 {
327 if (maildir_sync_message(m, e) == -1)
328 return false;
329 }
330
331 if (e->changed)
333
334 return true;
335}
int maildir_hcache_store(struct HeaderCache *hc, struct Email *e)
Save an Email to the Header Cache.
Definition: hcache.c:155
int maildir_hcache_delete(struct HeaderCache *hc, struct Email *e)
Delete an Email from the Header Cache.
Definition: hcache.c:81
static int maildir_sync_message(struct Mailbox *m, struct Email *e)
Sync an email to a Maildir folder.
Definition: message.c:216
bool attach_del
Has an attachment marked for deletion.
Definition: email.h:102
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ maildir_update_mtime()

void maildir_update_mtime ( struct Mailbox m)

Update our record of the Maildir modification time.

Parameters
mMailbox

Definition at line 717 of file mailbox.c.

718{
719 char buf[PATH_MAX] = { 0 };
720 struct stat st = { 0 };
722
723 snprintf(buf, sizeof(buf), "%s/%s", mailbox_path(m), "cur");
724 if (stat(buf, &st) == 0)
726
727 snprintf(buf, sizeof(buf), "%s/%s", mailbox_path(m), "new");
728 if (stat(buf, &st) == 0)
730}
void mutt_file_get_stat_timespec(struct timespec *dest, struct stat *st, enum MuttStatType type)
Read the stat() time into a time value.
Definition: file.c:1576
@ MUTT_STAT_MTIME
File/dir's mtime - last modified time.
Definition: file.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function: