** We scan through the folder and act upon all messages
** that are marked with the SELECT_UNSEEN bit.
**
-** If seen == 1, delete messages from unseen sequence.
-** If seen == 0, add messages to unseen sequence.
+** Either add messages to or (if doadd is false) delete messages from
+** the unseen sequence(s).
*/
-
void
-seq_setunseen(struct msgs *mp, int seen)
+seq_setunseen(struct msgs *mp, int doadd)
{
int n;
char **ap, *cp, *dp;
** bit set to/from each of these sequences.
*/
for (; *ap; ap++) {
- if (seen) {
+ if (doadd) {
+ for (n = mp->lowmsg; n <= mp->hghmsg; n++) {
+ if (is_unseen(mp, n)) {
+ seq_addmsg(mp, *ap, n, -1, 0);
+ }
+ }
+ } else {
/* make sure sequence exists first */
if (seq_getnum(mp, *ap) != -1) {
for (n = mp->lowsel; n <= mp->hghsel; n++) {
}
}
}
- } else {
- for (n = mp->lowmsg; n <= mp->hghmsg; n++) {
- if (is_unseen(mp, n)) {
- seq_addmsg(mp, *ap, n, -1, 0);
- }
- }
}
}
fclose(in); in = NULL;
}
- seq_setunseen(mp, 0); /* set the Unseen-Sequence */
+ seq_setunseen(mp, 1); /* add new msgs to unseen sequences */
seq_save(mp); /* synchronize sequences */
context_save(); /* save the context file */
done(0);
set_unseen(mp, msgnum);
seq_setprev(mp); /* set the Previous-Sequence */
- seq_setunseen(mp, 1); /* unset the Unseen-Sequence */
+ seq_setunseen(mp, 0); /* unset unseen seqs for shown msgs */
if (!(cts = (CT *) calloc((size_t) (mp->numsel + 1),
sizeof(*cts))))
done(1);
}
- seq_setunseen(mp, 0); /* synchronize any Unseen-Sequence's */
+ seq_setunseen(mp, 1); /* add new msgs to unseen sequences */
seq_save(mp); /* synchronize and save message sequences */
folder_free(mp); /* free folder/message structure */
set_unseen(mp, msgnum);
seq_setprev(mp); /* set the Previous-Sequence */
- seq_setunseen(mp, 1); /* unset the Unseen-Sequence */
+ seq_setunseen(mp, 0); /* unset unseen seqs for shown msgs */
if (mp->numsel > MAXARGS - 2)
adios(NULL, "more than %d messages for show exec",