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 if (mp->msgstats[msgnum - mp->lowoff])
31 mp->msgflags |= SEQMOD;
32 mp->msgstats[msgnum - mp->lowoff] = 0;
36 clear_sequence(struct msgs *mp, int seqnum, int msgnum)
38 assert_msg_range(mp, msgnum);
39 mp->msgstats[msgnum - mp->lowoff] &= ~(1 << (FFATTRSLOT + seqnum));
43 copy_msg_flags(struct msgs *mp, int dstmsg, int srcmsg)
45 assert_msg_range(mp, srcmsg);
46 assert_msg_range(mp, dstmsg);
47 mp->msgstats[dstmsg - mp->lowoff] = mp->msgstats[srcmsg - mp->lowoff];
51 does_exist(struct msgs *mp, int msgnum)
53 assert_msg_range(mp, msgnum);
54 return mp->msgstats[msgnum - mp->lowoff] & EXISTS;
58 get_msg_flags(struct msgs *mp, seqset_t *dst, int msgnum)
60 assert_msg_range(mp, msgnum);
61 *dst = mp->msgstats[msgnum - mp->lowoff];
65 in_sequence(struct msgs *mp, int seqnum, int msgnum)
67 assert_msg_range(mp, msgnum);
68 return mp->msgstats[msgnum - mp->lowoff] & (1 << (FFATTRSLOT + seqnum));
72 is_selected(struct msgs *mp, int msgnum)
74 assert_msg_range(mp, msgnum);
75 return mp->msgstats[msgnum - mp->lowoff] & SELECTED;
79 is_unseen(struct msgs *mp, int msgnum)
81 assert_msg_range(mp, msgnum);
82 return mp->msgstats[msgnum - mp->lowoff] & SELECT_UNSEEN;
86 set_exists(struct msgs *mp, int msgnum)
88 assert_msg_range(mp, msgnum);
89 mp->msgstats[msgnum - mp->lowoff] |= EXISTS;
93 set_msg_flags(struct msgs *mp, seqset_t *src, int msgnum)
95 assert_msg_range(mp, msgnum);
96 mp->msgstats[msgnum - mp->lowoff] = *src;
100 set_selected(struct msgs *mp, int msgnum)
102 assert_msg_range(mp, msgnum);
104 if (is_selected(mp, msgnum)) {
108 mp->msgstats[msgnum - mp->lowoff] |= SELECTED;
109 if (mp->lowsel == 0 || msgnum < mp->lowsel) {
112 if (msgnum > mp->hghsel) {
119 set_unseen(struct msgs *mp, int msgnum)
121 assert_msg_range(mp, msgnum);
122 mp->msgstats[msgnum - mp->lowoff] |= SELECT_UNSEEN;
126 unset_exists(struct msgs *mp, int msgnum)
128 assert_msg_range(mp, msgnum);
129 mp->msgstats[msgnum - mp->lowoff] &= ~EXISTS;
133 unset_selected(struct msgs *mp, int msgnum)
135 assert_msg_range(mp, msgnum);
137 if (!is_selected(mp, msgnum)) {
141 mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED;
142 if (mp->numsel > 0) {
149 ** private/public sequences
153 is_seq_private(struct msgs *mp, int seqnum)
155 return mp->attrstats & (1 << (FFATTRSLOT + seqnum));
159 make_seq_public(struct msgs *mp, int seqnum)
161 mp->attrstats &= ~(1 << (FFATTRSLOT + seqnum));
164 make_seq_private(struct msgs *mp, int seqnum)
166 mp->attrstats |= (1 << (FFATTRSLOT + seqnum));
169 make_all_public(struct msgs *mp)
180 clear_folder_flags(struct msgs *mp)
186 is_readonly(struct msgs *mp)
188 return mp->msgflags & READONLY;
191 set_readonly(struct msgs *mp)
193 mp->msgflags |= READONLY;
197 other_files(struct msgs *mp)
199 return mp->msgflags & OTHERS;
202 set_other_files(struct msgs *mp)
204 mp->msgflags |= OTHERS;