$Log$
+Revision 323.38 2002/05/23 03:40:05 ajc
+* Brought over a utility function I'll need later
+
Revision 323.37 2002/05/22 02:34:56 ajc
* Finished room/folder view selector. Pretty cool.
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
}
+/*
+ * Determine whether the specified message number is contained within the
+ * specified set.
+ */
+int is_msg_in_mset(char *mset, long msgnum) {
+ int num_sets;
+ int s;
+ char setstr[SIZ], lostr[SIZ], histr[SIZ]; /* was 1024 */
+ long lo, hi;
+
+ /*
+ * Now set it for all specified messages.
+ */
+ num_sets = num_tokens(mset, ',');
+ for (s=0; s<num_sets; ++s) {
+ extract_token(setstr, mset, s, ',');
+
+ extract_token(lostr, setstr, 0, ':');
+ if (num_tokens(setstr, ':') >= 2) {
+ extract_token(histr, setstr, 1, ':');
+ if (!strcmp(histr, "*")) {
+ snprintf(histr, sizeof histr, "%ld", LONG_MAX);
+ }
+ }
+ else {
+ strcpy(histr, lostr);
+ }
+ lo = atol(lostr);
+ hi = atol(histr);
+
+ if ((msgnum >= lo) && (msgnum <= hi)) return(1);
+ }
+
+ return(0);
+}
void get_preference(char *key, char *value);
void set_preference(char *key, char *value);
void knrooms(void);
+int is_msg_in_mset(char *mset, long msgnum);