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\" action=\"/changeview\">\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/viewcontacts_24x.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/taskmanag_24x.gif\" "
467 "<span class=\"navbar_link\">"
475 "<A HREF=\"/readfwd\">"
476 "<img align=\"middle\" src=\"/static/viewnotes_24x.gif\" "
478 "<span class=\"navbar_link\">"
486 "<A HREF=\"/readfwd\">"
487 "<img align=\"middle\" src=\"/static/readallmess3_24x.gif\" "
489 "<span class=\"navbar_link\">"
497 "<A HREF=\"/readfwd\">"
498 "<img align=\"middle\" src=\"/static/readallmess3_24x.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/enternewnote_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\">"
558 if (navbar_style == navbar_default) wprintf(
561 "TITLE=\"Leave all messages marked as unread, go to next room with unread messages\">"
562 "<img align=\"middle\" src=\"/static/skipthisroom_24x.gif\" border=\"0\">"
563 "<span class=\"navbar_link\">Skip this room</span></a>"
567 if (navbar_style == navbar_default) wprintf(
569 "<A HREF=\"/gotonext\" "
570 "TITLE=\"Mark all messages as read, go to next room with unread messages\">"
571 "<img align=\"middle\" src=\"/static/markngo_24x.gif\" border=\"0\">"
572 "<span class=\"navbar_link\">Goto next room</span></a>"
576 wprintf("</tr></table></div>\n");
586 * back end routine to take the session to a new room
589 void gotoroom(char *gname)
592 static long ls = (-1L);
594 /* store ungoto information */
595 strcpy(WC->ugname, WC->wc_roomname);
598 /* move to the new room */
599 serv_printf("GOTO %s", gname);
600 serv_getln(buf, sizeof buf);
602 serv_puts("GOTO _BASEROOM_");
603 serv_getln(buf, sizeof buf);
608 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
609 WC->room_flags = extract_int(&buf[4], 4);
610 /* highest_msg_read = extract_int(&buf[4],6);
611 maxmsgnum = extract_int(&buf[4],5);
612 is_mail = (char) extract_int(&buf[4],7); */
613 ls = extract_long(&buf[4], 6);
614 WC->wc_floor = extract_int(&buf[4], 10);
615 WC->wc_view = extract_int(&buf[4], 11);
616 WC->wc_default_view = extract_int(&buf[4], 12);
619 WC->is_room_aide = WC->is_aide;
621 WC->is_room_aide = (char) extract_int(&buf[4], 8);
623 remove_march(WC->wc_roomname);
624 if (!strcasecmp(gname, "_BASEROOM_"))
630 * Locate the room on the march list which we most want to go to. Each room
631 * is measured given a "weight" of preference based on various factors.
633 char *pop_march(int desired_floor)
635 static char TheRoom[128];
637 int TheOrder = 32767;
640 struct march *mptr = NULL;
642 strcpy(TheRoom, "_BASEROOM_");
643 if (WC->march == NULL)
646 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
648 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
649 weight = weight + 10000;
650 if (mptr->march_floor == desired_floor)
651 weight = weight + 5000;
653 weight = weight + ((128 - (mptr->march_floor)) * 128);
654 weight = weight + (128 - (mptr->march_order));
656 if (weight > TheWeight) {
658 strcpy(TheRoom, mptr->march_name);
659 TheFloor = mptr->march_floor;
660 TheOrder = mptr->march_order;
668 /* Goto next room having unread messages.
669 * We want to skip over rooms that the user has already been to, and take the
670 * user back to the lobby when done. The room we end up in is placed in
671 * newroom - which is set to 0 (the lobby) initially.
672 * We start the search in the current room rather than the beginning to prevent
673 * two or more concurrent users from dragging each other back to the same room.
678 struct march *mptr, *mptr2;
681 /* First check to see if the march-mode list is already allocated.
682 * If it is, pop the first room off the list and go there.
685 if (WC->march == NULL) {
687 serv_getln(buf, sizeof buf);
689 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
690 mptr = (struct march *) malloc(sizeof(struct march));
692 extract_token(mptr->march_name, buf, 0, '|', sizeof mptr->march_name);
693 mptr->march_floor = extract_int(buf, 2);
694 mptr->march_order = extract_int(buf, 3);
695 if (WC->march == NULL) {
699 while (mptr2->next != NULL)
704 /* add _BASEROOM_ to the end of the march list, so the user will end up
705 * in the system base room (usually the Lobby>) at the end of the loop
707 mptr = (struct march *) malloc(sizeof(struct march));
709 strcpy(mptr->march_name, "_BASEROOM_");
710 if (WC->march == NULL) {
714 while (mptr2->next != NULL)
719 * ...and remove the room we're currently in, so a <G>oto doesn't make us
720 * walk around in circles
722 remove_march(WC->wc_roomname);
724 if (WC->march != NULL) {
725 strcpy(next_room, pop_march(-1));
727 strcpy(next_room, "_BASEROOM_");
731 smart_goto(next_room);
735 void smart_goto(char *next_room) {
743 * mark all messages in current room as having been read
745 void slrp_highest(void)
750 serv_puts("SLRP HIGHEST");
751 serv_getln(buf, sizeof buf);
753 wprintf("<EM>%s</EM><br />\n", &buf[4]);
760 * un-goto the previous room
766 if (!strcmp(WC->ugname, "")) {
767 smart_goto(WC->wc_roomname);
770 serv_printf("GOTO %s", WC->ugname);
771 serv_getln(buf, sizeof buf);
773 smart_goto(WC->wc_roomname);
776 if (WC->uglsn >= 0L) {
777 serv_printf("SLRP %ld", WC->uglsn);
778 serv_getln(buf, sizeof buf);
780 strcpy(buf, WC->ugname);
781 strcpy(WC->ugname, "");
790 * Set/clear/read the "self-service list subscribe" flag for a room
792 * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged.
793 * Always returns the new value.
796 int self_service(int newval) {
797 int current_value = 0;
803 int flags, floor, order, view, flags2;
806 serv_getln(buf, sizeof buf);
807 if (buf[0] != '2') return(0);
809 extract_token(name, &buf[4], 0, '|', sizeof name);
810 extract_token(password, &buf[4], 1, '|', sizeof password);
811 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
812 flags = extract_int(&buf[4], 3);
813 floor = extract_int(&buf[4], 4);
814 order = extract_int(&buf[4], 5);
815 view = extract_int(&buf[4], 6);
816 flags2 = extract_int(&buf[4], 7);
818 if (flags2 & QR2_SELFLIST) {
826 flags2 = flags2 | QR2_SELFLIST;
828 else if (newval == 0) {
829 flags2 = flags2 & ~QR2_SELFLIST;
832 return(current_value);
835 if (newval != current_value) {
836 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
837 name, password, dirname, flags,
838 floor, order, view, flags2);
839 serv_getln(buf, sizeof buf);
852 * display the form for editing a room
854 void display_editroom(void)
859 char remote_room[SIZ];
862 char er_password[10];
864 char er_roomaide[26];
870 char *not_shared_with;
877 if (strlen(tab) == 0) tab = "admin";
881 serv_getln(buf, sizeof buf);
884 strcpy(WC->ImportantMessage, &buf[4]);
888 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
889 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
890 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
891 er_flags = extract_int(&buf[4], 3);
892 er_floor = extract_int(&buf[4], 4);
894 output_headers(1, 1, 1, 0, 0, 0, 0);
896 /* print the tabbed dialog */
898 "<div id=\"fix_scrollbar_bug\">"
899 "<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
901 "<TD> </TD>\n");
903 if (!strcmp(tab, "admin")) {
904 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
907 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=admin\">");
909 wprintf("Administration");
910 if (!strcmp(tab, "admin")) {
911 wprintf("</SPAN></TD>\n");
914 wprintf("</A></TD>\n");
917 wprintf("<TD> </TD>\n");
919 if (!strcmp(tab, "config")) {
920 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
923 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=config\">");
925 wprintf("Configuration");
926 if (!strcmp(tab, "config")) {
927 wprintf("</SPAN></TD>\n");
930 wprintf("</A></TD>\n");
933 wprintf("<TD> </TD>\n");
935 if (!strcmp(tab, "expire")) {
936 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
939 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=expire\">");
941 wprintf("Message expire policy");
942 if (!strcmp(tab, "expire")) {
943 wprintf("</SPAN></TD>\n");
946 wprintf("</A></TD>\n");
949 wprintf("<TD> </TD>\n");
951 if (!strcmp(tab, "access")) {
952 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
955 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=access\">");
957 wprintf("Access controls");
958 if (!strcmp(tab, "access")) {
959 wprintf("</SPAN></TD>\n");
962 wprintf("</A></TD>\n");
965 wprintf("<TD> </TD>\n");
967 if (!strcmp(tab, "sharing")) {
968 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
971 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=sharing\">");
974 if (!strcmp(tab, "sharing")) {
975 wprintf("</SPAN></TD>\n");
978 wprintf("</A></TD>\n");
981 wprintf("<TD> </TD>\n");
983 if (!strcmp(tab, "listserv")) {
984 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
987 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=listserv\">");
989 wprintf("Mailing list service");
990 if (!strcmp(tab, "listserv")) {
991 wprintf("</SPAN></TD>\n");
994 wprintf("</A></TD>\n");
997 wprintf("<TD> </TD>\n");
999 wprintf("</TR></TABLE></div>\n");
1000 /* end tabbed dialog */
1002 /* begin content of whatever tab is open now */
1003 wprintf("<div id=\"fix_scrollbar_bug\">"
1004 "<TABLE border=0 width=100%% bgcolor=\"#FFFFFF\">\n"
1007 if (!strcmp(tab, "admin")) {
1009 "<LI><A HREF=\"/delete_room\" "
1010 "onClick=\"return confirm('Are you sure you want to delete this room?');\">\n"
1011 "Delete this room</A>\n"
1012 "<LI><A HREF=\"/display_editroompic\">\n"
1013 "Set or change the icon for this room's banner</A>\n"
1014 "<LI><A HREF=\"/display_editinfo\">\n"
1015 "Edit this room's Info file</A>\n"
1019 if (!strcmp(tab, "config")) {
1020 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
1022 wprintf("<UL><LI>Name of room: ");
1023 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
1025 wprintf("<LI>Resides on floor: ");
1026 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1027 for (i = 0; i < 128; ++i)
1028 if (strlen(floorlist[i]) > 0) {
1029 wprintf("<OPTION ");
1031 wprintf("SELECTED ");
1032 wprintf("VALUE=\"%d\">", i);
1033 escputs(floorlist[i]);
1034 wprintf("</OPTION>\n");
1036 wprintf("</SELECT>\n");
1038 wprintf("<LI>Type of room:<UL>\n");
1040 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1041 if ((er_flags & QR_PRIVATE) == 0)
1042 wprintf("CHECKED ");
1043 wprintf("> Public room\n");
1045 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1046 if ((er_flags & QR_PRIVATE) &&
1047 (er_flags & QR_GUESSNAME))
1048 wprintf("CHECKED ");
1049 wprintf("> Private - guess name\n");
1051 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1052 if ((er_flags & QR_PRIVATE) &&
1053 (er_flags & QR_PASSWORDED))
1054 wprintf("CHECKED ");
1055 wprintf("> Private - require password:\n");
1056 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
1058 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1059 if ((er_flags & QR_PRIVATE)
1060 && ((er_flags & QR_GUESSNAME) == 0)
1061 && ((er_flags & QR_PASSWORDED) == 0))
1062 wprintf("CHECKED ");
1063 wprintf("> Private - invitation only\n");
1065 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1066 wprintf("> If private, cause current users to forget room\n");
1070 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1071 if (er_flags & QR_PREFONLY)
1072 wprintf("CHECKED ");
1073 wprintf("> Preferred users only\n");
1075 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1076 if (er_flags & QR_READONLY)
1077 wprintf("CHECKED ");
1078 wprintf("> Read-only room\n");
1080 /* directory stuff */
1081 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1082 if (er_flags & QR_DIRECTORY)
1083 wprintf("CHECKED ");
1084 wprintf("> File directory room\n");
1086 wprintf("<UL><LI>Directory name: ");
1087 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
1089 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1090 if (er_flags & QR_UPLOAD)
1091 wprintf("CHECKED ");
1092 wprintf("> Uploading allowed\n");
1094 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1095 if (er_flags & QR_DOWNLOAD)
1096 wprintf("CHECKED ");
1097 wprintf("> Downloading allowed\n");
1099 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1100 if (er_flags & QR_VISDIR)
1101 wprintf("CHECKED ");
1102 wprintf("> Visible directory</UL>\n");
1104 /* end of directory stuff */
1106 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1107 if (er_flags & QR_NETWORK)
1108 wprintf("CHECKED ");
1109 wprintf("> Network shared room\n");
1111 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1112 if (er_flags & QR_PERMANENT)
1113 wprintf("CHECKED ");
1114 wprintf("> Permanent (does not auto-purge)\n");
1116 /* start of anon options */
1118 wprintf("<LI>Anonymous messages<UL>\n");
1120 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1121 if (((er_flags & QR_ANONONLY) == 0)
1122 && ((er_flags & QR_ANONOPT) == 0))
1123 wprintf("CHECKED ");
1124 wprintf("> No anonymous messages\n");
1126 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1127 if (er_flags & QR_ANONONLY)
1128 wprintf("CHECKED ");
1129 wprintf("> All messages are anonymous\n");
1131 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1132 if (er_flags & QR_ANONOPT)
1133 wprintf("CHECKED ");
1134 wprintf("> Prompt user when entering messages</UL>\n");
1136 /* end of anon options */
1138 wprintf("<LI>Room aide: \n");
1140 serv_getln(buf, sizeof buf);
1141 if (buf[0] != '2') {
1142 wprintf("<EM>%s</EM>\n", &buf[4]);
1144 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1145 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1148 wprintf("</UL><CENTER>\n");
1149 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1150 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1152 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
1158 /* Sharing the room with other Citadel nodes... */
1159 if (!strcmp(tab, "sharing")) {
1161 shared_with = strdup("");
1162 not_shared_with = strdup("");
1164 /* Learn the current configuration */
1165 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1166 serv_getln(buf, sizeof buf);
1167 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1168 extract_token(node, buf, 0, '|', sizeof node);
1169 not_shared_with = realloc(not_shared_with,
1170 strlen(not_shared_with) + 32);
1171 strcat(not_shared_with, node);
1172 strcat(not_shared_with, "\n");
1176 serv_getln(buf, sizeof buf);
1177 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1178 extract_token(cmd, buf, 0, '|', sizeof cmd);
1179 extract_token(node, buf, 1, '|', sizeof node);
1180 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1181 if (!strcasecmp(cmd, "ignet_push_share")) {
1182 shared_with = realloc(shared_with,
1183 strlen(shared_with) + 32);
1184 strcat(shared_with, node);
1185 if (strlen(remote_room) > 0) {
1186 strcat(shared_with, "|");
1187 strcat(shared_with, remote_room);
1189 strcat(shared_with, "\n");
1193 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1194 extract_token(buf, shared_with, i, '\n', sizeof buf);
1195 extract_token(node, buf, 0, '|', sizeof node);
1196 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1197 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1198 if (!strcasecmp(node, cmd)) {
1199 remove_token(not_shared_with, j, '\n');
1204 /* Display the stuff */
1205 wprintf("<CENTER><br />"
1206 "<TABLE border=1 cellpadding=5><TR>"
1207 "<TD><B><I>Shared with</I></B></TD>"
1208 "<TD><B><I>Not shared with</I></B></TD></TR>\n"
1209 "<TR><TD VALIGN=TOP>\n");
1211 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1212 "<TD>Remote node name</TD>"
1213 "<TD>Remote room name</TD>"
1218 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1219 extract_token(buf, shared_with, i, '\n', sizeof buf);
1220 extract_token(node, buf, 0, '|', sizeof node);
1221 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1222 if (strlen(node) > 0) {
1223 wprintf("<FORM METHOD=\"POST\" "
1224 "ACTION=\"/netedit\">"
1225 "<TR><TD>%s</TD>\n", node);
1228 if (strlen(remote_room) > 0) {
1229 escputs(remote_room);
1235 wprintf("<INPUT TYPE=\"hidden\" NAME=\"line\" "
1236 "VALUE=\"ignet_push_share|");
1238 if (strlen(remote_room) > 0) {
1240 urlescputs(remote_room);
1243 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1244 "VALUE=\"sharing\">\n");
1245 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1246 "VALUE=\"remove\">\n");
1247 wprintf("<INPUT TYPE=\"submit\" "
1248 "NAME=\"sc\" VALUE=\"Unshare\">");
1249 wprintf("</TD></TR></FORM>\n");
1253 wprintf("</TABLE>\n");
1254 wprintf("</TD><TD VALIGN=TOP>\n");
1255 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1256 "<TD>Remote node name</TD>"
1257 "<TD>Remote room name</TD>"
1262 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1263 extract_token(node, not_shared_with, i, '\n', sizeof node);
1264 if (strlen(node) > 0) {
1265 wprintf("<FORM METHOD=\"POST\" "
1266 "ACTION=\"/netedit\">"
1270 "<INPUT TYPE=\"INPUT\" "
1274 wprintf("<INPUT TYPE=\"hidden\" "
1276 "VALUE=\"ignet_push_share|");
1279 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1280 "VALUE=\"sharing\">\n");
1281 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1282 "VALUE=\"add\">\n");
1283 wprintf("<INPUT TYPE=\"submit\" "
1284 "NAME=\"sc\" VALUE=\"Share\">");
1285 wprintf("</TD></TR></FORM>\n");
1289 wprintf("</TABLE>\n");
1290 wprintf("</TD></TR>"
1291 "</TABLE></CENTER><br />\n"
1292 "<I><B>Notes:</B><UL><LI>When sharing a room, "
1293 "it must be shared from both ends. Adding a node to "
1294 "the 'shared' list sends messages out, but in order to"
1295 " receive messages, the other nodes must be configured"
1296 " to send messages out to your system as well.\n"
1297 "<LI>If the remote room name is blank, it is assumed "
1298 "that the room name is identical on the remote node."
1299 "<LI>If the remote room name is different, the remote "
1300 "node must also configure the name of the room here."
1306 /* Mailing list management */
1307 if (!strcmp(tab, "listserv")) {
1309 wprintf("<br /><center>"
1310 "<TABLE BORDER=0 WIDTH=100%% CELLPADDING=5>"
1311 "<TR><TD VALIGN=TOP>");
1313 wprintf("<i>The contents of this room are being "
1314 "mailed <b>as individual messages</b> "
1315 "to the following list recipients:"
1316 "</i><br /><br />\n");
1319 serv_getln(buf, sizeof buf);
1320 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1321 extract_token(cmd, buf, 0, '|', sizeof cmd);
1322 if (!strcasecmp(cmd, "listrecp")) {
1323 extract_token(recp, buf, 1, '|', sizeof recp);
1326 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1329 wprintf("&tab=listserv\">(remove)</A><br />");
1333 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1334 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1335 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1336 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1337 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1338 wprintf("</FORM>\n");
1340 wprintf("</TD><TD VALIGN=TOP>\n");
1342 wprintf("<i>The contents of this room are being "
1343 "mailed <b>in digest form</b> "
1344 "to the following list recipients:"
1345 "</i><br /><br />\n");
1348 serv_getln(buf, sizeof buf);
1349 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1350 extract_token(cmd, buf, 0, '|', sizeof cmd);
1351 if (!strcasecmp(cmd, "digestrecp")) {
1352 extract_token(recp, buf, 1, '|', sizeof recp);
1355 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1358 wprintf("&tab=listserv\">(remove)</A><br />");
1362 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1363 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1364 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1365 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1366 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1367 wprintf("</FORM>\n");
1369 wprintf("</TD></TR></TABLE><hr />\n");
1371 if (self_service(999) == 1) {
1372 wprintf("This room is configured to allow "
1373 "self-service subscribe/unsubscribe requests."
1374 " <A HREF=\"/toggle_self_service?newval=0&"
1376 "Click to disable.</A><br />\n"
1377 "The URL for subscribe/unsubscribe is: "
1378 "<TT>http://%s/listsub</TT><br />\n",
1383 wprintf("This room is <i>not</i> configured to allow "
1384 "self-service subscribe/unsubscribe requests."
1385 " <A HREF=\"/toggle_self_service?newval=1&"
1387 "Click to enable.</A><br />\n"
1392 wprintf("</CENTER>\n");
1396 /* Mailing list management */
1397 if (!strcmp(tab, "expire")) {
1399 serv_puts("GPEX room");
1400 serv_getln(buf, sizeof buf);
1401 if (buf[0] == '2') {
1402 roompolicy = extract_int(&buf[4], 0);
1403 roomvalue = extract_int(&buf[4], 1);
1406 serv_puts("GPEX floor");
1407 serv_getln(buf, sizeof buf);
1408 if (buf[0] == '2') {
1409 floorpolicy = extract_int(&buf[4], 0);
1410 floorvalue = extract_int(&buf[4], 1);
1413 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/set_room_policy\">\n");
1414 wprintf("<TABLE border=0 cellspacing=5>\n");
1415 wprintf("<TR><TD>Message expire policy for this room<br />(");
1416 escputs(WC->wc_roomname);
1417 wprintf(")</TD><TD>");
1418 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1419 ((roompolicy == 0) ? "CHECKED" : "") );
1420 wprintf("Use the default policy for this floor<br />\n");
1421 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1422 ((roompolicy == 1) ? "CHECKED" : "") );
1423 wprintf("Never automatically expire messages<br />\n");
1424 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1425 ((roompolicy == 2) ? "CHECKED" : "") );
1426 wprintf("Expire by message count<br />\n");
1427 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1428 ((roompolicy == 3) ? "CHECKED" : "") );
1429 wprintf("Expire by message age<br />");
1430 wprintf("Number of messages or days: ");
1431 wprintf("<INPUT TYPE=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1432 wprintf("</TD></TR>\n");
1434 if (WC->axlevel >= 6) {
1435 wprintf("<TR><TD COLSPAN=2><hr /></TD></TR>\n");
1436 wprintf("<TR><TD>Message expire policy for this floor<br />(");
1437 escputs(floorlist[WC->wc_floor]);
1438 wprintf(")</TD><TD>");
1439 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1440 ((floorpolicy == 0) ? "CHECKED" : "") );
1441 wprintf("Use the system default<br />\n");
1442 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1443 ((floorpolicy == 1) ? "CHECKED" : "") );
1444 wprintf("Never automatically expire messages<br />\n");
1445 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1446 ((floorpolicy == 2) ? "CHECKED" : "") );
1447 wprintf("Expire by message count<br />\n");
1448 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1449 ((floorpolicy == 3) ? "CHECKED" : "") );
1450 wprintf("Expire by message age<br />");
1451 wprintf("Number of messages or days: ");
1452 wprintf("<INPUT TYPE=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1456 wprintf("<CENTER>\n");
1457 wprintf("<TR><TD COLSPAN=2><hr /><CENTER>\n");
1458 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1460 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1461 wprintf("</CENTER></TD><TR>\n");
1463 wprintf("</TABLE>\n"
1464 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1470 /* Mailing list management */
1471 if (!strcmp(tab, "access")) {
1475 /* end content of whatever tab is open now */
1476 wprintf("</TD></TR></TABLE></div>\n");
1483 * Toggle self-service list subscription
1485 void toggle_self_service(void) {
1488 newval = atoi(bstr("newval"));
1489 self_service(newval);
1496 * save new parameters for a room
1502 char er_password[10];
1503 char er_dirname[15];
1504 char er_roomaide[26];
1510 if (strcmp(bstr("sc"), "OK")) {
1511 strcpy(WC->ImportantMessage,
1512 "Cancelled. Changes were not saved.");
1517 serv_getln(buf, sizeof buf);
1519 if (buf[0] != '2') {
1520 strcpy(WC->ImportantMessage, &buf[4]);
1524 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1525 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1526 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1527 er_flags = extract_int(&buf[4], 3);
1529 strcpy(er_roomaide, bstr("er_roomaide"));
1530 if (strlen(er_roomaide) == 0) {
1532 serv_getln(buf, sizeof buf);
1533 if (buf[0] != '2') {
1534 strcpy(er_roomaide, "");
1536 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1539 strcpy(buf, bstr("er_name"));
1541 if (strlen(buf) > 0)
1542 strcpy(er_name, buf);
1544 strcpy(buf, bstr("er_password"));
1546 if (strlen(buf) > 0)
1547 strcpy(er_password, buf);
1549 strcpy(buf, bstr("er_dirname"));
1551 if (strlen(buf) > 0)
1552 strcpy(er_dirname, buf);
1554 strcpy(buf, bstr("type"));
1555 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
1557 if (!strcmp(buf, "invonly")) {
1558 er_flags |= (QR_PRIVATE);
1560 if (!strcmp(buf, "hidden")) {
1561 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
1563 if (!strcmp(buf, "passworded")) {
1564 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
1566 if (!strcmp(bstr("prefonly"), "yes")) {
1567 er_flags |= QR_PREFONLY;
1569 er_flags &= ~QR_PREFONLY;
1572 if (!strcmp(bstr("readonly"), "yes")) {
1573 er_flags |= QR_READONLY;
1575 er_flags &= ~QR_READONLY;
1578 if (!strcmp(bstr("permanent"), "yes")) {
1579 er_flags |= QR_PERMANENT;
1581 er_flags &= ~QR_PERMANENT;
1584 if (!strcmp(bstr("network"), "yes")) {
1585 er_flags |= QR_NETWORK;
1587 er_flags &= ~QR_NETWORK;
1590 if (!strcmp(bstr("directory"), "yes")) {
1591 er_flags |= QR_DIRECTORY;
1593 er_flags &= ~QR_DIRECTORY;
1596 if (!strcmp(bstr("ulallowed"), "yes")) {
1597 er_flags |= QR_UPLOAD;
1599 er_flags &= ~QR_UPLOAD;
1602 if (!strcmp(bstr("dlallowed"), "yes")) {
1603 er_flags |= QR_DOWNLOAD;
1605 er_flags &= ~QR_DOWNLOAD;
1608 if (!strcmp(bstr("visdir"), "yes")) {
1609 er_flags |= QR_VISDIR;
1611 er_flags &= ~QR_VISDIR;
1614 strcpy(buf, bstr("anon"));
1616 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
1617 if (!strcmp(buf, "anononly"))
1618 er_flags |= QR_ANONONLY;
1619 if (!strcmp(buf, "anon2"))
1620 er_flags |= QR_ANONOPT;
1623 if (!strcmp(bstr("bump"), "yes"))
1626 er_floor = atoi(bstr("er_floor"));
1628 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
1629 er_name, er_password, er_dirname, er_flags, bump, er_floor);
1631 serv_getln(buf, sizeof buf);
1632 if (buf[0] != '2') {
1633 strcpy(WC->ImportantMessage, &buf[4]);
1639 if (strlen(er_roomaide) > 0) {
1640 sprintf(buf, "SETA %s", er_roomaide);
1642 serv_getln(buf, sizeof buf);
1643 if (buf[0] != '2') {
1644 strcpy(WC->ImportantMessage, &buf[4]);
1645 display_main_menu();
1650 strcpy(WC->ImportantMessage, "Your changes have been saved.");
1657 * Display form for Invite, Kick, and show Who Knows a room
1659 void do_invt_kick(void) {
1660 char buf[SIZ], room[SIZ], username[SIZ];
1663 serv_getln(buf, sizeof buf);
1665 if (buf[0] != '2') {
1669 extract_token(room, &buf[4], 0, '|', sizeof room);
1671 strcpy(username, bstr("username"));
1673 if (!strcmp(bstr("sc"), "Kick")) {
1674 sprintf(buf, "KICK %s", username);
1676 serv_getln(buf, sizeof buf);
1678 if (buf[0] != '2') {
1679 strcpy(WC->ImportantMessage, &buf[4]);
1681 sprintf(WC->ImportantMessage,
1682 "<B><I>User %s kicked out of room %s.</I></B>\n",
1687 if (!strcmp(bstr("sc"), "Invite")) {
1688 sprintf(buf, "INVT %s", username);
1690 serv_getln(buf, sizeof buf);
1692 if (buf[0] != '2') {
1693 strcpy(WC->ImportantMessage, &buf[4]);
1695 sprintf(WC->ImportantMessage,
1696 "<B><I>User %s invited to room %s.</I></B>\n",
1707 * Display form for Invite, Kick, and show Who Knows a room
1709 void display_whok(void)
1711 char buf[SIZ], room[SIZ], username[SIZ];
1714 serv_getln(buf, sizeof buf);
1716 if (buf[0] != '2') {
1720 extract_token(room, &buf[4], 0, '|', sizeof room);
1723 wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
1724 "<TD>The users listed below have access to this room. "
1725 "To remove a user from the access list, select the user "
1726 "name from the list and click 'Kick'.<br /><br />");
1728 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1729 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1730 wprintf("<SELECT NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
1732 serv_getln(buf, sizeof buf);
1733 if (buf[0] == '1') {
1734 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1735 extract_token(username, buf, 0, '|', sizeof username);
1736 wprintf("<OPTION>");
1741 wprintf("</SELECT><br />\n");
1743 wprintf("<input type=submit name=sc value=\"Kick\">");
1744 wprintf("</FORM></CENTER>\n");
1747 "To grant another user access to this room, enter the "
1748 "user name in the box below and click 'Invite'.<br /><br />");
1750 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1751 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1752 wprintf("Invite: ");
1753 wprintf("<input type=\"text\" name=\"username\" style=\"width:100%%\"><br />\n"
1754 "<input type=\"hidden\" name=\"sc\" value=\"Invite\">"
1755 "<input type=\"submit\" value=\"Invite\">"
1756 "</FORM></CENTER>\n");
1758 wprintf("</TD></TR></TABLE>\n");
1765 * display the form for entering a new room
1767 void display_entroom(void)
1772 serv_puts("CRE8 0");
1773 serv_getln(buf, sizeof buf);
1775 if (buf[0] != '2') {
1776 strcpy(WC->ImportantMessage, &buf[4]);
1777 display_main_menu();
1781 output_headers(1, 1, 2, 0, 0, 0, 0);
1782 wprintf("<div id=\"banner\">\n"
1783 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1784 "<SPAN CLASS=\"titlebar\">Create a new room</SPAN>"
1785 "</TD></TR></TABLE>\n"
1786 "</div>\n<div id=\"content\">\n"
1789 wprintf("<div id=\"fix_scrollbar_bug\">"
1790 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1792 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"/entroom\">\n");
1794 wprintf("<UL><LI>Name of room: ");
1795 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
1797 wprintf("<LI>Resides on floor: ");
1799 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1800 for (i = 0; i < 128; ++i)
1801 if (strlen(floorlist[i]) > 0) {
1802 wprintf("<OPTION ");
1803 wprintf("VALUE=\"%d\">", i);
1804 escputs(floorlist[i]);
1805 wprintf("</OPTION>\n");
1807 wprintf("</SELECT>\n");
1809 /* Our clever little snippet of JavaScript automatically selects
1810 * a public room if the view is set to Bulletin Board, and it
1811 * selects a mailbox room otherwise. The user can override this,
1814 wprintf("<LI>Default view for room: ");
1815 wprintf("<SELECT NAME=\"er_view\" SIZE=\"1\" OnChange=\""
1816 " if (this.form.er_view.value == 0) { "
1817 " this.form.type[0].checked=true; "
1818 " this.form.er_floor.disabled = false; "
1821 " this.form.type[4].checked=true; "
1822 " this.form.er_floor.disabled = true; "
1825 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
1826 wprintf("<OPTION %s VALUE=\"%d\">",
1827 ((i == 0) ? "SELECTED" : ""), i );
1828 escputs(viewdefs[i]);
1829 wprintf("</OPTION>\n");
1831 wprintf("</SELECT>\n");
1833 wprintf("<LI>Type of room:<UL>\n");
1835 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1836 wprintf("CHECKED OnChange=\""
1837 " if (this.form.type[0].checked == true) { "
1838 " this.form.er_floor.disabled = false; "
1840 "\"> Public (automatically appears to everyone)\n");
1842 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
1843 " if (this.form.type[1].checked == true) { "
1844 " this.form.er_floor.disabled = false; "
1846 "\"> Private - hidden (accessible to anyone who knows its name)\n");
1848 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
1849 " if (this.form.type[2].checked == true) { "
1850 " this.form.er_floor.disabled = false; "
1852 "\"> Private - require password:\n");
1853 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
1855 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
1856 " if (this.form.type[3].checked == true) { "
1857 " this.form.er_floor.disabled = false; "
1859 "\"> Private - invitation only\n");
1861 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"personal\" "
1863 " if (this.form.type[4].checked == true) { "
1864 " this.form.er_floor.disabled = true; "
1866 "\"> Personal (mailbox for you only)\n");
1870 wprintf("<CENTER>\n");
1871 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1873 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1874 wprintf("</CENTER>\n");
1875 wprintf("</FORM>\n<hr />");
1876 serv_printf("MESG roomaccess");
1877 serv_getln(buf, sizeof buf);
1878 if (buf[0] == '1') {
1879 fmout(NULL, "CENTER");
1881 wprintf("</td></tr></table></div>\n");
1889 * support function for entroom() -- sets the default view
1891 void er_set_default_view(int newview) {
1904 serv_getln(buf, sizeof buf);
1905 if (buf[0] != '2') return;
1907 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
1908 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
1909 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
1910 rm_bits1 = extract_int(&buf[4], 3);
1911 rm_floor = extract_int(&buf[4], 4);
1912 rm_listorder = extract_int(&buf[4], 5);
1913 rm_bits2 = extract_int(&buf[4], 7);
1915 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1916 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
1917 rm_listorder, newview, rm_bits2
1919 serv_getln(buf, sizeof buf);
1932 char er_password[SIZ];
1937 if (strcmp(bstr("sc"), "OK")) {
1938 strcpy(WC->ImportantMessage,
1939 "Cancelled. No new room was created.");
1940 display_main_menu();
1943 strcpy(er_name, bstr("er_name"));
1944 strcpy(er_type, bstr("type"));
1945 strcpy(er_password, bstr("er_password"));
1946 er_floor = atoi(bstr("er_floor"));
1947 er_view = atoi(bstr("er_view"));
1950 if (!strcmp(er_type, "hidden"))
1952 if (!strcmp(er_type, "passworded"))
1954 if (!strcmp(er_type, "invonly"))
1956 if (!strcmp(er_type, "personal"))
1959 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
1960 er_name, er_num_type, er_password, er_floor, 0, er_view);
1962 serv_getln(buf, sizeof buf);
1963 if (buf[0] != '2') {
1964 strcpy(WC->ImportantMessage, &buf[4]);
1965 display_main_menu();
1969 do_change_view(er_view); /* Now go there */
1974 * display the screen to enter a private room
1976 void display_private(char *rname, int req_pass)
1978 output_headers(1, 1, 2, 0, 0, 0, 0);
1979 wprintf("<div id=\"banner\">\n"
1980 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1981 "<SPAN CLASS=\"titlebar\">Go to a hidden room</SPAN>"
1982 "</TD></TR></TABLE>\n"
1983 "</div>\n<div id=\"content\">\n"
1986 wprintf("<div id=\"fix_scrollbar_bug\">"
1987 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1989 wprintf("<CENTER>\n");
1990 wprintf("<br />If you know the name of a hidden (guess-name) or\n");
1991 wprintf("passworded room, you can enter that room by typing\n");
1992 wprintf("its name below. Once you gain access to a private\n");
1993 wprintf("room, it will appear in your regular room listings\n");
1994 wprintf("so you don't have to keep returning here.\n");
1995 wprintf("<br /><br />");
1997 wprintf("<FORM METHOD=\"POST\" ACTION=\"/goto_private\">\n");
1999 wprintf("<table border=\"0\" cellspacing=\"5\" "
2000 "cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
2002 "Enter room name:</TD><TD>"
2003 "<INPUT TYPE=\"text\" NAME=\"gr_name\" "
2004 "VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
2007 wprintf("</TD></TR><TR><TD>");
2008 wprintf("Enter room password:</TD><TD>");
2009 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
2011 wprintf("</TD></TR></TABLE><br />\n");
2013 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
2015 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2016 wprintf("</FORM>\n");
2017 wprintf("</td></tr></table></div>\n");
2022 * goto a private room
2024 void goto_private(void)
2029 if (strcasecmp(bstr("sc"), "OK")) {
2030 display_main_menu();
2033 strcpy(hold_rm, WC->wc_roomname);
2034 strcpy(buf, "GOTO ");
2035 strcat(buf, bstr("gr_name"));
2037 strcat(buf, bstr("gr_pass"));
2039 serv_getln(buf, sizeof buf);
2041 if (buf[0] == '2') {
2042 smart_goto(bstr("gr_name"));
2045 if (!strncmp(buf, "540", 3)) {
2046 display_private(bstr("gr_name"), 1);
2049 output_headers(1, 1, 1, 0, 0, 0, 0);
2050 wprintf("%s\n", &buf[4]);
2057 * display the screen to zap a room
2059 void display_zap(void)
2061 output_headers(1, 1, 2, 0, 0, 0, 0);
2063 wprintf("<div id=\"banner\">\n");
2064 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
2065 wprintf("<SPAN CLASS=\"titlebar\">Zap (forget/unsubscribe) the current room</SPAN>\n");
2066 wprintf("</TD></TR></TABLE>\n");
2067 wprintf("</div>\n<div id=\"content\">\n");
2069 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
2070 wprintf("disappear from your room list. Is this what you wish ");
2071 wprintf("to do?<br />\n");
2073 wprintf("<FORM METHOD=\"POST\" ACTION=\"/zap\">\n");
2074 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
2076 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2077 wprintf("</FORM>\n");
2088 char final_destination[SIZ];
2090 /* If the forget-room routine fails for any reason, we fall back
2091 * to the current room; otherwise, we go to the Lobby
2093 strcpy(final_destination, WC->wc_roomname);
2095 if (!strcasecmp(bstr("sc"), "OK")) {
2096 serv_printf("GOTO %s", WC->wc_roomname);
2097 serv_getln(buf, sizeof buf);
2098 if (buf[0] == '2') {
2100 serv_getln(buf, sizeof buf);
2101 if (buf[0] == '2') {
2102 strcpy(final_destination, "_BASEROOM_");
2106 smart_goto(final_destination);
2112 * Delete the current room
2114 void delete_room(void)
2118 serv_puts("KILL 1");
2119 serv_getln(buf, sizeof buf);
2120 if (buf[0] != '2') {
2121 strcpy(WC->ImportantMessage, &buf[4]);
2122 display_main_menu();
2125 smart_goto("_BASEROOM_");
2132 * Perform changes to a room's network configuration
2134 void netedit(void) {
2143 if (strlen(bstr("line"))==0) {
2148 strcpy(line, bstr("prefix"));
2149 strcat(line, bstr("line"));
2150 strcat(line, bstr("suffix"));
2159 serv_getln(buf, sizeof buf);
2160 if (buf[0] != '1') {
2166 /* This loop works for add *or* remove. Spiffy, eh? */
2167 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2168 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2169 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2170 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2171 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2172 if ( (strcasecmp(cmpa0, cmpb0))
2173 || (strcasecmp(cmpa1, cmpb1)) ) {
2174 fprintf(fp, "%s\n", buf);
2180 serv_getln(buf, sizeof buf);
2181 if (buf[0] != '4') {
2187 while (fgets(buf, sizeof buf, fp) != NULL) {
2188 buf[strlen(buf)-1] = 0;
2192 if (!strcasecmp(bstr("cmd"), "add")) {
2204 * Convert a room name to a folder-ish-looking name.
2206 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2211 * For mailboxes, just do it straight...
2214 sprintf(folder, "My folders|%s", room);
2218 * Otherwise, prefix the floor name as a "public folders" moniker
2221 sprintf(folder, "%s|%s", floorlist[floor], room);
2225 * Replace "\" characters with "|" for pseudo-folder-delimiting
2227 for (i=0; i<strlen(folder); ++i) {
2228 if (folder[i] == '\\') folder[i] = '|';
2236 * Back end for change_view()
2238 void do_change_view(int newview) {
2241 serv_printf("VIEW %d", newview);
2242 serv_getln(buf, sizeof buf);
2243 WC->wc_view = newview;
2244 smart_goto(WC->wc_roomname);
2250 * Change the view for this room
2252 void change_view(void) {
2255 view = atol(bstr("view"));
2256 do_change_view(view);
2261 * One big expanded tree list view --- like a folder list
2263 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2267 int has_subfolders = 0;
2270 parents = malloc(max_folders * sizeof(int));
2272 /* BEGIN TREE MENU */
2273 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2275 /* include NanoTree */
2276 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2278 /* initialize NanoTree */
2279 wprintf("<script type=\"text/javascript\"> \n"
2280 " showRootNode = false; \n"
2281 " sortNodes = false; \n"
2282 " dragable = false; \n"
2284 " function standardClick(treeNode) { \n"
2287 " var closedGif = 'static/folder_closed.gif'; \n"
2288 " var openGif = 'static/folder_open.gif'; \n"
2290 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2294 for (i=0; i<max_folders; ++i) {
2297 if ((i+1) < max_folders) {
2298 if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
2299 && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
2304 levels = num_tokens(fold[i].name, '|');
2305 parents[levels] = i;
2307 wprintf("var node%d = new TreeNode(%d, '", i, i);
2309 if (fold[i].selectable) {
2310 wprintf("<A HREF=\"/dotgoto?room=");
2311 urlescputs(fold[i].room);
2316 wprintf("<SPAN CLASS=\"roomlist_floor\">");
2318 else if (fold[i].hasnewmsgs) {
2319 wprintf("<SPAN CLASS=\"roomlist_new\">");
2322 wprintf("<SPAN CLASS=\"roomlist_old\">");
2324 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2329 if (has_subfolders) {
2330 wprintf("new Array(closedGif, openGif)");
2332 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2333 wprintf("'static/viewcontacts_16x.gif'");
2335 else if (fold[i].view == VIEW_CALENDAR) {
2336 wprintf("'static/calarea_16x.gif'");
2338 else if (fold[i].view == VIEW_TASKS) {
2339 wprintf("'static/taskmanag_16x.gif'");
2341 else if (fold[i].view == VIEW_NOTES) {
2342 wprintf("'static/storenotes_16x.gif'");
2344 else if (fold[i].view == VIEW_MAILBOX) {
2345 wprintf("'static/privatemess_16x.gif'");
2348 wprintf("'static/chatrooms_16x.gif'");
2351 urlescputs(fold[i].name);
2355 wprintf("rootNode.addChild(node%d);\n", i);
2358 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2362 wprintf("container = document.getElementById('roomlist_div'); \n"
2372 * Boxes and rooms and lists ... oh my!
2374 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2377 int levels, oldlevels;
2380 static int columns = 3;
2381 int boxes_per_column = 0;
2382 int current_column = 0;
2386 while (nf % columns != 0) ++nf;
2387 boxes_per_column = (nf / columns);
2388 if (boxes_per_column < 1) boxes_per_column = 1;
2390 /* Outer table (for columnization) */
2391 wprintf("<TABLE BORDER=0 WIDTH=96%% CELLPADDING=5>"
2392 "<tr><td valign=top>");
2396 for (i=0; i<max_folders; ++i) {
2398 levels = num_tokens(fold[i].name, '|');
2400 if ((levels == 1) && (oldlevels > 1)) {
2403 do_template("endbox");
2406 if ((num_boxes % boxes_per_column) == 0) {
2408 if (current_column < columns) {
2409 wprintf("</td><td valign=top>\n");
2416 /* Begin inner box */
2417 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2418 stresc(boxtitle, buf, 1, 0);
2419 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2420 do_template("beginbox");
2428 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
2429 if (fold[i].selectable) {
2430 wprintf("<A HREF=\"/dotgoto?room=");
2431 urlescputs(fold[i].room);
2437 if (fold[i].hasnewmsgs) {
2438 wprintf("<SPAN CLASS=\"roomlist_new\">");
2441 wprintf("<SPAN CLASS=\"roomlist_old\">");
2443 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2446 if (fold[i].selectable) {
2452 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
2453 wprintf(" (INBOX)");
2455 wprintf("<br />\n");
2458 /* End the final inner box */
2459 do_template("endbox");
2461 wprintf("</TD></TR></TABLE>\n");
2466 * Show the room list. (only should get called by
2467 * knrooms() because that's where output_headers() is called from)
2470 void list_all_rooms_by_floor(char *viewpref) {
2473 struct folder *fold = NULL;
2475 int max_folders = 0;
2476 int alloc_folders = 0;
2480 int num_floors = 1; /* add an extra one for private folders */
2482 /* Start with the mailboxes */
2485 fold = malloc(sizeof(struct folder));
2486 memset(fold, 0, sizeof(struct folder));
2487 strcpy(fold[0].name, "My folders");
2488 fold[0].is_mailbox = 1;
2490 /* Then add floors */
2492 serv_getln(buf, sizeof buf);
2493 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2494 if (max_folders >= alloc_folders) {
2495 alloc_folders = max_folders + 100;
2496 fold = realloc(fold,
2497 alloc_folders * sizeof(struct folder));
2499 memset(&fold[max_folders], 0, sizeof(struct folder));
2500 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
2507 serv_getln(buf, sizeof buf);
2508 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2509 if (max_folders >= alloc_folders) {
2510 alloc_folders = max_folders + 100;
2511 fold = realloc(fold,
2512 alloc_folders * sizeof(struct folder));
2514 memset(&fold[max_folders], 0, sizeof(struct folder));
2515 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
2516 ra_flags = extract_int(buf, 5);
2517 flags = extract_int(buf, 1);
2518 fold[max_folders].floor = extract_int(buf, 2);
2519 fold[max_folders].hasnewmsgs =
2520 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
2521 if (flags & QR_MAILBOX) {
2522 fold[max_folders].is_mailbox = 1;
2524 fold[max_folders].view = extract_int(buf, 6);
2525 room_to_folder(fold[max_folders].name,
2526 fold[max_folders].room,
2527 fold[max_folders].floor,
2528 fold[max_folders].is_mailbox);
2529 fold[max_folders].selectable = 1;
2533 /* Bubble-sort the folder list */
2534 for (i=0; i<max_folders; ++i) {
2535 for (j=0; j<(max_folders-1)-i; ++j) {
2536 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
2537 swap = strcasecmp(fold[j].name, fold[j+1].name);
2540 if ( (fold[j+1].is_mailbox)
2541 && (!fold[j].is_mailbox)) {
2549 memcpy(&ftmp, &fold[j], sizeof(struct folder));
2550 memcpy(&fold[j], &fold[j+1],
2551 sizeof(struct folder));
2552 memcpy(&fold[j+1], &ftmp,
2553 sizeof(struct folder));
2558 /* test only hackish view
2559 wprintf("<table><TR><TD>A Table</TD></TR></table>\n");
2560 for (i=0; i<max_folders; ++i) {
2561 escputs(fold[i].name);
2562 wprintf("<br />\n");
2566 if (!strcasecmp(viewpref, "folders")) {
2567 do_folder_view(fold, max_folders, num_floors);
2570 do_rooms_view(fold, max_folders, num_floors);
2578 /* Do either a known rooms list or a folders list, depending on the
2582 char listviewpref[SIZ];
2584 output_headers(1, 1, 2, 0, 0, 0, 0);
2587 /* Determine whether the user is trying to change views */
2588 if (bstr("view") != NULL) {
2589 if (strlen(bstr("view")) > 0) {
2590 set_preference("roomlistview", bstr("view"), 1);
2594 get_preference("roomlistview", listviewpref, sizeof listviewpref);
2596 if ( (strcasecmp(listviewpref, "folders"))
2597 && (strcasecmp(listviewpref, "table")) ) {
2598 strcpy(listviewpref, "rooms");
2602 wprintf("<div id=\"banner\">\n"
2603 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
2604 "<SPAN CLASS=\"titlebar\">"
2606 if (!strcasecmp(listviewpref, "rooms")) {
2607 wprintf("Room list");
2609 if (!strcasecmp(listviewpref, "folders")) {
2610 wprintf("Folder list");
2612 if (!strcasecmp(listviewpref, "table")) {
2613 wprintf("Room list");
2615 wprintf("</SPAN></TD>\n");
2617 /* offer the ability to switch views */
2618 wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
2619 "<SELECT NAME=\"newview\" SIZE=\"1\" "
2620 "OnChange=\"location.href=roomlistomatic.newview.options"
2621 "[selectedIndex].value\">\n");
2623 wprintf("<OPTION %s VALUE=\"/knrooms&view=rooms\">"
2626 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
2629 wprintf("<OPTION %s VALUE=\"/knrooms&view=folders\">"
2630 "View as folder list"
2632 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
2635 wprintf("</SELECT><br />");
2637 wprintf("</FORM></TD></TR></TABLE>\n");
2640 "<div id=\"content\">\n");
2642 /* Display the room list in the user's preferred format */
2643 list_all_rooms_by_floor(listviewpref);
2649 * Set the message expire policy for this room and/or floor
2651 void set_room_policy(void) {
2654 if (strcmp(bstr("sc"), "OK")) {
2655 strcpy(WC->ImportantMessage,
2656 "Cancelled. Changes were not saved.");
2661 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
2662 serv_getln(buf, sizeof buf);
2663 strcpy(WC->ImportantMessage, &buf[4]);
2665 if (WC->axlevel >= 6) {
2666 strcat(WC->ImportantMessage, "<br />\n");
2667 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
2668 serv_getln(buf, sizeof buf);
2669 strcat(WC->ImportantMessage, &buf[4]);