Update the flags for one sequence.
109{
110 bool unseen_done = false;
111 bool flagged_done = false;
112 bool replied_done = false;
113
114 char *tmpfname = NULL;
116
117 char seq_unseen[256] = { 0 };
118 char seq_replied[256] = { 0 };
119 char seq_flagged[256] = { 0 };
120
121 char *buf = NULL;
122 size_t sz;
123
124 FILE *fp_new = NULL;
126 return;
127
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));
134
135 snprintf(sequences,
sizeof(sequences),
"%s/.mh_sequences",
mailbox_path(m));
137 if (fp_old)
138 {
140 {
142 {
143 fprintf(fp_new, "%s %d\n", buf, n);
144 unseen_done = true;
145 }
147 {
148 fprintf(fp_new, "%s %d\n", buf, n);
149 flagged_done = true;
150 }
152 {
153 fprintf(fp_new, "%s %d\n", buf, n);
154 replied_done = true;
155 }
156 else
157 {
158 fprintf(fp_new, "%s\n", buf);
159 }
160 }
161 }
164
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);
171
173
174 unlink(sequences);
176 unlink(tmpfname);
177
179}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
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.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
#define MUTT_RL_NO_FLAGS
No flags are set.
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.