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("<TD BGCOLOR=\"#444455\">");
271 wprintf("<IMG HEIGHT=64 SRC=\"/image&name=_roompic_&room=");
272 urlescputs(WC->wc_roomname);
275 serv_getln(buf, sizeof buf);
277 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
278 wprintf("<td bgcolor=\"#444455\">"
279 "<img height=48 width=48 src=\""
280 "static/savecontact_48x.gif"
284 else if (WC->wc_view == VIEW_CALENDAR) {
285 wprintf("<td bgcolor=\"#444455\">"
286 "<img height=48 width=48 src=\""
287 "static/calarea_48x.gif"
291 else if (WC->wc_view == VIEW_TASKS) {
292 wprintf("<td bgcolor=\"#444455\">"
293 "<img height=48 width=48 src=\""
294 "static/taskmanag_48x.gif"
298 else if (WC->wc_view == VIEW_NOTES) {
299 wprintf("<td bgcolor=\"#444455\">"
300 "<img height=48 width=48 src=\""
301 "static/storenotes_48x.gif"
304 wprintf("'static/storenotes_16x.gif'");
306 else if (WC->wc_view == VIEW_MAILBOX) {
307 wprintf("<td bgcolor=\"#444455\">"
308 "<img height=48 width=48 src=\""
309 "static/privatemess_48x.gif"
314 wprintf("<td bgcolor=\"#444455\">"
315 "<img height=48 width=48 src=\""
316 "static/chatrooms_48x.gif"
324 /* Let the user know if new mail has arrived
326 void embed_newmail_button(void) {
327 if ( (WC->new_mail > WC->remember_new_mail) && (WC->new_mail>0) ) {
329 "<A HREF=\"/dotgoto?room=_MAIL_\">"
330 "<IMG SRC=\"/static/privatemess_32x.gif\" border=0 "
331 "ALT=\"You have new mail\">"
332 "<br /><SPAN CLASS=\"youhavemail\">"
333 "%d new mail</SPAN></A>", WC->new_mail);
334 WC->remember_new_mail = WC->new_mail;
341 * Display the current view and offer an option to change it
343 void embed_view_o_matic(void) {
346 wprintf("<FORM NAME=\"viewomatic\">\n"
347 "<span class=\"room_banner_new_messages\">View as: "
348 "<SELECT NAME=\"newview\" SIZE=\"1\" "
349 "STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif;"
350 " font-size: 7pt; background: #444455; color: #ddddcc;\" "
351 "OnChange=\"location.href=viewomatic.newview.options"
352 "[selectedIndex].value\">\n");
354 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
356 * Only offer the views that make sense, given the default
357 * view for the room. For example, don't offer a Calendar
358 * view in a non-Calendar room.
362 || (i == WC->wc_default_view)
363 || ( (i == 0) && (WC->wc_default_view == 1) )
364 || ( (i == 1) && (WC->wc_default_view == 0) )
367 wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
368 ((i == WC->wc_view) ? "SELECTED" : ""),
370 escputs(viewdefs[i]);
371 wprintf("</OPTION>\n");
374 wprintf("</select></span></form>\n");
379 void embed_room_banner(char *got, int navbar_style) {
382 /* We need to have the information returned by a GOTO server command.
383 * If it isn't supplied, we fake it by issuing our own GOTO.
386 serv_printf("GOTO %s", WC->wc_roomname);
387 serv_getln(fakegot, sizeof fakegot);
391 /* If the user happens to select the "make this my start page" link,
392 * we want it to remember the URL as a "/dotskip" one instead of
393 * a "skip" or "gotonext" or something like that.
395 snprintf(WC->this_page, sizeof(WC->this_page), "/dotskip&room=%s",
398 /* Check for new mail. */
399 WC->new_mail = extract_int(&got[4], 9);
400 WC->wc_view = extract_int(&got[4], 11);
402 svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname);
403 svprintf("NEWMSGS", WCS_STRING, "%d", extract_int(&got[4], 1));
404 svprintf("TOTALMSGS", WCS_STRING, "%d", extract_int(&got[4], 2));
405 svcallback("ROOMPIC", embed_room_graphic);
406 svcallback("ROOMINFO", readinfo);
407 svcallback("YOUHAVEMAIL", embed_newmail_button);
408 svcallback("VIEWOMATIC", embed_view_o_matic);
409 svcallback("START", offer_start_page);
411 do_template("roombanner");
412 if (navbar_style != navbar_none) {
414 wprintf("<div style=\"position:absolute; bottom:0px; left:0px\">\n"
415 "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\"><tr>\n");
418 if (navbar_style == navbar_default) wprintf(
420 "<a href=\"/ungoto\">"
421 "<img align=\"middle\" src=\"/static/back.gif\" border=\"0\">"
422 "<span class=\"navbar_link\">Ungoto</span></A>"
426 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
429 "<A HREF=\"/readnew\">"
430 "<img align=\"middle\" src=\"/static/readmsgs.gif\" border=\"0\">"
431 "<span class=\"navbar_link\">Read new messages</span></A>"
436 if (navbar_style == navbar_default) {
437 switch(WC->wc_view) {
438 case VIEW_ADDRESSBOOK:
441 "<A HREF=\"/readfwd\">"
442 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
444 "<span class=\"navbar_link\">"
452 "<A HREF=\"/readfwd?calview=day\">"
453 "<img align=\"middle\" src=\"/static/day_view.gif\" "
455 "<span class=\"navbar_link\">"
461 "<A HREF=\"/readfwd?calview=month\">"
462 "<img align=\"middle\" src=\"/static/month_view.gif\" "
464 "<span class=\"navbar_link\">"
472 "<A HREF=\"/readfwd\">"
473 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
475 "<span class=\"navbar_link\">"
483 "<A HREF=\"/readfwd\">"
484 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
486 "<span class=\"navbar_link\">"
494 "<A HREF=\"/readfwd\">"
495 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
497 "<span class=\"navbar_link\">"
505 "<A HREF=\"/readfwd\">"
506 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
508 "<span class=\"navbar_link\">"
516 if (navbar_style == navbar_default) {
519 "<A HREF=\"/display_enter\">"
520 "<img align=\"middle\" src=\"/static/enter.gif\" border=\"0\">"
521 "<span class=\"navbar_link\">"
523 switch(WC->wc_view) {
524 case VIEW_ADDRESSBOOK:
525 wprintf("Add new contact");
528 wprintf("Add new event");
531 wprintf("Add new task");
534 wprintf("Add new note");
537 wprintf("Enter a message");
540 wprintf("</span></a></td>\n");
543 if (navbar_style == navbar_default) wprintf(
546 "TITLE=\"Leave all messages marked as unread, go to next room with unread messages\">"
547 "<span class=\"navbar_link\">Skip this room</span>"
548 "<img align=\"middle\" src=\"/static/forward.gif\" border=\"0\"></A>"
552 if (navbar_style == navbar_default) wprintf(
554 "<A HREF=\"/gotonext\" "
555 "TITLE=\"Mark all messages as read, go to next room with unread messages\">"
556 "<span class=\"navbar_link\">Goto next room</span>"
557 "<img align=\"middle\" src=\"/static/forward.gif\" border=\"0\"></A>"
561 wprintf("</tr></table></div>\n");
571 * back end routine to take the session to a new room
574 void gotoroom(char *gname)
577 static long ls = (-1L);
579 /* store ungoto information */
580 strcpy(WC->ugname, WC->wc_roomname);
583 /* move to the new room */
584 serv_printf("GOTO %s", gname);
585 serv_getln(buf, sizeof buf);
587 serv_puts("GOTO _BASEROOM_");
588 serv_getln(buf, sizeof buf);
593 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
594 WC->room_flags = extract_int(&buf[4], 4);
595 /* highest_msg_read = extract_int(&buf[4],6);
596 maxmsgnum = extract_int(&buf[4],5);
597 is_mail = (char) extract_int(&buf[4],7); */
598 ls = extract_long(&buf[4], 6);
599 WC->wc_floor = extract_int(&buf[4], 10);
600 WC->wc_view = extract_int(&buf[4], 11);
601 WC->wc_default_view = extract_int(&buf[4], 12);
604 WC->is_room_aide = WC->is_aide;
606 WC->is_room_aide = (char) extract_int(&buf[4], 8);
608 remove_march(WC->wc_roomname);
609 if (!strcasecmp(gname, "_BASEROOM_"))
615 * Locate the room on the march list which we most want to go to. Each room
616 * is measured given a "weight" of preference based on various factors.
618 char *pop_march(int desired_floor)
620 static char TheRoom[128];
622 int TheOrder = 32767;
625 struct march *mptr = NULL;
627 strcpy(TheRoom, "_BASEROOM_");
628 if (WC->march == NULL)
631 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
633 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
634 weight = weight + 10000;
635 if (mptr->march_floor == desired_floor)
636 weight = weight + 5000;
638 weight = weight + ((128 - (mptr->march_floor)) * 128);
639 weight = weight + (128 - (mptr->march_order));
641 if (weight > TheWeight) {
643 strcpy(TheRoom, mptr->march_name);
644 TheFloor = mptr->march_floor;
645 TheOrder = mptr->march_order;
653 /* Goto next room having unread messages.
654 * We want to skip over rooms that the user has already been to, and take the
655 * user back to the lobby when done. The room we end up in is placed in
656 * newroom - which is set to 0 (the lobby) initially.
657 * We start the search in the current room rather than the beginning to prevent
658 * two or more concurrent users from dragging each other back to the same room.
663 struct march *mptr, *mptr2;
666 /* First check to see if the march-mode list is already allocated.
667 * If it is, pop the first room off the list and go there.
670 if (WC->march == NULL) {
672 serv_getln(buf, sizeof buf);
674 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
675 mptr = (struct march *) malloc(sizeof(struct march));
677 extract_token(mptr->march_name, buf, 0, '|', sizeof mptr->march_name);
678 mptr->march_floor = extract_int(buf, 2);
679 mptr->march_order = extract_int(buf, 3);
680 if (WC->march == NULL) {
684 while (mptr2->next != NULL)
689 /* add _BASEROOM_ to the end of the march list, so the user will end up
690 * in the system base room (usually the Lobby>) at the end of the loop
692 mptr = (struct march *) malloc(sizeof(struct march));
694 strcpy(mptr->march_name, "_BASEROOM_");
695 if (WC->march == NULL) {
699 while (mptr2->next != NULL)
704 * ...and remove the room we're currently in, so a <G>oto doesn't make us
705 * walk around in circles
707 remove_march(WC->wc_roomname);
709 if (WC->march != NULL) {
710 strcpy(next_room, pop_march(-1));
712 strcpy(next_room, "_BASEROOM_");
716 smart_goto(next_room);
720 void smart_goto(char *next_room) {
728 * mark all messages in current room as having been read
730 void slrp_highest(void)
735 serv_puts("SLRP HIGHEST");
736 serv_getln(buf, sizeof buf);
738 wprintf("<EM>%s</EM><br />\n", &buf[4]);
745 * un-goto the previous room
751 if (!strcmp(WC->ugname, "")) {
752 smart_goto(WC->wc_roomname);
755 serv_printf("GOTO %s", WC->ugname);
756 serv_getln(buf, sizeof buf);
758 smart_goto(WC->wc_roomname);
761 if (WC->uglsn >= 0L) {
762 serv_printf("SLRP %ld", WC->uglsn);
763 serv_getln(buf, sizeof buf);
765 strcpy(buf, WC->ugname);
766 strcpy(WC->ugname, "");
775 * Set/clear/read the "self-service list subscribe" flag for a room
777 * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged.
778 * Always returns the new value.
781 int self_service(int newval) {
782 int current_value = 0;
788 int flags, floor, order, view, flags2;
791 serv_getln(buf, sizeof buf);
792 if (buf[0] != '2') return(0);
794 extract_token(name, &buf[4], 0, '|', sizeof name);
795 extract_token(password, &buf[4], 1, '|', sizeof password);
796 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
797 flags = extract_int(&buf[4], 3);
798 floor = extract_int(&buf[4], 4);
799 order = extract_int(&buf[4], 5);
800 view = extract_int(&buf[4], 6);
801 flags2 = extract_int(&buf[4], 7);
803 if (flags2 & QR2_SELFLIST) {
811 flags2 = flags2 | QR2_SELFLIST;
813 else if (newval == 0) {
814 flags2 = flags2 & ~QR2_SELFLIST;
817 return(current_value);
820 if (newval != current_value) {
821 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
822 name, password, dirname, flags,
823 floor, order, view, flags2);
824 serv_getln(buf, sizeof buf);
837 * display the form for editing a room
839 void display_editroom(void)
844 char remote_room[SIZ];
847 char er_password[10];
849 char er_roomaide[26];
855 char *not_shared_with;
862 if (strlen(tab) == 0) tab = "admin";
866 serv_getln(buf, sizeof buf);
869 strcpy(WC->ImportantMessage, &buf[4]);
873 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
874 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
875 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
876 er_flags = extract_int(&buf[4], 3);
877 er_floor = extract_int(&buf[4], 4);
879 output_headers(1, 1, 1, 0, 0, 0, 0);
881 /* print the tabbed dialog */
883 "<div id=\"fix_scrollbar_bug\">"
884 "<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
886 "<TD> </TD>\n");
888 if (!strcmp(tab, "admin")) {
889 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
892 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=admin\">");
894 wprintf("Administration");
895 if (!strcmp(tab, "admin")) {
896 wprintf("</SPAN></TD>\n");
899 wprintf("</A></TD>\n");
902 wprintf("<TD> </TD>\n");
904 if (!strcmp(tab, "config")) {
905 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
908 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=config\">");
910 wprintf("Configuration");
911 if (!strcmp(tab, "config")) {
912 wprintf("</SPAN></TD>\n");
915 wprintf("</A></TD>\n");
918 wprintf("<TD> </TD>\n");
920 if (!strcmp(tab, "expire")) {
921 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
924 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=expire\">");
926 wprintf("Message expire policy");
927 if (!strcmp(tab, "expire")) {
928 wprintf("</SPAN></TD>\n");
931 wprintf("</A></TD>\n");
934 wprintf("<TD> </TD>\n");
936 if (!strcmp(tab, "access")) {
937 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
940 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=access\">");
942 wprintf("Access controls");
943 if (!strcmp(tab, "access")) {
944 wprintf("</SPAN></TD>\n");
947 wprintf("</A></TD>\n");
950 wprintf("<TD> </TD>\n");
952 if (!strcmp(tab, "sharing")) {
953 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
956 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=sharing\">");
959 if (!strcmp(tab, "sharing")) {
960 wprintf("</SPAN></TD>\n");
963 wprintf("</A></TD>\n");
966 wprintf("<TD> </TD>\n");
968 if (!strcmp(tab, "listserv")) {
969 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
972 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=listserv\">");
974 wprintf("Mailing list service");
975 if (!strcmp(tab, "listserv")) {
976 wprintf("</SPAN></TD>\n");
979 wprintf("</A></TD>\n");
982 wprintf("<TD> </TD>\n");
984 wprintf("</TR></TABLE></div>\n");
985 /* end tabbed dialog */
987 /* begin content of whatever tab is open now */
988 wprintf("<div id=\"fix_scrollbar_bug\">"
989 "<TABLE border=0 width=100%% bgcolor=\"#FFFFFF\">\n"
992 if (!strcmp(tab, "admin")) {
994 "<LI><A HREF=\"/delete_room\" "
995 "onClick=\"return confirm('Are you sure you want to delete this room?');\">\n"
996 "Delete this room</A>\n"
997 "<LI><A HREF=\"/display_editroompic\">\n"
998 "Set or change the icon for this room's banner</A>\n"
999 "<LI><A HREF=\"/display_editinfo\">\n"
1000 "Edit this room's Info file</A>\n"
1004 if (!strcmp(tab, "config")) {
1005 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
1007 wprintf("<UL><LI>Name of room: ");
1008 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
1010 wprintf("<LI>Resides on floor: ");
1011 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1012 for (i = 0; i < 128; ++i)
1013 if (strlen(floorlist[i]) > 0) {
1014 wprintf("<OPTION ");
1016 wprintf("SELECTED ");
1017 wprintf("VALUE=\"%d\">", i);
1018 escputs(floorlist[i]);
1019 wprintf("</OPTION>\n");
1021 wprintf("</SELECT>\n");
1023 wprintf("<LI>Type of room:<UL>\n");
1025 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1026 if ((er_flags & QR_PRIVATE) == 0)
1027 wprintf("CHECKED ");
1028 wprintf("> Public room\n");
1030 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1031 if ((er_flags & QR_PRIVATE) &&
1032 (er_flags & QR_GUESSNAME))
1033 wprintf("CHECKED ");
1034 wprintf("> Private - guess name\n");
1036 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1037 if ((er_flags & QR_PRIVATE) &&
1038 (er_flags & QR_PASSWORDED))
1039 wprintf("CHECKED ");
1040 wprintf("> Private - require password:\n");
1041 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
1043 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1044 if ((er_flags & QR_PRIVATE)
1045 && ((er_flags & QR_GUESSNAME) == 0)
1046 && ((er_flags & QR_PASSWORDED) == 0))
1047 wprintf("CHECKED ");
1048 wprintf("> Private - invitation only\n");
1050 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1051 wprintf("> If private, cause current users to forget room\n");
1055 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1056 if (er_flags & QR_PREFONLY)
1057 wprintf("CHECKED ");
1058 wprintf("> Preferred users only\n");
1060 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1061 if (er_flags & QR_READONLY)
1062 wprintf("CHECKED ");
1063 wprintf("> Read-only room\n");
1065 /* directory stuff */
1066 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1067 if (er_flags & QR_DIRECTORY)
1068 wprintf("CHECKED ");
1069 wprintf("> File directory room\n");
1071 wprintf("<UL><LI>Directory name: ");
1072 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
1074 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1075 if (er_flags & QR_UPLOAD)
1076 wprintf("CHECKED ");
1077 wprintf("> Uploading allowed\n");
1079 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1080 if (er_flags & QR_DOWNLOAD)
1081 wprintf("CHECKED ");
1082 wprintf("> Downloading allowed\n");
1084 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1085 if (er_flags & QR_VISDIR)
1086 wprintf("CHECKED ");
1087 wprintf("> Visible directory</UL>\n");
1089 /* end of directory stuff */
1091 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1092 if (er_flags & QR_NETWORK)
1093 wprintf("CHECKED ");
1094 wprintf("> Network shared room\n");
1096 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1097 if (er_flags & QR_PERMANENT)
1098 wprintf("CHECKED ");
1099 wprintf("> Permanent (does not auto-purge)\n");
1101 /* start of anon options */
1103 wprintf("<LI>Anonymous messages<UL>\n");
1105 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1106 if (((er_flags & QR_ANONONLY) == 0)
1107 && ((er_flags & QR_ANONOPT) == 0))
1108 wprintf("CHECKED ");
1109 wprintf("> No anonymous messages\n");
1111 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1112 if (er_flags & QR_ANONONLY)
1113 wprintf("CHECKED ");
1114 wprintf("> All messages are anonymous\n");
1116 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1117 if (er_flags & QR_ANONOPT)
1118 wprintf("CHECKED ");
1119 wprintf("> Prompt user when entering messages</UL>\n");
1121 /* end of anon options */
1123 wprintf("<LI>Room aide: \n");
1125 serv_getln(buf, sizeof buf);
1126 if (buf[0] != '2') {
1127 wprintf("<EM>%s</EM>\n", &buf[4]);
1129 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1130 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1133 wprintf("</UL><CENTER>\n");
1134 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1135 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1137 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
1143 /* Sharing the room with other Citadel nodes... */
1144 if (!strcmp(tab, "sharing")) {
1146 shared_with = strdup("");
1147 not_shared_with = strdup("");
1149 /* Learn the current configuration */
1150 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1151 serv_getln(buf, sizeof buf);
1152 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1153 extract_token(node, buf, 0, '|', sizeof node);
1154 not_shared_with = realloc(not_shared_with,
1155 strlen(not_shared_with) + 32);
1156 strcat(not_shared_with, node);
1157 strcat(not_shared_with, "\n");
1161 serv_getln(buf, sizeof buf);
1162 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1163 extract_token(cmd, buf, 0, '|', sizeof cmd);
1164 extract_token(node, buf, 1, '|', sizeof node);
1165 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1166 if (!strcasecmp(cmd, "ignet_push_share")) {
1167 shared_with = realloc(shared_with,
1168 strlen(shared_with) + 32);
1169 strcat(shared_with, node);
1170 if (strlen(remote_room) > 0) {
1171 strcat(shared_with, "|");
1172 strcat(shared_with, remote_room);
1174 strcat(shared_with, "\n");
1178 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1179 extract_token(buf, shared_with, i, '\n', sizeof buf);
1180 extract_token(node, buf, 0, '|', sizeof node);
1181 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1182 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1183 if (!strcasecmp(node, cmd)) {
1184 remove_token(not_shared_with, j, '\n');
1189 /* Display the stuff */
1190 wprintf("<CENTER><br />"
1191 "<TABLE border=1 cellpadding=5><TR>"
1192 "<TD><B><I>Shared with</I></B></TD>"
1193 "<TD><B><I>Not shared with</I></B></TD></TR>\n"
1194 "<TR><TD VALIGN=TOP>\n");
1196 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1197 "<TD>Remote node name</TD>"
1198 "<TD>Remote room name</TD>"
1203 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1204 extract_token(buf, shared_with, i, '\n', sizeof buf);
1205 extract_token(node, buf, 0, '|', sizeof node);
1206 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1207 if (strlen(node) > 0) {
1208 wprintf("<FORM METHOD=\"POST\" "
1209 "ACTION=\"/netedit\">"
1210 "<TR><TD>%s</TD>\n", node);
1213 if (strlen(remote_room) > 0) {
1214 escputs(remote_room);
1220 wprintf("<INPUT TYPE=\"hidden\" NAME=\"line\" "
1221 "VALUE=\"ignet_push_share|");
1223 if (strlen(remote_room) > 0) {
1225 urlescputs(remote_room);
1228 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1229 "VALUE=\"sharing\">\n");
1230 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1231 "VALUE=\"remove\">\n");
1232 wprintf("<INPUT TYPE=\"submit\" "
1233 "NAME=\"sc\" VALUE=\"Unshare\">");
1234 wprintf("</TD></TR></FORM>\n");
1238 wprintf("</TABLE>\n");
1239 wprintf("</TD><TD VALIGN=TOP>\n");
1240 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1241 "<TD>Remote node name</TD>"
1242 "<TD>Remote room name</TD>"
1247 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1248 extract_token(node, not_shared_with, i, '\n', sizeof node);
1249 if (strlen(node) > 0) {
1250 wprintf("<FORM METHOD=\"POST\" "
1251 "ACTION=\"/netedit\">"
1255 "<INPUT TYPE=\"INPUT\" "
1259 wprintf("<INPUT TYPE=\"hidden\" "
1261 "VALUE=\"ignet_push_share|");
1264 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1265 "VALUE=\"sharing\">\n");
1266 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1267 "VALUE=\"add\">\n");
1268 wprintf("<INPUT TYPE=\"submit\" "
1269 "NAME=\"sc\" VALUE=\"Share\">");
1270 wprintf("</TD></TR></FORM>\n");
1274 wprintf("</TABLE>\n");
1275 wprintf("</TD></TR>"
1276 "</TABLE></CENTER><br />\n"
1277 "<I><B>Notes:</B><UL><LI>When sharing a room, "
1278 "it must be shared from both ends. Adding a node to "
1279 "the 'shared' list sends messages out, but in order to"
1280 " receive messages, the other nodes must be configured"
1281 " to send messages out to your system as well.\n"
1282 "<LI>If the remote room name is blank, it is assumed "
1283 "that the room name is identical on the remote node."
1284 "<LI>If the remote room name is different, the remote "
1285 "node must also configure the name of the room here."
1291 /* Mailing list management */
1292 if (!strcmp(tab, "listserv")) {
1294 wprintf("<br /><center>"
1295 "<TABLE BORDER=0 WIDTH=100%% CELLPADDING=5>"
1296 "<TR><TD VALIGN=TOP>");
1298 wprintf("<i>The contents of this room are being "
1299 "mailed <b>as individual messages</b> "
1300 "to the following list recipients:"
1301 "</i><br /><br />\n");
1304 serv_getln(buf, sizeof buf);
1305 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1306 extract_token(cmd, buf, 0, '|', sizeof cmd);
1307 if (!strcasecmp(cmd, "listrecp")) {
1308 extract_token(recp, buf, 1, '|', sizeof recp);
1311 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1314 wprintf("&tab=listserv\">(remove)</A><br />");
1318 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1319 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1320 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1321 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1322 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1323 wprintf("</FORM>\n");
1325 wprintf("</TD><TD VALIGN=TOP>\n");
1327 wprintf("<i>The contents of this room are being "
1328 "mailed <b>in digest form</b> "
1329 "to the following list recipients:"
1330 "</i><br /><br />\n");
1333 serv_getln(buf, sizeof buf);
1334 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1335 extract_token(cmd, buf, 0, '|', sizeof cmd);
1336 if (!strcasecmp(cmd, "digestrecp")) {
1337 extract_token(recp, buf, 1, '|', sizeof recp);
1340 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1343 wprintf("&tab=listserv\">(remove)</A><br />");
1347 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1348 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1349 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1350 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1351 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1352 wprintf("</FORM>\n");
1354 wprintf("</TD></TR></TABLE><hr />\n");
1356 if (self_service(999) == 1) {
1357 wprintf("This room is configured to allow "
1358 "self-service subscribe/unsubscribe requests."
1359 " <A HREF=\"/toggle_self_service?newval=0&"
1361 "Click to disable.</A><br />\n"
1362 "The URL for subscribe/unsubscribe is: "
1363 "<TT>http://%s/listsub</TT><br />\n",
1368 wprintf("This room is <i>not</i> configured to allow "
1369 "self-service subscribe/unsubscribe requests."
1370 " <A HREF=\"/toggle_self_service?newval=1&"
1372 "Click to enable.</A><br />\n"
1377 wprintf("</CENTER>\n");
1381 /* Mailing list management */
1382 if (!strcmp(tab, "expire")) {
1384 serv_puts("GPEX room");
1385 serv_getln(buf, sizeof buf);
1386 if (buf[0] == '2') {
1387 roompolicy = extract_int(&buf[4], 0);
1388 roomvalue = extract_int(&buf[4], 1);
1391 serv_puts("GPEX floor");
1392 serv_getln(buf, sizeof buf);
1393 if (buf[0] == '2') {
1394 floorpolicy = extract_int(&buf[4], 0);
1395 floorvalue = extract_int(&buf[4], 1);
1398 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/set_room_policy\">\n");
1399 wprintf("<TABLE border=0 cellspacing=5>\n");
1400 wprintf("<TR><TD>Message expire policy for this room<br />(");
1401 escputs(WC->wc_roomname);
1402 wprintf(")</TD><TD>");
1403 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1404 ((roompolicy == 0) ? "CHECKED" : "") );
1405 wprintf("Use the default policy for this floor<br />\n");
1406 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1407 ((roompolicy == 1) ? "CHECKED" : "") );
1408 wprintf("Never automatically expire messages<br />\n");
1409 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1410 ((roompolicy == 2) ? "CHECKED" : "") );
1411 wprintf("Expire by message count<br />\n");
1412 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1413 ((roompolicy == 3) ? "CHECKED" : "") );
1414 wprintf("Expire by message age<br />");
1415 wprintf("Number of messages or days: ");
1416 wprintf("<INPUT TYPE=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1417 wprintf("</TD></TR>\n");
1419 if (WC->axlevel >= 6) {
1420 wprintf("<TR><TD COLSPAN=2><hr /></TD></TR>\n");
1421 wprintf("<TR><TD>Message expire policy for this floor<br />(");
1422 escputs(floorlist[WC->wc_floor]);
1423 wprintf(")</TD><TD>");
1424 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1425 ((floorpolicy == 0) ? "CHECKED" : "") );
1426 wprintf("Use the system default<br />\n");
1427 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1428 ((floorpolicy == 1) ? "CHECKED" : "") );
1429 wprintf("Never automatically expire messages<br />\n");
1430 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1431 ((floorpolicy == 2) ? "CHECKED" : "") );
1432 wprintf("Expire by message count<br />\n");
1433 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1434 ((floorpolicy == 3) ? "CHECKED" : "") );
1435 wprintf("Expire by message age<br />");
1436 wprintf("Number of messages or days: ");
1437 wprintf("<INPUT TYPE=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1441 wprintf("<CENTER>\n");
1442 wprintf("<TR><TD COLSPAN=2><hr /><CENTER>\n");
1443 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1445 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1446 wprintf("</CENTER></TD><TR>\n");
1448 wprintf("</TABLE>\n"
1449 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1455 /* Mailing list management */
1456 if (!strcmp(tab, "access")) {
1460 /* end content of whatever tab is open now */
1461 wprintf("</TD></TR></TABLE></div>\n");
1468 * Toggle self-service list subscription
1470 void toggle_self_service(void) {
1473 newval = atoi(bstr("newval"));
1474 self_service(newval);
1481 * save new parameters for a room
1487 char er_password[10];
1488 char er_dirname[15];
1489 char er_roomaide[26];
1495 if (strcmp(bstr("sc"), "OK")) {
1496 strcpy(WC->ImportantMessage,
1497 "Cancelled. Changes were not saved.");
1502 serv_getln(buf, sizeof buf);
1504 if (buf[0] != '2') {
1505 strcpy(WC->ImportantMessage, &buf[4]);
1509 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1510 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1511 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1512 er_flags = extract_int(&buf[4], 3);
1514 strcpy(er_roomaide, bstr("er_roomaide"));
1515 if (strlen(er_roomaide) == 0) {
1517 serv_getln(buf, sizeof buf);
1518 if (buf[0] != '2') {
1519 strcpy(er_roomaide, "");
1521 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1524 strcpy(buf, bstr("er_name"));
1526 if (strlen(buf) > 0)
1527 strcpy(er_name, buf);
1529 strcpy(buf, bstr("er_password"));
1531 if (strlen(buf) > 0)
1532 strcpy(er_password, buf);
1534 strcpy(buf, bstr("er_dirname"));
1536 if (strlen(buf) > 0)
1537 strcpy(er_dirname, buf);
1539 strcpy(buf, bstr("type"));
1540 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
1542 if (!strcmp(buf, "invonly")) {
1543 er_flags |= (QR_PRIVATE);
1545 if (!strcmp(buf, "hidden")) {
1546 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
1548 if (!strcmp(buf, "passworded")) {
1549 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
1551 if (!strcmp(bstr("prefonly"), "yes")) {
1552 er_flags |= QR_PREFONLY;
1554 er_flags &= ~QR_PREFONLY;
1557 if (!strcmp(bstr("readonly"), "yes")) {
1558 er_flags |= QR_READONLY;
1560 er_flags &= ~QR_READONLY;
1563 if (!strcmp(bstr("permanent"), "yes")) {
1564 er_flags |= QR_PERMANENT;
1566 er_flags &= ~QR_PERMANENT;
1569 if (!strcmp(bstr("network"), "yes")) {
1570 er_flags |= QR_NETWORK;
1572 er_flags &= ~QR_NETWORK;
1575 if (!strcmp(bstr("directory"), "yes")) {
1576 er_flags |= QR_DIRECTORY;
1578 er_flags &= ~QR_DIRECTORY;
1581 if (!strcmp(bstr("ulallowed"), "yes")) {
1582 er_flags |= QR_UPLOAD;
1584 er_flags &= ~QR_UPLOAD;
1587 if (!strcmp(bstr("dlallowed"), "yes")) {
1588 er_flags |= QR_DOWNLOAD;
1590 er_flags &= ~QR_DOWNLOAD;
1593 if (!strcmp(bstr("visdir"), "yes")) {
1594 er_flags |= QR_VISDIR;
1596 er_flags &= ~QR_VISDIR;
1599 strcpy(buf, bstr("anon"));
1601 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
1602 if (!strcmp(buf, "anononly"))
1603 er_flags |= QR_ANONONLY;
1604 if (!strcmp(buf, "anon2"))
1605 er_flags |= QR_ANONOPT;
1608 if (!strcmp(bstr("bump"), "yes"))
1611 er_floor = atoi(bstr("er_floor"));
1613 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
1614 er_name, er_password, er_dirname, er_flags, bump, er_floor);
1616 serv_getln(buf, sizeof buf);
1617 if (buf[0] != '2') {
1618 strcpy(WC->ImportantMessage, &buf[4]);
1624 if (strlen(er_roomaide) > 0) {
1625 sprintf(buf, "SETA %s", er_roomaide);
1627 serv_getln(buf, sizeof buf);
1628 if (buf[0] != '2') {
1629 strcpy(WC->ImportantMessage, &buf[4]);
1630 display_main_menu();
1635 strcpy(WC->ImportantMessage, "Your changes have been saved.");
1642 * Display form for Invite, Kick, and show Who Knows a room
1644 void do_invt_kick(void) {
1645 char buf[SIZ], room[SIZ], username[SIZ];
1648 serv_getln(buf, sizeof buf);
1650 if (buf[0] != '2') {
1654 extract_token(room, &buf[4], 0, '|', sizeof room);
1656 strcpy(username, bstr("username"));
1658 if (!strcmp(bstr("sc"), "Kick")) {
1659 sprintf(buf, "KICK %s", username);
1661 serv_getln(buf, sizeof buf);
1663 if (buf[0] != '2') {
1664 strcpy(WC->ImportantMessage, &buf[4]);
1666 sprintf(WC->ImportantMessage,
1667 "<B><I>User %s kicked out of room %s.</I></B>\n",
1672 if (!strcmp(bstr("sc"), "Invite")) {
1673 sprintf(buf, "INVT %s", username);
1675 serv_getln(buf, sizeof buf);
1677 if (buf[0] != '2') {
1678 strcpy(WC->ImportantMessage, &buf[4]);
1680 sprintf(WC->ImportantMessage,
1681 "<B><I>User %s invited to room %s.</I></B>\n",
1692 * Display form for Invite, Kick, and show Who Knows a room
1694 void display_whok(void)
1696 char buf[SIZ], room[SIZ], username[SIZ];
1699 serv_getln(buf, sizeof buf);
1701 if (buf[0] != '2') {
1705 extract_token(room, &buf[4], 0, '|', sizeof room);
1708 wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
1709 "<TD>The users listed below have access to this room. "
1710 "To remove a user from the access list, select the user "
1711 "name from the list and click 'Kick'.<br /><br />");
1713 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1714 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1715 wprintf("<SELECT NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
1717 serv_getln(buf, sizeof buf);
1718 if (buf[0] == '1') {
1719 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1720 extract_token(username, buf, 0, '|', sizeof username);
1721 wprintf("<OPTION>");
1726 wprintf("</SELECT><br />\n");
1728 wprintf("<input type=submit name=sc value=\"Kick\">");
1729 wprintf("</FORM></CENTER>\n");
1732 "To grant another user access to this room, enter the "
1733 "user name in the box below and click 'Invite'.<br /><br />");
1735 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1736 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1737 wprintf("Invite: ");
1738 wprintf("<input type=\"text\" name=\"username\" style=\"width:100%%\"><br />\n"
1739 "<input type=\"hidden\" name=\"sc\" value=\"Invite\">"
1740 "<input type=\"submit\" value=\"Invite\">"
1741 "</FORM></CENTER>\n");
1743 wprintf("</TD></TR></TABLE>\n");
1750 * display the form for entering a new room
1752 void display_entroom(void)
1757 serv_puts("CRE8 0");
1758 serv_getln(buf, sizeof buf);
1760 if (buf[0] != '2') {
1761 strcpy(WC->ImportantMessage, &buf[4]);
1762 display_main_menu();
1766 output_headers(1, 1, 2, 0, 0, 0, 0);
1767 wprintf("<div id=\"banner\">\n"
1768 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1769 "<SPAN CLASS=\"titlebar\">Create a new room</SPAN>"
1770 "</TD></TR></TABLE>\n"
1771 "</div>\n<div id=\"content\">\n"
1774 wprintf("<div id=\"fix_scrollbar_bug\">"
1775 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1777 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"/entroom\">\n");
1779 wprintf("<UL><LI>Name of room: ");
1780 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
1782 wprintf("<LI>Resides on floor: ");
1784 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1785 for (i = 0; i < 128; ++i)
1786 if (strlen(floorlist[i]) > 0) {
1787 wprintf("<OPTION ");
1788 wprintf("VALUE=\"%d\">", i);
1789 escputs(floorlist[i]);
1790 wprintf("</OPTION>\n");
1792 wprintf("</SELECT>\n");
1794 /* Our clever little snippet of JavaScript automatically selects
1795 * a public room if the view is set to Bulletin Board, and it
1796 * selects a mailbox room otherwise. The user can override this,
1799 wprintf("<LI>Default view for room: ");
1800 wprintf("<SELECT NAME=\"er_view\" SIZE=\"1\" OnChange=\""
1801 " if (this.form.er_view.value == 0) { "
1802 " this.form.type[0].checked=true; "
1803 " this.form.er_floor.disabled = false; "
1806 " this.form.type[4].checked=true; "
1807 " this.form.er_floor.disabled = true; "
1810 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
1811 wprintf("<OPTION %s VALUE=\"%d\">",
1812 ((i == 0) ? "SELECTED" : ""), i );
1813 escputs(viewdefs[i]);
1814 wprintf("</OPTION>\n");
1816 wprintf("</SELECT>\n");
1818 wprintf("<LI>Type of room:<UL>\n");
1820 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1821 wprintf("CHECKED OnChange=\""
1822 " if (this.form.type[0].checked == true) { "
1823 " this.form.er_floor.disabled = false; "
1825 "\"> Public (automatically appears to everyone)\n");
1827 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
1828 " if (this.form.type[1].checked == true) { "
1829 " this.form.er_floor.disabled = false; "
1831 "\"> Private - hidden (accessible to anyone who knows its name)\n");
1833 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
1834 " if (this.form.type[2].checked == true) { "
1835 " this.form.er_floor.disabled = false; "
1837 "\"> Private - require password:\n");
1838 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
1840 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
1841 " if (this.form.type[3].checked == true) { "
1842 " this.form.er_floor.disabled = false; "
1844 "\"> Private - invitation only\n");
1846 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"personal\" "
1848 " if (this.form.type[4].checked == true) { "
1849 " this.form.er_floor.disabled = true; "
1851 "\"> Personal (mailbox for you only)\n");
1855 wprintf("<CENTER>\n");
1856 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1858 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1859 wprintf("</CENTER>\n");
1860 wprintf("</FORM>\n<hr />");
1861 serv_printf("MESG roomaccess");
1862 serv_getln(buf, sizeof buf);
1863 if (buf[0] == '1') {
1864 fmout(NULL, "CENTER");
1866 wprintf("</td></tr></table></div>\n");
1874 * support function for entroom() -- sets the default view
1876 void er_set_default_view(int newview) {
1889 serv_getln(buf, sizeof buf);
1890 if (buf[0] != '2') return;
1892 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
1893 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
1894 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
1895 rm_bits1 = extract_int(&buf[4], 3);
1896 rm_floor = extract_int(&buf[4], 4);
1897 rm_listorder = extract_int(&buf[4], 5);
1898 rm_bits2 = extract_int(&buf[4], 7);
1900 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1901 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
1902 rm_listorder, newview, rm_bits2
1904 serv_getln(buf, sizeof buf);
1917 char er_password[SIZ];
1922 if (strcmp(bstr("sc"), "OK")) {
1923 strcpy(WC->ImportantMessage,
1924 "Cancelled. No new room was created.");
1925 display_main_menu();
1928 strcpy(er_name, bstr("er_name"));
1929 strcpy(er_type, bstr("type"));
1930 strcpy(er_password, bstr("er_password"));
1931 er_floor = atoi(bstr("er_floor"));
1932 er_view = atoi(bstr("er_view"));
1935 if (!strcmp(er_type, "hidden"))
1937 if (!strcmp(er_type, "passworded"))
1939 if (!strcmp(er_type, "invonly"))
1941 if (!strcmp(er_type, "personal"))
1944 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
1945 er_name, er_num_type, er_password, er_floor, 0, er_view);
1947 serv_getln(buf, sizeof buf);
1948 if (buf[0] != '2') {
1949 strcpy(WC->ImportantMessage, &buf[4]);
1950 display_main_menu();
1954 do_change_view(er_view); /* Now go there */
1959 * display the screen to enter a private room
1961 void display_private(char *rname, int req_pass)
1963 output_headers(1, 1, 2, 0, 0, 0, 0);
1964 wprintf("<div id=\"banner\">\n"
1965 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1966 "<SPAN CLASS=\"titlebar\">Go to a hidden room</SPAN>"
1967 "</TD></TR></TABLE>\n"
1968 "</div>\n<div id=\"content\">\n"
1971 wprintf("<div id=\"fix_scrollbar_bug\">"
1972 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1974 wprintf("<CENTER>\n");
1975 wprintf("<br />If you know the name of a hidden (guess-name) or\n");
1976 wprintf("passworded room, you can enter that room by typing\n");
1977 wprintf("its name below. Once you gain access to a private\n");
1978 wprintf("room, it will appear in your regular room listings\n");
1979 wprintf("so you don't have to keep returning here.\n");
1980 wprintf("<br /><br />");
1982 wprintf("<FORM METHOD=\"GET\" ACTION=\"/goto_private\">\n");
1984 wprintf("<table border=\"0\" cellspacing=\"5\" "
1985 "cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
1987 "Enter room name:</TD><TD>"
1988 "<INPUT TYPE=\"text\" NAME=\"gr_name\" "
1989 "VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1992 wprintf("</TD></TR><TR><TD>");
1993 wprintf("Enter room password:</TD><TD>");
1994 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1996 wprintf("</TD></TR></TABLE><br />\n");
1998 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
2000 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2001 wprintf("</FORM>\n");
2002 wprintf("</td></tr></table></div>\n");
2007 * goto a private room
2009 void goto_private(void)
2014 if (strcasecmp(bstr("sc"), "OK")) {
2015 display_main_menu();
2018 strcpy(hold_rm, WC->wc_roomname);
2019 strcpy(buf, "GOTO ");
2020 strcat(buf, bstr("gr_name"));
2022 strcat(buf, bstr("gr_pass"));
2024 serv_getln(buf, sizeof buf);
2026 if (buf[0] == '2') {
2027 smart_goto(bstr("gr_name"));
2030 if (!strncmp(buf, "540", 3)) {
2031 display_private(bstr("gr_name"), 1);
2034 output_headers(1, 1, 1, 0, 0, 0, 0);
2035 wprintf("%s\n", &buf[4]);
2042 * display the screen to zap a room
2044 void display_zap(void)
2046 output_headers(1, 1, 2, 0, 0, 0, 0);
2048 wprintf("<div id=\"banner\">\n");
2049 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
2050 wprintf("<SPAN CLASS=\"titlebar\">Zap (forget/unsubscribe) the current room</SPAN>\n");
2051 wprintf("</TD></TR></TABLE>\n");
2052 wprintf("</div>\n<div id=\"content\">\n");
2054 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
2055 wprintf("disappear from your room list. Is this what you wish ");
2056 wprintf("to do?<br />\n");
2058 wprintf("<FORM METHOD=\"GET\" ACTION=\"/zap\">\n");
2059 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
2061 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2062 wprintf("</FORM>\n");
2073 char final_destination[SIZ];
2075 /* If the forget-room routine fails for any reason, we fall back
2076 * to the current room; otherwise, we go to the Lobby
2078 strcpy(final_destination, WC->wc_roomname);
2080 if (!strcasecmp(bstr("sc"), "OK")) {
2081 serv_printf("GOTO %s", WC->wc_roomname);
2082 serv_getln(buf, sizeof buf);
2083 if (buf[0] == '2') {
2085 serv_getln(buf, sizeof buf);
2086 if (buf[0] == '2') {
2087 strcpy(final_destination, "_BASEROOM_");
2091 smart_goto(final_destination);
2097 * Delete the current room
2099 void delete_room(void)
2103 serv_puts("KILL 1");
2104 serv_getln(buf, sizeof buf);
2105 if (buf[0] != '2') {
2106 strcpy(WC->ImportantMessage, &buf[4]);
2107 display_main_menu();
2110 smart_goto("_BASEROOM_");
2117 * Perform changes to a room's network configuration
2119 void netedit(void) {
2128 if (strlen(bstr("line"))==0) {
2133 strcpy(line, bstr("prefix"));
2134 strcat(line, bstr("line"));
2135 strcat(line, bstr("suffix"));
2144 serv_getln(buf, sizeof buf);
2145 if (buf[0] != '1') {
2151 /* This loop works for add *or* remove. Spiffy, eh? */
2152 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2153 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2154 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2155 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2156 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2157 if ( (strcasecmp(cmpa0, cmpb0))
2158 || (strcasecmp(cmpa1, cmpb1)) ) {
2159 fprintf(fp, "%s\n", buf);
2165 serv_getln(buf, sizeof buf);
2166 if (buf[0] != '4') {
2172 while (fgets(buf, sizeof buf, fp) != NULL) {
2173 buf[strlen(buf)-1] = 0;
2177 if (!strcasecmp(bstr("cmd"), "add")) {
2189 * Convert a room name to a folder-ish-looking name.
2191 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2196 * For mailboxes, just do it straight...
2199 sprintf(folder, "My folders|%s", room);
2203 * Otherwise, prefix the floor name as a "public folders" moniker
2206 sprintf(folder, "%s|%s", floorlist[floor], room);
2210 * Replace "\" characters with "|" for pseudo-folder-delimiting
2212 for (i=0; i<strlen(folder); ++i) {
2213 if (folder[i] == '\\') folder[i] = '|';
2221 * Back end for change_view()
2223 void do_change_view(int newview) {
2226 serv_printf("VIEW %d", newview);
2227 serv_getln(buf, sizeof buf);
2228 WC->wc_view = newview;
2229 smart_goto(WC->wc_roomname);
2235 * Change the view for this room
2237 void change_view(void) {
2240 view = atol(bstr("view"));
2241 do_change_view(view);
2246 * One big expanded tree list view --- like a folder list
2248 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2252 int has_subfolders = 0;
2255 parents = malloc(max_folders * sizeof(int));
2257 /* BEGIN TREE MENU */
2258 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2260 /* include NanoTree */
2261 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2263 /* initialize NanoTree */
2264 wprintf("<script type=\"text/javascript\"> \n"
2265 " showRootNode = false; \n"
2266 " sortNodes = false; \n"
2267 " dragable = false; \n"
2269 " function standardClick(treeNode) { \n"
2272 " var closedGif = 'static/folder_closed.gif'; \n"
2273 " var openGif = 'static/folder_open.gif'; \n"
2275 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2279 for (i=0; i<max_folders; ++i) {
2282 if ((i+1) < max_folders) {
2283 if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
2284 && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
2289 levels = num_tokens(fold[i].name, '|');
2290 parents[levels] = i;
2292 wprintf("var node%d = new TreeNode(%d, '", i, i);
2294 if (fold[i].selectable) {
2295 wprintf("<A HREF=\"/dotgoto?room=");
2296 urlescputs(fold[i].room);
2301 wprintf("<SPAN CLASS=\"roomlist_floor\">");
2303 else if (fold[i].hasnewmsgs) {
2304 wprintf("<SPAN CLASS=\"roomlist_new\">");
2307 wprintf("<SPAN CLASS=\"roomlist_old\">");
2309 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2314 if (has_subfolders) {
2315 wprintf("new Array(closedGif, openGif)");
2317 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2318 wprintf("'static/savecontact_16x.gif'");
2320 else if (fold[i].view == VIEW_CALENDAR) {
2321 wprintf("'static/calarea_16x.gif'");
2323 else if (fold[i].view == VIEW_TASKS) {
2324 wprintf("'static/taskmanag_16x.gif'");
2326 else if (fold[i].view == VIEW_NOTES) {
2327 wprintf("'static/storenotes_16x.gif'");
2329 else if (fold[i].view == VIEW_MAILBOX) {
2330 wprintf("'static/privatemess_16x.gif'");
2333 wprintf("'static/chatrooms_16x.gif'");
2336 urlescputs(fold[i].name);
2340 wprintf("rootNode.addChild(node%d);\n", i);
2343 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2347 wprintf("container = document.getElementById('roomlist_div'); \n"
2357 * Boxes and rooms and lists ... oh my!
2359 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2362 int levels, oldlevels;
2365 static int columns = 3;
2366 int boxes_per_column = 0;
2367 int current_column = 0;
2371 while (nf % columns != 0) ++nf;
2372 boxes_per_column = (nf / columns);
2373 if (boxes_per_column < 1) boxes_per_column = 1;
2375 /* Outer table (for columnization) */
2376 wprintf("<TABLE BORDER=0 WIDTH=96%% CELLPADDING=5>"
2377 "<tr><td valign=top>");
2381 for (i=0; i<max_folders; ++i) {
2383 levels = num_tokens(fold[i].name, '|');
2385 if ((levels == 1) && (oldlevels > 1)) {
2388 do_template("endbox");
2391 if ((num_boxes % boxes_per_column) == 0) {
2393 if (current_column < columns) {
2394 wprintf("</td><td valign=top>\n");
2401 /* Begin inner box */
2402 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2403 stresc(boxtitle, buf, 1, 0);
2404 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2405 do_template("beginbox");
2413 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
2414 if (fold[i].selectable) {
2415 wprintf("<A HREF=\"/dotgoto?room=");
2416 urlescputs(fold[i].room);
2422 if (fold[i].hasnewmsgs) {
2423 wprintf("<SPAN CLASS=\"roomlist_new\">");
2426 wprintf("<SPAN CLASS=\"roomlist_old\">");
2428 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2431 if (fold[i].selectable) {
2437 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
2438 wprintf(" (INBOX)");
2440 wprintf("<br />\n");
2443 /* End the final inner box */
2444 do_template("endbox");
2446 wprintf("</TD></TR></TABLE>\n");
2451 * Show the room list. (only should get called by
2452 * knrooms() because that's where output_headers() is called from)
2455 void list_all_rooms_by_floor(char *viewpref) {
2458 struct folder *fold = NULL;
2460 int max_folders = 0;
2461 int alloc_folders = 0;
2465 int num_floors = 1; /* add an extra one for private folders */
2467 /* Start with the mailboxes */
2470 fold = malloc(sizeof(struct folder));
2471 memset(fold, 0, sizeof(struct folder));
2472 strcpy(fold[0].name, "My folders");
2473 fold[0].is_mailbox = 1;
2475 /* Then add floors */
2477 serv_getln(buf, sizeof buf);
2478 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2479 if (max_folders >= alloc_folders) {
2480 alloc_folders = max_folders + 100;
2481 fold = realloc(fold,
2482 alloc_folders * sizeof(struct folder));
2484 memset(&fold[max_folders], 0, sizeof(struct folder));
2485 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
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].room, buf, 0, '|', sizeof fold[max_folders].room);
2501 ra_flags = extract_int(buf, 5);
2502 flags = extract_int(buf, 1);
2503 fold[max_folders].floor = extract_int(buf, 2);
2504 fold[max_folders].hasnewmsgs =
2505 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
2506 if (flags & QR_MAILBOX) {
2507 fold[max_folders].is_mailbox = 1;
2509 fold[max_folders].view = extract_int(buf, 6);
2510 room_to_folder(fold[max_folders].name,
2511 fold[max_folders].room,
2512 fold[max_folders].floor,
2513 fold[max_folders].is_mailbox);
2514 fold[max_folders].selectable = 1;
2518 /* Bubble-sort the folder list */
2519 for (i=0; i<max_folders; ++i) {
2520 for (j=0; j<(max_folders-1)-i; ++j) {
2521 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
2522 swap = strcasecmp(fold[j].name, fold[j+1].name);
2525 if ( (fold[j+1].is_mailbox)
2526 && (!fold[j].is_mailbox)) {
2534 memcpy(&ftmp, &fold[j], sizeof(struct folder));
2535 memcpy(&fold[j], &fold[j+1],
2536 sizeof(struct folder));
2537 memcpy(&fold[j+1], &ftmp,
2538 sizeof(struct folder));
2543 /* test only hackish view
2544 wprintf("<table><TR><TD>A Table</TD></TR></table>\n");
2545 for (i=0; i<max_folders; ++i) {
2546 escputs(fold[i].name);
2547 wprintf("<br />\n");
2551 if (!strcasecmp(viewpref, "folders")) {
2552 do_folder_view(fold, max_folders, num_floors);
2555 do_rooms_view(fold, max_folders, num_floors);
2563 /* Do either a known rooms list or a folders list, depending on the
2567 char listviewpref[SIZ];
2569 output_headers(1, 1, 2, 0, 0, 0, 0);
2572 /* Determine whether the user is trying to change views */
2573 if (bstr("view") != NULL) {
2574 if (strlen(bstr("view")) > 0) {
2575 set_preference("roomlistview", bstr("view"));
2579 get_preference("roomlistview", listviewpref, sizeof listviewpref);
2581 if ( (strcasecmp(listviewpref, "folders"))
2582 && (strcasecmp(listviewpref, "table")) ) {
2583 strcpy(listviewpref, "rooms");
2587 wprintf("<div id=\"banner\">\n"
2588 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
2589 "<SPAN CLASS=\"titlebar\">"
2591 if (!strcasecmp(listviewpref, "rooms")) {
2592 wprintf("Room list");
2594 if (!strcasecmp(listviewpref, "folders")) {
2595 wprintf("Folder list");
2597 if (!strcasecmp(listviewpref, "table")) {
2598 wprintf("Room list");
2600 wprintf("</SPAN></TD>\n");
2602 /* offer the ability to switch views */
2603 wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
2604 "<SELECT NAME=\"newview\" SIZE=\"1\" "
2605 "OnChange=\"location.href=roomlistomatic.newview.options"
2606 "[selectedIndex].value\">\n");
2608 wprintf("<OPTION %s VALUE=\"/knrooms&view=rooms\">"
2611 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
2614 wprintf("<OPTION %s VALUE=\"/knrooms&view=folders\">"
2615 "View as folder list"
2617 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
2620 wprintf("</SELECT><br />");
2622 wprintf("</FORM></TD></TR></TABLE>\n");
2625 "<div id=\"content\">\n");
2627 /* Display the room list in the user's preferred format */
2628 list_all_rooms_by_floor(listviewpref);
2634 * Set the message expire policy for this room and/or floor
2636 void set_room_policy(void) {
2639 if (strcmp(bstr("sc"), "OK")) {
2640 strcpy(WC->ImportantMessage,
2641 "Cancelled. Changes were not saved.");
2646 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
2647 serv_getln(buf, sizeof buf);
2648 strcpy(WC->ImportantMessage, &buf[4]);
2650 if (WC->axlevel >= 6) {
2651 strcat(WC->ImportantMessage, "<br />\n");
2652 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
2653 serv_getln(buf, sizeof buf);
2654 strcat(WC->ImportantMessage, &buf[4]);