source: trunk/third/nmh/sbr/seq_setunseen.c @ 12455

Revision 12455, 1.3 KB checked in by danw, 26 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r12454, which included commits to RCS files with non-trunk default branches.
RevLine 
[12454]1
2/*
3 * seq_setunseen.c -- add/delete all messages which have the SELECT_UNSEEN
4 *                 -- bit set to/from the Unseen-Sequence
5 *
6 * $Id: seq_setunseen.c,v 1.1.1.1 1999-02-07 18:14:10 danw Exp $
7 */
8
9#include <h/mh.h>
10
11/*
12 * We scan through the folder and act upon all messages
13 * that are marked with the SELECT_UNSEEN bit.
14 *
15 * If seen == 1, delete messages from unseen sequence.
16 * If seen == 0, add messages to unseen sequence.
17 */
18
19void
20seq_setunseen (struct msgs *mp, int seen)
21{
22    int msgnum;
23    char **ap, *cp, *dp;
24
25    /*
26     * Get the list of sequences for Unseen-Sequence
27     * and split them.
28     */
29    if ((cp = context_find (usequence))) {
30        dp = getcpy (cp);
31        if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
32            free (dp);
33            return;
34        }
35    } else {
36        return;
37    }
38
39    /*
40     * Now add/delete each message which has the SELECT_UNSEEN
41     * bit set to/from each of these sequences.
42     */
43    for (; *ap; ap++) {
44        if (seen) {
45            /* make sure sequence exists first */
46            if (seq_getnum(mp, *ap) != -1)
47                for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++)
48                    if (is_unseen (mp, msgnum))
49                        seq_delmsg (mp, *ap, msgnum);
50        } else {
51            for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++)
52                if (is_unseen (mp, msgnum))
53                    seq_addmsg (mp, *ap, msgnum, -1, 0);
54        }
55    }
56
57    free (dp);
58}
Note: See TracBrowser for help on using the repository browser.