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);
101 mp->msgstats[msgnum - mp->lowoff] |= SELECTED;
105 set_unseen(struct msgs *mp, int msgnum)
107 assert_msg_range(mp, msgnum);
108 mp->msgstats[msgnum - mp->lowoff] |= SELECT_UNSEEN;
112 unset_exists(struct msgs *mp, int msgnum)
114 assert_msg_range(mp, msgnum);
115 mp->msgstats[msgnum - mp->lowoff] &= ~EXISTS;
119 unset_selected(struct msgs *mp, int msgnum)
121 assert_msg_range(mp, msgnum);
122 mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED;
126 unset_unseen(struct msgs *mp, int msgnum)
128 assert_msg_range(mp, msgnum);
129 mp->msgstats[msgnum - mp->lowoff] &= ~SELECT_UNSEEN;
134 ** private/public sequences
138 is_seq_private(struct msgs *mp, int seqnum)
140 return mp->attrstats & (1 << (FFATTRSLOT + seqnum));
144 make_seq_public(struct msgs *mp, int seqnum)
146 mp->attrstats &= ~(1 << (FFATTRSLOT + seqnum));
149 make_seq_private(struct msgs *mp, int seqnum)
151 mp->attrstats |= (1 << (FFATTRSLOT + seqnum));
154 make_all_public(struct msgs *mp)
165 clear_folder_flags(struct msgs *mp)
171 is_readonly(struct msgs *mp)
173 return mp->msgflags & READONLY;
176 set_readonly(struct msgs *mp)
178 mp->msgflags |= READONLY;
182 other_files(struct msgs *mp)
184 return mp->msgflags & OTHERS;
187 set_other_files(struct msgs *mp)
189 mp->msgflags |= OTHERS;