2 ** seq_msgstats -- message and sequence manipulation and folder attributes
4 ** (These functions had once been macros in h/mh.h)
11 assert_msg_range(struct msgs *mp, int msgnum)
13 if (msgnum < mp->lowoff || msgnum > mp->hghoff) {
14 adios(EX_SOFTWARE, NULL, "Bug: message out of bounds");
20 add_sequence(struct msgs *mp, int seqnum, int msgnum)
22 assert_msg_range(mp, msgnum);
23 mp->msgstats[msgnum - mp->lowoff] |= (1 << (FFATTRSLOT + seqnum));
27 clear_msg_flags(struct msgs *mp, int msgnum)
29 assert_msg_range(mp, msgnum);
30 mp->msgstats[msgnum - mp->lowoff] = 0;
34 clear_sequence(struct msgs *mp, int seqnum, int msgnum)
36 assert_msg_range(mp, msgnum);
37 mp->msgstats[msgnum - mp->lowoff] &= ~(1 << (FFATTRSLOT + seqnum));
41 copy_msg_flags(struct msgs *mp, int dstmsg, int srcmsg)
43 assert_msg_range(mp, srcmsg);
44 assert_msg_range(mp, dstmsg);
45 mp->msgstats[dstmsg - mp->lowoff] = mp->msgstats[srcmsg - mp->lowoff];
49 does_exist(struct msgs *mp, int msgnum)
51 assert_msg_range(mp, msgnum);
52 return mp->msgstats[msgnum - mp->lowoff] & EXISTS;
56 get_msg_flags(struct msgs *mp, seqset_t *dst, int msgnum)
58 assert_msg_range(mp, msgnum);
59 *dst = mp->msgstats[msgnum - mp->lowoff];
63 in_sequence(struct msgs *mp, int seqnum, int msgnum)
65 assert_msg_range(mp, msgnum);
66 return mp->msgstats[msgnum - mp->lowoff] & (1 << (FFATTRSLOT + seqnum));
70 is_selected(struct msgs *mp, int msgnum)
72 assert_msg_range(mp, msgnum);
73 return mp->msgstats[msgnum - mp->lowoff] & SELECTED;
77 is_unseen(struct msgs *mp, int msgnum)
79 assert_msg_range(mp, msgnum);
80 return mp->msgstats[msgnum - mp->lowoff] & SELECT_UNSEEN;
84 set_exists(struct msgs *mp, int msgnum)
86 assert_msg_range(mp, msgnum);
87 mp->msgstats[msgnum - mp->lowoff] |= EXISTS;
91 set_msg_flags(struct msgs *mp, seqset_t *src, int msgnum)
93 assert_msg_range(mp, msgnum);
94 mp->msgstats[msgnum - mp->lowoff] = *src;
98 set_selected(struct msgs *mp, int msgnum)
100 assert_msg_range(mp, msgnum);
102 if (is_selected(mp, msgnum)) {
106 mp->msgstats[msgnum - mp->lowoff] |= SELECTED;
107 if (mp->lowsel == 0 || msgnum < mp->lowsel) {
110 if (msgnum > mp->hghsel) {
117 set_unseen(struct msgs *mp, int msgnum)
119 assert_msg_range(mp, msgnum);
120 mp->msgstats[msgnum - mp->lowoff] |= SELECT_UNSEEN;
124 unset_exists(struct msgs *mp, int msgnum)
126 assert_msg_range(mp, msgnum);
127 mp->msgstats[msgnum - mp->lowoff] &= ~EXISTS;
131 unset_selected(struct msgs *mp, int msgnum)
133 assert_msg_range(mp, msgnum);
135 if (!is_selected(mp, msgnum)) {
139 mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED;
140 if (mp->numsel > 0) {
146 unset_unseen(struct msgs *mp, int msgnum)
148 assert_msg_range(mp, msgnum);
149 mp->msgstats[msgnum - mp->lowoff] &= ~SELECT_UNSEEN;
154 ** private/public sequences
158 is_seq_private(struct msgs *mp, int seqnum)
160 return mp->attrstats & (1 << (FFATTRSLOT + seqnum));
164 make_seq_public(struct msgs *mp, int seqnum)
166 mp->attrstats &= ~(1 << (FFATTRSLOT + seqnum));
169 make_seq_private(struct msgs *mp, int seqnum)
171 mp->attrstats |= (1 << (FFATTRSLOT + seqnum));
174 make_all_public(struct msgs *mp)
185 clear_folder_flags(struct msgs *mp)
191 is_readonly(struct msgs *mp)
193 return mp->msgflags & READONLY;
196 set_readonly(struct msgs *mp)
198 mp->msgflags |= READONLY;
202 other_files(struct msgs *mp)
204 return mp->msgflags & OTHERS;
207 set_other_files(struct msgs *mp)
209 mp->msgflags |= OTHERS;