Update the flags for one sequence.
108{
109 bool unseen_done = false;
110 bool flagged_done = false;
111 bool replied_done = false;
112
113 char *tmpfname = NULL;
115
116 char seq_unseen[256] = { 0 };
117 char seq_replied[256] = { 0 };
118 char seq_flagged[256] = { 0 };
119
120 char *buf = NULL;
121 size_t sz;
122
123 FILE *fp_new = NULL;
125 return;
126
130 snprintf(seq_unseen,
sizeof(seq_unseen),
"%s:",
NONULL(c_mh_seq_unseen));
131 snprintf(seq_replied,
sizeof(seq_replied),
"%s:",
NONULL(c_mh_seq_replied));
132 snprintf(seq_flagged,
sizeof(seq_flagged),
"%s:",
NONULL(c_mh_seq_flagged));
133
134 snprintf(sequences,
sizeof(sequences),
"%s/.mh_sequences",
mailbox_path(m));
135 FILE *fp_old = fopen(sequences, "r");
136 if (fp_old)
137 {
139 {
141 {
142 fprintf(fp_new, "%s %d\n", buf, n);
143 unseen_done = true;
144 }
146 {
147 fprintf(fp_new, "%s %d\n", buf, n);
148 flagged_done = true;
149 }
151 {
152 fprintf(fp_new, "%s %d\n", buf, n);
153 replied_done = true;
154 }
155 else
156 {
157 fprintf(fp_new, "%s\n", buf);
158 }
159 }
160 }
163
164 if (!unseen_done && unseen)
165 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_unseen), n);
166 if (!flagged_done && flagged)
167 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_flagged), n);
168 if (!replied_done && replied)
169 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_replied), n);
170
172
173 unlink(sequences);
175 unlink(tmpfname);
176
178}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
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_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
#define MUTT_RL_NO_FLAGS
No flags are set.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
bool mh_mkstemp(struct Mailbox *m, FILE **fp, char **tgt)
Create a temporary file.
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_len(const char *a)
Calculate the length of a string, safely.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.