Update the flags for one sequence.
111{
112 bool unseen_done = false;
113 bool flagged_done = false;
114 bool replied_done = false;
115
116 char *tmpfname = NULL;
118
119 char seq_unseen[256] = { 0 };
120 char seq_replied[256] = { 0 };
121 char seq_flagged[256] = { 0 };
122
123 char *buf = NULL;
124 size_t sz;
125
126 FILE *fp_new = NULL;
128 return;
129
133 snprintf(seq_unseen,
sizeof(seq_unseen),
"%s:",
NONULL(c_mh_seq_unseen));
134 snprintf(seq_replied,
sizeof(seq_replied),
"%s:",
NONULL(c_mh_seq_replied));
135 snprintf(seq_flagged,
sizeof(seq_flagged),
"%s:",
NONULL(c_mh_seq_flagged));
136
137 snprintf(sequences,
sizeof(sequences),
"%s/.mh_sequences",
mailbox_path(m));
139 if (fp_old)
140 {
142 {
144 {
145 fprintf(fp_new, "%s %d\n", buf, n);
146 unseen_done = true;
147 }
149 {
150 fprintf(fp_new, "%s %d\n", buf, n);
151 flagged_done = true;
152 }
154 {
155 fprintf(fp_new, "%s %d\n", buf, n);
156 replied_done = true;
157 }
158 else
159 {
160 fprintf(fp_new, "%s\n", buf);
161 }
162 }
163 }
166
167 if (!unseen_done && unseen)
168 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_unseen), n);
169 if (!flagged_done && flagged)
170 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_flagged), n);
171 if (!replied_done && replied)
172 fprintf(fp_new,
"%s: %d\n",
NONULL(c_mh_seq_replied), n);
173
175
176 unlink(sequences);
178 unlink(tmpfname);
179
181}
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.