4 * Lots of different room-related operations.
13 #include <sys/types.h>
15 #include <sys/socket.h>
18 #include <netinet/in.h>
47 char floorlist[128][SIZ];
50 * load the list of floors
52 void load_floorlist(void)
57 for (a = 0; a < 128; ++a)
61 serv_getln(buf, sizeof buf);
63 strcpy(floorlist[0], "Main Floor");
66 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
67 extract_token(floorlist[extract_int(buf, 0)], buf, 1, '|', sizeof floorlist[0]);
73 * remove a room from the march list
75 void remove_march(char *aaa)
77 struct march *mptr, *mptr2;
79 if (WC->march == NULL)
82 if (!strcasecmp(WC->march->march_name, aaa)) {
83 mptr = WC->march->next;
89 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
90 if (!strcasecmp(mptr->march_name, aaa)) {
91 mptr2->next = mptr->next;
104 void room_tree_list(struct roomlisting *rp)
113 room_tree_list(rp->lnext);
115 strcpy(rmname, rp->rlname);
118 wprintf("<A HREF=\"/dotgoto&room=");
122 escputs1(rmname, 1, 1);
123 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
125 else if (f & QR_DIRECTORY)
127 else if (f & QR_NETWORK)
131 wprintf("</A><TT> </TT>\n");
133 room_tree_list(rp->rnext);
139 * Room ordering stuff (compare first by floor, then by order)
141 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
143 if ((r1 == NULL) && (r2 == NULL))
149 if (r1->rlfloor < r2->rlfloor)
151 if (r1->rlfloor > r2->rlfloor)
153 if (r1->rlorder < r2->rlorder)
155 if (r1->rlorder > r2->rlorder)
162 * Common code for all room listings
164 void listrms(char *variety)
169 struct roomlisting *rl = NULL;
170 struct roomlisting *rp;
171 struct roomlisting *rs;
174 /* Ask the server for a room list */
176 serv_getln(buf, sizeof buf);
181 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
183 rp = malloc(sizeof(struct roomlisting));
184 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
185 rp->rlflags = extract_int(buf, 1);
186 rp->rlfloor = extract_int(buf, 2);
187 rp->rlorder = extract_int(buf, 3);
196 if (rordercmp(rp, rs) < 0) {
197 if (rs->lnext == NULL) {
204 if (rs->rnext == NULL) {
216 /* If no rooms were listed, print an nbsp to make the cell
217 * borders show up anyway.
219 if (num_rooms == 0) wprintf(" ");
224 * list all forgotten rooms
226 void zapped_list(void)
228 output_headers(1, 1, 0, 0, 0, 0, 0);
230 svprintf("BOXTITLE", WCS_STRING, "Zapped (forgotten) rooms");
231 do_template("beginbox");
235 wprintf("<br /><br />\n");
236 wprintf("Click on any room to un-zap it and goto that room.\n");
237 do_template("endbox");
243 * read this room's info file (set v to 1 for verbose mode)
250 serv_getln(buf, sizeof buf);
252 fmout(NULL, "CENTER");
259 /* Display room banner icon. The server doesn't actually
260 * need the room name, but we supply it in order to
261 * keep the browser from using a cached icon from
264 void embed_room_graphic(void) {
267 serv_puts("OIMG _roompic_");
268 serv_getln(buf, sizeof buf);
270 wprintf("<IMG HEIGHT=64 SRC=\"/image&name=_roompic_&room=");
271 urlescputs(WC->wc_roomname);
274 serv_getln(buf, sizeof buf);
276 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
277 wprintf("<img height=48 width=48 src=\""
278 "static/viewcontacts_48x.gif"
282 else if (WC->wc_view == VIEW_CALENDAR) {
283 wprintf("<img height=48 width=48 src=\""
284 "static/calarea_48x.gif"
288 else if (WC->wc_view == VIEW_TASKS) {
289 wprintf("<img height=48 width=48 src=\""
290 "static/taskmanag_48x.gif"
294 else if (WC->wc_view == VIEW_NOTES) {
295 wprintf("<img height=48 width=48 src=\""
296 "static/storenotes_48x.gif"
300 else if (WC->wc_view == VIEW_MAILBOX) {
301 wprintf("<img height=48 width=48 src=\""
302 "static/privatemess_48x.gif"
307 wprintf("<img height=48 width=48 src=\""
308 "static/chatrooms_48x.gif"
316 /* Let the user know if new mail has arrived
318 void embed_newmail_button(void) {
319 if ( (WC->new_mail > WC->remember_new_mail) && (WC->new_mail>0) ) {
321 "<A HREF=\"/dotgoto?room=_MAIL_\">"
322 "<IMG SRC=\"/static/privatemess_32x.gif\" border=0 "
323 "ALT=\"You have new mail\">"
324 "<br /><SPAN CLASS=\"youhavemail\">"
325 "%d new mail</SPAN></A>", WC->new_mail);
326 WC->remember_new_mail = WC->new_mail;
333 * Display the current view and offer an option to change it
335 void embed_view_o_matic(void) {
338 wprintf("<FORM NAME=\"viewomatic\">\n"
339 "<span class=\"room_banner_new_messages\">View as: "
340 "<SELECT NAME=\"newview\" SIZE=\"1\" "
341 "STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif;"
342 " font-size: 7pt; background: #444455; color: #ddddcc;\" "
343 "OnChange=\"location.href=viewomatic.newview.options"
344 "[selectedIndex].value\">\n");
346 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
348 * Only offer the views that make sense, given the default
349 * view for the room. For example, don't offer a Calendar
350 * view in a non-Calendar room.
354 || (i == WC->wc_default_view)
355 || ( (i == 0) && (WC->wc_default_view == 1) )
356 || ( (i == 1) && (WC->wc_default_view == 0) )
359 wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
360 ((i == WC->wc_view) ? "SELECTED" : ""),
362 escputs(viewdefs[i]);
363 wprintf("</OPTION>\n");
366 wprintf("</select></span></form>\n");
371 void embed_room_banner(char *got, int navbar_style) {
374 /* We need to have the information returned by a GOTO server command.
375 * If it isn't supplied, we fake it by issuing our own GOTO.
378 serv_printf("GOTO %s", WC->wc_roomname);
379 serv_getln(fakegot, sizeof fakegot);
383 /* If the user happens to select the "make this my start page" link,
384 * we want it to remember the URL as a "/dotskip" one instead of
385 * a "skip" or "gotonext" or something like that.
387 snprintf(WC->this_page, sizeof(WC->this_page), "/dotskip&room=%s",
390 /* Check for new mail. */
391 WC->new_mail = extract_int(&got[4], 9);
392 WC->wc_view = extract_int(&got[4], 11);
394 svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname);
395 svprintf("NEWMSGS", WCS_STRING, "%d", extract_int(&got[4], 1));
396 svprintf("TOTALMSGS", WCS_STRING, "%d", extract_int(&got[4], 2));
397 svcallback("ROOMPIC", embed_room_graphic);
398 svcallback("ROOMINFO", readinfo);
399 svcallback("YOUHAVEMAIL", embed_newmail_button);
400 svcallback("VIEWOMATIC", embed_view_o_matic);
401 svcallback("START", offer_start_page);
403 do_template("roombanner");
404 if (navbar_style != navbar_none) {
406 wprintf("<div style=\"position:absolute; bottom:0px; left:0px\">\n"
407 "<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>\n");
410 if (navbar_style == navbar_default) wprintf(
412 "<a href=\"/ungoto\">"
413 "<img align=\"middle\" src=\"/static/ungoto2_24x.gif\" border=\"0\">"
414 "<span class=\"navbar_link\">Ungoto</span></A>"
418 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
421 "<A HREF=\"/readnew\">"
422 "<img align=\"middle\" src=\"/static/newmess2_24x.gif\" border=\"0\">"
423 "<span class=\"navbar_link\">Read new messages</span></A>"
428 if (navbar_style == navbar_default) {
429 switch(WC->wc_view) {
430 case VIEW_ADDRESSBOOK:
433 "<A HREF=\"/readfwd\">"
434 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
436 "<span class=\"navbar_link\">"
444 "<A HREF=\"/readfwd?calview=day\">"
445 "<img align=\"middle\" src=\"/static/taskday2_24x.gif\" "
447 "<span class=\"navbar_link\">"
453 "<A HREF=\"/readfwd?calview=month\">"
454 "<img align=\"middle\" src=\"/static/monthview2_24x.gif\" "
456 "<span class=\"navbar_link\">"
464 "<A HREF=\"/readfwd\">"
465 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
467 "<span class=\"navbar_link\">"
475 "<A HREF=\"/readfwd\">"
476 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
478 "<span class=\"navbar_link\">"
486 "<A HREF=\"/readfwd\">"
487 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
489 "<span class=\"navbar_link\">"
497 "<A HREF=\"/readfwd\">"
498 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
500 "<span class=\"navbar_link\">"
508 if (navbar_style == navbar_default) {
509 switch(WC->wc_view) {
510 case VIEW_ADDRESSBOOK:
512 "<td><A HREF=\"/display_enter\">"
513 "<img align=\"middle\" src=\"/static/addnewcontact_24x.gif\" "
514 "border=\"0\"><span class=\"navbar_link\">"
521 "<td><A HREF=\"/display_enter\">"
522 "<img align=\"middle\" src=\"/static/addevent_24x.gif\" "
523 "border=\"0\"><span class=\"navbar_link\">"
530 "<td><A HREF=\"/display_enter\">"
531 "<img align=\"middle\" src=\"/static/newmess3_24x.gif\" "
532 "border=\"0\"><span class=\"navbar_link\">"
539 "<td><A HREF=\"/display_enter\">"
540 "<img align=\"middle\" src=\"/static/newmess3_24x.gif\" "
541 "border=\"0\"><span class=\"navbar_link\">"
548 "<td><A HREF=\"/display_enter\">"
549 "<img align=\"middle\" src=\"/static/newmess3_24x.gif\" "
550 "border=\"0\"><span class=\"navbar_link\">"
556 wprintf("</span></a></td>\n");
559 if (navbar_style == navbar_default) wprintf(
562 "TITLE=\"Leave all messages marked as unread, go to next room with unread messages\">"
563 "<img align=\"middle\" src=\"/static/skipthisroom_24x.gif\" border=\"0\">"
564 "<span class=\"navbar_link\">Skip this room</span></a>"
568 if (navbar_style == navbar_default) wprintf(
570 "<A HREF=\"/gotonext\" "
571 "TITLE=\"Mark all messages as read, go to next room with unread messages\">"
572 "<img align=\"middle\" src=\"/static/markngo_24x.gif\" border=\"0\">"
573 "<span class=\"navbar_link\">Goto next room</span></a>"
577 wprintf("</tr></table></div>\n");
587 * back end routine to take the session to a new room
590 void gotoroom(char *gname)
593 static long ls = (-1L);
595 /* store ungoto information */
596 strcpy(WC->ugname, WC->wc_roomname);
599 /* move to the new room */
600 serv_printf("GOTO %s", gname);
601 serv_getln(buf, sizeof buf);
603 serv_puts("GOTO _BASEROOM_");
604 serv_getln(buf, sizeof buf);
609 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
610 WC->room_flags = extract_int(&buf[4], 4);
611 /* highest_msg_read = extract_int(&buf[4],6);
612 maxmsgnum = extract_int(&buf[4],5);
613 is_mail = (char) extract_int(&buf[4],7); */
614 ls = extract_long(&buf[4], 6);
615 WC->wc_floor = extract_int(&buf[4], 10);
616 WC->wc_view = extract_int(&buf[4], 11);
617 WC->wc_default_view = extract_int(&buf[4], 12);
620 WC->is_room_aide = WC->is_aide;
622 WC->is_room_aide = (char) extract_int(&buf[4], 8);
624 remove_march(WC->wc_roomname);
625 if (!strcasecmp(gname, "_BASEROOM_"))
631 * Locate the room on the march list which we most want to go to. Each room
632 * is measured given a "weight" of preference based on various factors.
634 char *pop_march(int desired_floor)
636 static char TheRoom[128];
638 int TheOrder = 32767;
641 struct march *mptr = NULL;
643 strcpy(TheRoom, "_BASEROOM_");
644 if (WC->march == NULL)
647 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
649 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
650 weight = weight + 10000;
651 if (mptr->march_floor == desired_floor)
652 weight = weight + 5000;
654 weight = weight + ((128 - (mptr->march_floor)) * 128);
655 weight = weight + (128 - (mptr->march_order));
657 if (weight > TheWeight) {
659 strcpy(TheRoom, mptr->march_name);
660 TheFloor = mptr->march_floor;
661 TheOrder = mptr->march_order;
669 /* Goto next room having unread messages.
670 * We want to skip over rooms that the user has already been to, and take the
671 * user back to the lobby when done. The room we end up in is placed in
672 * newroom - which is set to 0 (the lobby) initially.
673 * We start the search in the current room rather than the beginning to prevent
674 * two or more concurrent users from dragging each other back to the same room.
679 struct march *mptr, *mptr2;
682 /* First check to see if the march-mode list is already allocated.
683 * If it is, pop the first room off the list and go there.
686 if (WC->march == NULL) {
688 serv_getln(buf, sizeof buf);
690 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
691 mptr = (struct march *) malloc(sizeof(struct march));
693 extract_token(mptr->march_name, buf, 0, '|', sizeof mptr->march_name);
694 mptr->march_floor = extract_int(buf, 2);
695 mptr->march_order = extract_int(buf, 3);
696 if (WC->march == NULL) {
700 while (mptr2->next != NULL)
705 /* add _BASEROOM_ to the end of the march list, so the user will end up
706 * in the system base room (usually the Lobby>) at the end of the loop
708 mptr = (struct march *) malloc(sizeof(struct march));
710 strcpy(mptr->march_name, "_BASEROOM_");
711 if (WC->march == NULL) {
715 while (mptr2->next != NULL)
720 * ...and remove the room we're currently in, so a <G>oto doesn't make us
721 * walk around in circles
723 remove_march(WC->wc_roomname);
725 if (WC->march != NULL) {
726 strcpy(next_room, pop_march(-1));
728 strcpy(next_room, "_BASEROOM_");
732 smart_goto(next_room);
736 void smart_goto(char *next_room) {
744 * mark all messages in current room as having been read
746 void slrp_highest(void)
751 serv_puts("SLRP HIGHEST");
752 serv_getln(buf, sizeof buf);
754 wprintf("<EM>%s</EM><br />\n", &buf[4]);
761 * un-goto the previous room
767 if (!strcmp(WC->ugname, "")) {
768 smart_goto(WC->wc_roomname);
771 serv_printf("GOTO %s", WC->ugname);
772 serv_getln(buf, sizeof buf);
774 smart_goto(WC->wc_roomname);
777 if (WC->uglsn >= 0L) {
778 serv_printf("SLRP %ld", WC->uglsn);
779 serv_getln(buf, sizeof buf);
781 strcpy(buf, WC->ugname);
782 strcpy(WC->ugname, "");
791 * Set/clear/read the "self-service list subscribe" flag for a room
793 * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged.
794 * Always returns the new value.
797 int self_service(int newval) {
798 int current_value = 0;
804 int flags, floor, order, view, flags2;
807 serv_getln(buf, sizeof buf);
808 if (buf[0] != '2') return(0);
810 extract_token(name, &buf[4], 0, '|', sizeof name);
811 extract_token(password, &buf[4], 1, '|', sizeof password);
812 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
813 flags = extract_int(&buf[4], 3);
814 floor = extract_int(&buf[4], 4);
815 order = extract_int(&buf[4], 5);
816 view = extract_int(&buf[4], 6);
817 flags2 = extract_int(&buf[4], 7);
819 if (flags2 & QR2_SELFLIST) {
827 flags2 = flags2 | QR2_SELFLIST;
829 else if (newval == 0) {
830 flags2 = flags2 & ~QR2_SELFLIST;
833 return(current_value);
836 if (newval != current_value) {
837 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
838 name, password, dirname, flags,
839 floor, order, view, flags2);
840 serv_getln(buf, sizeof buf);
853 * display the form for editing a room
855 void display_editroom(void)
860 char remote_room[SIZ];
863 char er_password[10];
865 char er_roomaide[26];
871 char *not_shared_with;
878 if (strlen(tab) == 0) tab = "admin";
882 serv_getln(buf, sizeof buf);
885 strcpy(WC->ImportantMessage, &buf[4]);
889 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
890 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
891 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
892 er_flags = extract_int(&buf[4], 3);
893 er_floor = extract_int(&buf[4], 4);
895 output_headers(1, 1, 1, 0, 0, 0, 0);
897 /* print the tabbed dialog */
899 "<div id=\"fix_scrollbar_bug\">"
900 "<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
902 "<TD> </TD>\n");
904 if (!strcmp(tab, "admin")) {
905 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
908 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=admin\">");
910 wprintf("Administration");
911 if (!strcmp(tab, "admin")) {
912 wprintf("</SPAN></TD>\n");
915 wprintf("</A></TD>\n");
918 wprintf("<TD> </TD>\n");
920 if (!strcmp(tab, "config")) {
921 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
924 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=config\">");
926 wprintf("Configuration");
927 if (!strcmp(tab, "config")) {
928 wprintf("</SPAN></TD>\n");
931 wprintf("</A></TD>\n");
934 wprintf("<TD> </TD>\n");
936 if (!strcmp(tab, "expire")) {
937 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
940 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=expire\">");
942 wprintf("Message expire policy");
943 if (!strcmp(tab, "expire")) {
944 wprintf("</SPAN></TD>\n");
947 wprintf("</A></TD>\n");
950 wprintf("<TD> </TD>\n");
952 if (!strcmp(tab, "access")) {
953 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
956 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=access\">");
958 wprintf("Access controls");
959 if (!strcmp(tab, "access")) {
960 wprintf("</SPAN></TD>\n");
963 wprintf("</A></TD>\n");
966 wprintf("<TD> </TD>\n");
968 if (!strcmp(tab, "sharing")) {
969 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
972 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=sharing\">");
975 if (!strcmp(tab, "sharing")) {
976 wprintf("</SPAN></TD>\n");
979 wprintf("</A></TD>\n");
982 wprintf("<TD> </TD>\n");
984 if (!strcmp(tab, "listserv")) {
985 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
988 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=listserv\">");
990 wprintf("Mailing list service");
991 if (!strcmp(tab, "listserv")) {
992 wprintf("</SPAN></TD>\n");
995 wprintf("</A></TD>\n");
998 wprintf("<TD> </TD>\n");
1000 wprintf("</TR></TABLE></div>\n");
1001 /* end tabbed dialog */
1003 /* begin content of whatever tab is open now */
1004 wprintf("<div id=\"fix_scrollbar_bug\">"
1005 "<TABLE border=0 width=100%% bgcolor=\"#FFFFFF\">\n"
1008 if (!strcmp(tab, "admin")) {
1010 "<LI><A HREF=\"/delete_room\" "
1011 "onClick=\"return confirm('Are you sure you want to delete this room?');\">\n"
1012 "Delete this room</A>\n"
1013 "<LI><A HREF=\"/display_editroompic\">\n"
1014 "Set or change the icon for this room's banner</A>\n"
1015 "<LI><A HREF=\"/display_editinfo\">\n"
1016 "Edit this room's Info file</A>\n"
1020 if (!strcmp(tab, "config")) {
1021 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
1023 wprintf("<UL><LI>Name of room: ");
1024 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
1026 wprintf("<LI>Resides on floor: ");
1027 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1028 for (i = 0; i < 128; ++i)
1029 if (strlen(floorlist[i]) > 0) {
1030 wprintf("<OPTION ");
1032 wprintf("SELECTED ");
1033 wprintf("VALUE=\"%d\">", i);
1034 escputs(floorlist[i]);
1035 wprintf("</OPTION>\n");
1037 wprintf("</SELECT>\n");
1039 wprintf("<LI>Type of room:<UL>\n");
1041 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1042 if ((er_flags & QR_PRIVATE) == 0)
1043 wprintf("CHECKED ");
1044 wprintf("> Public room\n");
1046 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1047 if ((er_flags & QR_PRIVATE) &&
1048 (er_flags & QR_GUESSNAME))
1049 wprintf("CHECKED ");
1050 wprintf("> Private - guess name\n");
1052 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1053 if ((er_flags & QR_PRIVATE) &&
1054 (er_flags & QR_PASSWORDED))
1055 wprintf("CHECKED ");
1056 wprintf("> Private - require password:\n");
1057 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
1059 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1060 if ((er_flags & QR_PRIVATE)
1061 && ((er_flags & QR_GUESSNAME) == 0)
1062 && ((er_flags & QR_PASSWORDED) == 0))
1063 wprintf("CHECKED ");
1064 wprintf("> Private - invitation only\n");
1066 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1067 wprintf("> If private, cause current users to forget room\n");
1071 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1072 if (er_flags & QR_PREFONLY)
1073 wprintf("CHECKED ");
1074 wprintf("> Preferred users only\n");
1076 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1077 if (er_flags & QR_READONLY)
1078 wprintf("CHECKED ");
1079 wprintf("> Read-only room\n");
1081 /* directory stuff */
1082 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1083 if (er_flags & QR_DIRECTORY)
1084 wprintf("CHECKED ");
1085 wprintf("> File directory room\n");
1087 wprintf("<UL><LI>Directory name: ");
1088 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
1090 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1091 if (er_flags & QR_UPLOAD)
1092 wprintf("CHECKED ");
1093 wprintf("> Uploading allowed\n");
1095 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1096 if (er_flags & QR_DOWNLOAD)
1097 wprintf("CHECKED ");
1098 wprintf("> Downloading allowed\n");
1100 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1101 if (er_flags & QR_VISDIR)
1102 wprintf("CHECKED ");
1103 wprintf("> Visible directory</UL>\n");
1105 /* end of directory stuff */
1107 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1108 if (er_flags & QR_NETWORK)
1109 wprintf("CHECKED ");
1110 wprintf("> Network shared room\n");
1112 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1113 if (er_flags & QR_PERMANENT)
1114 wprintf("CHECKED ");
1115 wprintf("> Permanent (does not auto-purge)\n");
1117 /* start of anon options */
1119 wprintf("<LI>Anonymous messages<UL>\n");
1121 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1122 if (((er_flags & QR_ANONONLY) == 0)
1123 && ((er_flags & QR_ANONOPT) == 0))
1124 wprintf("CHECKED ");
1125 wprintf("> No anonymous messages\n");
1127 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1128 if (er_flags & QR_ANONONLY)
1129 wprintf("CHECKED ");
1130 wprintf("> All messages are anonymous\n");
1132 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1133 if (er_flags & QR_ANONOPT)
1134 wprintf("CHECKED ");
1135 wprintf("> Prompt user when entering messages</UL>\n");
1137 /* end of anon options */
1139 wprintf("<LI>Room aide: \n");
1141 serv_getln(buf, sizeof buf);
1142 if (buf[0] != '2') {
1143 wprintf("<EM>%s</EM>\n", &buf[4]);
1145 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1146 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1149 wprintf("</UL><CENTER>\n");
1150 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1151 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1153 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
1159 /* Sharing the room with other Citadel nodes... */
1160 if (!strcmp(tab, "sharing")) {
1162 shared_with = strdup("");
1163 not_shared_with = strdup("");
1165 /* Learn the current configuration */
1166 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1167 serv_getln(buf, sizeof buf);
1168 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1169 extract_token(node, buf, 0, '|', sizeof node);
1170 not_shared_with = realloc(not_shared_with,
1171 strlen(not_shared_with) + 32);
1172 strcat(not_shared_with, node);
1173 strcat(not_shared_with, "\n");
1177 serv_getln(buf, sizeof buf);
1178 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1179 extract_token(cmd, buf, 0, '|', sizeof cmd);
1180 extract_token(node, buf, 1, '|', sizeof node);
1181 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1182 if (!strcasecmp(cmd, "ignet_push_share")) {
1183 shared_with = realloc(shared_with,
1184 strlen(shared_with) + 32);
1185 strcat(shared_with, node);
1186 if (strlen(remote_room) > 0) {
1187 strcat(shared_with, "|");
1188 strcat(shared_with, remote_room);
1190 strcat(shared_with, "\n");
1194 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1195 extract_token(buf, shared_with, i, '\n', sizeof buf);
1196 extract_token(node, buf, 0, '|', sizeof node);
1197 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1198 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1199 if (!strcasecmp(node, cmd)) {
1200 remove_token(not_shared_with, j, '\n');
1205 /* Display the stuff */
1206 wprintf("<CENTER><br />"
1207 "<TABLE border=1 cellpadding=5><TR>"
1208 "<TD><B><I>Shared with</I></B></TD>"
1209 "<TD><B><I>Not shared with</I></B></TD></TR>\n"
1210 "<TR><TD VALIGN=TOP>\n");
1212 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1213 "<TD>Remote node name</TD>"
1214 "<TD>Remote room name</TD>"
1219 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1220 extract_token(buf, shared_with, i, '\n', sizeof buf);
1221 extract_token(node, buf, 0, '|', sizeof node);
1222 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1223 if (strlen(node) > 0) {
1224 wprintf("<FORM METHOD=\"POST\" "
1225 "ACTION=\"/netedit\">"
1226 "<TR><TD>%s</TD>\n", node);
1229 if (strlen(remote_room) > 0) {
1230 escputs(remote_room);
1236 wprintf("<INPUT TYPE=\"hidden\" NAME=\"line\" "
1237 "VALUE=\"ignet_push_share|");
1239 if (strlen(remote_room) > 0) {
1241 urlescputs(remote_room);
1244 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1245 "VALUE=\"sharing\">\n");
1246 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1247 "VALUE=\"remove\">\n");
1248 wprintf("<INPUT TYPE=\"submit\" "
1249 "NAME=\"sc\" VALUE=\"Unshare\">");
1250 wprintf("</TD></TR></FORM>\n");
1254 wprintf("</TABLE>\n");
1255 wprintf("</TD><TD VALIGN=TOP>\n");
1256 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1257 "<TD>Remote node name</TD>"
1258 "<TD>Remote room name</TD>"
1263 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1264 extract_token(node, not_shared_with, i, '\n', sizeof node);
1265 if (strlen(node) > 0) {
1266 wprintf("<FORM METHOD=\"POST\" "
1267 "ACTION=\"/netedit\">"
1271 "<INPUT TYPE=\"INPUT\" "
1275 wprintf("<INPUT TYPE=\"hidden\" "
1277 "VALUE=\"ignet_push_share|");
1280 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1281 "VALUE=\"sharing\">\n");
1282 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1283 "VALUE=\"add\">\n");
1284 wprintf("<INPUT TYPE=\"submit\" "
1285 "NAME=\"sc\" VALUE=\"Share\">");
1286 wprintf("</TD></TR></FORM>\n");
1290 wprintf("</TABLE>\n");
1291 wprintf("</TD></TR>"
1292 "</TABLE></CENTER><br />\n"
1293 "<I><B>Notes:</B><UL><LI>When sharing a room, "
1294 "it must be shared from both ends. Adding a node to "
1295 "the 'shared' list sends messages out, but in order to"
1296 " receive messages, the other nodes must be configured"
1297 " to send messages out to your system as well.\n"
1298 "<LI>If the remote room name is blank, it is assumed "
1299 "that the room name is identical on the remote node."
1300 "<LI>If the remote room name is different, the remote "
1301 "node must also configure the name of the room here."
1307 /* Mailing list management */
1308 if (!strcmp(tab, "listserv")) {
1310 wprintf("<br /><center>"
1311 "<TABLE BORDER=0 WIDTH=100%% CELLPADDING=5>"
1312 "<TR><TD VALIGN=TOP>");
1314 wprintf("<i>The contents of this room are being "
1315 "mailed <b>as individual messages</b> "
1316 "to the following list recipients:"
1317 "</i><br /><br />\n");
1320 serv_getln(buf, sizeof buf);
1321 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1322 extract_token(cmd, buf, 0, '|', sizeof cmd);
1323 if (!strcasecmp(cmd, "listrecp")) {
1324 extract_token(recp, buf, 1, '|', sizeof recp);
1327 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1330 wprintf("&tab=listserv\">(remove)</A><br />");
1334 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1335 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1336 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1337 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1338 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1339 wprintf("</FORM>\n");
1341 wprintf("</TD><TD VALIGN=TOP>\n");
1343 wprintf("<i>The contents of this room are being "
1344 "mailed <b>in digest form</b> "
1345 "to the following list recipients:"
1346 "</i><br /><br />\n");
1349 serv_getln(buf, sizeof buf);
1350 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1351 extract_token(cmd, buf, 0, '|', sizeof cmd);
1352 if (!strcasecmp(cmd, "digestrecp")) {
1353 extract_token(recp, buf, 1, '|', sizeof recp);
1356 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1359 wprintf("&tab=listserv\">(remove)</A><br />");
1363 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1364 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1365 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1366 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1367 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1368 wprintf("</FORM>\n");
1370 wprintf("</TD></TR></TABLE><hr />\n");
1372 if (self_service(999) == 1) {
1373 wprintf("This room is configured to allow "
1374 "self-service subscribe/unsubscribe requests."
1375 " <A HREF=\"/toggle_self_service?newval=0&"
1377 "Click to disable.</A><br />\n"
1378 "The URL for subscribe/unsubscribe is: "
1379 "<TT>http://%s/listsub</TT><br />\n",
1384 wprintf("This room is <i>not</i> configured to allow "
1385 "self-service subscribe/unsubscribe requests."
1386 " <A HREF=\"/toggle_self_service?newval=1&"
1388 "Click to enable.</A><br />\n"
1393 wprintf("</CENTER>\n");
1397 /* Mailing list management */
1398 if (!strcmp(tab, "expire")) {
1400 serv_puts("GPEX room");
1401 serv_getln(buf, sizeof buf);
1402 if (buf[0] == '2') {
1403 roompolicy = extract_int(&buf[4], 0);
1404 roomvalue = extract_int(&buf[4], 1);
1407 serv_puts("GPEX floor");
1408 serv_getln(buf, sizeof buf);
1409 if (buf[0] == '2') {
1410 floorpolicy = extract_int(&buf[4], 0);
1411 floorvalue = extract_int(&buf[4], 1);
1414 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/set_room_policy\">\n");
1415 wprintf("<TABLE border=0 cellspacing=5>\n");
1416 wprintf("<TR><TD>Message expire policy for this room<br />(");
1417 escputs(WC->wc_roomname);
1418 wprintf(")</TD><TD>");
1419 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1420 ((roompolicy == 0) ? "CHECKED" : "") );
1421 wprintf("Use the default policy for this floor<br />\n");
1422 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1423 ((roompolicy == 1) ? "CHECKED" : "") );
1424 wprintf("Never automatically expire messages<br />\n");
1425 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1426 ((roompolicy == 2) ? "CHECKED" : "") );
1427 wprintf("Expire by message count<br />\n");
1428 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1429 ((roompolicy == 3) ? "CHECKED" : "") );
1430 wprintf("Expire by message age<br />");
1431 wprintf("Number of messages or days: ");
1432 wprintf("<INPUT TYPE=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1433 wprintf("</TD></TR>\n");
1435 if (WC->axlevel >= 6) {
1436 wprintf("<TR><TD COLSPAN=2><hr /></TD></TR>\n");
1437 wprintf("<TR><TD>Message expire policy for this floor<br />(");
1438 escputs(floorlist[WC->wc_floor]);
1439 wprintf(")</TD><TD>");
1440 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1441 ((floorpolicy == 0) ? "CHECKED" : "") );
1442 wprintf("Use the system default<br />\n");
1443 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1444 ((floorpolicy == 1) ? "CHECKED" : "") );
1445 wprintf("Never automatically expire messages<br />\n");
1446 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1447 ((floorpolicy == 2) ? "CHECKED" : "") );
1448 wprintf("Expire by message count<br />\n");
1449 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1450 ((floorpolicy == 3) ? "CHECKED" : "") );
1451 wprintf("Expire by message age<br />");
1452 wprintf("Number of messages or days: ");
1453 wprintf("<INPUT TYPE=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1457 wprintf("<CENTER>\n");
1458 wprintf("<TR><TD COLSPAN=2><hr /><CENTER>\n");
1459 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1461 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1462 wprintf("</CENTER></TD><TR>\n");
1464 wprintf("</TABLE>\n"
1465 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1471 /* Mailing list management */
1472 if (!strcmp(tab, "access")) {
1476 /* end content of whatever tab is open now */
1477 wprintf("</TD></TR></TABLE></div>\n");
1484 * Toggle self-service list subscription
1486 void toggle_self_service(void) {
1489 newval = atoi(bstr("newval"));
1490 self_service(newval);
1497 * save new parameters for a room
1503 char er_password[10];
1504 char er_dirname[15];
1505 char er_roomaide[26];
1511 if (strcmp(bstr("sc"), "OK")) {
1512 strcpy(WC->ImportantMessage,
1513 "Cancelled. Changes were not saved.");
1518 serv_getln(buf, sizeof buf);
1520 if (buf[0] != '2') {
1521 strcpy(WC->ImportantMessage, &buf[4]);
1525 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1526 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1527 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1528 er_flags = extract_int(&buf[4], 3);
1530 strcpy(er_roomaide, bstr("er_roomaide"));
1531 if (strlen(er_roomaide) == 0) {
1533 serv_getln(buf, sizeof buf);
1534 if (buf[0] != '2') {
1535 strcpy(er_roomaide, "");
1537 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1540 strcpy(buf, bstr("er_name"));
1542 if (strlen(buf) > 0)
1543 strcpy(er_name, buf);
1545 strcpy(buf, bstr("er_password"));
1547 if (strlen(buf) > 0)
1548 strcpy(er_password, buf);
1550 strcpy(buf, bstr("er_dirname"));
1552 if (strlen(buf) > 0)
1553 strcpy(er_dirname, buf);
1555 strcpy(buf, bstr("type"));
1556 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
1558 if (!strcmp(buf, "invonly")) {
1559 er_flags |= (QR_PRIVATE);
1561 if (!strcmp(buf, "hidden")) {
1562 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
1564 if (!strcmp(buf, "passworded")) {
1565 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
1567 if (!strcmp(bstr("prefonly"), "yes")) {
1568 er_flags |= QR_PREFONLY;
1570 er_flags &= ~QR_PREFONLY;
1573 if (!strcmp(bstr("readonly"), "yes")) {
1574 er_flags |= QR_READONLY;
1576 er_flags &= ~QR_READONLY;
1579 if (!strcmp(bstr("permanent"), "yes")) {
1580 er_flags |= QR_PERMANENT;
1582 er_flags &= ~QR_PERMANENT;
1585 if (!strcmp(bstr("network"), "yes")) {
1586 er_flags |= QR_NETWORK;
1588 er_flags &= ~QR_NETWORK;
1591 if (!strcmp(bstr("directory"), "yes")) {
1592 er_flags |= QR_DIRECTORY;
1594 er_flags &= ~QR_DIRECTORY;
1597 if (!strcmp(bstr("ulallowed"), "yes")) {
1598 er_flags |= QR_UPLOAD;
1600 er_flags &= ~QR_UPLOAD;
1603 if (!strcmp(bstr("dlallowed"), "yes")) {
1604 er_flags |= QR_DOWNLOAD;
1606 er_flags &= ~QR_DOWNLOAD;
1609 if (!strcmp(bstr("visdir"), "yes")) {
1610 er_flags |= QR_VISDIR;
1612 er_flags &= ~QR_VISDIR;
1615 strcpy(buf, bstr("anon"));
1617 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
1618 if (!strcmp(buf, "anononly"))
1619 er_flags |= QR_ANONONLY;
1620 if (!strcmp(buf, "anon2"))
1621 er_flags |= QR_ANONOPT;
1624 if (!strcmp(bstr("bump"), "yes"))
1627 er_floor = atoi(bstr("er_floor"));
1629 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
1630 er_name, er_password, er_dirname, er_flags, bump, er_floor);
1632 serv_getln(buf, sizeof buf);
1633 if (buf[0] != '2') {
1634 strcpy(WC->ImportantMessage, &buf[4]);
1640 if (strlen(er_roomaide) > 0) {
1641 sprintf(buf, "SETA %s", er_roomaide);
1643 serv_getln(buf, sizeof buf);
1644 if (buf[0] != '2') {
1645 strcpy(WC->ImportantMessage, &buf[4]);
1646 display_main_menu();
1651 strcpy(WC->ImportantMessage, "Your changes have been saved.");
1658 * Display form for Invite, Kick, and show Who Knows a room
1660 void do_invt_kick(void) {
1661 char buf[SIZ], room[SIZ], username[SIZ];
1664 serv_getln(buf, sizeof buf);
1666 if (buf[0] != '2') {
1670 extract_token(room, &buf[4], 0, '|', sizeof room);
1672 strcpy(username, bstr("username"));
1674 if (!strcmp(bstr("sc"), "Kick")) {
1675 sprintf(buf, "KICK %s", username);
1677 serv_getln(buf, sizeof buf);
1679 if (buf[0] != '2') {
1680 strcpy(WC->ImportantMessage, &buf[4]);
1682 sprintf(WC->ImportantMessage,
1683 "<B><I>User %s kicked out of room %s.</I></B>\n",
1688 if (!strcmp(bstr("sc"), "Invite")) {
1689 sprintf(buf, "INVT %s", username);
1691 serv_getln(buf, sizeof buf);
1693 if (buf[0] != '2') {
1694 strcpy(WC->ImportantMessage, &buf[4]);
1696 sprintf(WC->ImportantMessage,
1697 "<B><I>User %s invited to room %s.</I></B>\n",
1708 * Display form for Invite, Kick, and show Who Knows a room
1710 void display_whok(void)
1712 char buf[SIZ], room[SIZ], username[SIZ];
1715 serv_getln(buf, sizeof buf);
1717 if (buf[0] != '2') {
1721 extract_token(room, &buf[4], 0, '|', sizeof room);
1724 wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
1725 "<TD>The users listed below have access to this room. "
1726 "To remove a user from the access list, select the user "
1727 "name from the list and click 'Kick'.<br /><br />");
1729 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1730 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1731 wprintf("<SELECT NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
1733 serv_getln(buf, sizeof buf);
1734 if (buf[0] == '1') {
1735 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1736 extract_token(username, buf, 0, '|', sizeof username);
1737 wprintf("<OPTION>");
1742 wprintf("</SELECT><br />\n");
1744 wprintf("<input type=submit name=sc value=\"Kick\">");
1745 wprintf("</FORM></CENTER>\n");
1748 "To grant another user access to this room, enter the "
1749 "user name in the box below and click 'Invite'.<br /><br />");
1751 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1752 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1753 wprintf("Invite: ");
1754 wprintf("<input type=\"text\" name=\"username\" style=\"width:100%%\"><br />\n"
1755 "<input type=\"hidden\" name=\"sc\" value=\"Invite\">"
1756 "<input type=\"submit\" value=\"Invite\">"
1757 "</FORM></CENTER>\n");
1759 wprintf("</TD></TR></TABLE>\n");
1766 * display the form for entering a new room
1768 void display_entroom(void)
1773 serv_puts("CRE8 0");
1774 serv_getln(buf, sizeof buf);
1776 if (buf[0] != '2') {
1777 strcpy(WC->ImportantMessage, &buf[4]);
1778 display_main_menu();
1782 output_headers(1, 1, 2, 0, 0, 0, 0);
1783 wprintf("<div id=\"banner\">\n"
1784 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1785 "<SPAN CLASS=\"titlebar\">Create a new room</SPAN>"
1786 "</TD></TR></TABLE>\n"
1787 "</div>\n<div id=\"content\">\n"
1790 wprintf("<div id=\"fix_scrollbar_bug\">"
1791 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1793 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"/entroom\">\n");
1795 wprintf("<UL><LI>Name of room: ");
1796 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
1798 wprintf("<LI>Resides on floor: ");
1800 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1801 for (i = 0; i < 128; ++i)
1802 if (strlen(floorlist[i]) > 0) {
1803 wprintf("<OPTION ");
1804 wprintf("VALUE=\"%d\">", i);
1805 escputs(floorlist[i]);
1806 wprintf("</OPTION>\n");
1808 wprintf("</SELECT>\n");
1810 /* Our clever little snippet of JavaScript automatically selects
1811 * a public room if the view is set to Bulletin Board, and it
1812 * selects a mailbox room otherwise. The user can override this,
1815 wprintf("<LI>Default view for room: ");
1816 wprintf("<SELECT NAME=\"er_view\" SIZE=\"1\" OnChange=\""
1817 " if (this.form.er_view.value == 0) { "
1818 " this.form.type[0].checked=true; "
1819 " this.form.er_floor.disabled = false; "
1822 " this.form.type[4].checked=true; "
1823 " this.form.er_floor.disabled = true; "
1826 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
1827 wprintf("<OPTION %s VALUE=\"%d\">",
1828 ((i == 0) ? "SELECTED" : ""), i );
1829 escputs(viewdefs[i]);
1830 wprintf("</OPTION>\n");
1832 wprintf("</SELECT>\n");
1834 wprintf("<LI>Type of room:<UL>\n");
1836 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1837 wprintf("CHECKED OnChange=\""
1838 " if (this.form.type[0].checked == true) { "
1839 " this.form.er_floor.disabled = false; "
1841 "\"> Public (automatically appears to everyone)\n");
1843 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
1844 " if (this.form.type[1].checked == true) { "
1845 " this.form.er_floor.disabled = false; "
1847 "\"> Private - hidden (accessible to anyone who knows its name)\n");
1849 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
1850 " if (this.form.type[2].checked == true) { "
1851 " this.form.er_floor.disabled = false; "
1853 "\"> Private - require password:\n");
1854 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
1856 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
1857 " if (this.form.type[3].checked == true) { "
1858 " this.form.er_floor.disabled = false; "
1860 "\"> Private - invitation only\n");
1862 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"personal\" "
1864 " if (this.form.type[4].checked == true) { "
1865 " this.form.er_floor.disabled = true; "
1867 "\"> Personal (mailbox for you only)\n");
1871 wprintf("<CENTER>\n");
1872 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1874 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1875 wprintf("</CENTER>\n");
1876 wprintf("</FORM>\n<hr />");
1877 serv_printf("MESG roomaccess");
1878 serv_getln(buf, sizeof buf);
1879 if (buf[0] == '1') {
1880 fmout(NULL, "CENTER");
1882 wprintf("</td></tr></table></div>\n");
1890 * support function for entroom() -- sets the default view
1892 void er_set_default_view(int newview) {
1905 serv_getln(buf, sizeof buf);
1906 if (buf[0] != '2') return;
1908 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
1909 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
1910 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
1911 rm_bits1 = extract_int(&buf[4], 3);
1912 rm_floor = extract_int(&buf[4], 4);
1913 rm_listorder = extract_int(&buf[4], 5);
1914 rm_bits2 = extract_int(&buf[4], 7);
1916 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1917 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
1918 rm_listorder, newview, rm_bits2
1920 serv_getln(buf, sizeof buf);
1933 char er_password[SIZ];
1938 if (strcmp(bstr("sc"), "OK")) {
1939 strcpy(WC->ImportantMessage,
1940 "Cancelled. No new room was created.");
1941 display_main_menu();
1944 strcpy(er_name, bstr("er_name"));
1945 strcpy(er_type, bstr("type"));
1946 strcpy(er_password, bstr("er_password"));
1947 er_floor = atoi(bstr("er_floor"));
1948 er_view = atoi(bstr("er_view"));
1951 if (!strcmp(er_type, "hidden"))
1953 if (!strcmp(er_type, "passworded"))
1955 if (!strcmp(er_type, "invonly"))
1957 if (!strcmp(er_type, "personal"))
1960 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
1961 er_name, er_num_type, er_password, er_floor, 0, er_view);
1963 serv_getln(buf, sizeof buf);
1964 if (buf[0] != '2') {
1965 strcpy(WC->ImportantMessage, &buf[4]);
1966 display_main_menu();
1970 do_change_view(er_view); /* Now go there */
1975 * display the screen to enter a private room
1977 void display_private(char *rname, int req_pass)
1979 output_headers(1, 1, 2, 0, 0, 0, 0);
1980 wprintf("<div id=\"banner\">\n"
1981 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1982 "<SPAN CLASS=\"titlebar\">Go to a hidden room</SPAN>"
1983 "</TD></TR></TABLE>\n"
1984 "</div>\n<div id=\"content\">\n"
1987 wprintf("<div id=\"fix_scrollbar_bug\">"
1988 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1990 wprintf("<CENTER>\n");
1991 wprintf("<br />If you know the name of a hidden (guess-name) or\n");
1992 wprintf("passworded room, you can enter that room by typing\n");
1993 wprintf("its name below. Once you gain access to a private\n");
1994 wprintf("room, it will appear in your regular room listings\n");
1995 wprintf("so you don't have to keep returning here.\n");
1996 wprintf("<br /><br />");
1998 wprintf("<FORM METHOD=\"GET\" ACTION=\"/goto_private\">\n");
2000 wprintf("<table border=\"0\" cellspacing=\"5\" "
2001 "cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
2003 "Enter room name:</TD><TD>"
2004 "<INPUT TYPE=\"text\" NAME=\"gr_name\" "
2005 "VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
2008 wprintf("</TD></TR><TR><TD>");
2009 wprintf("Enter room password:</TD><TD>");
2010 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
2012 wprintf("</TD></TR></TABLE><br />\n");
2014 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
2016 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2017 wprintf("</FORM>\n");
2018 wprintf("</td></tr></table></div>\n");
2023 * goto a private room
2025 void goto_private(void)
2030 if (strcasecmp(bstr("sc"), "OK")) {
2031 display_main_menu();
2034 strcpy(hold_rm, WC->wc_roomname);
2035 strcpy(buf, "GOTO ");
2036 strcat(buf, bstr("gr_name"));
2038 strcat(buf, bstr("gr_pass"));
2040 serv_getln(buf, sizeof buf);
2042 if (buf[0] == '2') {
2043 smart_goto(bstr("gr_name"));
2046 if (!strncmp(buf, "540", 3)) {
2047 display_private(bstr("gr_name"), 1);
2050 output_headers(1, 1, 1, 0, 0, 0, 0);
2051 wprintf("%s\n", &buf[4]);
2058 * display the screen to zap a room
2060 void display_zap(void)
2062 output_headers(1, 1, 2, 0, 0, 0, 0);
2064 wprintf("<div id=\"banner\">\n");
2065 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
2066 wprintf("<SPAN CLASS=\"titlebar\">Zap (forget/unsubscribe) the current room</SPAN>\n");
2067 wprintf("</TD></TR></TABLE>\n");
2068 wprintf("</div>\n<div id=\"content\">\n");
2070 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
2071 wprintf("disappear from your room list. Is this what you wish ");
2072 wprintf("to do?<br />\n");
2074 wprintf("<FORM METHOD=\"GET\" ACTION=\"/zap\">\n");
2075 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
2077 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2078 wprintf("</FORM>\n");
2089 char final_destination[SIZ];
2091 /* If the forget-room routine fails for any reason, we fall back
2092 * to the current room; otherwise, we go to the Lobby
2094 strcpy(final_destination, WC->wc_roomname);
2096 if (!strcasecmp(bstr("sc"), "OK")) {
2097 serv_printf("GOTO %s", WC->wc_roomname);
2098 serv_getln(buf, sizeof buf);
2099 if (buf[0] == '2') {
2101 serv_getln(buf, sizeof buf);
2102 if (buf[0] == '2') {
2103 strcpy(final_destination, "_BASEROOM_");
2107 smart_goto(final_destination);
2113 * Delete the current room
2115 void delete_room(void)
2119 serv_puts("KILL 1");
2120 serv_getln(buf, sizeof buf);
2121 if (buf[0] != '2') {
2122 strcpy(WC->ImportantMessage, &buf[4]);
2123 display_main_menu();
2126 smart_goto("_BASEROOM_");
2133 * Perform changes to a room's network configuration
2135 void netedit(void) {
2144 if (strlen(bstr("line"))==0) {
2149 strcpy(line, bstr("prefix"));
2150 strcat(line, bstr("line"));
2151 strcat(line, bstr("suffix"));
2160 serv_getln(buf, sizeof buf);
2161 if (buf[0] != '1') {
2167 /* This loop works for add *or* remove. Spiffy, eh? */
2168 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2169 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2170 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2171 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2172 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2173 if ( (strcasecmp(cmpa0, cmpb0))
2174 || (strcasecmp(cmpa1, cmpb1)) ) {
2175 fprintf(fp, "%s\n", buf);
2181 serv_getln(buf, sizeof buf);
2182 if (buf[0] != '4') {
2188 while (fgets(buf, sizeof buf, fp) != NULL) {
2189 buf[strlen(buf)-1] = 0;
2193 if (!strcasecmp(bstr("cmd"), "add")) {
2205 * Convert a room name to a folder-ish-looking name.
2207 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2212 * For mailboxes, just do it straight...
2215 sprintf(folder, "My folders|%s", room);
2219 * Otherwise, prefix the floor name as a "public folders" moniker
2222 sprintf(folder, "%s|%s", floorlist[floor], room);
2226 * Replace "\" characters with "|" for pseudo-folder-delimiting
2228 for (i=0; i<strlen(folder); ++i) {
2229 if (folder[i] == '\\') folder[i] = '|';
2237 * Back end for change_view()
2239 void do_change_view(int newview) {
2242 serv_printf("VIEW %d", newview);
2243 serv_getln(buf, sizeof buf);
2244 WC->wc_view = newview;
2245 smart_goto(WC->wc_roomname);
2251 * Change the view for this room
2253 void change_view(void) {
2256 view = atol(bstr("view"));
2257 do_change_view(view);
2262 * One big expanded tree list view --- like a folder list
2264 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2268 int has_subfolders = 0;
2271 parents = malloc(max_folders * sizeof(int));
2273 /* BEGIN TREE MENU */
2274 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2276 /* include NanoTree */
2277 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2279 /* initialize NanoTree */
2280 wprintf("<script type=\"text/javascript\"> \n"
2281 " showRootNode = false; \n"
2282 " sortNodes = false; \n"
2283 " dragable = false; \n"
2285 " function standardClick(treeNode) { \n"
2288 " var closedGif = 'static/folder_closed.gif'; \n"
2289 " var openGif = 'static/folder_open.gif'; \n"
2291 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2295 for (i=0; i<max_folders; ++i) {
2298 if ((i+1) < max_folders) {
2299 if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
2300 && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
2305 levels = num_tokens(fold[i].name, '|');
2306 parents[levels] = i;
2308 wprintf("var node%d = new TreeNode(%d, '", i, i);
2310 if (fold[i].selectable) {
2311 wprintf("<A HREF=\"/dotgoto?room=");
2312 urlescputs(fold[i].room);
2317 wprintf("<SPAN CLASS=\"roomlist_floor\">");
2319 else if (fold[i].hasnewmsgs) {
2320 wprintf("<SPAN CLASS=\"roomlist_new\">");
2323 wprintf("<SPAN CLASS=\"roomlist_old\">");
2325 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2330 if (has_subfolders) {
2331 wprintf("new Array(closedGif, openGif)");
2333 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2334 wprintf("'static/viewcontacts_16x.gif'");
2336 else if (fold[i].view == VIEW_CALENDAR) {
2337 wprintf("'static/calarea_16x.gif'");
2339 else if (fold[i].view == VIEW_TASKS) {
2340 wprintf("'static/taskmanag_16x.gif'");
2342 else if (fold[i].view == VIEW_NOTES) {
2343 wprintf("'static/storenotes_16x.gif'");
2345 else if (fold[i].view == VIEW_MAILBOX) {
2346 wprintf("'static/privatemess_16x.gif'");
2349 wprintf("'static/chatrooms_16x.gif'");
2352 urlescputs(fold[i].name);
2356 wprintf("rootNode.addChild(node%d);\n", i);
2359 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2363 wprintf("container = document.getElementById('roomlist_div'); \n"
2373 * Boxes and rooms and lists ... oh my!
2375 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2378 int levels, oldlevels;
2381 static int columns = 3;
2382 int boxes_per_column = 0;
2383 int current_column = 0;
2387 while (nf % columns != 0) ++nf;
2388 boxes_per_column = (nf / columns);
2389 if (boxes_per_column < 1) boxes_per_column = 1;
2391 /* Outer table (for columnization) */
2392 wprintf("<TABLE BORDER=0 WIDTH=96%% CELLPADDING=5>"
2393 "<tr><td valign=top>");
2397 for (i=0; i<max_folders; ++i) {
2399 levels = num_tokens(fold[i].name, '|');
2401 if ((levels == 1) && (oldlevels > 1)) {
2404 do_template("endbox");
2407 if ((num_boxes % boxes_per_column) == 0) {
2409 if (current_column < columns) {
2410 wprintf("</td><td valign=top>\n");
2417 /* Begin inner box */
2418 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2419 stresc(boxtitle, buf, 1, 0);
2420 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2421 do_template("beginbox");
2429 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
2430 if (fold[i].selectable) {
2431 wprintf("<A HREF=\"/dotgoto?room=");
2432 urlescputs(fold[i].room);
2438 if (fold[i].hasnewmsgs) {
2439 wprintf("<SPAN CLASS=\"roomlist_new\">");
2442 wprintf("<SPAN CLASS=\"roomlist_old\">");
2444 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2447 if (fold[i].selectable) {
2453 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
2454 wprintf(" (INBOX)");
2456 wprintf("<br />\n");
2459 /* End the final inner box */
2460 do_template("endbox");
2462 wprintf("</TD></TR></TABLE>\n");
2467 * Show the room list. (only should get called by
2468 * knrooms() because that's where output_headers() is called from)
2471 void list_all_rooms_by_floor(char *viewpref) {
2474 struct folder *fold = NULL;
2476 int max_folders = 0;
2477 int alloc_folders = 0;
2481 int num_floors = 1; /* add an extra one for private folders */
2483 /* Start with the mailboxes */
2486 fold = malloc(sizeof(struct folder));
2487 memset(fold, 0, sizeof(struct folder));
2488 strcpy(fold[0].name, "My folders");
2489 fold[0].is_mailbox = 1;
2491 /* Then add floors */
2493 serv_getln(buf, sizeof buf);
2494 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2495 if (max_folders >= alloc_folders) {
2496 alloc_folders = max_folders + 100;
2497 fold = realloc(fold,
2498 alloc_folders * sizeof(struct folder));
2500 memset(&fold[max_folders], 0, sizeof(struct folder));
2501 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
2508 serv_getln(buf, sizeof buf);
2509 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2510 if (max_folders >= alloc_folders) {
2511 alloc_folders = max_folders + 100;
2512 fold = realloc(fold,
2513 alloc_folders * sizeof(struct folder));
2515 memset(&fold[max_folders], 0, sizeof(struct folder));
2516 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
2517 ra_flags = extract_int(buf, 5);
2518 flags = extract_int(buf, 1);
2519 fold[max_folders].floor = extract_int(buf, 2);
2520 fold[max_folders].hasnewmsgs =
2521 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
2522 if (flags & QR_MAILBOX) {
2523 fold[max_folders].is_mailbox = 1;
2525 fold[max_folders].view = extract_int(buf, 6);
2526 room_to_folder(fold[max_folders].name,
2527 fold[max_folders].room,
2528 fold[max_folders].floor,
2529 fold[max_folders].is_mailbox);
2530 fold[max_folders].selectable = 1;
2534 /* Bubble-sort the folder list */
2535 for (i=0; i<max_folders; ++i) {
2536 for (j=0; j<(max_folders-1)-i; ++j) {
2537 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
2538 swap = strcasecmp(fold[j].name, fold[j+1].name);
2541 if ( (fold[j+1].is_mailbox)
2542 && (!fold[j].is_mailbox)) {
2550 memcpy(&ftmp, &fold[j], sizeof(struct folder));
2551 memcpy(&fold[j], &fold[j+1],
2552 sizeof(struct folder));
2553 memcpy(&fold[j+1], &ftmp,
2554 sizeof(struct folder));
2559 /* test only hackish view
2560 wprintf("<table><TR><TD>A Table</TD></TR></table>\n");
2561 for (i=0; i<max_folders; ++i) {
2562 escputs(fold[i].name);
2563 wprintf("<br />\n");
2567 if (!strcasecmp(viewpref, "folders")) {
2568 do_folder_view(fold, max_folders, num_floors);
2571 do_rooms_view(fold, max_folders, num_floors);
2579 /* Do either a known rooms list or a folders list, depending on the
2583 char listviewpref[SIZ];
2585 output_headers(1, 1, 2, 0, 0, 0, 0);
2588 /* Determine whether the user is trying to change views */
2589 if (bstr("view") != NULL) {
2590 if (strlen(bstr("view")) > 0) {
2591 set_preference("roomlistview", bstr("view"), 1);
2595 get_preference("roomlistview", listviewpref, sizeof listviewpref);
2597 if ( (strcasecmp(listviewpref, "folders"))
2598 && (strcasecmp(listviewpref, "table")) ) {
2599 strcpy(listviewpref, "rooms");
2603 wprintf("<div id=\"banner\">\n"
2604 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
2605 "<SPAN CLASS=\"titlebar\">"
2607 if (!strcasecmp(listviewpref, "rooms")) {
2608 wprintf("Room list");
2610 if (!strcasecmp(listviewpref, "folders")) {
2611 wprintf("Folder list");
2613 if (!strcasecmp(listviewpref, "table")) {
2614 wprintf("Room list");
2616 wprintf("</SPAN></TD>\n");
2618 /* offer the ability to switch views */
2619 wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
2620 "<SELECT NAME=\"newview\" SIZE=\"1\" "
2621 "OnChange=\"location.href=roomlistomatic.newview.options"
2622 "[selectedIndex].value\">\n");
2624 wprintf("<OPTION %s VALUE=\"/knrooms&view=rooms\">"
2627 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
2630 wprintf("<OPTION %s VALUE=\"/knrooms&view=folders\">"
2631 "View as folder list"
2633 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
2636 wprintf("</SELECT><br />");
2638 wprintf("</FORM></TD></TR></TABLE>\n");
2641 "<div id=\"content\">\n");
2643 /* Display the room list in the user's preferred format */
2644 list_all_rooms_by_floor(listviewpref);
2650 * Set the message expire policy for this room and/or floor
2652 void set_room_policy(void) {
2655 if (strcmp(bstr("sc"), "OK")) {
2656 strcpy(WC->ImportantMessage,
2657 "Cancelled. Changes were not saved.");
2662 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
2663 serv_getln(buf, sizeof buf);
2664 strcpy(WC->ImportantMessage, &buf[4]);
2666 if (WC->axlevel >= 6) {
2667 strcat(WC->ImportantMessage, "<br />\n");
2668 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
2669 serv_getln(buf, sizeof buf);
2670 strcat(WC->ImportantMessage, &buf[4]);