52 if ((i <= mhs->max) && mhs->
flags)
55 const int newmax = i + 128;
56 int j = mhs->
flags ? mhs->
max + 1 : 0;
110 bool unseen_done =
false;
111 bool flagged_done =
false;
112 bool replied_done =
false;
114 char *tmpfname = NULL;
117 char seq_unseen[256] = { 0 };
118 char seq_replied[256] = { 0 };
119 char seq_flagged[256] = { 0 };
131 snprintf(seq_unseen,
sizeof(seq_unseen),
"%s:",
NONULL(c_mh_seq_unseen));
132 snprintf(seq_replied,
sizeof(seq_replied),
"%s:",
NONULL(c_mh_seq_replied));
133 snprintf(seq_flagged,
sizeof(seq_flagged),
"%s:",
NONULL(c_mh_seq_flagged));
135 snprintf(sequences,
sizeof(sequences),
"%s/.mh_sequences",
mailbox_path(m));
143 fprintf(fp_new,
"%s %d\n", buf, n);
148 fprintf(fp_new,
"%s %d\n", buf, n);
153 fprintf(fp_new,
"%s %d\n", buf, n);
158 fprintf(fp_new,
"%s\n", buf);
165 if (!unseen_done && unseen)
166 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_unseen), n);
167 if (!flagged_done && flagged)
168 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_flagged), n);
169 if (!replied_done && replied)
170 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_replied), n);
190 fprintf(fp,
"%s:", tag);
195 for (
int i = 0; i <= mhs->
max; i++)
207 fprintf(fp,
" %d", first);
209 fprintf(fp,
" %d-%d", first, last);
219 fprintf(fp,
" %d", first);
221 fprintf(fp,
" %d-%d", first, last);
237 char *tmpfname = NULL;
247 char seq_unseen[256] = { 0 };
248 char seq_replied[256] = { 0 };
249 char seq_flagged[256] = { 0 };
256 snprintf(seq_unseen,
sizeof(seq_unseen),
"%s:",
NONULL(c_mh_seq_unseen));
257 snprintf(seq_replied,
sizeof(seq_replied),
"%s:",
NONULL(c_mh_seq_replied));
258 snprintf(seq_flagged,
sizeof(seq_flagged),
"%s:",
NONULL(c_mh_seq_flagged));
267 snprintf(sequences,
sizeof(sequences),
"%s/.mh_sequences",
mailbox_path(m));
281 fprintf(fp_new,
"%s\n", buf);
296 p = strrchr(e->
path,
'/');
302 if (!mutt_str_atoi_full(p, &seq_num))
355 char *p = strchr(t,
'-');
359 if (!mutt_str_atoi_full(t, first) || !mutt_str_atoi_full(p, last))
364 if (!mutt_str_atoi_full(t, first))
384 int first, last, rc = 0;
387 snprintf(pathname,
sizeof(pathname),
"%s/.mh_sequences",
path);
398 char *t = strtok(buf,
" \t:");
411 while ((t = strtok(NULL,
" \t:")))
419 for (; first <= last; first++)
442 struct stat st = { 0 };
444 if ((snprintf(path,
sizeof(path),
"%s/.mh_sequences",
mailbox_path(m)) <
sizeof(path)) &&
445 (stat(path, &st) == 0))
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Structs that make up an email.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
int mutt_file_safe_rename(const char *src, const char *target)
NFS-safe renaming of files.
int mutt_file_stat_timespec_compare(struct stat *st, enum MuttStatType type, struct timespec *b)
Compare stat info with a time value.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
#define MUTT_RL_NO_FLAGS
No flags are set.
@ MUTT_STAT_MTIME
File/dir's mtime - last modified time.
#define MUTT_MEM_REALLOC(pptr, n, type)
bool mh_mkstemp(struct Mailbox *m, FILE **fp, char **tgt)
Create a temporary file.
Convenience wrapper for the library headers.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
void mh_seq_add_one(struct Mailbox *m, int n, bool unseen, bool flagged, bool replied)
Update the flags for one sequence.
static void mh_seq_alloc(struct MhSequences *mhs, int i)
Allocate more memory for sequences.
MhSeqFlags mh_seq_check(struct MhSequences *mhs, int i)
Get the flags for a given sequence.
void mh_seq_free(struct MhSequences *mhs)
Free some sequences.
static MhSeqFlags mh_seq_set(struct MhSequences *mhs, int i, MhSeqFlags f)
Set a flag for a given sequence.
static int mh_seq_read_token(char *t, int *first, int *last)
Parse a number, or number range.
int mh_seq_changed(struct Mailbox *m)
Has the mailbox changed.
void mh_seq_update(struct Mailbox *m)
Update sequence numbers.
int mh_seq_read(struct MhSequences *mhs, const char *path)
Read a set of MH sequences.
static void mh_seq_write_one(FILE *fp, struct MhSequences *mhs, MhSeqFlags f, const char *tag)
Write a flag sequence to a file.
#define MH_SEQ_UNSEEN
Email hasn't been read.
#define MH_SEQ_REPLIED
Email has been replied to.
uint8_t MhSeqFlags
Flags, e.g. MH_SEQ_UNSEEN.
#define MH_SEQ_FLAGGED
Email is flagged.
The envelope/body of an email.
bool flagged
Marked important?
bool replied
Email has been replied to.
char * path
Path of Email (for local Mailboxes)
bool deleted
Email is deleted.
int msg_count
Total number of messages.
struct Email ** emails
Array of Emails.
struct timespec last_visited
Time of last exit from this mailbox.
Set of MH sequence numbers.
MhSeqFlags * flags
Flags for each email.
int max
Number of flags stored.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.