3 * seq_setunseen.c -- add/delete all messages which have the SELECT_UNSEEN
4 * -- bit set to/from the Unseen-Sequence
8 * This code is Copyright (c) 2002, by the authors of nmh. See the
9 * COPYRIGHT file in the root directory of the nmh distribution for
10 * complete copyright information.
16 * We scan through the folder and act upon all messages
17 * that are marked with the SELECT_UNSEEN bit.
19 * If seen == 1, delete messages from unseen sequence.
20 * If seen == 0, add messages to unseen sequence.
24 seq_setunseen (struct msgs *mp, int seen)
30 * Get the list of sequences for Unseen-Sequence
33 if ((cp = context_find (usequence))) {
35 if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
44 * Now add/delete each message which has the SELECT_UNSEEN
45 * bit set to/from each of these sequences.
49 /* make sure sequence exists first */
50 if (seq_getnum(mp, *ap) != -1)
51 for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
52 if (is_unseen (mp, msgnum))
53 seq_delmsg (mp, *ap, msgnum);
55 for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++)
56 if (is_unseen (mp, msgnum))
57 seq_addmsg (mp, *ap, msgnum, -1, 0);