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/savecontact_48x.gif"
282 else if (WC->wc_view == VIEW_CALENDAR) {
283 wprintf("<img height=48 width=48 src=\""
284 "static/calarea_48x.gif"
288 else if (WC->wc_view == VIEW_TASKS) {
289 wprintf("<img height=48 width=48 src=\""
290 "static/taskmanag_48x.gif"
294 else if (WC->wc_view == VIEW_NOTES) {
295 wprintf("<img height=48 width=48 src=\""
296 "static/storenotes_48x.gif"
300 else if (WC->wc_view == VIEW_MAILBOX) {
301 wprintf("<img height=48 width=48 src=\""
302 "static/privatemess_48x.gif"
307 wprintf("<img height=48 width=48 src=\""
308 "static/chatrooms_48x.gif"
316 /* Let the user know if new mail has arrived
318 void embed_newmail_button(void) {
319 if ( (WC->new_mail > WC->remember_new_mail) && (WC->new_mail>0) ) {
321 "<A HREF=\"/dotgoto?room=_MAIL_\">"
322 "<IMG SRC=\"/static/privatemess_32x.gif\" border=0 "
323 "ALT=\"You have new mail\">"
324 "<br /><SPAN CLASS=\"youhavemail\">"
325 "%d new mail</SPAN></A>", WC->new_mail);
326 WC->remember_new_mail = WC->new_mail;
333 * Display the current view and offer an option to change it
335 void embed_view_o_matic(void) {
338 wprintf("<FORM NAME=\"viewomatic\">\n"
339 "<span class=\"room_banner_new_messages\">View as: "
340 "<SELECT NAME=\"newview\" SIZE=\"1\" "
341 "STYLE=\"font-family: Bitstream Vera Sans,Arial,Helvetica,sans-serif;"
342 " font-size: 7pt; background: #444455; color: #ddddcc;\" "
343 "OnChange=\"location.href=viewomatic.newview.options"
344 "[selectedIndex].value\">\n");
346 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
348 * Only offer the views that make sense, given the default
349 * view for the room. For example, don't offer a Calendar
350 * view in a non-Calendar room.
354 || (i == WC->wc_default_view)
355 || ( (i == 0) && (WC->wc_default_view == 1) )
356 || ( (i == 1) && (WC->wc_default_view == 0) )
359 wprintf("<OPTION %s VALUE=\"/changeview?view=%d\">",
360 ((i == WC->wc_view) ? "SELECTED" : ""),
362 escputs(viewdefs[i]);
363 wprintf("</OPTION>\n");
366 wprintf("</select></span></form>\n");
371 void embed_room_banner(char *got, int navbar_style) {
374 /* We need to have the information returned by a GOTO server command.
375 * If it isn't supplied, we fake it by issuing our own GOTO.
378 serv_printf("GOTO %s", WC->wc_roomname);
379 serv_getln(fakegot, sizeof fakegot);
383 /* If the user happens to select the "make this my start page" link,
384 * we want it to remember the URL as a "/dotskip" one instead of
385 * a "skip" or "gotonext" or something like that.
387 snprintf(WC->this_page, sizeof(WC->this_page), "/dotskip&room=%s",
390 /* Check for new mail. */
391 WC->new_mail = extract_int(&got[4], 9);
392 WC->wc_view = extract_int(&got[4], 11);
394 svprintf("ROOMNAME", WCS_STRING, "%s", WC->wc_roomname);
395 svprintf("NEWMSGS", WCS_STRING, "%d", extract_int(&got[4], 1));
396 svprintf("TOTALMSGS", WCS_STRING, "%d", extract_int(&got[4], 2));
397 svcallback("ROOMPIC", embed_room_graphic);
398 svcallback("ROOMINFO", readinfo);
399 svcallback("YOUHAVEMAIL", embed_newmail_button);
400 svcallback("VIEWOMATIC", embed_view_o_matic);
401 svcallback("START", offer_start_page);
403 do_template("roombanner");
404 if (navbar_style != navbar_none) {
406 wprintf("<div style=\"position:absolute; bottom:0px; left:0px\">\n"
407 "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%%\"><tr>\n");
410 if (navbar_style == navbar_default) wprintf(
412 "<a href=\"/ungoto\">"
413 "<img align=\"middle\" src=\"/static/back.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/readmsgs.gif\" border=\"0\">"
423 "<span class=\"navbar_link\">Read new messages</span></A>"
428 if (navbar_style == navbar_default) {
429 switch(WC->wc_view) {
430 case VIEW_ADDRESSBOOK:
433 "<A HREF=\"/readfwd\">"
434 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
436 "<span class=\"navbar_link\">"
444 "<A HREF=\"/readfwd?calview=day\">"
445 "<img align=\"middle\" src=\"/static/day_view.gif\" "
447 "<span class=\"navbar_link\">"
453 "<A HREF=\"/readfwd?calview=month\">"
454 "<img align=\"middle\" src=\"/static/month_view.gif\" "
456 "<span class=\"navbar_link\">"
464 "<A HREF=\"/readfwd\">"
465 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
467 "<span class=\"navbar_link\">"
475 "<A HREF=\"/readfwd\">"
476 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
478 "<span class=\"navbar_link\">"
486 "<A HREF=\"/readfwd\">"
487 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
489 "<span class=\"navbar_link\">"
497 "<A HREF=\"/readfwd\">"
498 "<img align=\"middle\" src=\"/static/readmsgs.gif\" "
500 "<span class=\"navbar_link\">"
508 if (navbar_style == navbar_default) {
511 "<A HREF=\"/display_enter\">"
512 "<img align=\"middle\" src=\"/static/enter.gif\" border=\"0\">"
513 "<span class=\"navbar_link\">"
515 switch(WC->wc_view) {
516 case VIEW_ADDRESSBOOK:
517 wprintf("Add new contact");
520 wprintf("Add new event");
523 wprintf("Add new task");
526 wprintf("Add new note");
529 wprintf("Enter a message");
532 wprintf("</span></a></td>\n");
535 if (navbar_style == navbar_default) wprintf(
538 "TITLE=\"Leave all messages marked as unread, go to next room with unread messages\">"
539 "<span class=\"navbar_link\">Skip this room</span>"
540 "<img align=\"middle\" src=\"/static/forward.gif\" border=\"0\"></A>"
544 if (navbar_style == navbar_default) wprintf(
546 "<A HREF=\"/gotonext\" "
547 "TITLE=\"Mark all messages as read, go to next room with unread messages\">"
548 "<span class=\"navbar_link\">Goto next room</span>"
549 "<img align=\"middle\" src=\"/static/forward.gif\" border=\"0\"></A>"
553 wprintf("</tr></table></div>\n");
563 * back end routine to take the session to a new room
566 void gotoroom(char *gname)
569 static long ls = (-1L);
571 /* store ungoto information */
572 strcpy(WC->ugname, WC->wc_roomname);
575 /* move to the new room */
576 serv_printf("GOTO %s", gname);
577 serv_getln(buf, sizeof buf);
579 serv_puts("GOTO _BASEROOM_");
580 serv_getln(buf, sizeof buf);
585 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
586 WC->room_flags = extract_int(&buf[4], 4);
587 /* highest_msg_read = extract_int(&buf[4],6);
588 maxmsgnum = extract_int(&buf[4],5);
589 is_mail = (char) extract_int(&buf[4],7); */
590 ls = extract_long(&buf[4], 6);
591 WC->wc_floor = extract_int(&buf[4], 10);
592 WC->wc_view = extract_int(&buf[4], 11);
593 WC->wc_default_view = extract_int(&buf[4], 12);
596 WC->is_room_aide = WC->is_aide;
598 WC->is_room_aide = (char) extract_int(&buf[4], 8);
600 remove_march(WC->wc_roomname);
601 if (!strcasecmp(gname, "_BASEROOM_"))
607 * Locate the room on the march list which we most want to go to. Each room
608 * is measured given a "weight" of preference based on various factors.
610 char *pop_march(int desired_floor)
612 static char TheRoom[128];
614 int TheOrder = 32767;
617 struct march *mptr = NULL;
619 strcpy(TheRoom, "_BASEROOM_");
620 if (WC->march == NULL)
623 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
625 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
626 weight = weight + 10000;
627 if (mptr->march_floor == desired_floor)
628 weight = weight + 5000;
630 weight = weight + ((128 - (mptr->march_floor)) * 128);
631 weight = weight + (128 - (mptr->march_order));
633 if (weight > TheWeight) {
635 strcpy(TheRoom, mptr->march_name);
636 TheFloor = mptr->march_floor;
637 TheOrder = mptr->march_order;
645 /* Goto next room having unread messages.
646 * We want to skip over rooms that the user has already been to, and take the
647 * user back to the lobby when done. The room we end up in is placed in
648 * newroom - which is set to 0 (the lobby) initially.
649 * We start the search in the current room rather than the beginning to prevent
650 * two or more concurrent users from dragging each other back to the same room.
655 struct march *mptr, *mptr2;
658 /* First check to see if the march-mode list is already allocated.
659 * If it is, pop the first room off the list and go there.
662 if (WC->march == NULL) {
664 serv_getln(buf, sizeof buf);
666 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
667 mptr = (struct march *) malloc(sizeof(struct march));
669 extract_token(mptr->march_name, buf, 0, '|', sizeof mptr->march_name);
670 mptr->march_floor = extract_int(buf, 2);
671 mptr->march_order = extract_int(buf, 3);
672 if (WC->march == NULL) {
676 while (mptr2->next != NULL)
681 /* add _BASEROOM_ to the end of the march list, so the user will end up
682 * in the system base room (usually the Lobby>) at the end of the loop
684 mptr = (struct march *) malloc(sizeof(struct march));
686 strcpy(mptr->march_name, "_BASEROOM_");
687 if (WC->march == NULL) {
691 while (mptr2->next != NULL)
696 * ...and remove the room we're currently in, so a <G>oto doesn't make us
697 * walk around in circles
699 remove_march(WC->wc_roomname);
701 if (WC->march != NULL) {
702 strcpy(next_room, pop_march(-1));
704 strcpy(next_room, "_BASEROOM_");
708 smart_goto(next_room);
712 void smart_goto(char *next_room) {
720 * mark all messages in current room as having been read
722 void slrp_highest(void)
727 serv_puts("SLRP HIGHEST");
728 serv_getln(buf, sizeof buf);
730 wprintf("<EM>%s</EM><br />\n", &buf[4]);
737 * un-goto the previous room
743 if (!strcmp(WC->ugname, "")) {
744 smart_goto(WC->wc_roomname);
747 serv_printf("GOTO %s", WC->ugname);
748 serv_getln(buf, sizeof buf);
750 smart_goto(WC->wc_roomname);
753 if (WC->uglsn >= 0L) {
754 serv_printf("SLRP %ld", WC->uglsn);
755 serv_getln(buf, sizeof buf);
757 strcpy(buf, WC->ugname);
758 strcpy(WC->ugname, "");
767 * Set/clear/read the "self-service list subscribe" flag for a room
769 * Set 'newval' to 0 to clear, 1 to set, any other value to leave unchanged.
770 * Always returns the new value.
773 int self_service(int newval) {
774 int current_value = 0;
780 int flags, floor, order, view, flags2;
783 serv_getln(buf, sizeof buf);
784 if (buf[0] != '2') return(0);
786 extract_token(name, &buf[4], 0, '|', sizeof name);
787 extract_token(password, &buf[4], 1, '|', sizeof password);
788 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
789 flags = extract_int(&buf[4], 3);
790 floor = extract_int(&buf[4], 4);
791 order = extract_int(&buf[4], 5);
792 view = extract_int(&buf[4], 6);
793 flags2 = extract_int(&buf[4], 7);
795 if (flags2 & QR2_SELFLIST) {
803 flags2 = flags2 | QR2_SELFLIST;
805 else if (newval == 0) {
806 flags2 = flags2 & ~QR2_SELFLIST;
809 return(current_value);
812 if (newval != current_value) {
813 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
814 name, password, dirname, flags,
815 floor, order, view, flags2);
816 serv_getln(buf, sizeof buf);
829 * display the form for editing a room
831 void display_editroom(void)
836 char remote_room[SIZ];
839 char er_password[10];
841 char er_roomaide[26];
847 char *not_shared_with;
854 if (strlen(tab) == 0) tab = "admin";
858 serv_getln(buf, sizeof buf);
861 strcpy(WC->ImportantMessage, &buf[4]);
865 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
866 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
867 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
868 er_flags = extract_int(&buf[4], 3);
869 er_floor = extract_int(&buf[4], 4);
871 output_headers(1, 1, 1, 0, 0, 0, 0);
873 /* print the tabbed dialog */
875 "<div id=\"fix_scrollbar_bug\">"
876 "<TABLE border=0 cellspacing=0 cellpadding=0 width=100%%>"
878 "<TD> </TD>\n");
880 if (!strcmp(tab, "admin")) {
881 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
884 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=admin\">");
886 wprintf("Administration");
887 if (!strcmp(tab, "admin")) {
888 wprintf("</SPAN></TD>\n");
891 wprintf("</A></TD>\n");
894 wprintf("<TD> </TD>\n");
896 if (!strcmp(tab, "config")) {
897 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
900 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=config\">");
902 wprintf("Configuration");
903 if (!strcmp(tab, "config")) {
904 wprintf("</SPAN></TD>\n");
907 wprintf("</A></TD>\n");
910 wprintf("<TD> </TD>\n");
912 if (!strcmp(tab, "expire")) {
913 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
916 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=expire\">");
918 wprintf("Message expire policy");
919 if (!strcmp(tab, "expire")) {
920 wprintf("</SPAN></TD>\n");
923 wprintf("</A></TD>\n");
926 wprintf("<TD> </TD>\n");
928 if (!strcmp(tab, "access")) {
929 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
932 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=access\">");
934 wprintf("Access controls");
935 if (!strcmp(tab, "access")) {
936 wprintf("</SPAN></TD>\n");
939 wprintf("</A></TD>\n");
942 wprintf("<TD> </TD>\n");
944 if (!strcmp(tab, "sharing")) {
945 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
948 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=sharing\">");
951 if (!strcmp(tab, "sharing")) {
952 wprintf("</SPAN></TD>\n");
955 wprintf("</A></TD>\n");
958 wprintf("<TD> </TD>\n");
960 if (!strcmp(tab, "listserv")) {
961 wprintf("<TD BGCOLOR=\"#FFFFFF\"><SPAN CLASS=\"tablabel\">");
964 wprintf("<TD BGCOLOR=\"#CCCCCC\"><A HREF=\"/display_editroom&tab=listserv\">");
966 wprintf("Mailing list service");
967 if (!strcmp(tab, "listserv")) {
968 wprintf("</SPAN></TD>\n");
971 wprintf("</A></TD>\n");
974 wprintf("<TD> </TD>\n");
976 wprintf("</TR></TABLE></div>\n");
977 /* end tabbed dialog */
979 /* begin content of whatever tab is open now */
980 wprintf("<div id=\"fix_scrollbar_bug\">"
981 "<TABLE border=0 width=100%% bgcolor=\"#FFFFFF\">\n"
984 if (!strcmp(tab, "admin")) {
986 "<LI><A HREF=\"/delete_room\" "
987 "onClick=\"return confirm('Are you sure you want to delete this room?');\">\n"
988 "Delete this room</A>\n"
989 "<LI><A HREF=\"/display_editroompic\">\n"
990 "Set or change the icon for this room's banner</A>\n"
991 "<LI><A HREF=\"/display_editinfo\">\n"
992 "Edit this room's Info file</A>\n"
996 if (!strcmp(tab, "config")) {
997 wprintf("<FORM METHOD=\"POST\" ACTION=\"/editroom\">\n");
999 wprintf("<UL><LI>Name of room: ");
1000 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"19\">\n", er_name);
1002 wprintf("<LI>Resides on floor: ");
1003 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1004 for (i = 0; i < 128; ++i)
1005 if (strlen(floorlist[i]) > 0) {
1006 wprintf("<OPTION ");
1008 wprintf("SELECTED ");
1009 wprintf("VALUE=\"%d\">", i);
1010 escputs(floorlist[i]);
1011 wprintf("</OPTION>\n");
1013 wprintf("</SELECT>\n");
1015 wprintf("<LI>Type of room:<UL>\n");
1017 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1018 if ((er_flags & QR_PRIVATE) == 0)
1019 wprintf("CHECKED ");
1020 wprintf("> Public room\n");
1022 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1023 if ((er_flags & QR_PRIVATE) &&
1024 (er_flags & QR_GUESSNAME))
1025 wprintf("CHECKED ");
1026 wprintf("> Private - guess name\n");
1028 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1029 if ((er_flags & QR_PRIVATE) &&
1030 (er_flags & QR_PASSWORDED))
1031 wprintf("CHECKED ");
1032 wprintf("> Private - require password:\n");
1033 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n", er_password);
1035 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1036 if ((er_flags & QR_PRIVATE)
1037 && ((er_flags & QR_GUESSNAME) == 0)
1038 && ((er_flags & QR_PASSWORDED) == 0))
1039 wprintf("CHECKED ");
1040 wprintf("> Private - invitation only\n");
1042 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1043 wprintf("> If private, cause current users to forget room\n");
1047 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1048 if (er_flags & QR_PREFONLY)
1049 wprintf("CHECKED ");
1050 wprintf("> Preferred users only\n");
1052 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1053 if (er_flags & QR_READONLY)
1054 wprintf("CHECKED ");
1055 wprintf("> Read-only room\n");
1057 /* directory stuff */
1058 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1059 if (er_flags & QR_DIRECTORY)
1060 wprintf("CHECKED ");
1061 wprintf("> File directory room\n");
1063 wprintf("<UL><LI>Directory name: ");
1064 wprintf("<INPUT TYPE=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n", er_dirname);
1066 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1067 if (er_flags & QR_UPLOAD)
1068 wprintf("CHECKED ");
1069 wprintf("> Uploading allowed\n");
1071 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1072 if (er_flags & QR_DOWNLOAD)
1073 wprintf("CHECKED ");
1074 wprintf("> Downloading allowed\n");
1076 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1077 if (er_flags & QR_VISDIR)
1078 wprintf("CHECKED ");
1079 wprintf("> Visible directory</UL>\n");
1081 /* end of directory stuff */
1083 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1084 if (er_flags & QR_NETWORK)
1085 wprintf("CHECKED ");
1086 wprintf("> Network shared room\n");
1088 wprintf("<LI><INPUT TYPE=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1089 if (er_flags & QR_PERMANENT)
1090 wprintf("CHECKED ");
1091 wprintf("> Permanent (does not auto-purge)\n");
1093 /* start of anon options */
1095 wprintf("<LI>Anonymous messages<UL>\n");
1097 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1098 if (((er_flags & QR_ANONONLY) == 0)
1099 && ((er_flags & QR_ANONOPT) == 0))
1100 wprintf("CHECKED ");
1101 wprintf("> No anonymous messages\n");
1103 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1104 if (er_flags & QR_ANONONLY)
1105 wprintf("CHECKED ");
1106 wprintf("> All messages are anonymous\n");
1108 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1109 if (er_flags & QR_ANONOPT)
1110 wprintf("CHECKED ");
1111 wprintf("> Prompt user when entering messages</UL>\n");
1113 /* end of anon options */
1115 wprintf("<LI>Room aide: \n");
1117 serv_getln(buf, sizeof buf);
1118 if (buf[0] != '2') {
1119 wprintf("<EM>%s</EM>\n", &buf[4]);
1121 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1122 wprintf("<INPUT TYPE=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1125 wprintf("</UL><CENTER>\n");
1126 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1127 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1129 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">"
1135 /* Sharing the room with other Citadel nodes... */
1136 if (!strcmp(tab, "sharing")) {
1138 shared_with = strdup("");
1139 not_shared_with = strdup("");
1141 /* Learn the current configuration */
1142 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1143 serv_getln(buf, sizeof buf);
1144 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1145 extract_token(node, buf, 0, '|', sizeof node);
1146 not_shared_with = realloc(not_shared_with,
1147 strlen(not_shared_with) + 32);
1148 strcat(not_shared_with, node);
1149 strcat(not_shared_with, "\n");
1153 serv_getln(buf, sizeof buf);
1154 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1155 extract_token(cmd, buf, 0, '|', sizeof cmd);
1156 extract_token(node, buf, 1, '|', sizeof node);
1157 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1158 if (!strcasecmp(cmd, "ignet_push_share")) {
1159 shared_with = realloc(shared_with,
1160 strlen(shared_with) + 32);
1161 strcat(shared_with, node);
1162 if (strlen(remote_room) > 0) {
1163 strcat(shared_with, "|");
1164 strcat(shared_with, remote_room);
1166 strcat(shared_with, "\n");
1170 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1171 extract_token(buf, shared_with, i, '\n', sizeof buf);
1172 extract_token(node, buf, 0, '|', sizeof node);
1173 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1174 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1175 if (!strcasecmp(node, cmd)) {
1176 remove_token(not_shared_with, j, '\n');
1181 /* Display the stuff */
1182 wprintf("<CENTER><br />"
1183 "<TABLE border=1 cellpadding=5><TR>"
1184 "<TD><B><I>Shared with</I></B></TD>"
1185 "<TD><B><I>Not shared with</I></B></TD></TR>\n"
1186 "<TR><TD VALIGN=TOP>\n");
1188 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1189 "<TD>Remote node name</TD>"
1190 "<TD>Remote room name</TD>"
1195 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1196 extract_token(buf, shared_with, i, '\n', sizeof buf);
1197 extract_token(node, buf, 0, '|', sizeof node);
1198 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1199 if (strlen(node) > 0) {
1200 wprintf("<FORM METHOD=\"POST\" "
1201 "ACTION=\"/netedit\">"
1202 "<TR><TD>%s</TD>\n", node);
1205 if (strlen(remote_room) > 0) {
1206 escputs(remote_room);
1212 wprintf("<INPUT TYPE=\"hidden\" NAME=\"line\" "
1213 "VALUE=\"ignet_push_share|");
1215 if (strlen(remote_room) > 0) {
1217 urlescputs(remote_room);
1220 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1221 "VALUE=\"sharing\">\n");
1222 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1223 "VALUE=\"remove\">\n");
1224 wprintf("<INPUT TYPE=\"submit\" "
1225 "NAME=\"sc\" VALUE=\"Unshare\">");
1226 wprintf("</TD></TR></FORM>\n");
1230 wprintf("</TABLE>\n");
1231 wprintf("</TD><TD VALIGN=TOP>\n");
1232 wprintf("<TABLE border=0 cellpadding=5><TR BGCOLOR=\"#CCCCCC\">"
1233 "<TD>Remote node name</TD>"
1234 "<TD>Remote room name</TD>"
1239 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1240 extract_token(node, not_shared_with, i, '\n', sizeof node);
1241 if (strlen(node) > 0) {
1242 wprintf("<FORM METHOD=\"POST\" "
1243 "ACTION=\"/netedit\">"
1247 "<INPUT TYPE=\"INPUT\" "
1251 wprintf("<INPUT TYPE=\"hidden\" "
1253 "VALUE=\"ignet_push_share|");
1256 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" "
1257 "VALUE=\"sharing\">\n");
1258 wprintf("<INPUT TYPE=\"hidden\" NAME=\"cmd\" "
1259 "VALUE=\"add\">\n");
1260 wprintf("<INPUT TYPE=\"submit\" "
1261 "NAME=\"sc\" VALUE=\"Share\">");
1262 wprintf("</TD></TR></FORM>\n");
1266 wprintf("</TABLE>\n");
1267 wprintf("</TD></TR>"
1268 "</TABLE></CENTER><br />\n"
1269 "<I><B>Notes:</B><UL><LI>When sharing a room, "
1270 "it must be shared from both ends. Adding a node to "
1271 "the 'shared' list sends messages out, but in order to"
1272 " receive messages, the other nodes must be configured"
1273 " to send messages out to your system as well.\n"
1274 "<LI>If the remote room name is blank, it is assumed "
1275 "that the room name is identical on the remote node."
1276 "<LI>If the remote room name is different, the remote "
1277 "node must also configure the name of the room here."
1283 /* Mailing list management */
1284 if (!strcmp(tab, "listserv")) {
1286 wprintf("<br /><center>"
1287 "<TABLE BORDER=0 WIDTH=100%% CELLPADDING=5>"
1288 "<TR><TD VALIGN=TOP>");
1290 wprintf("<i>The contents of this room are being "
1291 "mailed <b>as individual messages</b> "
1292 "to the following list recipients:"
1293 "</i><br /><br />\n");
1296 serv_getln(buf, sizeof buf);
1297 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1298 extract_token(cmd, buf, 0, '|', sizeof cmd);
1299 if (!strcasecmp(cmd, "listrecp")) {
1300 extract_token(recp, buf, 1, '|', sizeof recp);
1303 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1306 wprintf("&tab=listserv\">(remove)</A><br />");
1310 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1311 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1312 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1313 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1314 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1315 wprintf("</FORM>\n");
1317 wprintf("</TD><TD VALIGN=TOP>\n");
1319 wprintf("<i>The contents of this room are being "
1320 "mailed <b>in digest form</b> "
1321 "to the following list recipients:"
1322 "</i><br /><br />\n");
1325 serv_getln(buf, sizeof buf);
1326 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1327 extract_token(cmd, buf, 0, '|', sizeof cmd);
1328 if (!strcasecmp(cmd, "digestrecp")) {
1329 extract_token(recp, buf, 1, '|', sizeof recp);
1332 wprintf(" <A HREF=\"/netedit&cmd=remove&line="
1335 wprintf("&tab=listserv\">(remove)</A><br />");
1339 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/netedit\">\n"
1340 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1341 "<INPUT TYPE=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1342 wprintf("<INPUT TYPE=\"text\" NAME=\"line\">\n");
1343 wprintf("<INPUT TYPE=\"submit\" NAME=\"cmd\" VALUE=\"Add\">");
1344 wprintf("</FORM>\n");
1346 wprintf("</TD></TR></TABLE><hr />\n");
1348 if (self_service(999) == 1) {
1349 wprintf("This room is configured to allow "
1350 "self-service subscribe/unsubscribe requests."
1351 " <A HREF=\"/toggle_self_service?newval=0&"
1353 "Click to disable.</A><br />\n"
1354 "The URL for subscribe/unsubscribe is: "
1355 "<TT>http://%s/listsub</TT><br />\n",
1360 wprintf("This room is <i>not</i> configured to allow "
1361 "self-service subscribe/unsubscribe requests."
1362 " <A HREF=\"/toggle_self_service?newval=1&"
1364 "Click to enable.</A><br />\n"
1369 wprintf("</CENTER>\n");
1373 /* Mailing list management */
1374 if (!strcmp(tab, "expire")) {
1376 serv_puts("GPEX room");
1377 serv_getln(buf, sizeof buf);
1378 if (buf[0] == '2') {
1379 roompolicy = extract_int(&buf[4], 0);
1380 roomvalue = extract_int(&buf[4], 1);
1383 serv_puts("GPEX floor");
1384 serv_getln(buf, sizeof buf);
1385 if (buf[0] == '2') {
1386 floorpolicy = extract_int(&buf[4], 0);
1387 floorvalue = extract_int(&buf[4], 1);
1390 wprintf("<br /><FORM METHOD=\"POST\" ACTION=\"/set_room_policy\">\n");
1391 wprintf("<TABLE border=0 cellspacing=5>\n");
1392 wprintf("<TR><TD>Message expire policy for this room<br />(");
1393 escputs(WC->wc_roomname);
1394 wprintf(")</TD><TD>");
1395 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1396 ((roompolicy == 0) ? "CHECKED" : "") );
1397 wprintf("Use the default policy for this floor<br />\n");
1398 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1399 ((roompolicy == 1) ? "CHECKED" : "") );
1400 wprintf("Never automatically expire messages<br />\n");
1401 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1402 ((roompolicy == 2) ? "CHECKED" : "") );
1403 wprintf("Expire by message count<br />\n");
1404 wprintf("<INPUT TYPE=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1405 ((roompolicy == 3) ? "CHECKED" : "") );
1406 wprintf("Expire by message age<br />");
1407 wprintf("Number of messages or days: ");
1408 wprintf("<INPUT TYPE=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1409 wprintf("</TD></TR>\n");
1411 if (WC->axlevel >= 6) {
1412 wprintf("<TR><TD COLSPAN=2><hr /></TD></TR>\n");
1413 wprintf("<TR><TD>Message expire policy for this floor<br />(");
1414 escputs(floorlist[WC->wc_floor]);
1415 wprintf(")</TD><TD>");
1416 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1417 ((floorpolicy == 0) ? "CHECKED" : "") );
1418 wprintf("Use the system default<br />\n");
1419 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1420 ((floorpolicy == 1) ? "CHECKED" : "") );
1421 wprintf("Never automatically expire messages<br />\n");
1422 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1423 ((floorpolicy == 2) ? "CHECKED" : "") );
1424 wprintf("Expire by message count<br />\n");
1425 wprintf("<INPUT TYPE=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1426 ((floorpolicy == 3) ? "CHECKED" : "") );
1427 wprintf("Expire by message age<br />");
1428 wprintf("Number of messages or days: ");
1429 wprintf("<INPUT TYPE=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1433 wprintf("<CENTER>\n");
1434 wprintf("<TR><TD COLSPAN=2><hr /><CENTER>\n");
1435 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1437 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1438 wprintf("</CENTER></TD><TR>\n");
1440 wprintf("</TABLE>\n"
1441 "<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1447 /* Mailing list management */
1448 if (!strcmp(tab, "access")) {
1452 /* end content of whatever tab is open now */
1453 wprintf("</TD></TR></TABLE></div>\n");
1460 * Toggle self-service list subscription
1462 void toggle_self_service(void) {
1465 newval = atoi(bstr("newval"));
1466 self_service(newval);
1473 * save new parameters for a room
1479 char er_password[10];
1480 char er_dirname[15];
1481 char er_roomaide[26];
1487 if (strcmp(bstr("sc"), "OK")) {
1488 strcpy(WC->ImportantMessage,
1489 "Cancelled. Changes were not saved.");
1494 serv_getln(buf, sizeof buf);
1496 if (buf[0] != '2') {
1497 strcpy(WC->ImportantMessage, &buf[4]);
1501 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1502 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1503 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1504 er_flags = extract_int(&buf[4], 3);
1506 strcpy(er_roomaide, bstr("er_roomaide"));
1507 if (strlen(er_roomaide) == 0) {
1509 serv_getln(buf, sizeof buf);
1510 if (buf[0] != '2') {
1511 strcpy(er_roomaide, "");
1513 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1516 strcpy(buf, bstr("er_name"));
1518 if (strlen(buf) > 0)
1519 strcpy(er_name, buf);
1521 strcpy(buf, bstr("er_password"));
1523 if (strlen(buf) > 0)
1524 strcpy(er_password, buf);
1526 strcpy(buf, bstr("er_dirname"));
1528 if (strlen(buf) > 0)
1529 strcpy(er_dirname, buf);
1531 strcpy(buf, bstr("type"));
1532 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
1534 if (!strcmp(buf, "invonly")) {
1535 er_flags |= (QR_PRIVATE);
1537 if (!strcmp(buf, "hidden")) {
1538 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
1540 if (!strcmp(buf, "passworded")) {
1541 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
1543 if (!strcmp(bstr("prefonly"), "yes")) {
1544 er_flags |= QR_PREFONLY;
1546 er_flags &= ~QR_PREFONLY;
1549 if (!strcmp(bstr("readonly"), "yes")) {
1550 er_flags |= QR_READONLY;
1552 er_flags &= ~QR_READONLY;
1555 if (!strcmp(bstr("permanent"), "yes")) {
1556 er_flags |= QR_PERMANENT;
1558 er_flags &= ~QR_PERMANENT;
1561 if (!strcmp(bstr("network"), "yes")) {
1562 er_flags |= QR_NETWORK;
1564 er_flags &= ~QR_NETWORK;
1567 if (!strcmp(bstr("directory"), "yes")) {
1568 er_flags |= QR_DIRECTORY;
1570 er_flags &= ~QR_DIRECTORY;
1573 if (!strcmp(bstr("ulallowed"), "yes")) {
1574 er_flags |= QR_UPLOAD;
1576 er_flags &= ~QR_UPLOAD;
1579 if (!strcmp(bstr("dlallowed"), "yes")) {
1580 er_flags |= QR_DOWNLOAD;
1582 er_flags &= ~QR_DOWNLOAD;
1585 if (!strcmp(bstr("visdir"), "yes")) {
1586 er_flags |= QR_VISDIR;
1588 er_flags &= ~QR_VISDIR;
1591 strcpy(buf, bstr("anon"));
1593 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
1594 if (!strcmp(buf, "anononly"))
1595 er_flags |= QR_ANONONLY;
1596 if (!strcmp(buf, "anon2"))
1597 er_flags |= QR_ANONOPT;
1600 if (!strcmp(bstr("bump"), "yes"))
1603 er_floor = atoi(bstr("er_floor"));
1605 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d",
1606 er_name, er_password, er_dirname, er_flags, bump, er_floor);
1608 serv_getln(buf, sizeof buf);
1609 if (buf[0] != '2') {
1610 strcpy(WC->ImportantMessage, &buf[4]);
1616 if (strlen(er_roomaide) > 0) {
1617 sprintf(buf, "SETA %s", er_roomaide);
1619 serv_getln(buf, sizeof buf);
1620 if (buf[0] != '2') {
1621 strcpy(WC->ImportantMessage, &buf[4]);
1622 display_main_menu();
1627 strcpy(WC->ImportantMessage, "Your changes have been saved.");
1634 * Display form for Invite, Kick, and show Who Knows a room
1636 void do_invt_kick(void) {
1637 char buf[SIZ], room[SIZ], username[SIZ];
1640 serv_getln(buf, sizeof buf);
1642 if (buf[0] != '2') {
1646 extract_token(room, &buf[4], 0, '|', sizeof room);
1648 strcpy(username, bstr("username"));
1650 if (!strcmp(bstr("sc"), "Kick")) {
1651 sprintf(buf, "KICK %s", username);
1653 serv_getln(buf, sizeof buf);
1655 if (buf[0] != '2') {
1656 strcpy(WC->ImportantMessage, &buf[4]);
1658 sprintf(WC->ImportantMessage,
1659 "<B><I>User %s kicked out of room %s.</I></B>\n",
1664 if (!strcmp(bstr("sc"), "Invite")) {
1665 sprintf(buf, "INVT %s", username);
1667 serv_getln(buf, sizeof buf);
1669 if (buf[0] != '2') {
1670 strcpy(WC->ImportantMessage, &buf[4]);
1672 sprintf(WC->ImportantMessage,
1673 "<B><I>User %s invited to room %s.</I></B>\n",
1684 * Display form for Invite, Kick, and show Who Knows a room
1686 void display_whok(void)
1688 char buf[SIZ], room[SIZ], username[SIZ];
1691 serv_getln(buf, sizeof buf);
1693 if (buf[0] != '2') {
1697 extract_token(room, &buf[4], 0, '|', sizeof room);
1700 wprintf("<TABLE border=0 CELLSPACING=10><TR VALIGN=TOP>"
1701 "<TD>The users listed below have access to this room. "
1702 "To remove a user from the access list, select the user "
1703 "name from the list and click 'Kick'.<br /><br />");
1705 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1706 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1707 wprintf("<SELECT NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
1709 serv_getln(buf, sizeof buf);
1710 if (buf[0] == '1') {
1711 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1712 extract_token(username, buf, 0, '|', sizeof username);
1713 wprintf("<OPTION>");
1718 wprintf("</SELECT><br />\n");
1720 wprintf("<input type=submit name=sc value=\"Kick\">");
1721 wprintf("</FORM></CENTER>\n");
1724 "To grant another user access to this room, enter the "
1725 "user name in the box below and click 'Invite'.<br /><br />");
1727 wprintf("<CENTER><FORM METHOD=\"POST\" ACTION=\"/do_invt_kick\">\n");
1728 wprintf("<INPUT TYPE=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
1729 wprintf("Invite: ");
1730 wprintf("<input type=\"text\" name=\"username\" style=\"width:100%%\"><br />\n"
1731 "<input type=\"hidden\" name=\"sc\" value=\"Invite\">"
1732 "<input type=\"submit\" value=\"Invite\">"
1733 "</FORM></CENTER>\n");
1735 wprintf("</TD></TR></TABLE>\n");
1742 * display the form for entering a new room
1744 void display_entroom(void)
1749 serv_puts("CRE8 0");
1750 serv_getln(buf, sizeof buf);
1752 if (buf[0] != '2') {
1753 strcpy(WC->ImportantMessage, &buf[4]);
1754 display_main_menu();
1758 output_headers(1, 1, 2, 0, 0, 0, 0);
1759 wprintf("<div id=\"banner\">\n"
1760 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1761 "<SPAN CLASS=\"titlebar\">Create a new room</SPAN>"
1762 "</TD></TR></TABLE>\n"
1763 "</div>\n<div id=\"content\">\n"
1766 wprintf("<div id=\"fix_scrollbar_bug\">"
1767 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1769 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"/entroom\">\n");
1771 wprintf("<UL><LI>Name of room: ");
1772 wprintf("<INPUT TYPE=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
1774 wprintf("<LI>Resides on floor: ");
1776 wprintf("<SELECT NAME=\"er_floor\" SIZE=\"1\">\n");
1777 for (i = 0; i < 128; ++i)
1778 if (strlen(floorlist[i]) > 0) {
1779 wprintf("<OPTION ");
1780 wprintf("VALUE=\"%d\">", i);
1781 escputs(floorlist[i]);
1782 wprintf("</OPTION>\n");
1784 wprintf("</SELECT>\n");
1786 /* Our clever little snippet of JavaScript automatically selects
1787 * a public room if the view is set to Bulletin Board, and it
1788 * selects a mailbox room otherwise. The user can override this,
1791 wprintf("<LI>Default view for room: ");
1792 wprintf("<SELECT NAME=\"er_view\" SIZE=\"1\" OnChange=\""
1793 " if (this.form.er_view.value == 0) { "
1794 " this.form.type[0].checked=true; "
1795 " this.form.er_floor.disabled = false; "
1798 " this.form.type[4].checked=true; "
1799 " this.form.er_floor.disabled = true; "
1802 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
1803 wprintf("<OPTION %s VALUE=\"%d\">",
1804 ((i == 0) ? "SELECTED" : ""), i );
1805 escputs(viewdefs[i]);
1806 wprintf("</OPTION>\n");
1808 wprintf("</SELECT>\n");
1810 wprintf("<LI>Type of room:<UL>\n");
1812 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1813 wprintf("CHECKED OnChange=\""
1814 " if (this.form.type[0].checked == true) { "
1815 " this.form.er_floor.disabled = false; "
1817 "\"> Public (automatically appears to everyone)\n");
1819 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
1820 " if (this.form.type[1].checked == true) { "
1821 " this.form.er_floor.disabled = false; "
1823 "\"> Private - hidden (accessible to anyone who knows its name)\n");
1825 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
1826 " if (this.form.type[2].checked == true) { "
1827 " this.form.er_floor.disabled = false; "
1829 "\"> Private - require password:\n");
1830 wprintf("<INPUT TYPE=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
1832 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
1833 " if (this.form.type[3].checked == true) { "
1834 " this.form.er_floor.disabled = false; "
1836 "\"> Private - invitation only\n");
1838 wprintf("<LI><INPUT TYPE=\"radio\" NAME=\"type\" VALUE=\"personal\" "
1840 " if (this.form.type[4].checked == true) { "
1841 " this.form.er_floor.disabled = true; "
1843 "\"> Personal (mailbox for you only)\n");
1847 wprintf("<CENTER>\n");
1848 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
1850 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1851 wprintf("</CENTER>\n");
1852 wprintf("</FORM>\n<hr />");
1853 serv_printf("MESG roomaccess");
1854 serv_getln(buf, sizeof buf);
1855 if (buf[0] == '1') {
1856 fmout(NULL, "CENTER");
1858 wprintf("</td></tr></table></div>\n");
1866 * support function for entroom() -- sets the default view
1868 void er_set_default_view(int newview) {
1881 serv_getln(buf, sizeof buf);
1882 if (buf[0] != '2') return;
1884 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
1885 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
1886 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
1887 rm_bits1 = extract_int(&buf[4], 3);
1888 rm_floor = extract_int(&buf[4], 4);
1889 rm_listorder = extract_int(&buf[4], 5);
1890 rm_bits2 = extract_int(&buf[4], 7);
1892 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1893 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
1894 rm_listorder, newview, rm_bits2
1896 serv_getln(buf, sizeof buf);
1909 char er_password[SIZ];
1914 if (strcmp(bstr("sc"), "OK")) {
1915 strcpy(WC->ImportantMessage,
1916 "Cancelled. No new room was created.");
1917 display_main_menu();
1920 strcpy(er_name, bstr("er_name"));
1921 strcpy(er_type, bstr("type"));
1922 strcpy(er_password, bstr("er_password"));
1923 er_floor = atoi(bstr("er_floor"));
1924 er_view = atoi(bstr("er_view"));
1927 if (!strcmp(er_type, "hidden"))
1929 if (!strcmp(er_type, "passworded"))
1931 if (!strcmp(er_type, "invonly"))
1933 if (!strcmp(er_type, "personal"))
1936 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
1937 er_name, er_num_type, er_password, er_floor, 0, er_view);
1939 serv_getln(buf, sizeof buf);
1940 if (buf[0] != '2') {
1941 strcpy(WC->ImportantMessage, &buf[4]);
1942 display_main_menu();
1946 do_change_view(er_view); /* Now go there */
1951 * display the screen to enter a private room
1953 void display_private(char *rname, int req_pass)
1955 output_headers(1, 1, 2, 0, 0, 0, 0);
1956 wprintf("<div id=\"banner\">\n"
1957 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
1958 "<SPAN CLASS=\"titlebar\">Go to a hidden room</SPAN>"
1959 "</TD></TR></TABLE>\n"
1960 "</div>\n<div id=\"content\">\n"
1963 wprintf("<div id=\"fix_scrollbar_bug\">"
1964 "<table border=0 width=100%% bgcolor=\"#ffffff\"><tr><td>\n");
1966 wprintf("<CENTER>\n");
1967 wprintf("<br />If you know the name of a hidden (guess-name) or\n");
1968 wprintf("passworded room, you can enter that room by typing\n");
1969 wprintf("its name below. Once you gain access to a private\n");
1970 wprintf("room, it will appear in your regular room listings\n");
1971 wprintf("so you don't have to keep returning here.\n");
1972 wprintf("<br /><br />");
1974 wprintf("<FORM METHOD=\"GET\" ACTION=\"/goto_private\">\n");
1976 wprintf("<table border=\"0\" cellspacing=\"5\" "
1977 "cellpadding=\"5\" BGCOLOR=\"#EEEEEE\">\n"
1979 "Enter room name:</TD><TD>"
1980 "<INPUT TYPE=\"text\" NAME=\"gr_name\" "
1981 "VALUE=\"%s\" MAXLENGTH=\"19\">\n", rname);
1984 wprintf("</TD></TR><TR><TD>");
1985 wprintf("Enter room password:</TD><TD>");
1986 wprintf("<INPUT TYPE=\"password\" NAME=\"gr_pass\" MAXLENGTH=\"9\">\n");
1988 wprintf("</TD></TR></TABLE><br />\n");
1990 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">"
1992 "<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
1993 wprintf("</FORM>\n");
1994 wprintf("</td></tr></table></div>\n");
1999 * goto a private room
2001 void goto_private(void)
2006 if (strcasecmp(bstr("sc"), "OK")) {
2007 display_main_menu();
2010 strcpy(hold_rm, WC->wc_roomname);
2011 strcpy(buf, "GOTO ");
2012 strcat(buf, bstr("gr_name"));
2014 strcat(buf, bstr("gr_pass"));
2016 serv_getln(buf, sizeof buf);
2018 if (buf[0] == '2') {
2019 smart_goto(bstr("gr_name"));
2022 if (!strncmp(buf, "540", 3)) {
2023 display_private(bstr("gr_name"), 1);
2026 output_headers(1, 1, 1, 0, 0, 0, 0);
2027 wprintf("%s\n", &buf[4]);
2034 * display the screen to zap a room
2036 void display_zap(void)
2038 output_headers(1, 1, 2, 0, 0, 0, 0);
2040 wprintf("<div id=\"banner\">\n");
2041 wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#770000\"><TR><TD>");
2042 wprintf("<SPAN CLASS=\"titlebar\">Zap (forget/unsubscribe) the current room</SPAN>\n");
2043 wprintf("</TD></TR></TABLE>\n");
2044 wprintf("</div>\n<div id=\"content\">\n");
2046 wprintf("If you select this option, <em>%s</em> will ", WC->wc_roomname);
2047 wprintf("disappear from your room list. Is this what you wish ");
2048 wprintf("to do?<br />\n");
2050 wprintf("<FORM METHOD=\"GET\" ACTION=\"/zap\">\n");
2051 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"OK\">");
2053 wprintf("<INPUT TYPE=\"submit\" NAME=\"sc\" VALUE=\"Cancel\">");
2054 wprintf("</FORM>\n");
2065 char final_destination[SIZ];
2067 /* If the forget-room routine fails for any reason, we fall back
2068 * to the current room; otherwise, we go to the Lobby
2070 strcpy(final_destination, WC->wc_roomname);
2072 if (!strcasecmp(bstr("sc"), "OK")) {
2073 serv_printf("GOTO %s", WC->wc_roomname);
2074 serv_getln(buf, sizeof buf);
2075 if (buf[0] == '2') {
2077 serv_getln(buf, sizeof buf);
2078 if (buf[0] == '2') {
2079 strcpy(final_destination, "_BASEROOM_");
2083 smart_goto(final_destination);
2089 * Delete the current room
2091 void delete_room(void)
2095 serv_puts("KILL 1");
2096 serv_getln(buf, sizeof buf);
2097 if (buf[0] != '2') {
2098 strcpy(WC->ImportantMessage, &buf[4]);
2099 display_main_menu();
2102 smart_goto("_BASEROOM_");
2109 * Perform changes to a room's network configuration
2111 void netedit(void) {
2120 if (strlen(bstr("line"))==0) {
2125 strcpy(line, bstr("prefix"));
2126 strcat(line, bstr("line"));
2127 strcat(line, bstr("suffix"));
2136 serv_getln(buf, sizeof buf);
2137 if (buf[0] != '1') {
2143 /* This loop works for add *or* remove. Spiffy, eh? */
2144 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2145 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2146 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2147 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2148 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2149 if ( (strcasecmp(cmpa0, cmpb0))
2150 || (strcasecmp(cmpa1, cmpb1)) ) {
2151 fprintf(fp, "%s\n", buf);
2157 serv_getln(buf, sizeof buf);
2158 if (buf[0] != '4') {
2164 while (fgets(buf, sizeof buf, fp) != NULL) {
2165 buf[strlen(buf)-1] = 0;
2169 if (!strcasecmp(bstr("cmd"), "add")) {
2181 * Convert a room name to a folder-ish-looking name.
2183 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2188 * For mailboxes, just do it straight...
2191 sprintf(folder, "My folders|%s", room);
2195 * Otherwise, prefix the floor name as a "public folders" moniker
2198 sprintf(folder, "%s|%s", floorlist[floor], room);
2202 * Replace "\" characters with "|" for pseudo-folder-delimiting
2204 for (i=0; i<strlen(folder); ++i) {
2205 if (folder[i] == '\\') folder[i] = '|';
2213 * Back end for change_view()
2215 void do_change_view(int newview) {
2218 serv_printf("VIEW %d", newview);
2219 serv_getln(buf, sizeof buf);
2220 WC->wc_view = newview;
2221 smart_goto(WC->wc_roomname);
2227 * Change the view for this room
2229 void change_view(void) {
2232 view = atol(bstr("view"));
2233 do_change_view(view);
2238 * One big expanded tree list view --- like a folder list
2240 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2244 int has_subfolders = 0;
2247 parents = malloc(max_folders * sizeof(int));
2249 /* BEGIN TREE MENU */
2250 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2252 /* include NanoTree */
2253 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2255 /* initialize NanoTree */
2256 wprintf("<script type=\"text/javascript\"> \n"
2257 " showRootNode = false; \n"
2258 " sortNodes = false; \n"
2259 " dragable = false; \n"
2261 " function standardClick(treeNode) { \n"
2264 " var closedGif = 'static/folder_closed.gif'; \n"
2265 " var openGif = 'static/folder_open.gif'; \n"
2267 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2271 for (i=0; i<max_folders; ++i) {
2274 if ((i+1) < max_folders) {
2275 if ( (!strncasecmp(fold[i].name, fold[i+1].name, strlen(fold[i].name)))
2276 && (fold[i+1].name[strlen(fold[i].name)] == '|') ) {
2281 levels = num_tokens(fold[i].name, '|');
2282 parents[levels] = i;
2284 wprintf("var node%d = new TreeNode(%d, '", i, i);
2286 if (fold[i].selectable) {
2287 wprintf("<A HREF=\"/dotgoto?room=");
2288 urlescputs(fold[i].room);
2293 wprintf("<SPAN CLASS=\"roomlist_floor\">");
2295 else if (fold[i].hasnewmsgs) {
2296 wprintf("<SPAN CLASS=\"roomlist_new\">");
2299 wprintf("<SPAN CLASS=\"roomlist_old\">");
2301 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2306 if (has_subfolders) {
2307 wprintf("new Array(closedGif, openGif)");
2309 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2310 wprintf("'static/savecontact_16x.gif'");
2312 else if (fold[i].view == VIEW_CALENDAR) {
2313 wprintf("'static/calarea_16x.gif'");
2315 else if (fold[i].view == VIEW_TASKS) {
2316 wprintf("'static/taskmanag_16x.gif'");
2318 else if (fold[i].view == VIEW_NOTES) {
2319 wprintf("'static/storenotes_16x.gif'");
2321 else if (fold[i].view == VIEW_MAILBOX) {
2322 wprintf("'static/privatemess_16x.gif'");
2325 wprintf("'static/chatrooms_16x.gif'");
2328 urlescputs(fold[i].name);
2332 wprintf("rootNode.addChild(node%d);\n", i);
2335 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2339 wprintf("container = document.getElementById('roomlist_div'); \n"
2349 * Boxes and rooms and lists ... oh my!
2351 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2354 int levels, oldlevels;
2357 static int columns = 3;
2358 int boxes_per_column = 0;
2359 int current_column = 0;
2363 while (nf % columns != 0) ++nf;
2364 boxes_per_column = (nf / columns);
2365 if (boxes_per_column < 1) boxes_per_column = 1;
2367 /* Outer table (for columnization) */
2368 wprintf("<TABLE BORDER=0 WIDTH=96%% CELLPADDING=5>"
2369 "<tr><td valign=top>");
2373 for (i=0; i<max_folders; ++i) {
2375 levels = num_tokens(fold[i].name, '|');
2377 if ((levels == 1) && (oldlevels > 1)) {
2380 do_template("endbox");
2383 if ((num_boxes % boxes_per_column) == 0) {
2385 if (current_column < columns) {
2386 wprintf("</td><td valign=top>\n");
2393 /* Begin inner box */
2394 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2395 stresc(boxtitle, buf, 1, 0);
2396 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2397 do_template("beginbox");
2405 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
2406 if (fold[i].selectable) {
2407 wprintf("<A HREF=\"/dotgoto?room=");
2408 urlescputs(fold[i].room);
2414 if (fold[i].hasnewmsgs) {
2415 wprintf("<SPAN CLASS=\"roomlist_new\">");
2418 wprintf("<SPAN CLASS=\"roomlist_old\">");
2420 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2423 if (fold[i].selectable) {
2429 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
2430 wprintf(" (INBOX)");
2432 wprintf("<br />\n");
2435 /* End the final inner box */
2436 do_template("endbox");
2438 wprintf("</TD></TR></TABLE>\n");
2443 * Show the room list. (only should get called by
2444 * knrooms() because that's where output_headers() is called from)
2447 void list_all_rooms_by_floor(char *viewpref) {
2450 struct folder *fold = NULL;
2452 int max_folders = 0;
2453 int alloc_folders = 0;
2457 int num_floors = 1; /* add an extra one for private folders */
2459 /* Start with the mailboxes */
2462 fold = malloc(sizeof(struct folder));
2463 memset(fold, 0, sizeof(struct folder));
2464 strcpy(fold[0].name, "My folders");
2465 fold[0].is_mailbox = 1;
2467 /* Then add floors */
2469 serv_getln(buf, sizeof buf);
2470 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2471 if (max_folders >= alloc_folders) {
2472 alloc_folders = max_folders + 100;
2473 fold = realloc(fold,
2474 alloc_folders * sizeof(struct folder));
2476 memset(&fold[max_folders], 0, sizeof(struct folder));
2477 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
2484 serv_getln(buf, sizeof buf);
2485 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2486 if (max_folders >= alloc_folders) {
2487 alloc_folders = max_folders + 100;
2488 fold = realloc(fold,
2489 alloc_folders * sizeof(struct folder));
2491 memset(&fold[max_folders], 0, sizeof(struct folder));
2492 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
2493 ra_flags = extract_int(buf, 5);
2494 flags = extract_int(buf, 1);
2495 fold[max_folders].floor = extract_int(buf, 2);
2496 fold[max_folders].hasnewmsgs =
2497 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
2498 if (flags & QR_MAILBOX) {
2499 fold[max_folders].is_mailbox = 1;
2501 fold[max_folders].view = extract_int(buf, 6);
2502 room_to_folder(fold[max_folders].name,
2503 fold[max_folders].room,
2504 fold[max_folders].floor,
2505 fold[max_folders].is_mailbox);
2506 fold[max_folders].selectable = 1;
2510 /* Bubble-sort the folder list */
2511 for (i=0; i<max_folders; ++i) {
2512 for (j=0; j<(max_folders-1)-i; ++j) {
2513 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
2514 swap = strcasecmp(fold[j].name, fold[j+1].name);
2517 if ( (fold[j+1].is_mailbox)
2518 && (!fold[j].is_mailbox)) {
2526 memcpy(&ftmp, &fold[j], sizeof(struct folder));
2527 memcpy(&fold[j], &fold[j+1],
2528 sizeof(struct folder));
2529 memcpy(&fold[j+1], &ftmp,
2530 sizeof(struct folder));
2535 /* test only hackish view
2536 wprintf("<table><TR><TD>A Table</TD></TR></table>\n");
2537 for (i=0; i<max_folders; ++i) {
2538 escputs(fold[i].name);
2539 wprintf("<br />\n");
2543 if (!strcasecmp(viewpref, "folders")) {
2544 do_folder_view(fold, max_folders, num_floors);
2547 do_rooms_view(fold, max_folders, num_floors);
2555 /* Do either a known rooms list or a folders list, depending on the
2559 char listviewpref[SIZ];
2561 output_headers(1, 1, 2, 0, 0, 0, 0);
2564 /* Determine whether the user is trying to change views */
2565 if (bstr("view") != NULL) {
2566 if (strlen(bstr("view")) > 0) {
2567 set_preference("roomlistview", bstr("view"));
2571 get_preference("roomlistview", listviewpref, sizeof listviewpref);
2573 if ( (strcasecmp(listviewpref, "folders"))
2574 && (strcasecmp(listviewpref, "table")) ) {
2575 strcpy(listviewpref, "rooms");
2579 wprintf("<div id=\"banner\">\n"
2580 "<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
2581 "<SPAN CLASS=\"titlebar\">"
2583 if (!strcasecmp(listviewpref, "rooms")) {
2584 wprintf("Room list");
2586 if (!strcasecmp(listviewpref, "folders")) {
2587 wprintf("Folder list");
2589 if (!strcasecmp(listviewpref, "table")) {
2590 wprintf("Room list");
2592 wprintf("</SPAN></TD>\n");
2594 /* offer the ability to switch views */
2595 wprintf("<TD ALIGN=RIGHT><FORM NAME=\"roomlistomatic\">\n"
2596 "<SELECT NAME=\"newview\" SIZE=\"1\" "
2597 "OnChange=\"location.href=roomlistomatic.newview.options"
2598 "[selectedIndex].value\">\n");
2600 wprintf("<OPTION %s VALUE=\"/knrooms&view=rooms\">"
2603 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
2606 wprintf("<OPTION %s VALUE=\"/knrooms&view=folders\">"
2607 "View as folder list"
2609 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
2612 wprintf("</SELECT><br />");
2614 wprintf("</FORM></TD></TR></TABLE>\n");
2617 "<div id=\"content\">\n");
2619 /* Display the room list in the user's preferred format */
2620 list_all_rooms_by_floor(listviewpref);
2626 * Set the message expire policy for this room and/or floor
2628 void set_room_policy(void) {
2631 if (strcmp(bstr("sc"), "OK")) {
2632 strcpy(WC->ImportantMessage,
2633 "Cancelled. Changes were not saved.");
2638 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
2639 serv_getln(buf, sizeof buf);
2640 strcpy(WC->ImportantMessage, &buf[4]);
2642 if (WC->axlevel >= 6) {
2643 strcat(WC->ImportantMessage, "<br />\n");
2644 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
2645 serv_getln(buf, sizeof buf);
2646 strcat(WC->ImportantMessage, &buf[4]);