2 ** seq_msgstats -- message and sequence manipulation and folder attributes
4 ** (These functions had once been macros in h/mh.h)
10 assert_msg_range(struct msgs *mp, int msgnum)
12 if (msgnum < mp->lowoff || msgnum > mp->hghoff) {
13 adios(NULL, "Bug: message out of bounds");
19 add_sequence(struct msgs *mp, int seqnum, int msgnum)
21 assert_msg_range(mp, msgnum);
22 mp->msgstats[msgnum - mp->lowoff] |= (1 << (FFATTRSLOT + seqnum));
26 clear_msg_flags(struct msgs *mp, int msgnum)
28 assert_msg_range(mp, msgnum);
29 mp->msgstats[msgnum - mp->lowoff] = 0;
33 clear_sequence(struct msgs *mp, int seqnum, int msgnum)
35 assert_msg_range(mp, msgnum);
36 mp->msgstats[msgnum - mp->lowoff] &= ~(1 << (FFATTRSLOT + seqnum));
40 copy_msg_flags(struct msgs *mp, int dstmsg, int srcmsg)
42 assert_msg_range(mp, srcmsg);
43 assert_msg_range(mp, dstmsg);
44 mp->msgstats[dstmsg - mp->lowoff] = mp->msgstats[srcmsg - mp->lowoff];
48 does_exist(struct msgs *mp, int msgnum)
50 assert_msg_range(mp, msgnum);
51 return mp->msgstats[msgnum - mp->lowoff] & EXISTS;
55 get_msg_flags(struct msgs *mp, seqset_t *dst, int msgnum)
57 assert_msg_range(mp, msgnum);
58 *dst = mp->msgstats[msgnum - mp->lowoff];
62 in_sequence(struct msgs *mp, int seqnum, int msgnum)
64 assert_msg_range(mp, msgnum);
65 return mp->msgstats[msgnum - mp->lowoff] & (1 << (FFATTRSLOT + seqnum));
69 is_selected(struct msgs *mp, int msgnum)
71 assert_msg_range(mp, msgnum);
72 return mp->msgstats[msgnum - mp->lowoff] & SELECTED;
76 is_unseen(struct msgs *mp, int msgnum)
78 assert_msg_range(mp, msgnum);
79 return mp->msgstats[msgnum - mp->lowoff] & SELECT_UNSEEN;
83 set_exists(struct msgs *mp, int msgnum)
85 assert_msg_range(mp, msgnum);
86 mp->msgstats[msgnum - mp->lowoff] |= EXISTS;
90 set_msg_flags(struct msgs *mp, seqset_t *src, int msgnum)
92 assert_msg_range(mp, msgnum);
93 mp->msgstats[msgnum - mp->lowoff] = *src;
97 set_selected(struct msgs *mp, int msgnum)
99 assert_msg_range(mp, msgnum);
100 mp->msgstats[msgnum - mp->lowoff] |= SELECTED;
104 set_unseen(struct msgs *mp, int msgnum)
106 assert_msg_range(mp, msgnum);
107 mp->msgstats[msgnum - mp->lowoff] |= SELECT_UNSEEN;
111 unset_exists(struct msgs *mp, int msgnum)
113 assert_msg_range(mp, msgnum);
114 mp->msgstats[msgnum - mp->lowoff] &= ~EXISTS;
118 unset_selected(struct msgs *mp, int msgnum)
120 assert_msg_range(mp, msgnum);
121 mp->msgstats[msgnum - mp->lowoff] &= ~SELECTED;
125 unset_unseen(struct msgs *mp, int msgnum)
127 assert_msg_range(mp, msgnum);
128 mp->msgstats[msgnum - mp->lowoff] &= ~SELECT_UNSEEN;
133 ** private/public sequences
137 is_seq_private(struct msgs *mp, int seqnum)
139 return mp->attrstats & (1 << (FFATTRSLOT + seqnum));
143 make_seq_public(struct msgs *mp, int seqnum)
145 mp->attrstats &= ~(1 << (FFATTRSLOT + seqnum));
148 make_seq_private(struct msgs *mp, int seqnum)
150 mp->attrstats |= (1 << (FFATTRSLOT + seqnum));
153 make_all_public(struct msgs *mp)
164 clear_folder_flags(struct msgs *mp)
170 is_readonly(struct msgs *mp)
172 return mp->msgflags & READONLY;
175 set_readonly(struct msgs *mp)
177 mp->msgflags |= READONLY;
181 other_files(struct msgs *mp)
183 return mp->msgflags & OTHERS;
186 set_other_files(struct msgs *mp)
188 mp->msgflags |= OTHERS;