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 void gotoroom(char *gname)
573 static long ls = (-1L);
575 /* store ungoto information */
576 strcpy(WC->ugname, WC->wc_roomname);
579 /* move to the new room */
580 serv_printf("GOTO %s", gname);
581 serv_getln(buf, sizeof buf);
583 serv_puts("GOTO _BASEROOM_");
584 serv_getln(buf, sizeof buf);
589 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
590 WC->room_flags = extract_int(&buf[4], 4);
591 /* highest_msg_read = extract_int(&buf[4],6);
592 maxmsgnum = extract_int(&buf[4],5);
593 is_mail = (char) extract_int(&buf[4],7); */
594 ls = extract_long(&buf[4], 6);
595 WC->wc_floor = extract_int(&buf[4], 10);
596 WC->wc_view = extract_int(&buf[4], 11);
597 WC->wc_default_view = extract_int(&buf[4], 12);
600 WC->is_room_aide = WC->is_aide;
602 WC->is_room_aide = (char) extract_int(&buf[4], 8);
604 remove_march(WC->wc_roomname);
605 if (!strcasecmp(gname, "_BASEROOM_"))
611 * Locate the room on the march list which we most want to go to. Each room
612 * is measured given a "weight" of preference based on various factors.
614 char *pop_march(int desired_floor)
616 static char TheRoom[128];
618 int TheOrder = 32767;
621 struct march *mptr = NULL;
623 strcpy(TheRoom, "_BASEROOM_");
624 if (WC->march == NULL)
627 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
629 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
630 weight = weight + 10000;
631 if (mptr->march_floor == desired_floor)
632 weight = weight + 5000;
634 weight = weight + ((128 - (mptr->march_floor)) * 128);
635 weight = weight + (128 - (mptr->march_order));
637 if (weight > TheWeight) {
639 strcpy(TheRoom, mptr->march_name);
640 TheFloor = mptr->march_floor;
641 TheOrder = mptr->march_order;
649 /* Goto next room having unread messages.
650 * We want to skip over rooms that the user has already been to, and take the
651 * user back to the lobby when done. The room we end up in is placed in
652 * newroom - which is set to 0 (the lobby) initially.
653 * We start the search in the current room rather than the beginning to prevent
654 * two or more concurrent users from dragging each other back to the same room.
659 struct march *mptr, *mptr2;
662 /* First check to see if the march-mode list is already allocated.
663 * If it is, pop the first room off the list and go there.
666 if (WC->march == NULL) {
668 serv_getln(buf, sizeof buf);
670 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
671 mptr = (struct march *) malloc(sizeof(struct march));
673 extract_token(mptr->march_name, buf, 0, '|', sizeof mptr->march_name);
674 mptr->march_floor = extract_int(buf, 2);
675 mptr->march_order = extract_int(buf, 3);
676 if (WC->march == NULL) {
680 while (mptr2->next != NULL)
685 /* add _BASEROOM_ to the end of the march list, so the user will end up
686 * in the system base room (usually the Lobby>) at the end of the loop
688 mptr = (struct march *) malloc(sizeof(struct march));
690 strcpy(mptr->march_name, "_BASEROOM_");
691 if (WC->march == NULL) {
695 while (mptr2->next != NULL)
700 * ...and remove the room we're currently in, so a <G>oto doesn't make us
701 * walk around in circles
703 remove_march(WC->wc_roomname);
705 if (WC->march != NULL) {
706 strcpy(next_room, pop_march(-1));
708 strcpy(next_room, "_BASEROOM_");
712 smart_goto(next_room);
716 void smart_goto(char *next_room) {
724 * mark all messages in current room as having been read
726 void slrp_highest(void)
731 serv_puts("SLRP HIGHEST");
732 serv_getln(buf, sizeof buf);
734 wprintf("<EM>%s</EM><br />\n", &buf[4]);
741 * un-goto the previous room
747 if (!strcmp(WC->ugname, "")) {
748 smart_goto(WC->wc_roomname);
751 serv_printf("GOTO %s", WC->ugname);
752 serv_getln(buf, sizeof buf);
754 smart_goto(WC->wc_roomname);
757 if (WC->uglsn >= 0L) {
758 serv_printf("SLRP %ld", WC->uglsn);
759 serv_getln(buf, sizeof buf);
761 strcpy(buf, WC->ugname);
762 strcpy(WC->ugname, "");
771 * Set/clear/read the "self-service list subscribe" flag for a room
773 * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged.
774 * Always returns the new value.
777 int self_service(int newval) {
778 int current_value = 0;
784 int flags, floor, order, view, flags2;
787 serv_getln(buf, sizeof buf);
788 if (buf[0] != '2') return(0);
790 extract_token(name, &buf[4], 0, '|', sizeof name);
791 extract_token(password, &buf[4], 1, '|', sizeof password);
792 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
793 flags = extract_int(&buf[4], 3);
794 floor = extract_int(&buf[4], 4);
795 order = extract_int(&buf[4], 5);
796 view = extract_int(&buf[4], 6);
797 flags2 = extract_int(&buf[4], 7);
799 if (flags2 & QR2_SELFLIST) {
807 flags2 = flags2 | QR2_SELFLIST;
809 else if (newval == 0) {
810 flags2 = flags2 & ~QR2_SELFLIST;
813 return(current_value);
816 if (newval != current_value) {
817 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
818 name, password, dirname, flags,
819 floor, order, view, flags2);
820 serv_getln(buf, sizeof buf);
833 * display the form for editing a room
835 void display_editroom(void)
840 char remote_room[SIZ];
843 char er_password[10];
845 char er_roomaide[26];
851 char *not_shared_with;
858 if (strlen(tab) == 0) tab = "admin";
862 serv_getln(buf, sizeof buf);
865 strcpy(WC->ImportantMessage, &buf[4]);
869 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
870 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
871 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
872 er_flags = extract_int(&buf[4], 3);
873 er_floor = extract_int(&buf[4], 4);
875 output_headers(1, 1, 1, 0, 0, 0, 0);
877 /* print the tabbed dialog */
879 "<div id=\"fix_scrollbar_bug\">"
880 "<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
882 "<TD> </TD>\n");
884 if (!strcmp(tab, "admin")) {
885 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
888 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=admin\">");
890 wprintf("Administration");
891 if (!strcmp(tab, "admin")) {
892 wprintf("</SPAN></TD>\n");
895 wprintf("</A></TD>\n");
898 wprintf("<TD> </TD>\n");
900 if (!strcmp(tab, "config")) {
901 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
904 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=config\">");
906 wprintf("Configuration");
907 if (!strcmp(tab, "config")) {
908 wprintf("</SPAN></TD>\n");
911 wprintf("</A></TD>\n");
914 wprintf("<TD> </TD>\n");
916 if (!strcmp(tab, "expire")) {
917 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
920 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=expire\">");
922 wprintf("Message expire policy");
923 if (!strcmp(tab, "expire")) {
924 wprintf("</SPAN></TD>\n");
927 wprintf("</A></TD>\n");
930 wprintf("<TD> </TD>\n");
932 if (!strcmp(tab, "access")) {
933 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
936 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=access\">");
938 wprintf("Access controls");
939 if (!strcmp(tab, "access")) {
940 wprintf("</SPAN></TD>\n");
943 wprintf("</A></TD>\n");
946 wprintf("<TD> </TD>\n");
948 if (!strcmp(tab, "sharing")) {
949 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
952 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=sharing\">");
955 if (!strcmp(tab, "sharing")) {
956 wprintf("</SPAN></TD>\n");
959 wprintf("</A></TD>\n");
962 wprintf("<TD> </TD>\n");
964 if (!strcmp(tab, "listserv")) {
965 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
968 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=listserv\">");
970 wprintf("Mailing list service");
971 if (!strcmp(tab, "listserv")) {
972 wprintf("</SPAN></TD>\n");
975 wprintf("</A></TD>\n");
978 wprintf("<TD> </TD>\n");
980 wprintf("</TR></TABLE></div>\n");
981 /* end tabbed dialog */
983 /* begin content of whatever tab is open now */
984 wprintf("<div id=\"fix_scrollbar_bug\">"
985 "<TABLE border=0 width=100%% bgcolor=\"#FFFFFF\">\n"
988 if (!strcmp(tab, "admin")) {
990 "<LI><A HREF=\"/delete_room\" "
991 "onClick=\"return confirm('Are you sure you want to delete this room?');\">\n"
992 "Delete this room</A>\n"
993 "<LI><A HREF=\"/display_editroompic\">\n"
994 "Set or change the icon for this room's banner</A>\n"
995 "<LI><A HREF=\"/display_editinfo\">\n"
996 "Edit this room's Info file</A>\n"
1000 if (!strcmp(tab, "config")) {
1001 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
1003 wprintf("<UL><LI>Name of room: ");
1004 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
1006 wprintf("<LI>Resides on floor: ");
1007 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1008 for (i = 0; i < 128; ++i)
1009 if (strlen(floorlist[i]) > 0) {
1010 wprintf("<OPTION ");
1012 wprintf("SELECTED ");
1013 wprintf("VALUE=\"%d\">", i);
1014 escputs(floorlist[i]);
1015 wprintf("</OPTION>\n");
1017 wprintf("</SELECT>\n");
1019 wprintf("<LI>Type of room:<UL>\n");
1021 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1022 if ((er_flags & QR_PRIVATE) == 0)
1023 wprintf("CHECKED ");
1024 wprintf("> Public room\n");
1026 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1027 if ((er_flags & QR_PRIVATE) &&
1028 (er_flags & QR_GUESSNAME))
1029 wprintf("CHECKED ");
1030 wprintf("> Private - guess name\n");
1032 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1033 if ((er_flags & QR_PRIVATE) &&
1034 (er_flags & QR_PASSWORDED))
1035 wprintf("CHECKED ");
1036 wprintf("> Private - require password:\n");
1037 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
1039 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1040 if ((er_flags & QR_PRIVATE)
1041 && ((er_flags & QR_GUESSNAME) == 0)
1042 && ((er_flags & QR_PASSWORDED) == 0))
1043 wprintf("CHECKED ");
1044 wprintf("> Private - invitation only\n");
1046 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1047 wprintf("> If private, cause current users to forget room\n");
1051 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1052 if (er_flags & QR_PREFONLY)
1053 wprintf("CHECKED ");
1054 wprintf("> Preferred users only\n");
1056 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1057 if (er_flags & QR_READONLY)
1058 wprintf("CHECKED ");
1059 wprintf("> Read-only room\n");
1061 /* directory stuff */
1062 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1063 if (er_flags & QR_DIRECTORY)
1064 wprintf("CHECKED ");
1065 wprintf("> File directory room\n");
1067 wprintf("<UL><LI>Directory name: ");
1068 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
1070 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1071 if (er_flags & QR_UPLOAD)
1072 wprintf("CHECKED ");
1073 wprintf("> Uploading allowed\n");
1075 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1076 if (er_flags & QR_DOWNLOAD)
1077 wprintf("CHECKED ");
1078 wprintf("> Downloading allowed\n");
1080 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1081 if (er_flags & QR_VISDIR)
1082 wprintf("CHECKED ");
1083 wprintf("> Visible directory</UL>\n");
1085 /* end of directory stuff */
1087 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1088 if (er_flags & QR_NETWORK)
1089 wprintf("CHECKED ");
1090 wprintf("> Network shared room\n");
1092 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1093 if (er_flags & QR_PERMANENT)
1094 wprintf("CHECKED ");
1095 wprintf("> Permanent (does not auto-purge)\n");
1097 /* start of anon options */
1099 wprintf("<LI>Anonymous messages<UL>\n");
1101 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1102 if (((er_flags & QR_ANONONLY) == 0)
1103 && ((er_flags & QR_ANONOPT) == 0))
1104 wprintf("CHECKED ");
1105 wprintf("> No anonymous messages\n");
1107 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1108 if (er_flags & QR_ANONONLY)
1109 wprintf("CHECKED ");
1110 wprintf("> All messages are anonymous\n");
1112 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1113 if (er_flags & QR_ANONOPT)
1114 wprintf("CHECKED ");
1115 wprintf("> Prompt user when entering messages</UL>\n");
1117 /* end of anon options */
1119 wprintf("<LI>Room aide: \n");
1121 serv_getln(buf, sizeof buf);
1122 if (buf[0] != '2') {
1123 wprintf("<EM>%s</EM>\n", &buf[4]);
1125 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1126 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1129 wprintf("</UL><CENTER>\n");
1130 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1131 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1133 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
1139 /* Sharing the room with other Citadel nodes... */
1140 if (!strcmp(tab, "sharing")) {
1142 shared_with = strdup("");
1143 not_shared_with = strdup("");
1145 /* Learn the current configuration */
1146 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1147 serv_getln(buf, sizeof buf);
1148 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1149 extract_token(node, buf, 0, '|', sizeof node);
1150 not_shared_with = realloc(not_shared_with,
1151 strlen(not_shared_with) + 32);
1152 strcat(not_shared_with, node);
1153 strcat(not_shared_with, "\n");
1157 serv_getln(buf, sizeof buf);
1158 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1159 extract_token(cmd, buf, 0, '|', sizeof cmd);
1160 extract_token(node, buf, 1, '|', sizeof node);
1161 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1162 if (!strcasecmp(cmd, "ignet_push_share")) {
1163 shared_with = realloc(shared_with,
1164 strlen(shared_with) + 32);
1165 strcat(shared_with, node);
1166 if (strlen(remote_room) > 0) {
1167 strcat(shared_with, "|");
1168 strcat(shared_with, remote_room);
1170 strcat(shared_with, "\n");
1174 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1175 extract_token(buf, shared_with, i, '\n', sizeof buf);
1176 extract_token(node, buf, 0, '|', sizeof node);
1177 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1178 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1179 if (!strcasecmp(node, cmd)) {
1180 remove_token(not_shared_with, j, '\n');
1185 /* Display the stuff */
1186 wprintf("<CENTER><br />"
1187 "<TABLE border=1 cellpadding=5><TR>"
1188 "<TD><B><I>Shared with</I></B></TD>"
1189 "<TD><B><I>Not shared with</I></B></TD></TR>\n"
1190 "<TR><TD VALIGN=TOP>\n");
1192 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1193 "<TD>Remote node name</TD>"
1194 "<TD>Remote room name</TD>"
1199 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1200 extract_token(buf, shared_with, i, '\n', sizeof buf);
1201 extract_token(node, buf, 0, '|', sizeof node);
1202 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1203 if (strlen(node) > 0) {
1204 wprintf("<FORM METHOD=\"POST\" "
1205 "ACTION=\"/netedit\">"
1206 "<TR><TD>%s</TD>\n", node);
1209 if (strlen(remote_room) > 0) {
1210 escputs(remote_room);
1216 wprintf("<INPUT TYPE=\"hidden\" NAME=\"line\" "
1217 "VALUE=\"ignet_push_share|");
1219 if (strlen(remote_room) > 0) {
1221 urlescputs(remote_room);
1224 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1225 "VALUE=\"sharing\">\n");
1226 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1227 "VALUE=\"remove\">\n");
1228 wprintf("<INPUT TYPE=\"submit\" "
1229 "NAME=\"sc\" VALUE=\"Unshare\">");
1230 wprintf("</TD></TR></FORM>\n");
1234 wprintf("</TABLE>\n");
1235 wprintf("</TD><TD VALIGN=TOP>\n");
1236 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1237 "<TD>Remote node name</TD>"
1238 "<TD>Remote room name</TD>"
1243 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1244 extract_token(node, not_shared_with, i, '\n', sizeof node);
1245 if (strlen(node) > 0) {
1246 wprintf("<FORM METHOD=\"POST\" "
1247 "ACTION=\"/netedit\">"
1251 "<INPUT TYPE=\"INPUT\" "
1255 wprintf("<INPUT TYPE=\"hidden\" "
1257 "VALUE=\"ignet_push_share|");
1260 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1261 "VALUE=\"sharing\">\n");
1262 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1263 "VALUE=\"add\">\n");
1264 wprintf("<INPUT TYPE=\"submit\" "
1265 "NAME=\"sc\" VALUE=\"Share\">");
1266 wprintf("</TD></TR></FORM>\n");
1270 wprintf("</TABLE>\n");
1271 wprintf("</TD></TR>"
1272 "</TABLE></CENTER><br />\n"
1273 "<I><B>Notes:</B><UL><LI>When sharing a room, "
1274 "it must be shared from both ends. Adding a node to "
1275 "the 'shared' list sends messages out, but in order to"
1276 " receive messages, the other nodes must be configured"
1277 " to send messages out to your system as well.\n"
1278 "<LI>If the remote room name is blank, it is assumed "
1279 "that the room name is identical on the remote node."
1280 "<LI>If the remote room name is different, the remote "
1281 "node must also configure the name of the room here."
1287 /* Mailing list management */
1288 if (!strcmp(tab, "listserv")) {
1290 wprintf("<br /><center>"
1291 "<TABLE BORDER=0 WIDTH=100%% CELLPADDING=5>"
1292 "<TR><TD VALIGN=TOP>");
1294 wprintf("<i>The contents of this room are being "
1295 "mailed <b>as individual messages</b> "
1296 "to the following list recipients:"
1297 "</i><br /><br />\n");
1300 serv_getln(buf, sizeof buf);
1301 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1302 extract_token(cmd, buf, 0, '|', sizeof cmd);
1303 if (!strcasecmp(cmd, "listrecp")) {
1304 extract_token(recp, buf, 1, '|', sizeof recp);
1307 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1310 wprintf("&tab=listserv\">(remove)</A><br />");
1314 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1315 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1316 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1317 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1318 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1319 wprintf("</FORM>\n");
1321 wprintf("</TD><TD VALIGN=TOP>\n");
1323 wprintf("<i>The contents of this room are being "
1324 "mailed <b>in digest form</b> "
1325 "to the following list recipients:"
1326 "</i><br /><br />\n");
1329 serv_getln(buf, sizeof buf);
1330 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1331 extract_token(cmd, buf, 0, '|', sizeof cmd);
1332 if (!strcasecmp(cmd, "digestrecp")) {
1333 extract_token(recp, buf, 1, '|', sizeof recp);
1336 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1339 wprintf("&tab=listserv\">(remove)</A><br />");
1343 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1344 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1345 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1346 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1347 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1348 wprintf("</FORM>\n");
1350 wprintf("</TD></TR></TABLE><hr />\n");
1352 if (self_service(999) == 1) {
1353 wprintf("This room is configured to allow "
1354 "self-service subscribe/unsubscribe requests."
1355 " <A HREF=\"/toggle_self_service?newval=0&"
1357 "Click to disable.</A><br />\n"
1358 "The URL for subscribe/unsubscribe is: "
1359 "<TT>http://%s/listsub</TT><br />\n",
1364 wprintf("This room is <i>not</i> configured to allow "
1365 "self-service subscribe/unsubscribe requests."
1366 " <A HREF=\"/toggle_self_service?newval=1&"
1368 "Click to enable.</A><br />\n"
1373 wprintf("</CENTER>\n");
1377 /* Mailing list management */
1378 if (!strcmp(tab, "expire")) {
1380 serv_puts("GPEX room");
1381 serv_getln(buf, sizeof buf);
1382 if (buf[0] == '2') {
1383 roompolicy = extract_int(&buf[4], 0);
1384 roomvalue = extract_int(&buf[4], 1);
1387 serv_puts("GPEX floor");
1388 serv_getln(buf, sizeof buf);
1389 if (buf[0] == '2') {
1390 floorpolicy = extract_int(&buf[4], 0);
1391 floorvalue = extract_int(&buf[4], 1);
1394 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/set_room_policy\">\n");
1395 wprintf("<TABLE border=0 cellspacing=5>\n");
1396 wprintf("<TR><TD>Message expire policy for this room<br />(");
1397 escputs(WC->wc_roomname);
1398 wprintf(")</TD><TD>");
1399 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1400 ((roompolicy == 0) ? "CHECKED" : "") );
1401 wprintf("Use the default policy for this floor<br />\n");
1402 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1403 ((roompolicy == 1) ? "CHECKED" : "") );
1404 wprintf("Never automatically expire messages<br />\n");
1405 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1406 ((roompolicy == 2) ? "CHECKED" : "") );
1407 wprintf("Expire by message count<br />\n");
1408 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1409 ((roompolicy == 3) ? "CHECKED" : "") );
1410 wprintf("Expire by message age<br />");
1411 wprintf("Number of messages or days: ");
1412 wprintf("<INPUT TYPE=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1413 wprintf("</TD></TR>\n");
1415 if (WC->axlevel >= 6) {
1416 wprintf("<TR><TD COLSPAN=2><hr /></TD></TR>\n");
1417 wprintf("<TR><TD>Message expire policy for this floor<br />(");
1418 escputs(floorlist[WC->wc_floor]);
1419 wprintf(")</TD><TD>");
1420 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1421 ((floorpolicy == 0) ? "CHECKED" : "") );
1422 wprintf("Use the system default<br />\n");
1423 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1424 ((floorpolicy == 1) ? "CHECKED" : "") );
1425 wprintf("Never automatically expire messages<br />\n");
1426 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1427 ((floorpolicy == 2) ? "CHECKED" : "") );
1428 wprintf("Expire by message count<br />\n");
1429 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1430 ((floorpolicy == 3) ? "CHECKED" : "") );
1431 wprintf("Expire by message age<br />");
1432 wprintf("Number of messages or days: ");
1433 wprintf("<INPUT TYPE=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1437 wprintf("<CENTER>\n");
1438 wprintf("<TR><TD COLSPAN=2><hr /><CENTER>\n");
1439 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1441 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1442 wprintf("</CENTER></TD><TR>\n");
1444 wprintf("</TABLE>\n"
1445 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1451 /* Mailing list management */
1452 if (!strcmp(tab, "access")) {
1456 /* end content of whatever tab is open now */
1457 wprintf("</TD></TR></TABLE></div>\n");
1464 * Toggle self-service list subscription
1466 void toggle_self_service(void) {
1469 newval = atoi(bstr("newval"));
1470 self_service(newval);
1477 * save new parameters for a room
1483 char er_password[10];
1484 char er_dirname[15];
1485 char er_roomaide[26];
1491 if (strcmp(bstr("sc"), "OK")) {
1492 strcpy(WC->ImportantMessage,
1493 "Cancelled. Changes were not saved.");
1498 serv_getln(buf, sizeof buf);
1500 if (buf[0] != '2') {
1501 strcpy(WC->ImportantMessage, &buf[4]);
1505 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1506 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1507 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1508 er_flags = extract_int(&buf[4], 3);
1510 strcpy(er_roomaide, bstr("er_roomaide"));
1511 if (strlen(er_roomaide) == 0) {
1513 serv_getln(buf, sizeof buf);
1514 if (buf[0] != '2') {
1515 strcpy(er_roomaide, "");
1517 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1520 strcpy(buf, bstr("er_name"));
1522 if (strlen(buf) > 0)
1523 strcpy(er_name, buf);
1525 strcpy(buf, bstr("er_password"));
1527 if (strlen(buf) > 0)
1528 strcpy(er_password, buf);
1530 strcpy(buf, bstr("er_dirname"));
1532 if (strlen(buf) > 0)
1533 strcpy(er_dirname, buf);
1535 strcpy(buf, bstr("type"));
1536 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
1538 if (!strcmp(buf, "invonly")) {
1539 er_flags |= (QR_PRIVATE);
1541 if (!strcmp(buf, "hidden")) {
1542 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
1544 if (!strcmp(buf, "passworded")) {
1545 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
1547 if (!strcmp(bstr("prefonly"), "yes")) {
1548 er_flags |= QR_PREFONLY;
1550 er_flags &= ~QR_PREFONLY;
1553 if (!strcmp(bstr("readonly"), "yes")) {
1554 er_flags |= QR_READONLY;
1556 er_flags &= ~QR_READONLY;
1559 if (!strcmp(bstr("permanent"), "yes")) {
1560 er_flags |= QR_PERMANENT;
1562 er_flags &= ~QR_PERMANENT;
1565 if (!strcmp(bstr("network"), "yes")) {
1566 er_flags |= QR_NETWORK;
1568 er_flags &= ~QR_NETWORK;
1571 if (!strcmp(bstr("directory"), "yes")) {
1572 er_flags |= QR_DIRECTORY;
1574 er_flags &= ~QR_DIRECTORY;
1577 if (!strcmp(bstr("ulallowed"), "yes")) {
1578 er_flags |= QR_UPLOAD;
1580 er_flags &= ~QR_UPLOAD;
1583 if (!strcmp(bstr("dlallowed"), "yes")) {
1584 er_flags |= QR_DOWNLOAD;
1586 er_flags &= ~QR_DOWNLOAD;
1589 if (!strcmp(bstr("visdir"), "yes")) {
1590 er_flags |= QR_VISDIR;
1592 er_flags &= ~QR_VISDIR;
1595 strcpy(buf, bstr("anon"));
1597 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
1598 if (!strcmp(buf, "anononly"))
1599 er_flags |= QR_ANONONLY;
1600 if (!strcmp(buf, "anon2"))
1601 er_flags |= QR_ANONOPT;
1604 if (!strcmp(bstr("bump"), "yes"))
1607 er_floor = atoi(bstr("er_floor"));
1609 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
1610 er_name, er_password, er_dirname, er_flags, bump, er_floor);
1612 serv_getln(buf, sizeof buf);
1613 if (buf[0] != '2') {
1614 strcpy(WC->ImportantMessage, &buf[4]);
1620 if (strlen(er_roomaide) > 0) {
1621 sprintf(buf, "SETA %s", er_roomaide);
1623 serv_getln(buf, sizeof buf);
1624 if (buf[0] != '2') {
1625 strcpy(WC->ImportantMessage, &buf[4]);
1626 display_main_menu();
1631 strcpy(WC->ImportantMessage, "Your changes have been saved.");
1638 * Display form for Invite, Kick, and show Who Knows a room
1640 void do_invt_kick(void) {
1641 char buf[SIZ], room[SIZ], username[SIZ];
1644 serv_getln(buf, sizeof buf);
1646 if (buf[0] != '2') {
1650 extract_token(room, &buf[4], 0, '|', sizeof room);
1652 strcpy(username, bstr("username"));
1654 if (!strcmp(bstr("sc"), "Kick")) {
1655 sprintf(buf, "KICK %s", username);
1657 serv_getln(buf, sizeof buf);
1659 if (buf[0] != '2') {
1660 strcpy(WC->ImportantMessage, &buf[4]);
1662 sprintf(WC->ImportantMessage,
1663 "<B><I>User %s kicked out of room %s.</I></B>\n",
1668 if (!strcmp(bstr("sc"), "Invite")) {
1669 sprintf(buf, "INVT %s", username);
1671 serv_getln(buf, sizeof buf);
1673 if (buf[0] != '2') {
1674 strcpy(WC->ImportantMessage, &buf[4]);
1676 sprintf(WC->ImportantMessage,
1677 "<B><I>User %s invited to room %s.</I></B>\n",
1688 * Display form for Invite, Kick, and show Who Knows a room
1690 void display_whok(void)
1692 char buf[SIZ], room[SIZ], username[SIZ];
1695 serv_getln(buf, sizeof buf);
1697 if (buf[0] != '2') {
1701 extract_token(room, &buf[4], 0, '|', sizeof room);
1704 wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
1705 "<TD>The users listed below have access to this room. "
1706 "To remove a user from the access list, select the user "
1707 "name from the list and click 'Kick'.<br /><br />");
1709 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1710 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1711 wprintf("<SELECT NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
1713 serv_getln(buf, sizeof buf);
1714 if (buf[0] == '1') {
1715 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1716 extract_token(username, buf, 0, '|', sizeof username);
1717 wprintf("<OPTION>");
1722 wprintf("</SELECT><br />\n");
1724 wprintf("<input type=submit name=sc value=\"Kick\">");
1725 wprintf("</FORM></CENTER>\n");
1728 "To grant another user access to this room, enter the "
1729 "user name in the box below and click 'Invite'.<br /><br />");
1731 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1732 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1733 wprintf("Invite: ");
1734 wprintf("<input type=\"text\" name=\"username\" style=\"width:100%%\"><br />\n"
1735 "<input type=\"hidden\" name=\"sc\" value=\"Invite\">"
1736 "<input type=\"submit\" value=\"Invite\">"
1737 "</FORM></CENTER>\n");
1739 wprintf("</TD></TR></TABLE>\n");
1746 * display the form for entering a new room
1748 void display_entroom(void)
1753 serv_puts("CRE8 0");
1754 serv_getln(buf, sizeof buf);
1756 if (buf[0] != '2') {
1757 strcpy(WC->ImportantMessage, &buf[4]);
1758 display_main_menu();
1762 output_headers(1, 1, 2, 0, 0, 0, 0);
1763 wprintf("<div id=\"banner\">\n"
1764 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1765 "<SPAN CLASS=\"titlebar\">Create a new room</SPAN>"
1766 "</TD></TR></TABLE>\n"
1767 "</div>\n<div id=\"content\">\n"
1770 wprintf("<div id=\"fix_scrollbar_bug\">"
1771 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1773 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"/entroom\">\n");
1775 wprintf("<UL><LI>Name of room: ");
1776 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
1778 wprintf("<LI>Resides on floor: ");
1780 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1781 for (i = 0; i < 128; ++i)
1782 if (strlen(floorlist[i]) > 0) {
1783 wprintf("<OPTION ");
1784 wprintf("VALUE=\"%d\">", i);
1785 escputs(floorlist[i]);
1786 wprintf("</OPTION>\n");
1788 wprintf("</SELECT>\n");
1790 /* Our clever little snippet of JavaScript automatically selects
1791 * a public room if the view is set to Bulletin Board, and it
1792 * selects a mailbox room otherwise. The user can override this,
1795 wprintf("<LI>Default view for room: ");
1796 wprintf("<SELECT NAME=\"er_view\" SIZE=\"1\" OnChange=\""
1797 " if (this.form.er_view.value == 0) { "
1798 " this.form.type[0].checked=true; "
1799 " this.form.er_floor.disabled = false; "
1802 " this.form.type[4].checked=true; "
1803 " this.form.er_floor.disabled = true; "
1806 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
1807 wprintf("<OPTION %s VALUE=\"%d\">",
1808 ((i == 0) ? "SELECTED" : ""), i );
1809 escputs(viewdefs[i]);
1810 wprintf("</OPTION>\n");
1812 wprintf("</SELECT>\n");
1814 wprintf("<LI>Type of room:<UL>\n");
1816 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1817 wprintf("CHECKED OnChange=\""
1818 " if (this.form.type[0].checked == true) { "
1819 " this.form.er_floor.disabled = false; "
1821 "\"> Public (automatically appears to everyone)\n");
1823 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
1824 " if (this.form.type[1].checked == true) { "
1825 " this.form.er_floor.disabled = false; "
1827 "\"> Private - hidden (accessible to anyone who knows its name)\n");
1829 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
1830 " if (this.form.type[2].checked == true) { "
1831 " this.form.er_floor.disabled = false; "
1833 "\"> Private - require password:\n");
1834 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
1836 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
1837 " if (this.form.type[3].checked == true) { "
1838 " this.form.er_floor.disabled = false; "
1840 "\"> Private - invitation only\n");
1842 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"personal\" "
1844 " if (this.form.type[4].checked == true) { "
1845 " this.form.er_floor.disabled = true; "
1847 "\"> Personal (mailbox for you only)\n");
1851 wprintf("<CENTER>\n");
1852 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1854 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1855 wprintf("</CENTER>\n");
1856 wprintf("</FORM>\n<hr />");
1857 serv_printf("MESG roomaccess");
1858 serv_getln(buf, sizeof buf);
1859 if (buf[0] == '1') {
1860 fmout(NULL, "CENTER");
1862 wprintf("</td></tr></table></div>\n");
1870 * support function for entroom() -- sets the default view
1872 void er_set_default_view(int newview) {
1885 serv_getln(buf, sizeof buf);
1886 if (buf[0] != '2') return;
1888 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
1889 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
1890 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
1891 rm_bits1 = extract_int(&buf[4], 3);
1892 rm_floor = extract_int(&buf[4], 4);
1893 rm_listorder = extract_int(&buf[4], 5);
1894 rm_bits2 = extract_int(&buf[4], 7);
1896 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1897 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
1898 rm_listorder, newview, rm_bits2
1900 serv_getln(buf, sizeof buf);
1913 char er_password[SIZ];
1918 if (strcmp(bstr("sc"), "OK")) {
1919 strcpy(WC->ImportantMessage,
1920 "Cancelled. No new room was created.");
1921 display_main_menu();
1924 strcpy(er_name, bstr("er_name"));
1925 strcpy(er_type, bstr("type"));
1926 strcpy(er_password, bstr("er_password"));
1927 er_floor = atoi(bstr("er_floor"));
1928 er_view = atoi(bstr("er_view"));
1931 if (!strcmp(er_type, "hidden"))
1933 if (!strcmp(er_type, "passworded"))
1935 if (!strcmp(er_type, "invonly"))
1937 if (!strcmp(er_type, "personal"))
1940 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
1941 er_name, er_num_type, er_password, er_floor, 0, er_view);
1943 serv_getln(buf, sizeof buf);
1944 if (buf[0] != '2') {
1945 strcpy(WC->ImportantMessage, &buf[4]);
1946 display_main_menu();
1950 do_change_view(er_view); /* Now go there */
1955 * display the screen to enter a private room
1957 void display_private(char *rname, int req_pass)
1959 output_headers(1, 1, 2, 0, 0, 0, 0);
1960 wprintf("<div id=\"banner\">\n"
1961 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1962 "<SPAN CLASS=\"titlebar\">Go to a hidden room</SPAN>"
1963 "</TD></TR></TABLE>\n"
1964 "</div>\n<div id=\"content\">\n"
1967 wprintf("<div id=\"fix_scrollbar_bug\">"
1968 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1970 wprintf("<CENTER>\n");
1971 wprintf("<br />If you know the name of a hidden (guess-name) or\n");
1972 wprintf("passworded room, you can enter that room by typing\n");
1973 wprintf("its name below. Once you gain access to a private\n");
1974 wprintf("room, it will appear in your regular room listings\n");
1975 wprintf("so you don't have to keep returning here.\n");
1976 wprintf("<br /><br />");
1978 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1980 wprintf("<table border=\"0\" cellspacing=\"5\" "
1981 "cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
1983 "Enter room name:</TD><TD>"
1984 "<INPUT TYPE=\"text\" NAME=\"gr_name\" "
1985 "VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1988 wprintf("</TD></TR><TR><TD>");
1989 wprintf("Enter room password:</TD><TD>");
1990 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1992 wprintf("</TD></TR></TABLE><br />\n");
1994 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1996 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1997 wprintf("</FORM>\n");
1998 wprintf("</td></tr></table></div>\n");
2003 * goto a private room
2005 void goto_private(void)
2010 if (strcasecmp(bstr("sc"), "OK")) {
2011 display_main_menu();
2014 strcpy(hold_rm, WC->wc_roomname);
2015 strcpy(buf, "GOTO ");
2016 strcat(buf, bstr("gr_name"));
2018 strcat(buf, bstr("gr_pass"));
2020 serv_getln(buf, sizeof buf);
2022 if (buf[0] == '2') {
2023 smart_goto(bstr("gr_name"));
2026 if (!strncmp(buf, "540", 3)) {
2027 display_private(bstr("gr_name"), 1);
2030 output_headers(1, 1, 1, 0, 0, 0, 0);
2031 wprintf("%s\n", &buf[4]);
2038 * display the screen to zap a room
2040 void display_zap(void)
2042 output_headers(1, 1, 2, 0, 0, 0, 0);
2044 wprintf("<div id=\"banner\">\n");
2045 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
2046 wprintf("<SPAN CLASS=\"titlebar\">Zap (forget/unsubscribe) the current room</SPAN>\n");
2047 wprintf("</TD></TR></TABLE>\n");
2048 wprintf("</div>\n<div id=\"content\">\n");
2050 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
2051 wprintf("disappear from your room list. Is this what you wish ");
2052 wprintf("to do?<br />\n");
2054 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
2055 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
2057 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2058 wprintf("</FORM>\n");
2069 char final_destination[SIZ];
2071 /* If the forget-room routine fails for any reason, we fall back
2072 * to the current room; otherwise, we go to the Lobby
2074 strcpy(final_destination, WC->wc_roomname);
2076 if (!strcasecmp(bstr("sc"), "OK")) {
2077 serv_printf("GOTO %s", WC->wc_roomname);
2078 serv_getln(buf, sizeof buf);
2079 if (buf[0] == '2') {
2081 serv_getln(buf, sizeof buf);
2082 if (buf[0] == '2') {
2083 strcpy(final_destination, "_BASEROOM_");
2087 smart_goto(final_destination);
2093 * Delete the current room
2095 void delete_room(void)
2099 serv_puts("KILL 1");
2100 serv_getln(buf, sizeof buf);
2101 if (buf[0] != '2') {
2102 strcpy(WC->ImportantMessage, &buf[4]);
2103 display_main_menu();
2106 smart_goto("_BASEROOM_");
2113 * Perform changes to a room's network configuration
2115 void netedit(void) {
2124 if (strlen(bstr("line"))==0) {
2129 strcpy(line, bstr("prefix"));
2130 strcat(line, bstr("line"));
2131 strcat(line, bstr("suffix"));
2140 serv_getln(buf, sizeof buf);
2141 if (buf[0] != '1') {
2147 /* This loop works for add *or* remove. Spiffy, eh? */
2148 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2149 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2150 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2151 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2152 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2153 if ( (strcasecmp(cmpa0, cmpb0))
2154 || (strcasecmp(cmpa1, cmpb1)) ) {
2155 fprintf(fp, "%s\n", buf);
2161 serv_getln(buf, sizeof buf);
2162 if (buf[0] != '4') {
2168 while (fgets(buf, sizeof buf, fp) != NULL) {
2169 buf[strlen(buf)-1] = 0;
2173 if (!strcasecmp(bstr("cmd"), "add")) {
2185 * Convert a room name to a folder-ish-looking name.
2187 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2192 * For mailboxes, just do it straight...
2195 sprintf(folder, "My folders|%s", room);
2199 * Otherwise, prefix the floor name as a "public folders" moniker
2202 sprintf(folder, "%s|%s", floorlist[floor], room);
2206 * Replace "\" characters with "|" for pseudo-folder-delimiting
2208 for (i=0; i<strlen(folder); ++i) {
2209 if (folder[i] == '\\') folder[i] = '|';
2217 * Back end for change_view()
2219 void do_change_view(int newview) {
2222 serv_printf("VIEW %d", newview);
2223 serv_getln(buf, sizeof buf);
2224 WC->wc_view = newview;
2225 smart_goto(WC->wc_roomname);
2231 * Change the view for this room
2233 void change_view(void) {
2236 view = atol(bstr("view"));
2237 do_change_view(view);
2242 * One big expanded tree list view --- like a folder list
2244 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2248 int has_subfolders = 0;
2251 parents = malloc(max_folders * sizeof(int));
2253 /* BEGIN TREE MENU */
2254 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2256 /* include NanoTree */
2257 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2259 /* initialize NanoTree */
2260 wprintf("<script type=\"text/javascript\"> \n"
2261 " showRootNode = false; \n"
2262 " sortNodes = false; \n"
2263 " dragable = false; \n"
2265 " function standardClick(treeNode) { \n"
2268 " var closedGif = 'static/folder_closed.gif'; \n"
2269 " var openGif = 'static/folder_open.gif'; \n"
2271 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2275 for (i=0; i<max_folders; ++i) {
2278 if ((i+1) < max_folders) {
2279 if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
2280 && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
2285 levels = num_tokens(fold[i].name, '|');
2286 parents[levels] = i;
2288 wprintf("var node%d = new TreeNode(%d, '", i, i);
2290 if (fold[i].selectable) {
2291 wprintf("<A HREF=\"/dotgoto?room=");
2292 urlescputs(fold[i].room);
2297 wprintf("<SPAN CLASS=\"roomlist_floor\">");
2299 else if (fold[i].hasnewmsgs) {
2300 wprintf("<SPAN CLASS=\"roomlist_new\">");
2303 wprintf("<SPAN CLASS=\"roomlist_old\">");
2305 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2310 if (has_subfolders) {
2311 wprintf("new Array(closedGif, openGif)");
2313 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2314 wprintf("'static/viewcontacts_16x.gif'");
2316 else if (fold[i].view == VIEW_CALENDAR) {
2317 wprintf("'static/calarea_16x.gif'");
2319 else if (fold[i].view == VIEW_TASKS) {
2320 wprintf("'static/taskmanag_16x.gif'");
2322 else if (fold[i].view == VIEW_NOTES) {
2323 wprintf("'static/storenotes_16x.gif'");
2325 else if (fold[i].view == VIEW_MAILBOX) {
2326 wprintf("'static/privatemess_16x.gif'");
2329 wprintf("'static/chatrooms_16x.gif'");
2332 urlescputs(fold[i].name);
2336 wprintf("rootNode.addChild(node%d);\n", i);
2339 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2343 wprintf("container = document.getElementById('roomlist_div'); \n"
2353 * Boxes and rooms and lists ... oh my!
2355 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2358 int levels, oldlevels;
2361 static int columns = 3;
2362 int boxes_per_column = 0;
2363 int current_column = 0;
2367 while (nf % columns != 0) ++nf;
2368 boxes_per_column = (nf / columns);
2369 if (boxes_per_column < 1) boxes_per_column = 1;
2371 /* Outer table (for columnization) */
2372 wprintf("<TABLE BORDER=0 WIDTH=96%% CELLPADDING=5>"
2373 "<tr><td valign=top>");
2377 for (i=0; i<max_folders; ++i) {
2379 levels = num_tokens(fold[i].name, '|');
2381 if ((levels == 1) && (oldlevels > 1)) {
2384 do_template("endbox");
2387 if ((num_boxes % boxes_per_column) == 0) {
2389 if (current_column < columns) {
2390 wprintf("</td><td valign=top>\n");
2397 /* Begin inner box */
2398 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2399 stresc(boxtitle, buf, 1, 0);
2400 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2401 do_template("beginbox");
2409 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
2410 if (fold[i].selectable) {
2411 wprintf("<A HREF=\"/dotgoto?room=");
2412 urlescputs(fold[i].room);
2418 if (fold[i].hasnewmsgs) {
2419 wprintf("<SPAN CLASS=\"roomlist_new\">");
2422 wprintf("<SPAN CLASS=\"roomlist_old\">");
2424 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2427 if (fold[i].selectable) {
2433 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
2434 wprintf(" (INBOX)");
2436 wprintf("<br />\n");
2439 /* End the final inner box */
2440 do_template("endbox");
2442 wprintf("</TD></TR></TABLE>\n");
2447 * Show the room list. (only should get called by
2448 * knrooms() because that's where output_headers() is called from)
2451 void list_all_rooms_by_floor(char *viewpref) {
2454 struct folder *fold = NULL;
2456 int max_folders = 0;
2457 int alloc_folders = 0;
2461 int num_floors = 1; /* add an extra one for private folders */
2463 /* Start with the mailboxes */
2466 fold = malloc(sizeof(struct folder));
2467 memset(fold, 0, sizeof(struct folder));
2468 strcpy(fold[0].name, "My folders");
2469 fold[0].is_mailbox = 1;
2471 /* Then add floors */
2473 serv_getln(buf, sizeof buf);
2474 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2475 if (max_folders >= alloc_folders) {
2476 alloc_folders = max_folders + 100;
2477 fold = realloc(fold,
2478 alloc_folders * sizeof(struct folder));
2480 memset(&fold[max_folders], 0, sizeof(struct folder));
2481 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
2488 serv_getln(buf, sizeof buf);
2489 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2490 if (max_folders >= alloc_folders) {
2491 alloc_folders = max_folders + 100;
2492 fold = realloc(fold,
2493 alloc_folders * sizeof(struct folder));
2495 memset(&fold[max_folders], 0, sizeof(struct folder));
2496 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
2497 ra_flags = extract_int(buf, 5);
2498 flags = extract_int(buf, 1);
2499 fold[max_folders].floor = extract_int(buf, 2);
2500 fold[max_folders].hasnewmsgs =
2501 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
2502 if (flags & QR_MAILBOX) {
2503 fold[max_folders].is_mailbox = 1;
2505 fold[max_folders].view = extract_int(buf, 6);
2506 room_to_folder(fold[max_folders].name,
2507 fold[max_folders].room,
2508 fold[max_folders].floor,
2509 fold[max_folders].is_mailbox);
2510 fold[max_folders].selectable = 1;
2514 /* Bubble-sort the folder list */
2515 for (i=0; i<max_folders; ++i) {
2516 for (j=0; j<(max_folders-1)-i; ++j) {
2517 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
2518 swap = strcasecmp(fold[j].name, fold[j+1].name);
2521 if ( (fold[j+1].is_mailbox)
2522 && (!fold[j].is_mailbox)) {
2530 memcpy(&ftmp, &fold[j], sizeof(struct folder));
2531 memcpy(&fold[j], &fold[j+1],
2532 sizeof(struct folder));
2533 memcpy(&fold[j+1], &ftmp,
2534 sizeof(struct folder));
2539 /* test only hackish view
2540 wprintf("<table><TR><TD>A Table</TD></TR></table>\n");
2541 for (i=0; i<max_folders; ++i) {
2542 escputs(fold[i].name);
2543 wprintf("<br />\n");
2547 if (!strcasecmp(viewpref, "folders")) {
2548 do_folder_view(fold, max_folders, num_floors);
2551 do_rooms_view(fold, max_folders, num_floors);
2559 /* Do either a known rooms list or a folders list, depending on the
2563 char listviewpref[SIZ];
2565 output_headers(1, 1, 2, 0, 0, 0, 0);
2568 /* Determine whether the user is trying to change views */
2569 if (bstr("view") != NULL) {
2570 if (strlen(bstr("view")) > 0) {
2571 set_preference("roomlistview", bstr("view"), 1);
2575 get_preference("roomlistview", listviewpref, sizeof listviewpref);
2577 if ( (strcasecmp(listviewpref, "folders"))
2578 && (strcasecmp(listviewpref, "table")) ) {
2579 strcpy(listviewpref, "rooms");
2583 wprintf("<div id=\"banner\">\n"
2584 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
2585 "<SPAN CLASS=\"titlebar\">"
2587 if (!strcasecmp(listviewpref, "rooms")) {
2588 wprintf("Room list");
2590 if (!strcasecmp(listviewpref, "folders")) {
2591 wprintf("Folder list");
2593 if (!strcasecmp(listviewpref, "table")) {
2594 wprintf("Room list");
2596 wprintf("</SPAN></TD>\n");
2598 /* offer the ability to switch views */
2599 wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
2600 "<SELECT NAME=\"newview\" SIZE=\"1\" "
2601 "OnChange=\"location.href=roomlistomatic.newview.options"
2602 "[selectedIndex].value\">\n");
2604 wprintf("<OPTION %s VALUE=\"/knrooms&view=rooms\">"
2607 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
2610 wprintf("<OPTION %s VALUE=\"/knrooms&view=folders\">"
2611 "View as folder list"
2613 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
2616 wprintf("</SELECT><br />");
2618 wprintf("</FORM></TD></TR></TABLE>\n");
2621 "<div id=\"content\">\n");
2623 /* Display the room list in the user's preferred format */
2624 list_all_rooms_by_floor(listviewpref);
2630 * Set the message expire policy for this room and/or floor
2632 void set_room_policy(void) {
2635 if (strcmp(bstr("sc"), "OK")) {
2636 strcpy(WC->ImportantMessage,
2637 "Cancelled. Changes were not saved.");
2642 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
2643 serv_getln(buf, sizeof buf);
2644 strcpy(WC->ImportantMessage, &buf[4]);
2646 if (WC->axlevel >= 6) {
2647 strcat(WC->ImportantMessage, "<br />\n");
2648 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
2649 serv_getln(buf, sizeof buf);
2650 strcat(WC->ImportantMessage, &buf[4]);