4 * Lots of different room-related operations.
28 char floorlist[128][SIZ];
31 * load the list of floors
33 void load_floorlist(void)
38 for (a = 0; a < 128; ++a)
42 serv_getln(buf, sizeof buf);
44 strcpy(floorlist[0], "Main Floor");
47 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
48 extract_token(floorlist[extract_int(buf, 0)], buf, 1, '|', sizeof floorlist[0]);
54 * remove a room from the march list
56 void remove_march(char *aaa)
58 struct march *mptr, *mptr2;
60 if (WC->march == NULL)
63 if (!strcasecmp(WC->march->march_name, aaa)) {
64 mptr = WC->march->next;
70 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
71 if (!strcasecmp(mptr->march_name, aaa)) {
72 mptr2->next = mptr->next;
85 void room_tree_list(struct roomlisting *rp)
94 room_tree_list(rp->lnext);
96 strcpy(rmname, rp->rlname);
99 wprintf("<A HREF=\"/dotgoto&room=");
103 escputs1(rmname, 1, 1);
104 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
106 else if (f & QR_DIRECTORY)
108 else if (f & QR_NETWORK)
112 wprintf("</A><TT> </TT>\n");
114 room_tree_list(rp->rnext);
120 * Room ordering stuff (compare first by floor, then by order)
122 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
124 if ((r1 == NULL) && (r2 == NULL))
130 if (r1->rlfloor < r2->rlfloor)
132 if (r1->rlfloor > r2->rlfloor)
134 if (r1->rlorder < r2->rlorder)
136 if (r1->rlorder > r2->rlorder)
143 * Common code for all room listings
145 void listrms(char *variety)
150 struct roomlisting *rl = NULL;
151 struct roomlisting *rp;
152 struct roomlisting *rs;
155 /* Ask the server for a room list */
157 serv_getln(buf, sizeof buf);
162 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
164 rp = malloc(sizeof(struct roomlisting));
165 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
166 rp->rlflags = extract_int(buf, 1);
167 rp->rlfloor = extract_int(buf, 2);
168 rp->rlorder = extract_int(buf, 3);
177 if (rordercmp(rp, rs) < 0) {
178 if (rs->lnext == NULL) {
185 if (rs->rnext == NULL) {
197 /* If no rooms were listed, print an nbsp to make the cell
198 * borders show up anyway.
200 if (num_rooms == 0) wprintf(" ");
205 * list all forgotten rooms
207 void zapped_list(void)
209 output_headers(1, 1, 0, 0, 0, 0, 0);
211 svprintf("BOXTITLE", WCS_STRING, "Zapped (forgotten) rooms");
212 do_template("beginbox");
216 wprintf("<br /><br />\n");
217 wprintf("Click on any room to un-zap it and goto that room.\n");
218 do_template("endbox");
224 * read this room's info file (set v to 1 for verbose mode)
231 serv_getln(buf, sizeof buf);
233 fmout(NULL, "CENTER");
240 /* Display room banner icon. The server doesn't actually
241 * need the room name, but we supply it in order to
242 * keep the browser from using a cached icon from
245 void embed_room_graphic(void) {
248 serv_puts("OIMG _roompic_");
249 serv_getln(buf, sizeof buf);
251 wprintf("<IMG HEIGHT=64 SRC=\"/image&name=_roompic_&room=");
252 urlescputs(WC->wc_roomname);
255 serv_getln(buf, sizeof buf);
257 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
258 wprintf("<img height=48 width=48 src=\""
259 "static/viewcontacts_48x.gif"
263 else if (WC->wc_view == VIEW_CALENDAR) {
264 wprintf("<img height=48 width=48 src=\""
265 "static/calarea_48x.gif"
269 else if (WC->wc_view == VIEW_TASKS) {
270 wprintf("<img height=48 width=48 src=\""
271 "static/taskmanag_48x.gif"
275 else if (WC->wc_view == VIEW_NOTES) {
276 wprintf("<img height=48 width=48 src=\""
277 "static/storenotes_48x.gif"
281 else if (WC->wc_view == VIEW_MAILBOX) {
282 wprintf("<img height=48 width=48 src=\""
283 "static/privatemess_48x.gif"
288 wprintf("<img height=48 width=48 src=\""
289 "static/chatrooms_48x.gif"
297 /* Let the user know if new mail has arrived
299 void embed_newmail_button(void) {
300 if ( (WC->new_mail > WC->remember_new_mail) && (WC->new_mail>0) ) {
302 "<A HREF=\"/dotgoto?room=_MAIL_\">"
303 "<IMG SRC=\"/static/privatemess_32x.gif\" border=0 "
304 "ALT=\"You have new mail\">"
305 "<br /><SPAN CLASS=\"youhavemail\">"
306 "%d new mail</SPAN></A>", WC->new_mail);
307 WC->remember_new_mail = WC->new_mail;
314 * Display the current view and offer an option to change it
316 void embed_view_o_matic(void) {
319 wprintf("<form name=\"viewomatic\" action=\"/changeview\">\n"
320 "<span class=\"room_banner_new_messages\">View as: "
321 "<SELECT NAME=\"newview\" SIZE=\"1\" "
322 "STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif;"
323 " font-size: 7pt; background: #444455; color: #ddddcc;\" "
324 "OnChange=\"location.href=viewomatic.newview.options"
325 "[selectedIndex].value\">\n");
327 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
329 * Only offer the views that make sense, given the default
330 * view for the room. For example, don't offer a Calendar
331 * view in a non-Calendar room.
335 || (i == WC->wc_default_view)
336 || ( (i == 0) && (WC->wc_default_view == 1) )
337 || ( (i == 1) && (WC->wc_default_view == 0) )
340 wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
341 ((i == WC->wc_view) ? "SELECTED" : ""),
343 escputs(viewdefs[i]);
344 wprintf("</OPTION>\n");
347 wprintf("</select></span></form>\n");
352 void embed_room_banner(char *got, int navbar_style) {
355 /* We need to have the information returned by a GOTO server command.
356 * If it isn't supplied, we fake it by issuing our own GOTO.
359 serv_printf("GOTO %s", WC->wc_roomname);
360 serv_getln(fakegot, sizeof fakegot);
364 /* If the user happens to select the "make this my start page" link,
365 * we want it to remember the URL as a "/dotskip" one instead of
366 * a "skip" or "gotonext" or something like that.
368 snprintf(WC->this_page, sizeof(WC->this_page), "/dotskip&room=%s",
371 /* Check for new mail. */
372 WC->new_mail = extract_int(&got[4], 9);
373 WC->wc_view = extract_int(&got[4], 11);
375 svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname);
376 svprintf("NEWMSGS", WCS_STRING, "%d", extract_int(&got[4], 1));
377 svprintf("TOTALMSGS", WCS_STRING, "%d", extract_int(&got[4], 2));
378 svcallback("ROOMPIC", embed_room_graphic);
379 svcallback("ROOMINFO", readinfo);
380 svcallback("YOUHAVEMAIL", embed_newmail_button);
381 svcallback("VIEWOMATIC", embed_view_o_matic);
382 svcallback("START", offer_start_page);
384 do_template("roombanner");
385 if (navbar_style != navbar_none) {
387 wprintf("<div style=\"position:absolute; bottom:0px; left:0px\">\n"
388 "<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>\n");
391 if (navbar_style == navbar_default) wprintf(
393 "<a href=\"/ungoto\">"
394 "<img align=\"middle\" src=\"/static/ungoto2_24x.gif\" border=\"0\">"
395 "<span class=\"navbar_link\">Ungoto</span></A>"
399 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
402 "<A HREF=\"/readnew\">"
403 "<img align=\"middle\" src=\"/static/newmess2_24x.gif\" border=\"0\">"
404 "<span class=\"navbar_link\">Read new messages</span></A>"
409 if (navbar_style == navbar_default) {
410 switch(WC->wc_view) {
411 case VIEW_ADDRESSBOOK:
414 "<A HREF=\"/readfwd\">"
415 "<img align=\"middle\" src=\"/static/viewcontacts_24x.gif\" "
417 "<span class=\"navbar_link\">"
425 "<A HREF=\"/readfwd?calview=day\">"
426 "<img align=\"middle\" src=\"/static/taskday2_24x.gif\" "
428 "<span class=\"navbar_link\">"
434 "<A HREF=\"/readfwd?calview=month\">"
435 "<img align=\"middle\" src=\"/static/monthview2_24x.gif\" "
437 "<span class=\"navbar_link\">"
445 "<A HREF=\"/readfwd\">"
446 "<img align=\"middle\" src=\"/static/taskmanag_24x.gif\" "
448 "<span class=\"navbar_link\">"
456 "<A HREF=\"/readfwd\">"
457 "<img align=\"middle\" src=\"/static/viewnotes_24x.gif\" "
459 "<span class=\"navbar_link\">"
467 "<A HREF=\"/readfwd\">"
468 "<img align=\"middle\" src=\"/static/readallmess3_24x.gif\" "
470 "<span class=\"navbar_link\">"
478 "<A HREF=\"/readfwd\">"
479 "<img align=\"middle\" src=\"/static/readallmess3_24x.gif\" "
481 "<span class=\"navbar_link\">"
489 if (navbar_style == navbar_default) {
490 switch(WC->wc_view) {
491 case VIEW_ADDRESSBOOK:
493 "<td><A HREF=\"/display_enter\">"
494 "<img align=\"middle\" src=\"/static/addnewcontact_24x.gif\" "
495 "border=\"0\"><span class=\"navbar_link\">"
502 "<td><A HREF=\"/display_enter\">"
503 "<img align=\"middle\" src=\"/static/addevent_24x.gif\" "
504 "border=\"0\"><span class=\"navbar_link\">"
511 "<td><A HREF=\"/display_enter\">"
512 "<img align=\"middle\" src=\"/static/newmess3_24x.gif\" "
513 "border=\"0\"><span class=\"navbar_link\">"
520 "<td><A HREF=\"/display_enter\">"
521 "<img align=\"middle\" src=\"/static/enternewnote_24x.gif\" "
522 "border=\"0\"><span class=\"navbar_link\">"
529 "<td><A HREF=\"/display_enter\">"
530 "<img align=\"middle\" src=\"/static/newmess3_24x.gif\" "
531 "border=\"0\"><span class=\"navbar_link\">"
539 if (navbar_style == navbar_default) wprintf(
542 "TITLE=\"Leave all messages marked as unread, go to next room with unread messages\">"
543 "<img align=\"middle\" src=\"/static/skipthisroom_24x.gif\" border=\"0\">"
544 "<span class=\"navbar_link\">Skip this room</span></a>"
548 if (navbar_style == navbar_default) wprintf(
550 "<A HREF=\"/gotonext\" "
551 "TITLE=\"Mark all messages as read, go to next room with unread messages\">"
552 "<img align=\"middle\" src=\"/static/markngo_24x.gif\" border=\"0\">"
553 "<span class=\"navbar_link\">Goto next room</span></a>"
557 wprintf("</tr></table></div>\n");
567 * back end routine to take the session to a new room
570 int gotoroom(char *gname)
573 static long ls = (-1L);
576 /* store ungoto information */
577 strcpy(WC->ugname, WC->wc_roomname);
580 /* move to the new room */
581 serv_printf("GOTO %s", gname);
582 serv_getln(buf, sizeof buf);
586 serv_puts("GOTO _BASEROOM_");
587 serv_getln(buf, sizeof buf);
594 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
595 WC->room_flags = extract_int(&buf[4], 4);
596 /* highest_msg_read = extract_int(&buf[4],6);
597 maxmsgnum = extract_int(&buf[4],5);
598 is_mail = (char) extract_int(&buf[4],7); */
599 ls = extract_long(&buf[4], 6);
600 WC->wc_floor = extract_int(&buf[4], 10);
601 WC->wc_view = extract_int(&buf[4], 11);
602 WC->wc_default_view = extract_int(&buf[4], 12);
605 WC->is_room_aide = WC->is_aide;
607 WC->is_room_aide = (char) extract_int(&buf[4], 8);
609 remove_march(WC->wc_roomname);
610 if (!strcasecmp(gname, "_BASEROOM_"))
618 * Locate the room on the march list which we most want to go to. Each room
619 * is measured given a "weight" of preference based on various factors.
621 char *pop_march(int desired_floor)
623 static char TheRoom[128];
625 int TheOrder = 32767;
628 struct march *mptr = NULL;
630 strcpy(TheRoom, "_BASEROOM_");
631 if (WC->march == NULL)
634 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
636 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
637 weight = weight + 10000;
638 if (mptr->march_floor == desired_floor)
639 weight = weight + 5000;
641 weight = weight + ((128 - (mptr->march_floor)) * 128);
642 weight = weight + (128 - (mptr->march_order));
644 if (weight > TheWeight) {
646 strcpy(TheRoom, mptr->march_name);
647 TheFloor = mptr->march_floor;
648 TheOrder = mptr->march_order;
656 /* Goto next room having unread messages.
657 * We want to skip over rooms that the user has already been to, and take the
658 * user back to the lobby when done. The room we end up in is placed in
659 * newroom - which is set to 0 (the lobby) initially.
660 * We start the search in the current room rather than the beginning to prevent
661 * two or more concurrent users from dragging each other back to the same room.
666 struct march *mptr, *mptr2;
669 /* First check to see if the march-mode list is already allocated.
670 * If it is, pop the first room off the list and go there.
673 if (WC->march == NULL) {
675 serv_getln(buf, sizeof buf);
677 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
678 mptr = (struct march *) malloc(sizeof(struct march));
680 extract_token(mptr->march_name, buf, 0, '|', sizeof mptr->march_name);
681 mptr->march_floor = extract_int(buf, 2);
682 mptr->march_order = extract_int(buf, 3);
683 if (WC->march == NULL) {
687 while (mptr2->next != NULL)
692 /* add _BASEROOM_ to the end of the march list, so the user will end up
693 * in the system base room (usually the Lobby>) at the end of the loop
695 mptr = (struct march *) malloc(sizeof(struct march));
697 strcpy(mptr->march_name, "_BASEROOM_");
698 if (WC->march == NULL) {
702 while (mptr2->next != NULL)
707 * ...and remove the room we're currently in, so a <G>oto doesn't make us
708 * walk around in circles
710 remove_march(WC->wc_roomname);
712 if (WC->march != NULL) {
713 strcpy(next_room, pop_march(-1));
715 strcpy(next_room, "_BASEROOM_");
719 smart_goto(next_room);
723 void smart_goto(char *next_room) {
731 * mark all messages in current room as having been read
733 void slrp_highest(void)
738 serv_puts("SLRP HIGHEST");
739 serv_getln(buf, sizeof buf);
741 wprintf("<EM>%s</EM><br />\n", &buf[4]);
748 * un-goto the previous room
754 if (!strcmp(WC->ugname, "")) {
755 smart_goto(WC->wc_roomname);
758 serv_printf("GOTO %s", WC->ugname);
759 serv_getln(buf, sizeof buf);
761 smart_goto(WC->wc_roomname);
764 if (WC->uglsn >= 0L) {
765 serv_printf("SLRP %ld", WC->uglsn);
766 serv_getln(buf, sizeof buf);
768 strcpy(buf, WC->ugname);
769 strcpy(WC->ugname, "");
778 * Set/clear/read the "self-service list subscribe" flag for a room
780 * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged.
781 * Always returns the new value.
784 int self_service(int newval) {
785 int current_value = 0;
791 int flags, floor, order, view, flags2;
794 serv_getln(buf, sizeof buf);
795 if (buf[0] != '2') return(0);
797 extract_token(name, &buf[4], 0, '|', sizeof name);
798 extract_token(password, &buf[4], 1, '|', sizeof password);
799 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
800 flags = extract_int(&buf[4], 3);
801 floor = extract_int(&buf[4], 4);
802 order = extract_int(&buf[4], 5);
803 view = extract_int(&buf[4], 6);
804 flags2 = extract_int(&buf[4], 7);
806 if (flags2 & QR2_SELFLIST) {
814 flags2 = flags2 | QR2_SELFLIST;
816 else if (newval == 0) {
817 flags2 = flags2 & ~QR2_SELFLIST;
820 return(current_value);
823 if (newval != current_value) {
824 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
825 name, password, dirname, flags,
826 floor, order, view, flags2);
827 serv_getln(buf, sizeof buf);
840 * display the form for editing a room
842 void display_editroom(void)
847 char remote_room[SIZ];
850 char er_password[10];
852 char er_roomaide[26];
858 char *not_shared_with;
865 if (strlen(tab) == 0) tab = "admin";
869 serv_getln(buf, sizeof buf);
872 strcpy(WC->ImportantMessage, &buf[4]);
876 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
877 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
878 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
879 er_flags = extract_int(&buf[4], 3);
880 er_floor = extract_int(&buf[4], 4);
882 output_headers(1, 1, 1, 0, 0, 0, 0);
884 /* print the tabbed dialog */
886 "<div id=\"fix_scrollbar_bug\">"
887 "<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
889 "<TD> </TD>\n");
891 if (!strcmp(tab, "admin")) {
892 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
895 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=admin\">");
897 wprintf("Administration");
898 if (!strcmp(tab, "admin")) {
899 wprintf("</SPAN></TD>\n");
902 wprintf("</A></TD>\n");
905 wprintf("<TD> </TD>\n");
907 if (!strcmp(tab, "config")) {
908 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
911 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=config\">");
913 wprintf("Configuration");
914 if (!strcmp(tab, "config")) {
915 wprintf("</SPAN></TD>\n");
918 wprintf("</A></TD>\n");
921 wprintf("<TD> </TD>\n");
923 if (!strcmp(tab, "expire")) {
924 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
927 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=expire\">");
929 wprintf("Message expire policy");
930 if (!strcmp(tab, "expire")) {
931 wprintf("</SPAN></TD>\n");
934 wprintf("</A></TD>\n");
937 wprintf("<TD> </TD>\n");
939 if (!strcmp(tab, "access")) {
940 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
943 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=access\">");
945 wprintf("Access controls");
946 if (!strcmp(tab, "access")) {
947 wprintf("</SPAN></TD>\n");
950 wprintf("</A></TD>\n");
953 wprintf("<TD> </TD>\n");
955 if (!strcmp(tab, "sharing")) {
956 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
959 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=sharing\">");
962 if (!strcmp(tab, "sharing")) {
963 wprintf("</SPAN></TD>\n");
966 wprintf("</A></TD>\n");
969 wprintf("<TD> </TD>\n");
971 if (!strcmp(tab, "listserv")) {
972 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
975 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=listserv\">");
977 wprintf("Mailing list service");
978 if (!strcmp(tab, "listserv")) {
979 wprintf("</SPAN></TD>\n");
982 wprintf("</A></TD>\n");
985 wprintf("<TD> </TD>\n");
987 wprintf("</TR></TABLE></div>\n");
988 /* end tabbed dialog */
990 /* begin content of whatever tab is open now */
991 wprintf("<div id=\"fix_scrollbar_bug\">"
992 "<TABLE border=0 width=100%% bgcolor=\"#FFFFFF\">\n"
995 if (!strcmp(tab, "admin")) {
997 "<LI><A HREF=\"/delete_room\" "
998 "onClick=\"return confirm('Are you sure you want to delete this room?');\">\n"
999 "Delete this room</A>\n"
1000 "<LI><A HREF=\"/display_editroompic\">\n"
1001 "Set or change the icon for this room's banner</A>\n"
1002 "<LI><A HREF=\"/display_editinfo\">\n"
1003 "Edit this room's Info file</A>\n"
1007 if (!strcmp(tab, "config")) {
1008 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
1010 wprintf("<UL><LI>Name of room: ");
1011 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
1013 wprintf("<LI>Resides on floor: ");
1014 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1015 for (i = 0; i < 128; ++i)
1016 if (strlen(floorlist[i]) > 0) {
1017 wprintf("<OPTION ");
1019 wprintf("SELECTED ");
1020 wprintf("VALUE=\"%d\">", i);
1021 escputs(floorlist[i]);
1022 wprintf("</OPTION>\n");
1024 wprintf("</SELECT>\n");
1026 wprintf("<LI>Type of room:<UL>\n");
1028 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1029 if ((er_flags & QR_PRIVATE) == 0)
1030 wprintf("CHECKED ");
1031 wprintf("> Public room\n");
1033 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1034 if ((er_flags & QR_PRIVATE) &&
1035 (er_flags & QR_GUESSNAME))
1036 wprintf("CHECKED ");
1037 wprintf("> Private - guess name\n");
1039 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1040 if ((er_flags & QR_PRIVATE) &&
1041 (er_flags & QR_PASSWORDED))
1042 wprintf("CHECKED ");
1043 wprintf("> Private - require password:\n");
1044 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
1046 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1047 if ((er_flags & QR_PRIVATE)
1048 && ((er_flags & QR_GUESSNAME) == 0)
1049 && ((er_flags & QR_PASSWORDED) == 0))
1050 wprintf("CHECKED ");
1051 wprintf("> Private - invitation only\n");
1053 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1054 wprintf("> If private, cause current users to forget room\n");
1058 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1059 if (er_flags & QR_PREFONLY)
1060 wprintf("CHECKED ");
1061 wprintf("> Preferred users only\n");
1063 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1064 if (er_flags & QR_READONLY)
1065 wprintf("CHECKED ");
1066 wprintf("> Read-only room\n");
1068 /* directory stuff */
1069 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1070 if (er_flags & QR_DIRECTORY)
1071 wprintf("CHECKED ");
1072 wprintf("> File directory room\n");
1074 wprintf("<UL><LI>Directory name: ");
1075 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
1077 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1078 if (er_flags & QR_UPLOAD)
1079 wprintf("CHECKED ");
1080 wprintf("> Uploading allowed\n");
1082 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1083 if (er_flags & QR_DOWNLOAD)
1084 wprintf("CHECKED ");
1085 wprintf("> Downloading allowed\n");
1087 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1088 if (er_flags & QR_VISDIR)
1089 wprintf("CHECKED ");
1090 wprintf("> Visible directory</UL>\n");
1092 /* end of directory stuff */
1094 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1095 if (er_flags & QR_NETWORK)
1096 wprintf("CHECKED ");
1097 wprintf("> Network shared room\n");
1099 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1100 if (er_flags & QR_PERMANENT)
1101 wprintf("CHECKED ");
1102 wprintf("> Permanent (does not auto-purge)\n");
1104 /* start of anon options */
1106 wprintf("<LI>Anonymous messages<UL>\n");
1108 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1109 if (((er_flags & QR_ANONONLY) == 0)
1110 && ((er_flags & QR_ANONOPT) == 0))
1111 wprintf("CHECKED ");
1112 wprintf("> No anonymous messages\n");
1114 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1115 if (er_flags & QR_ANONONLY)
1116 wprintf("CHECKED ");
1117 wprintf("> All messages are anonymous\n");
1119 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1120 if (er_flags & QR_ANONOPT)
1121 wprintf("CHECKED ");
1122 wprintf("> Prompt user when entering messages</UL>\n");
1124 /* end of anon options */
1126 wprintf("<LI>Room aide: \n");
1128 serv_getln(buf, sizeof buf);
1129 if (buf[0] != '2') {
1130 wprintf("<EM>%s</EM>\n", &buf[4]);
1132 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1133 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1136 wprintf("</UL><CENTER>\n");
1137 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1138 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1140 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
1146 /* Sharing the room with other Citadel nodes... */
1147 if (!strcmp(tab, "sharing")) {
1149 shared_with = strdup("");
1150 not_shared_with = strdup("");
1152 /* Learn the current configuration */
1153 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1154 serv_getln(buf, sizeof buf);
1155 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1156 extract_token(node, buf, 0, '|', sizeof node);
1157 not_shared_with = realloc(not_shared_with,
1158 strlen(not_shared_with) + 32);
1159 strcat(not_shared_with, node);
1160 strcat(not_shared_with, "\n");
1164 serv_getln(buf, sizeof buf);
1165 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1166 extract_token(cmd, buf, 0, '|', sizeof cmd);
1167 extract_token(node, buf, 1, '|', sizeof node);
1168 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1169 if (!strcasecmp(cmd, "ignet_push_share")) {
1170 shared_with = realloc(shared_with,
1171 strlen(shared_with) + 32);
1172 strcat(shared_with, node);
1173 if (strlen(remote_room) > 0) {
1174 strcat(shared_with, "|");
1175 strcat(shared_with, remote_room);
1177 strcat(shared_with, "\n");
1181 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1182 extract_token(buf, shared_with, i, '\n', sizeof buf);
1183 extract_token(node, buf, 0, '|', sizeof node);
1184 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1185 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1186 if (!strcasecmp(node, cmd)) {
1187 remove_token(not_shared_with, j, '\n');
1192 /* Display the stuff */
1193 wprintf("<CENTER><br />"
1194 "<TABLE border=1 cellpadding=5><TR>"
1195 "<TD><B><I>Shared with</I></B></TD>"
1196 "<TD><B><I>Not shared with</I></B></TD></TR>\n"
1197 "<TR><TD VALIGN=TOP>\n");
1199 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1200 "<TD>Remote node name</TD>"
1201 "<TD>Remote room name</TD>"
1206 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1207 extract_token(buf, shared_with, i, '\n', sizeof buf);
1208 extract_token(node, buf, 0, '|', sizeof node);
1209 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1210 if (strlen(node) > 0) {
1211 wprintf("<FORM METHOD=\"POST\" "
1212 "ACTION=\"/netedit\">"
1213 "<TR><TD>%s</TD>\n", node);
1216 if (strlen(remote_room) > 0) {
1217 escputs(remote_room);
1223 wprintf("<INPUT TYPE=\"hidden\" NAME=\"line\" "
1224 "VALUE=\"ignet_push_share|");
1226 if (strlen(remote_room) > 0) {
1228 urlescputs(remote_room);
1231 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1232 "VALUE=\"sharing\">\n");
1233 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1234 "VALUE=\"remove\">\n");
1235 wprintf("<INPUT TYPE=\"submit\" "
1236 "NAME=\"sc\" VALUE=\"Unshare\">");
1237 wprintf("</TD></TR></FORM>\n");
1241 wprintf("</TABLE>\n");
1242 wprintf("</TD><TD VALIGN=TOP>\n");
1243 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1244 "<TD>Remote node name</TD>"
1245 "<TD>Remote room name</TD>"
1250 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1251 extract_token(node, not_shared_with, i, '\n', sizeof node);
1252 if (strlen(node) > 0) {
1253 wprintf("<FORM METHOD=\"POST\" "
1254 "ACTION=\"/netedit\">"
1258 "<INPUT TYPE=\"INPUT\" "
1262 wprintf("<INPUT TYPE=\"hidden\" "
1264 "VALUE=\"ignet_push_share|");
1267 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1268 "VALUE=\"sharing\">\n");
1269 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1270 "VALUE=\"add\">\n");
1271 wprintf("<INPUT TYPE=\"submit\" "
1272 "NAME=\"sc\" VALUE=\"Share\">");
1273 wprintf("</TD></TR></FORM>\n");
1277 wprintf("</TABLE>\n");
1278 wprintf("</TD></TR>"
1279 "</TABLE></CENTER><br />\n"
1280 "<I><B>Notes:</B><UL><LI>When sharing a room, "
1281 "it must be shared from both ends. Adding a node to "
1282 "the 'shared' list sends messages out, but in order to"
1283 " receive messages, the other nodes must be configured"
1284 " to send messages out to your system as well.\n"
1285 "<LI>If the remote room name is blank, it is assumed "
1286 "that the room name is identical on the remote node."
1287 "<LI>If the remote room name is different, the remote "
1288 "node must also configure the name of the room here."
1294 /* Mailing list management */
1295 if (!strcmp(tab, "listserv")) {
1297 wprintf("<br /><center>"
1298 "<TABLE BORDER=0 WIDTH=100%% CELLPADDING=5>"
1299 "<TR><TD VALIGN=TOP>");
1301 wprintf("<i>The contents of this room are being "
1302 "mailed <b>as individual messages</b> "
1303 "to the following list recipients:"
1304 "</i><br /><br />\n");
1307 serv_getln(buf, sizeof buf);
1308 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1309 extract_token(cmd, buf, 0, '|', sizeof cmd);
1310 if (!strcasecmp(cmd, "listrecp")) {
1311 extract_token(recp, buf, 1, '|', sizeof recp);
1314 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1317 wprintf("&tab=listserv\">(remove)</A><br />");
1321 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1322 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1323 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1324 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1325 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1326 wprintf("</FORM>\n");
1328 wprintf("</TD><TD VALIGN=TOP>\n");
1330 wprintf("<i>The contents of this room are being "
1331 "mailed <b>in digest form</b> "
1332 "to the following list recipients:"
1333 "</i><br /><br />\n");
1336 serv_getln(buf, sizeof buf);
1337 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1338 extract_token(cmd, buf, 0, '|', sizeof cmd);
1339 if (!strcasecmp(cmd, "digestrecp")) {
1340 extract_token(recp, buf, 1, '|', sizeof recp);
1343 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1346 wprintf("&tab=listserv\">(remove)</A><br />");
1350 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1351 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1352 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1353 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1354 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1355 wprintf("</FORM>\n");
1357 wprintf("</TD></TR></TABLE><hr />\n");
1359 if (self_service(999) == 1) {
1360 wprintf("This room is configured to allow "
1361 "self-service subscribe/unsubscribe requests."
1362 " <A HREF=\"/toggle_self_service?newval=0&"
1364 "Click to disable.</A><br />\n"
1365 "The URL for subscribe/unsubscribe is: "
1366 "<TT>http://%s/listsub</TT><br />\n",
1371 wprintf("This room is <i>not</i> configured to allow "
1372 "self-service subscribe/unsubscribe requests."
1373 " <A HREF=\"/toggle_self_service?newval=1&"
1375 "Click to enable.</A><br />\n"
1380 wprintf("</CENTER>\n");
1384 /* Mailing list management */
1385 if (!strcmp(tab, "expire")) {
1387 serv_puts("GPEX room");
1388 serv_getln(buf, sizeof buf);
1389 if (buf[0] == '2') {
1390 roompolicy = extract_int(&buf[4], 0);
1391 roomvalue = extract_int(&buf[4], 1);
1394 serv_puts("GPEX floor");
1395 serv_getln(buf, sizeof buf);
1396 if (buf[0] == '2') {
1397 floorpolicy = extract_int(&buf[4], 0);
1398 floorvalue = extract_int(&buf[4], 1);
1401 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/set_room_policy\">\n");
1402 wprintf("<TABLE border=0 cellspacing=5>\n");
1403 wprintf("<TR><TD>Message expire policy for this room<br />(");
1404 escputs(WC->wc_roomname);
1405 wprintf(")</TD><TD>");
1406 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1407 ((roompolicy == 0) ? "CHECKED" : "") );
1408 wprintf("Use the default policy for this floor<br />\n");
1409 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1410 ((roompolicy == 1) ? "CHECKED" : "") );
1411 wprintf("Never automatically expire messages<br />\n");
1412 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1413 ((roompolicy == 2) ? "CHECKED" : "") );
1414 wprintf("Expire by message count<br />\n");
1415 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1416 ((roompolicy == 3) ? "CHECKED" : "") );
1417 wprintf("Expire by message age<br />");
1418 wprintf("Number of messages or days: ");
1419 wprintf("<INPUT TYPE=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1420 wprintf("</TD></TR>\n");
1422 if (WC->axlevel >= 6) {
1423 wprintf("<TR><TD COLSPAN=2><hr /></TD></TR>\n");
1424 wprintf("<TR><TD>Message expire policy for this floor<br />(");
1425 escputs(floorlist[WC->wc_floor]);
1426 wprintf(")</TD><TD>");
1427 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1428 ((floorpolicy == 0) ? "CHECKED" : "") );
1429 wprintf("Use the system default<br />\n");
1430 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1431 ((floorpolicy == 1) ? "CHECKED" : "") );
1432 wprintf("Never automatically expire messages<br />\n");
1433 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1434 ((floorpolicy == 2) ? "CHECKED" : "") );
1435 wprintf("Expire by message count<br />\n");
1436 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1437 ((floorpolicy == 3) ? "CHECKED" : "") );
1438 wprintf("Expire by message age<br />");
1439 wprintf("Number of messages or days: ");
1440 wprintf("<INPUT TYPE=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1444 wprintf("<CENTER>\n");
1445 wprintf("<TR><TD COLSPAN=2><hr /><CENTER>\n");
1446 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1448 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1449 wprintf("</CENTER></TD><TR>\n");
1451 wprintf("</TABLE>\n"
1452 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1458 /* Mailing list management */
1459 if (!strcmp(tab, "access")) {
1463 /* end content of whatever tab is open now */
1464 wprintf("</TD></TR></TABLE></div>\n");
1471 * Toggle self-service list subscription
1473 void toggle_self_service(void) {
1476 newval = atoi(bstr("newval"));
1477 self_service(newval);
1484 * save new parameters for a room
1490 char er_password[10];
1491 char er_dirname[15];
1492 char er_roomaide[26];
1498 if (strcmp(bstr("sc"), "OK")) {
1499 strcpy(WC->ImportantMessage,
1500 "Cancelled. Changes were not saved.");
1505 serv_getln(buf, sizeof buf);
1507 if (buf[0] != '2') {
1508 strcpy(WC->ImportantMessage, &buf[4]);
1512 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1513 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1514 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1515 er_flags = extract_int(&buf[4], 3);
1517 strcpy(er_roomaide, bstr("er_roomaide"));
1518 if (strlen(er_roomaide) == 0) {
1520 serv_getln(buf, sizeof buf);
1521 if (buf[0] != '2') {
1522 strcpy(er_roomaide, "");
1524 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1527 strcpy(buf, bstr("er_name"));
1529 if (strlen(buf) > 0)
1530 strcpy(er_name, buf);
1532 strcpy(buf, bstr("er_password"));
1534 if (strlen(buf) > 0)
1535 strcpy(er_password, buf);
1537 strcpy(buf, bstr("er_dirname"));
1539 if (strlen(buf) > 0)
1540 strcpy(er_dirname, buf);
1542 strcpy(buf, bstr("type"));
1543 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
1545 if (!strcmp(buf, "invonly")) {
1546 er_flags |= (QR_PRIVATE);
1548 if (!strcmp(buf, "hidden")) {
1549 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
1551 if (!strcmp(buf, "passworded")) {
1552 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
1554 if (!strcmp(bstr("prefonly"), "yes")) {
1555 er_flags |= QR_PREFONLY;
1557 er_flags &= ~QR_PREFONLY;
1560 if (!strcmp(bstr("readonly"), "yes")) {
1561 er_flags |= QR_READONLY;
1563 er_flags &= ~QR_READONLY;
1566 if (!strcmp(bstr("permanent"), "yes")) {
1567 er_flags |= QR_PERMANENT;
1569 er_flags &= ~QR_PERMANENT;
1572 if (!strcmp(bstr("network"), "yes")) {
1573 er_flags |= QR_NETWORK;
1575 er_flags &= ~QR_NETWORK;
1578 if (!strcmp(bstr("directory"), "yes")) {
1579 er_flags |= QR_DIRECTORY;
1581 er_flags &= ~QR_DIRECTORY;
1584 if (!strcmp(bstr("ulallowed"), "yes")) {
1585 er_flags |= QR_UPLOAD;
1587 er_flags &= ~QR_UPLOAD;
1590 if (!strcmp(bstr("dlallowed"), "yes")) {
1591 er_flags |= QR_DOWNLOAD;
1593 er_flags &= ~QR_DOWNLOAD;
1596 if (!strcmp(bstr("visdir"), "yes")) {
1597 er_flags |= QR_VISDIR;
1599 er_flags &= ~QR_VISDIR;
1602 strcpy(buf, bstr("anon"));
1604 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
1605 if (!strcmp(buf, "anononly"))
1606 er_flags |= QR_ANONONLY;
1607 if (!strcmp(buf, "anon2"))
1608 er_flags |= QR_ANONOPT;
1611 if (!strcmp(bstr("bump"), "yes"))
1614 er_floor = atoi(bstr("er_floor"));
1616 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
1617 er_name, er_password, er_dirname, er_flags, bump, er_floor);
1619 serv_getln(buf, sizeof buf);
1620 if (buf[0] != '2') {
1621 strcpy(WC->ImportantMessage, &buf[4]);
1627 if (strlen(er_roomaide) > 0) {
1628 sprintf(buf, "SETA %s", er_roomaide);
1630 serv_getln(buf, sizeof buf);
1631 if (buf[0] != '2') {
1632 strcpy(WC->ImportantMessage, &buf[4]);
1633 display_main_menu();
1638 strcpy(WC->ImportantMessage, "Your changes have been saved.");
1645 * Display form for Invite, Kick, and show Who Knows a room
1647 void do_invt_kick(void) {
1648 char buf[SIZ], room[SIZ], username[SIZ];
1651 serv_getln(buf, sizeof buf);
1653 if (buf[0] != '2') {
1657 extract_token(room, &buf[4], 0, '|', sizeof room);
1659 strcpy(username, bstr("username"));
1661 if (!strcmp(bstr("sc"), "Kick")) {
1662 sprintf(buf, "KICK %s", username);
1664 serv_getln(buf, sizeof buf);
1666 if (buf[0] != '2') {
1667 strcpy(WC->ImportantMessage, &buf[4]);
1669 sprintf(WC->ImportantMessage,
1670 "<B><I>User %s kicked out of room %s.</I></B>\n",
1675 if (!strcmp(bstr("sc"), "Invite")) {
1676 sprintf(buf, "INVT %s", username);
1678 serv_getln(buf, sizeof buf);
1680 if (buf[0] != '2') {
1681 strcpy(WC->ImportantMessage, &buf[4]);
1683 sprintf(WC->ImportantMessage,
1684 "<B><I>User %s invited to room %s.</I></B>\n",
1695 * Display form for Invite, Kick, and show Who Knows a room
1697 void display_whok(void)
1699 char buf[SIZ], room[SIZ], username[SIZ];
1702 serv_getln(buf, sizeof buf);
1704 if (buf[0] != '2') {
1708 extract_token(room, &buf[4], 0, '|', sizeof room);
1711 wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
1712 "<TD>The users listed below have access to this room. "
1713 "To remove a user from the access list, select the user "
1714 "name from the list and click 'Kick'.<br /><br />");
1716 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1717 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1718 wprintf("<SELECT NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
1720 serv_getln(buf, sizeof buf);
1721 if (buf[0] == '1') {
1722 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1723 extract_token(username, buf, 0, '|', sizeof username);
1724 wprintf("<OPTION>");
1729 wprintf("</SELECT><br />\n");
1731 wprintf("<input type=submit name=sc value=\"Kick\">");
1732 wprintf("</FORM></CENTER>\n");
1735 "To grant another user access to this room, enter the "
1736 "user name in the box below and click 'Invite'.<br /><br />");
1738 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1739 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1740 wprintf("Invite: ");
1741 wprintf("<input type=\"text\" name=\"username\" style=\"width:100%%\"><br />\n"
1742 "<input type=\"hidden\" name=\"sc\" value=\"Invite\">"
1743 "<input type=\"submit\" value=\"Invite\">"
1744 "</FORM></CENTER>\n");
1746 wprintf("</TD></TR></TABLE>\n");
1753 * display the form for entering a new room
1755 void display_entroom(void)
1760 serv_puts("CRE8 0");
1761 serv_getln(buf, sizeof buf);
1763 if (buf[0] != '2') {
1764 strcpy(WC->ImportantMessage, &buf[4]);
1765 display_main_menu();
1769 output_headers(1, 1, 2, 0, 0, 0, 0);
1770 wprintf("<div id=\"banner\">\n"
1771 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1772 "<SPAN CLASS=\"titlebar\">Create a new room</SPAN>"
1773 "</TD></TR></TABLE>\n"
1774 "</div>\n<div id=\"content\">\n"
1777 wprintf("<div id=\"fix_scrollbar_bug\">"
1778 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1780 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"/entroom\">\n");
1782 wprintf("<UL><LI>Name of room: ");
1783 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
1785 wprintf("<LI>Resides on floor: ");
1787 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1788 for (i = 0; i < 128; ++i)
1789 if (strlen(floorlist[i]) > 0) {
1790 wprintf("<OPTION ");
1791 wprintf("VALUE=\"%d\">", i);
1792 escputs(floorlist[i]);
1793 wprintf("</OPTION>\n");
1795 wprintf("</SELECT>\n");
1797 /* Our clever little snippet of JavaScript automatically selects
1798 * a public room if the view is set to Bulletin Board, and it
1799 * selects a mailbox room otherwise. The user can override this,
1802 wprintf("<LI>Default view for room: ");
1803 wprintf("<SELECT NAME=\"er_view\" SIZE=\"1\" OnChange=\""
1804 " if (this.form.er_view.value == 0) { "
1805 " this.form.type[0].checked=true; "
1806 " this.form.er_floor.disabled = false; "
1809 " this.form.type[4].checked=true; "
1810 " this.form.er_floor.disabled = true; "
1813 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
1814 wprintf("<OPTION %s VALUE=\"%d\">",
1815 ((i == 0) ? "SELECTED" : ""), i );
1816 escputs(viewdefs[i]);
1817 wprintf("</OPTION>\n");
1819 wprintf("</SELECT>\n");
1821 wprintf("<LI>Type of room:<UL>\n");
1823 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1824 wprintf("CHECKED OnChange=\""
1825 " if (this.form.type[0].checked == true) { "
1826 " this.form.er_floor.disabled = false; "
1828 "\"> Public (automatically appears to everyone)\n");
1830 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
1831 " if (this.form.type[1].checked == true) { "
1832 " this.form.er_floor.disabled = false; "
1834 "\"> Private - hidden (accessible to anyone who knows its name)\n");
1836 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
1837 " if (this.form.type[2].checked == true) { "
1838 " this.form.er_floor.disabled = false; "
1840 "\"> Private - require password:\n");
1841 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
1843 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
1844 " if (this.form.type[3].checked == true) { "
1845 " this.form.er_floor.disabled = false; "
1847 "\"> Private - invitation only\n");
1849 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"personal\" "
1851 " if (this.form.type[4].checked == true) { "
1852 " this.form.er_floor.disabled = true; "
1854 "\"> Personal (mailbox for you only)\n");
1858 wprintf("<CENTER>\n");
1859 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1861 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1862 wprintf("</CENTER>\n");
1863 wprintf("</FORM>\n<hr />");
1864 serv_printf("MESG roomaccess");
1865 serv_getln(buf, sizeof buf);
1866 if (buf[0] == '1') {
1867 fmout(NULL, "CENTER");
1869 wprintf("</td></tr></table></div>\n");
1877 * support function for entroom() -- sets the default view
1879 void er_set_default_view(int newview) {
1892 serv_getln(buf, sizeof buf);
1893 if (buf[0] != '2') return;
1895 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
1896 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
1897 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
1898 rm_bits1 = extract_int(&buf[4], 3);
1899 rm_floor = extract_int(&buf[4], 4);
1900 rm_listorder = extract_int(&buf[4], 5);
1901 rm_bits2 = extract_int(&buf[4], 7);
1903 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1904 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
1905 rm_listorder, newview, rm_bits2
1907 serv_getln(buf, sizeof buf);
1920 char er_password[SIZ];
1925 if (strcmp(bstr("sc"), "OK")) {
1926 strcpy(WC->ImportantMessage,
1927 "Cancelled. No new room was created.");
1928 display_main_menu();
1931 strcpy(er_name, bstr("er_name"));
1932 strcpy(er_type, bstr("type"));
1933 strcpy(er_password, bstr("er_password"));
1934 er_floor = atoi(bstr("er_floor"));
1935 er_view = atoi(bstr("er_view"));
1938 if (!strcmp(er_type, "hidden"))
1940 if (!strcmp(er_type, "passworded"))
1942 if (!strcmp(er_type, "invonly"))
1944 if (!strcmp(er_type, "personal"))
1947 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
1948 er_name, er_num_type, er_password, er_floor, 0, er_view);
1950 serv_getln(buf, sizeof buf);
1951 if (buf[0] != '2') {
1952 strcpy(WC->ImportantMessage, &buf[4]);
1953 display_main_menu();
1957 do_change_view(er_view); /* Now go there */
1962 * display the screen to enter a private room
1964 void display_private(char *rname, int req_pass)
1966 output_headers(1, 1, 2, 0, 0, 0, 0);
1967 wprintf("<div id=\"banner\">\n"
1968 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1969 "<SPAN CLASS=\"titlebar\">Go to a hidden room</SPAN>"
1970 "</TD></TR></TABLE>\n"
1971 "</div>\n<div id=\"content\">\n"
1974 wprintf("<div id=\"fix_scrollbar_bug\">"
1975 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1977 wprintf("<CENTER>\n");
1978 wprintf("<br />If you know the name of a hidden (guess-name) or\n");
1979 wprintf("passworded room, you can enter that room by typing\n");
1980 wprintf("its name below. Once you gain access to a private\n");
1981 wprintf("room, it will appear in your regular room listings\n");
1982 wprintf("so you don't have to keep returning here.\n");
1983 wprintf("<br /><br />");
1985 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1987 wprintf("<table border=\"0\" cellspacing=\"5\" "
1988 "cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
1990 "Enter room name:</TD><TD>"
1991 "<INPUT TYPE=\"text\" NAME=\"gr_name\" "
1992 "VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1995 wprintf("</TD></TR><TR><TD>");
1996 wprintf("Enter room password:</TD><TD>");
1997 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1999 wprintf("</TD></TR></TABLE><br />\n");
2001 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
2003 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2004 wprintf("</FORM>\n");
2005 wprintf("</td></tr></table></div>\n");
2010 * goto a private room
2012 void goto_private(void)
2017 if (strcasecmp(bstr("sc"), "OK")) {
2018 display_main_menu();
2021 strcpy(hold_rm, WC->wc_roomname);
2022 strcpy(buf, "GOTO ");
2023 strcat(buf, bstr("gr_name"));
2025 strcat(buf, bstr("gr_pass"));
2027 serv_getln(buf, sizeof buf);
2029 if (buf[0] == '2') {
2030 smart_goto(bstr("gr_name"));
2033 if (!strncmp(buf, "540", 3)) {
2034 display_private(bstr("gr_name"), 1);
2037 output_headers(1, 1, 1, 0, 0, 0, 0);
2038 wprintf("%s\n", &buf[4]);
2045 * display the screen to zap a room
2047 void display_zap(void)
2049 output_headers(1, 1, 2, 0, 0, 0, 0);
2051 wprintf("<div id=\"banner\">\n");
2052 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
2053 wprintf("<SPAN CLASS=\"titlebar\">Zap (forget/unsubscribe) the current room</SPAN>\n");
2054 wprintf("</TD></TR></TABLE>\n");
2055 wprintf("</div>\n<div id=\"content\">\n");
2057 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
2058 wprintf("disappear from your room list. Is this what you wish ");
2059 wprintf("to do?<br />\n");
2061 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
2062 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
2064 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2065 wprintf("</FORM>\n");
2076 char final_destination[SIZ];
2078 /* If the forget-room routine fails for any reason, we fall back
2079 * to the current room; otherwise, we go to the Lobby
2081 strcpy(final_destination, WC->wc_roomname);
2083 if (!strcasecmp(bstr("sc"), "OK")) {
2084 serv_printf("GOTO %s", WC->wc_roomname);
2085 serv_getln(buf, sizeof buf);
2086 if (buf[0] == '2') {
2088 serv_getln(buf, sizeof buf);
2089 if (buf[0] == '2') {
2090 strcpy(final_destination, "_BASEROOM_");
2094 smart_goto(final_destination);
2100 * Delete the current room
2102 void delete_room(void)
2106 serv_puts("KILL 1");
2107 serv_getln(buf, sizeof buf);
2108 if (buf[0] != '2') {
2109 strcpy(WC->ImportantMessage, &buf[4]);
2110 display_main_menu();
2113 smart_goto("_BASEROOM_");
2120 * Perform changes to a room's network configuration
2122 void netedit(void) {
2131 if (strlen(bstr("line"))==0) {
2136 strcpy(line, bstr("prefix"));
2137 strcat(line, bstr("line"));
2138 strcat(line, bstr("suffix"));
2147 serv_getln(buf, sizeof buf);
2148 if (buf[0] != '1') {
2154 /* This loop works for add *or* remove. Spiffy, eh? */
2155 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2156 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2157 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2158 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2159 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2160 if ( (strcasecmp(cmpa0, cmpb0))
2161 || (strcasecmp(cmpa1, cmpb1)) ) {
2162 fprintf(fp, "%s\n", buf);
2168 serv_getln(buf, sizeof buf);
2169 if (buf[0] != '4') {
2175 while (fgets(buf, sizeof buf, fp) != NULL) {
2176 buf[strlen(buf)-1] = 0;
2180 if (!strcasecmp(bstr("cmd"), "add")) {
2192 * Convert a room name to a folder-ish-looking name.
2194 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2199 * For mailboxes, just do it straight...
2202 sprintf(folder, "My folders|%s", room);
2206 * Otherwise, prefix the floor name as a "public folders" moniker
2209 sprintf(folder, "%s|%s", floorlist[floor], room);
2213 * Replace "\" characters with "|" for pseudo-folder-delimiting
2215 for (i=0; i<strlen(folder); ++i) {
2216 if (folder[i] == '\\') folder[i] = '|';
2224 * Back end for change_view()
2226 void do_change_view(int newview) {
2229 serv_printf("VIEW %d", newview);
2230 serv_getln(buf, sizeof buf);
2231 WC->wc_view = newview;
2232 smart_goto(WC->wc_roomname);
2238 * Change the view for this room
2240 void change_view(void) {
2243 view = atol(bstr("view"));
2244 do_change_view(view);
2249 * One big expanded tree list view --- like a folder list
2251 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2255 int has_subfolders = 0;
2258 parents = malloc(max_folders * sizeof(int));
2260 /* BEGIN TREE MENU */
2261 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2263 /* include NanoTree */
2264 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2266 /* initialize NanoTree */
2267 wprintf("<script type=\"text/javascript\"> \n"
2268 " showRootNode = false; \n"
2269 " sortNodes = false; \n"
2270 " dragable = false; \n"
2272 " function standardClick(treeNode) { \n"
2275 " var closedGif = 'static/folder_closed.gif'; \n"
2276 " var openGif = 'static/folder_open.gif'; \n"
2278 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2282 for (i=0; i<max_folders; ++i) {
2285 if ((i+1) < max_folders) {
2286 if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
2287 && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
2292 levels = num_tokens(fold[i].name, '|');
2293 parents[levels] = i;
2295 wprintf("var node%d = new TreeNode(%d, '", i, i);
2297 if (fold[i].selectable) {
2298 wprintf("<A HREF=\"/dotgoto?room=");
2299 urlescputs(fold[i].room);
2304 wprintf("<SPAN CLASS=\"roomlist_floor\">");
2306 else if (fold[i].hasnewmsgs) {
2307 wprintf("<SPAN CLASS=\"roomlist_new\">");
2310 wprintf("<SPAN CLASS=\"roomlist_old\">");
2312 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2317 if (has_subfolders) {
2318 wprintf("new Array(closedGif, openGif)");
2320 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2321 wprintf("'static/viewcontacts_16x.gif'");
2323 else if (fold[i].view == VIEW_CALENDAR) {
2324 wprintf("'static/calarea_16x.gif'");
2326 else if (fold[i].view == VIEW_TASKS) {
2327 wprintf("'static/taskmanag_16x.gif'");
2329 else if (fold[i].view == VIEW_NOTES) {
2330 wprintf("'static/storenotes_16x.gif'");
2332 else if (fold[i].view == VIEW_MAILBOX) {
2333 wprintf("'static/privatemess_16x.gif'");
2336 wprintf("'static/chatrooms_16x.gif'");
2339 urlescputs(fold[i].name);
2343 wprintf("rootNode.addChild(node%d);\n", i);
2346 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2350 wprintf("container = document.getElementById('roomlist_div'); \n"
2360 * Boxes and rooms and lists ... oh my!
2362 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2365 int levels, oldlevels;
2368 static int columns = 3;
2369 int boxes_per_column = 0;
2370 int current_column = 0;
2374 while (nf % columns != 0) ++nf;
2375 boxes_per_column = (nf / columns);
2376 if (boxes_per_column < 1) boxes_per_column = 1;
2378 /* Outer table (for columnization) */
2379 wprintf("<TABLE BORDER=0 WIDTH=96%% CELLPADDING=5>"
2380 "<tr><td valign=top>");
2384 for (i=0; i<max_folders; ++i) {
2386 levels = num_tokens(fold[i].name, '|');
2388 if ((levels == 1) && (oldlevels > 1)) {
2391 do_template("endbox");
2394 if ((num_boxes % boxes_per_column) == 0) {
2396 if (current_column < columns) {
2397 wprintf("</td><td valign=top>\n");
2404 /* Begin inner box */
2405 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2406 stresc(boxtitle, buf, 1, 0);
2407 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2408 do_template("beginbox");
2416 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
2417 if (fold[i].selectable) {
2418 wprintf("<A HREF=\"/dotgoto?room=");
2419 urlescputs(fold[i].room);
2425 if (fold[i].hasnewmsgs) {
2426 wprintf("<SPAN CLASS=\"roomlist_new\">");
2429 wprintf("<SPAN CLASS=\"roomlist_old\">");
2431 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2434 if (fold[i].selectable) {
2440 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
2441 wprintf(" (INBOX)");
2443 wprintf("<br />\n");
2446 /* End the final inner box */
2447 do_template("endbox");
2449 wprintf("</TD></TR></TABLE>\n");
2454 * Show the room list. (only should get called by
2455 * knrooms() because that's where output_headers() is called from)
2458 void list_all_rooms_by_floor(char *viewpref) {
2461 struct folder *fold = NULL;
2463 int max_folders = 0;
2464 int alloc_folders = 0;
2468 int num_floors = 1; /* add an extra one for private folders */
2470 /* Start with the mailboxes */
2473 fold = malloc(sizeof(struct folder));
2474 memset(fold, 0, sizeof(struct folder));
2475 strcpy(fold[0].name, "My folders");
2476 fold[0].is_mailbox = 1;
2478 /* Then add floors */
2480 serv_getln(buf, sizeof buf);
2481 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2482 if (max_folders >= alloc_folders) {
2483 alloc_folders = max_folders + 100;
2484 fold = realloc(fold,
2485 alloc_folders * sizeof(struct folder));
2487 memset(&fold[max_folders], 0, sizeof(struct folder));
2488 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
2495 serv_getln(buf, sizeof buf);
2496 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2497 if (max_folders >= alloc_folders) {
2498 alloc_folders = max_folders + 100;
2499 fold = realloc(fold,
2500 alloc_folders * sizeof(struct folder));
2502 memset(&fold[max_folders], 0, sizeof(struct folder));
2503 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
2504 ra_flags = extract_int(buf, 5);
2505 flags = extract_int(buf, 1);
2506 fold[max_folders].floor = extract_int(buf, 2);
2507 fold[max_folders].hasnewmsgs =
2508 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
2509 if (flags & QR_MAILBOX) {
2510 fold[max_folders].is_mailbox = 1;
2512 fold[max_folders].view = extract_int(buf, 6);
2513 room_to_folder(fold[max_folders].name,
2514 fold[max_folders].room,
2515 fold[max_folders].floor,
2516 fold[max_folders].is_mailbox);
2517 fold[max_folders].selectable = 1;
2521 /* Bubble-sort the folder list */
2522 for (i=0; i<max_folders; ++i) {
2523 for (j=0; j<(max_folders-1)-i; ++j) {
2524 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
2525 swap = strcasecmp(fold[j].name, fold[j+1].name);
2528 if ( (fold[j+1].is_mailbox)
2529 && (!fold[j].is_mailbox)) {
2537 memcpy(&ftmp, &fold[j], sizeof(struct folder));
2538 memcpy(&fold[j], &fold[j+1],
2539 sizeof(struct folder));
2540 memcpy(&fold[j+1], &ftmp,
2541 sizeof(struct folder));
2546 /* test only hackish view
2547 wprintf("<table><TR><TD>A Table</TD></TR></table>\n");
2548 for (i=0; i<max_folders; ++i) {
2549 escputs(fold[i].name);
2550 wprintf("<br />\n");
2554 if (!strcasecmp(viewpref, "folders")) {
2555 do_folder_view(fold, max_folders, num_floors);
2558 do_rooms_view(fold, max_folders, num_floors);
2566 /* Do either a known rooms list or a folders list, depending on the
2570 char listviewpref[SIZ];
2572 output_headers(1, 1, 2, 0, 0, 0, 0);
2575 /* Determine whether the user is trying to change views */
2576 if (bstr("view") != NULL) {
2577 if (strlen(bstr("view")) > 0) {
2578 set_preference("roomlistview", bstr("view"), 1);
2582 get_preference("roomlistview", listviewpref, sizeof listviewpref);
2584 if ( (strcasecmp(listviewpref, "folders"))
2585 && (strcasecmp(listviewpref, "table")) ) {
2586 strcpy(listviewpref, "rooms");
2590 wprintf("<div id=\"banner\">\n"
2591 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
2592 "<SPAN CLASS=\"titlebar\">"
2594 if (!strcasecmp(listviewpref, "rooms")) {
2595 wprintf("Room list");
2597 if (!strcasecmp(listviewpref, "folders")) {
2598 wprintf("Folder list");
2600 if (!strcasecmp(listviewpref, "table")) {
2601 wprintf("Room list");
2603 wprintf("</SPAN></TD>\n");
2605 /* offer the ability to switch views */
2606 wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
2607 "<SELECT NAME=\"newview\" SIZE=\"1\" "
2608 "OnChange=\"location.href=roomlistomatic.newview.options"
2609 "[selectedIndex].value\">\n");
2611 wprintf("<OPTION %s VALUE=\"/knrooms&view=rooms\">"
2614 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
2617 wprintf("<OPTION %s VALUE=\"/knrooms&view=folders\">"
2618 "View as folder list"
2620 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
2623 wprintf("</SELECT><br />");
2625 wprintf("</FORM></TD></TR></TABLE>\n");
2628 "<div id=\"content\">\n");
2630 /* Display the room list in the user's preferred format */
2631 list_all_rooms_by_floor(listviewpref);
2637 * Set the message expire policy for this room and/or floor
2639 void set_room_policy(void) {
2642 if (strcmp(bstr("sc"), "OK")) {
2643 strcpy(WC->ImportantMessage,
2644 "Cancelled. Changes were not saved.");
2649 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
2650 serv_getln(buf, sizeof buf);
2651 strcpy(WC->ImportantMessage, &buf[4]);
2653 if (WC->axlevel >= 6) {
2654 strcat(WC->ImportantMessage, "<br />\n");
2655 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
2656 serv_getln(buf, sizeof buf);
2657 strcat(WC->ImportantMessage, &buf[4]);