2 ** seq_setunseen.c -- add/delete all messages which have the SELECT_UNSEEN
3 ** -- bit set to/from the Unseen-Sequence
5 ** This code is Copyright (c) 2002, by the authors of nmh. See the
6 ** COPYRIGHT file in the root directory of the nmh distribution for
7 ** complete copyright information.
13 ** We scan through the folder and act upon all messages
14 ** that are marked with the SELECT_UNSEEN bit.
16 ** If seen == 1, delete messages from unseen sequence.
17 ** If seen == 0, add messages to unseen sequence.
21 seq_setunseen(struct msgs *mp, int seen)
27 ** Get the list of sequences for Unseen-Sequence
30 if ((cp = context_find(usequence))) {
33 /* not set in profile, thus use the default */
34 dp = getcpy(seq_unseen);
36 if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
37 /* contains no sequence name, i.e. we're finished */
43 ** Now add/delete each message which has the SELECT_UNSEEN
44 ** bit set to/from each of these sequences.
48 /* make sure sequence exists first */
49 if (seq_getnum(mp, *ap) != -1) {
50 for (n = mp->lowsel; n <= mp->hghsel; n++) {
51 if (is_unseen(mp, n)) {
52 seq_delmsg(mp, *ap, n);
57 for (n = mp->lowmsg; n <= mp->hghmsg; n++) {
58 if (is_unseen(mp, n)) {
59 seq_addmsg(mp, *ap, n, -1, 0);