]>
diplodocus.org Git - nmh/blob - sbr/seq_del.c
3 * seq_del.c -- delete message(s) from a sequence
12 * Delete all SELECTED messages from sequence
14 * If public == 1, make sequence public.
15 * If public == 0, make sequence private.
16 * If public == -1, leave the public/private bit alone for existing
17 * sequences. For new sequences, set this bit based
18 * on its readonly status.
20 * If error, return 0, else return 1.
24 seq_delsel (struct msgs
*mp
, char *cp
, int public, int zero
)
26 int i
, msgnum
, new_seq
= 1;
32 * Get the number for this sequence
34 for (i
= 0; mp
->msgattrs
[i
]; i
++) {
35 if (!strcmp (mp
->msgattrs
[i
], cp
)) {
42 * If the zero flag is set, first add all existing
43 * messages in this folder to the sequence.
47 * create the sequence, if necessary
51 advise (NULL
, "only %d sequences allowed (no room for %s)!", NUMATTRS
, cp
);
54 if (!(mp
->msgattrs
[i
] = strdup (cp
))) {
55 advise (NULL
, "strdup failed");
58 mp
->msgattrs
[i
+ 1] = NULL
;
61 * now add sequence bit to all existing messages
63 for (msgnum
= mp
->lowmsg
; msgnum
<= mp
->hghmsg
; msgnum
++) {
64 if (does_exist (mp
, msgnum
))
65 add_sequence (mp
, i
, msgnum
);
67 clear_sequence (mp
, i
, msgnum
);
71 advise (NULL
, "no such sequence as %s", cp
);
77 * Now clear the bit on all selected messages
79 for (msgnum
= mp
->lowsel
; msgnum
<= mp
->hghsel
; msgnum
++)
80 if (is_selected (mp
, msgnum
))
81 clear_sequence (mp
, i
, msgnum
);
84 * Set the public/private bit for this sequence.
87 make_seq_public (mp
, i
);
89 make_seq_private (mp
, i
);
92 * If public == -1, then only set the
93 * public/private bit for new sequences.
96 make_seq_private (mp
, i
);
98 make_seq_public (mp
, i
);
101 mp
->msgflags
|= SEQMOD
;
107 * Delete message from sequence.
109 * If error, return 0, else return 1.
113 seq_delmsg (struct msgs
*mp
, char *cp
, int msgnum
)
117 if (!seq_nameok (cp
))
120 for (i
= 0; mp
->msgattrs
[i
]; i
++) {
121 if (!strcmp (mp
->msgattrs
[i
], cp
)) {
122 clear_sequence (mp
, i
, msgnum
);
123 mp
->msgflags
|= SEQMOD
;
128 advise (NULL
, "no such sequence as %s", cp
);