5 * \defgroup RoomOps Lots of different room-related operations.
6 * \ingroup CitadelCommunitacion
11 char floorlist[128][SIZ]; /**< list of our floor names */
13 char *viewdefs[9]; /**< the different kinds of available views */
16 * \brief initialize the viewdefs with localized strings
18 void initialize_viewdefs(void) {
19 viewdefs[0] = _("Bulletin Board");
20 viewdefs[1] = _("Mail Folder");
21 viewdefs[2] = _("Address Book");
22 viewdefs[3] = _("Calendar");
23 viewdefs[4] = _("Task List");
24 viewdefs[5] = _("Notes List");
25 viewdefs[6] = _("Wiki");
26 viewdefs[7] = _("Calendar List");
27 viewdefs[8] = _("Journal");
31 * \brief Determine which views are allowed as the default for creating a new room.
33 * \param which_view The view ID being queried.
35 int is_view_allowed_as_default(int which_view)
38 case VIEW_BBS: return(1);
39 case VIEW_MAILBOX: return(1);
40 case VIEW_ADDRESSBOOK: return(1);
41 case VIEW_CALENDAR: return(1);
42 case VIEW_TASKS: return(1);
43 case VIEW_NOTES: return(1);
44 case VIEW_WIKI: return(0); /**< because it isn't finished yet */
45 case VIEW_CALBRIEF: return(0);
46 case VIEW_JOURNAL: return(0);
47 default: return(0); /**< should never get here */
53 * \brief load the list of floors
55 void load_floorlist(void)
60 for (a = 0; a < 128; ++a)
64 serv_getln(buf, sizeof buf);
66 strcpy(floorlist[0], "Main Floor");
69 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
70 extract_token(floorlist[extract_int(buf, 0)], buf, 1, '|', sizeof floorlist[0]);
76 * \brief Free a session's march list
78 * \param wcf Pointer to session being cleared
80 void free_march_list(struct wcsession *wcf)
84 while (wcf->march != NULL) {
85 mptr = wcf->march->next;
95 * \brief remove a room from the march list
97 void remove_march(char *aaa)
99 struct march *mptr, *mptr2;
101 if (WC->march == NULL)
104 if (!strcasecmp(WC->march->march_name, aaa)) {
105 mptr = WC->march->next;
111 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
112 if (!strcasecmp(mptr->march_name, aaa)) {
113 mptr2->next = mptr->next;
126 * \brief display rooms in tree structure???
127 * \param rp the roomlist to build a tree from
129 void room_tree_list(struct roomlisting *rp)
138 room_tree_list(rp->lnext);
140 strcpy(rmname, rp->rlname);
143 wprintf("<a href=\"dotgoto&room=");
147 escputs1(rmname, 1, 1);
148 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
150 else if (f & QR_DIRECTORY)
152 else if (f & QR_NETWORK)
156 wprintf("</a><tt> </tt>\n");
158 room_tree_list(rp->rnext);
164 * \brief Room ordering stuff (compare first by floor, then by order)
165 * \param r1 first roomlist to compare
166 * \param r2 second roomlist co compare
167 * \return are they the same???
169 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
171 if ((r1 == NULL) && (r2 == NULL))
177 if (r1->rlfloor < r2->rlfloor)
179 if (r1->rlfloor > r2->rlfloor)
181 if (r1->rlorder < r2->rlorder)
183 if (r1->rlorder > r2->rlorder)
190 * \brief Common code for all room listings
191 * \param variety what???
193 void listrms(char *variety)
198 struct roomlisting *rl = NULL;
199 struct roomlisting *rp;
200 struct roomlisting *rs;
202 /** Ask the server for a room list */
204 serv_getln(buf, sizeof buf);
210 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
212 rp = malloc(sizeof(struct roomlisting));
213 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
214 rp->rlflags = extract_int(buf, 1);
215 rp->rlfloor = extract_int(buf, 2);
216 rp->rlorder = extract_int(buf, 3);
225 if (rordercmp(rp, rs) < 0) {
226 if (rs->lnext == NULL) {
233 if (rs->rnext == NULL) {
246 * If no rooms were listed, print an nbsp to make the cell
247 * borders show up anyway.
249 if (num_rooms == 0) wprintf(" ");
254 * \brief list all forgotten rooms
256 void zapped_list(void)
258 output_headers(1, 1, 1, 0, 0, 0);
260 svprintf("BOXTITLE", WCS_STRING, _("Zapped (forgotten) rooms"));
261 do_template("beginbox");
265 wprintf("<br /><br />\n");
266 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
267 do_template("endbox");
273 * \brief read this room's info file (set v to 1 for verbose mode)
280 int fullinfo_len = 0;
283 serv_getln(buf, sizeof buf);
286 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
287 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
288 strcpy(&fullinfo[fullinfo_len], buf);
289 fullinfo_len += strlen(buf);
293 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
294 strcpy(&briefinfo[50], "...");
296 wprintf("<div class=\"infos\" "
297 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
300 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
301 wprintf("<img class=\"close_infos\" "
302 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
303 "src=\"static/closewindow.gif\" alt=\"%s\">",
318 * \brief Display room banner icon.
319 * The server doesn't actually
320 * need the room name, but we supply it in order to
321 * keep the browser from using a cached icon from
324 void embed_room_graphic(void) {
327 serv_puts("OIMG _roompic_");
328 serv_getln(buf, sizeof buf);
330 wprintf("<img height=\"64px\" src=\"image&name=_roompic_&room=");
331 urlescputs(WC->wc_roomname);
334 serv_getln(buf, sizeof buf);
336 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
337 wprintf("<img height=48 width=48 src=\""
338 "static/viewcontacts_48x.gif"
342 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
343 wprintf("<img height=48 width=48 src=\""
344 "static/calarea_48x.gif"
348 else if (WC->wc_view == VIEW_TASKS) {
349 wprintf("<img height=48 width=48 src=\""
350 "static/taskmanag_48x.gif"
354 else if (WC->wc_view == VIEW_NOTES) {
355 wprintf("<img height=48 width=48 src=\""
356 "static/storenotes_48x.gif"
360 else if (WC->wc_view == VIEW_MAILBOX) {
361 wprintf("<img height=48 width=48 src=\""
362 "static/privatemess_48x.gif"
367 wprintf("<img height=48 width=48 src=\""
368 "static/chatrooms_48x.gif"
378 * \brief Display the current view and offer an option to change it
380 void embed_view_o_matic(void) {
383 wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
384 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
385 wprintf("<label for=\"view_name\">");
386 wprintf(_("View as:"));
388 "<select name=\"newview\" size=\"1\" "
389 "id=\"view_name\" class=\"selectbox\" "
390 "OnChange=\"location.href=viewomatic.newview.options"
391 "[selectedIndex].value\">\n");
393 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
395 * Only offer the views that make sense, given the default
396 * view for the room. For example, don't offer a Calendar
397 * view in a non-Calendar room.
401 || (i == WC->wc_default_view) /**< default */
402 || ( (i == 0) && (WC->wc_default_view == 1) ) /**< mail or bulletin */
403 || ( (i == 1) && (WC->wc_default_view == 0) ) /**< mail or bulletin */
404 /** || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */
407 wprintf("<option %s value=\"changeview?view=%d\">",
408 ((i == WC->wc_view) ? "selected" : ""),
410 escputs(viewdefs[i]);
411 wprintf("</option>\n");
414 wprintf("</select></form>\n");
419 * \brief Display a search box
421 void embed_search_o_matic(void) {
422 wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
423 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
424 wprintf("<label for=\"search_name\">");
425 wprintf(_("Search: "));
426 wprintf("</label> <input "
427 "type=\"text\" name=\"query\" size=\"15\" maxlength=\"128\" "
428 "id=\"search_name\" class=\"inputbox\">\n"
430 wprintf("</select></form>\n");
435 * \brief Embed the room banner
437 * \param got The information returned from a GOTO server command
438 * \param navbar_style Determines which navigation buttons to display
442 void embed_room_banner(char *got, int navbar_style) {
445 char sanitized_roomname[256];
446 char with_files[256];
450 * We need to have the information returned by a GOTO server command.
451 * If it isn't supplied, we fake it by issuing our own GOTO.
454 serv_printf("GOTO %s", WC->wc_roomname);
455 serv_getln(buf, sizeof buf);
459 /** The browser needs some information for its own use */
460 wprintf("<script type=\"text/javascript\"> \n"
461 " room_is_trash = %d; \n"
467 * If the user happens to select the "make this my start page" link,
468 * we want it to remember the URL as a "/dotskip" one instead of
469 * a "skip" or "gotonext" or something like that.
471 snprintf(WC->this_page, sizeof(WC->this_page), "dotskip&room=%s",
474 /** Check for new mail. */
475 WC->new_mail = extract_int(&got[4], 9);
476 WC->wc_view = extract_int(&got[4], 11);
478 /* Is this a directory room and does it contain files? */
479 if (WC->room_flags & QR_VISDIR)
482 serv_getln(buf2, sizeof buf2);
483 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
485 snprintf (with_files, sizeof with_files, " (%d file%s)", file_count, ((file_count>1) ? "s" : ""));
488 strcpy (with_files, "");
490 stresc(sanitized_roomname, 256, WC->wc_roomname, 1, 1);
491 svprintf("ROOMNAME", WCS_STRING, "%s%s", sanitized_roomname, with_files);
492 svprintf("NUMMSGS", WCS_STRING,
493 _("%d new of %d messages"),
494 extract_int(&got[4], 1),
495 extract_int(&got[4], 2)
497 svcallback("ROOMPIC", embed_room_graphic);
498 svcallback("ROOMINFO", readinfo);
499 svcallback("VIEWOMATIC", embed_view_o_matic);
500 svcallback("SEARCHOMATIC", embed_search_o_matic);
501 svcallback("START", offer_start_page);
503 do_template("roombanner");
504 if (navbar_style != navbar_none) {
506 wprintf("<div id=\"navbar\"><ul>");
508 if (navbar_style == navbar_default) wprintf(
509 "<li class=\"ungoto\">"
510 "<a href=\"ungoto\">"
511 "<img align=\"middle\" src=\"static/ungoto2_24x.gif\" border=\"0\">"
512 "<span class=\"navbar_link\">%s</span></A>"
513 "</li>\n", _("Ungoto")
516 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
518 "<li class=\"newmess\">"
519 "<a href=\"readnew\">"
520 "<img align=\"middle\" src=\"static/newmess2_24x.gif\" border=\"0\">"
521 "<span class=\"navbar_link\">%s</span></A>"
522 "</li>\n", _("Read new messages")
526 if (navbar_style == navbar_default) {
527 switch(WC->wc_view) {
528 case VIEW_ADDRESSBOOK:
530 "<li class=\"viewcontacts\">"
531 "<a href=\"readfwd\">"
532 "<img align=\"middle\" src=\"static/viewcontacts_24x.gif\" "
534 "<span class=\"navbar_link\">"
536 "</span></a></li>\n", _("View contacts")
541 "<li class=\"staskday\">"
542 "<a href=\"readfwd?calview=day\">"
543 "<img align=\"middle\" src=\"static/taskday2_24x.gif\" "
545 "<span class=\"navbar_link\">"
547 "</span></a></li>\n", _("Day view")
550 "<li class=\"monthview\">"
551 "<a href=\"readfwd?calview=month\">"
552 "<img align=\"middle\" src=\"static/monthview2_24x.gif\" "
554 "<span class=\"navbar_link\">"
556 "</span></a></li>\n", _("Month view")
561 "<li class=\"monthview\">"
562 "<a href=\"readfwd?calview=month\">"
563 "<img align=\"middle\" src=\"static/monthview2_24x.gif\" "
565 "<span class=\"navbar_link\">"
567 "</span></a></li>\n", _("Calendar list")
572 "<li class=\"taskmanag\">"
573 "<a href=\"readfwd\">"
574 "<img align=\"middle\" src=\"static/taskmanag_24x.gif\" "
576 "<span class=\"navbar_link\">"
578 "</span></a></li>\n", _("View tasks")
583 "<li class=\"viewnotes\">"
584 "<a href=\"readfwd\">"
585 "<img align=\"middle\" src=\"static/viewnotes_24x.gif\" "
587 "<span class=\"navbar_link\">"
589 "</span></a></li>\n", _("View notes")
594 "<li class=\"readallmess\">"
595 "<a href=\"readfwd\">"
596 "<img align=\"middle\" src=\"static/readallmess3_24x.gif\" "
598 "<span class=\"navbar_link\">"
600 "</span></a></li>\n", _("View message list")
605 "<li class=\"readallmess\">"
606 "<a href=\"readfwd\">"
607 "<img align=\"middle\" src=\"static/readallmess3_24x.gif\" "
609 "<span class=\"navbar_link\">"
611 "</span></a></li>\n", _("Wiki home")
616 "<li class=\"readallmess\">"
617 "<a href=\"readfwd\">"
618 "<img align=\"middle\" src=\"static/readallmess3_24x.gif\" "
620 "<span class=\"navbar_link\">"
622 "</span></a></li>\n", _("Read all messages")
628 if (navbar_style == navbar_default) {
629 switch(WC->wc_view) {
630 case VIEW_ADDRESSBOOK:
632 "<li class=\"addnewcontact\">"
633 "<a href=\"display_enter\">"
634 "<img align=\"middle\" src=\"static/addnewcontact_24x.gif\" "
635 "border=\"0\"><span class=\"navbar_link\">"
637 "</span></a></li>\n", _("Add new contact")
642 wprintf("<li class=\"addevent\"><a href=\"display_enter");
643 if (!IsEmptyStr(bstr("year" ))) wprintf("?year=%s", bstr("year"));
644 if (!IsEmptyStr(bstr("month"))) wprintf("?month=%s", bstr("month"));
645 if (!IsEmptyStr(bstr("day" ))) wprintf("?day=%s", bstr("day"));
647 "<img align=\"middle\" src=\"static/addevent_24x.gif\" "
648 "border=\"0\"><span class=\"navbar_link\">"
650 "</span></a></li>\n", _("Add new event")
655 "<li class=\"newmess\">"
656 "<a href=\"display_enter\">"
657 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
658 "border=\"0\"><span class=\"navbar_link\">"
660 "</span></a></li>\n", _("Add new task")
665 "<li class=\"enternewnote\">"
666 "<a href=\"javascript:add_new_note();\">"
667 "<img align=\"middle\" src=\"static/enternewnote_24x.gif\" "
668 "border=\"0\"><span class=\"navbar_link\">"
670 "</span></a></li>\n", _("Add new note")
674 safestrncpy(buf, bstr("page"), sizeof buf);
677 "<li class=\"newmess\">"
678 "<a href=\"display_enter?wikipage=%s\">"
679 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
680 "border=\"0\"><span class=\"navbar_link\">"
682 "</span></a></li>\n", buf, _("Edit this page")
687 "<li class=\"newmess\">"
688 "<a href=\"display_enter\">"
689 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
690 "border=\"0\"><span class=\"navbar_link\">"
692 "</span></a></li>\n", _("Write mail")
697 "<li class=\"newmess\">"
698 "<a href=\"display_enter\">"
699 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
700 "border=\"0\"><span class=\"navbar_link\">"
702 "</span></a></li>\n", _("Enter a message")
708 if (navbar_style == navbar_default) wprintf(
709 "<li class=\"skipthisroom\">"
712 "<img align=\"middle\" src=\"static/skipthisroom_24x.gif\" border=\"0\">"
713 "<span class=\"navbar_link\">%s</span></a>"
715 _("Leave all messages marked as unread, go to next room with unread messages"),
719 if (navbar_style == navbar_default) wprintf(
720 "<li class=\"markngo\">"
721 "<a href=\"gotonext\" "
723 "<img align=\"middle\" src=\"static/markngo_24x.gif\" border=\"0\">"
724 "<span class=\"navbar_link\">%s</span></a>"
726 _("Mark all messages as read, go to next room with unread messages"),
730 wprintf("</ul></div>\n");
737 * \brief back end routine to take the session to a new room
738 * \param gname room to go to
741 int gotoroom(char *gname)
744 static long ls = (-1L);
747 /** store ungoto information */
748 strcpy(WC->ugname, WC->wc_roomname);
751 /** move to the new room */
752 serv_printf("GOTO %s", gname);
753 serv_getln(buf, sizeof buf);
757 serv_puts("GOTO _BASEROOM_");
758 serv_getln(buf, sizeof buf);
765 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
766 WC->room_flags = extract_int(&buf[4], 4);
767 /* highest_msg_read = extract_int(&buf[4],6);
768 maxmsgnum = extract_int(&buf[4],5);
770 WC->is_mailbox = extract_int(&buf[4],7);
771 ls = extract_long(&buf[4], 6);
772 WC->wc_floor = extract_int(&buf[4], 10);
773 WC->wc_view = extract_int(&buf[4], 11);
774 WC->wc_default_view = extract_int(&buf[4], 12);
775 WC->wc_is_trash = extract_int(&buf[4], 13);
776 WC->room_flags2 = extract_int(&buf[4], 14);
779 WC->is_room_aide = WC->is_aide;
781 WC->is_room_aide = (char) extract_int(&buf[4], 8);
783 remove_march(WC->wc_roomname);
784 if (!strcasecmp(gname, "_BASEROOM_"))
792 * \brief Locate the room on the march list which we most want to go to.
794 * is measured given a "weight" of preference based on various factors.
795 * \param desired_floor the room number on the citadel server
796 * \return the roomname
798 char *pop_march(int desired_floor)
800 static char TheRoom[128];
802 int TheOrder = 32767;
805 struct march *mptr = NULL;
807 strcpy(TheRoom, "_BASEROOM_");
808 if (WC->march == NULL)
811 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
813 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
814 weight = weight + 10000;
815 if (mptr->march_floor == desired_floor)
816 weight = weight + 5000;
818 weight = weight + ((128 - (mptr->march_floor)) * 128);
819 weight = weight + (128 - (mptr->march_order));
821 if (weight > TheWeight) {
823 strcpy(TheRoom, mptr->march_name);
824 TheFloor = mptr->march_floor;
825 TheOrder = mptr->march_order;
834 *\brief Goto next room having unread messages.
835 * We want to skip over rooms that the user has already been to, and take the
836 * user back to the lobby when done. The room we end up in is placed in
837 * newroom - which is set to 0 (the lobby) initially.
838 * We start the search in the current room rather than the beginning to prevent
839 * two or more concurrent users from dragging each other back to the same room.
844 struct march *mptr, *mptr2;
849 * First check to see if the march-mode list is already allocated.
850 * If it is, pop the first room off the list and go there.
853 if (WC->march == NULL) {
855 serv_getln(buf, sizeof buf);
857 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
858 extract_token(room_name, buf, 0, '|', sizeof room_name);
859 if (strcasecmp(room_name, WC->wc_roomname)) {
860 mptr = (struct march *) malloc(sizeof(struct march));
862 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
863 mptr->march_floor = extract_int(buf, 2);
864 mptr->march_order = extract_int(buf, 3);
865 if (WC->march == NULL) {
869 while (mptr2->next != NULL)
876 * add _BASEROOM_ to the end of the march list, so the user will end up
877 * in the system base room (usually the Lobby>) at the end of the loop
879 mptr = (struct march *) malloc(sizeof(struct march));
881 mptr->march_order = 0;
882 mptr->march_floor = 0;
883 strcpy(mptr->march_name, "_BASEROOM_");
884 if (WC->march == NULL) {
888 while (mptr2->next != NULL)
893 * ...and remove the room we're currently in, so a <G>oto doesn't make us
894 * walk around in circles
896 remove_march(WC->wc_roomname);
898 if (WC->march != NULL) {
899 strcpy(next_room, pop_march(-1));
901 strcpy(next_room, "_BASEROOM_");
905 smart_goto(next_room);
910 * \brief goto next room
911 * \param next_room next room to go to
913 void smart_goto(char *next_room) {
921 * \brief mark all messages in current room as having been read
923 void slrp_highest(void)
927 serv_puts("SLRP HIGHEST");
928 serv_getln(buf, sizeof buf);
933 * \brief un-goto the previous room
939 if (!strcmp(WC->ugname, "")) {
940 smart_goto(WC->wc_roomname);
943 serv_printf("GOTO %s", WC->ugname);
944 serv_getln(buf, sizeof buf);
946 smart_goto(WC->wc_roomname);
949 if (WC->uglsn >= 0L) {
950 serv_printf("SLRP %ld", WC->uglsn);
951 serv_getln(buf, sizeof buf);
953 strcpy(buf, WC->ugname);
954 strcpy(WC->ugname, "");
963 * \brief Set/clear/read the "self-service list subscribe" flag for a room
965 * \param newval set to 0 to clear, 1 to set, any other value to leave unchanged.
966 * \return return the new value.
969 int self_service(int newval) {
970 int current_value = 0;
976 int flags, floor, order, view, flags2;
979 serv_getln(buf, sizeof buf);
980 if (buf[0] != '2') return(0);
982 extract_token(name, &buf[4], 0, '|', sizeof name);
983 extract_token(password, &buf[4], 1, '|', sizeof password);
984 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
985 flags = extract_int(&buf[4], 3);
986 floor = extract_int(&buf[4], 4);
987 order = extract_int(&buf[4], 5);
988 view = extract_int(&buf[4], 6);
989 flags2 = extract_int(&buf[4], 7);
991 if (flags2 & QR2_SELFLIST) {
999 flags2 = flags2 | QR2_SELFLIST;
1001 else if (newval == 0) {
1002 flags2 = flags2 & ~QR2_SELFLIST;
1005 return(current_value);
1008 if (newval != current_value) {
1009 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1010 name, password, dirname, flags,
1011 floor, order, view, flags2);
1012 serv_getln(buf, sizeof buf);
1025 * \brief display the form for editing a room
1027 void display_editroom(void)
1032 char remote_room[128];
1035 char er_password[10];
1036 char er_dirname[15];
1037 char er_roomaide[26];
1044 char *not_shared_with;
1047 int floorpolicy = 0;
1049 char pop3_host[128];
1054 if (IsEmptyStr(tab)) tab = "admin";
1057 output_headers(1, 1, 1, 0, 0, 0);
1059 wprintf("<div class=\"fix_scrollbar_bug\">");
1061 /** print the tabbed dialog */
1062 wprintf("<ul class=\"tabbed_dialog\">\n");
1064 wprintf("<li class=\"tablabel ");
1065 if (!strcmp(tab, "admin")) {
1066 wprintf(" tab_cell_label\">");
1067 wprintf(_("Administration"));
1070 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1071 wprintf(_("Administration"));
1076 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1078 wprintf("<li class=\"tablabel ");
1079 if (!strcmp(tab, "config")) {
1080 wprintf(" tab_cell_label\">");
1081 wprintf(_("Configuration"));
1084 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1085 wprintf(_("Configuration"));
1090 wprintf("<li class=\"tablabel ");
1091 if (!strcmp(tab, "expire")) {
1092 wprintf(" tab_cell_label\">");
1093 wprintf(_("Message expire policy"));
1096 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1097 wprintf(_("Message expire policy"));
1102 wprintf("<li class=\"tablabel ");
1103 if (!strcmp(tab, "access")) {
1104 wprintf(" tab_cell_label\">");
1105 wprintf(_("Access controls"));
1108 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1109 wprintf(_("Access controls"));
1114 wprintf("<li class=\"tablabel ");
1115 if (!strcmp(tab, "sharing")) {
1116 wprintf(" tab_cell_label\">");
1117 wprintf(_("Sharing"));
1120 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1121 wprintf(_("Sharing"));
1126 wprintf("<li class=\"tablabel ");
1127 if (!strcmp(tab, "listserv")) {
1128 wprintf(" tab_cell_label\">");
1129 wprintf(_("Mailing list service"));
1132 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1133 wprintf(_("Mailing list service"));
1140 wprintf("<li class=\"tablabel ");
1141 if (!strcmp(tab, "feeds")) {
1142 wprintf(" tab_cell_label\">");
1143 wprintf(_("Remote retrieval"));
1146 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1147 wprintf(_("Remote retrieval"));
1153 /** end tabbed dialog */
1155 /** begin content of whatever tab is open now */
1157 if (!strcmp(tab, "admin")) {
1158 wprintf("<div class=\"tabcontent\">");
1160 "<li><a href=\"delete_room\" "
1161 "onClick=\"return confirm('");
1162 wprintf(_("Are you sure you want to delete this room?"));
1163 wprintf("');\">\n");
1164 wprintf(_("Delete this room"));
1166 "<li><a href=\"display_editroompic\">\n");
1167 wprintf(_("Set or change the icon for this room's banner"));
1169 "<li><a href=\"display_editinfo\">\n");
1170 wprintf(_("Edit this room's Info file"));
1176 if (!strcmp(tab, "config")) {
1177 wprintf("<div class=\"tabcontent\">");
1179 serv_getln(buf, sizeof buf);
1181 if (!strncmp(buf, "550", 3)) {
1182 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1183 _("Higher access is required to access this function.")
1186 else if (buf[0] != '2') {
1187 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1190 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1191 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1192 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1193 er_flags = extract_int(&buf[4], 3);
1194 er_floor = extract_int(&buf[4], 4);
1195 er_flags2 = extract_int(&buf[4], 7);
1197 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1198 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1200 wprintf("<ul><li>");
1201 wprintf(_("Name of room: "));
1202 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1208 wprintf(_("Resides on floor: "));
1209 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1210 if (er_flags & QR_MAILBOX)
1211 wprintf("disabled >\n");
1212 for (i = 0; i < 128; ++i)
1213 if (!IsEmptyStr(floorlist[i])) {
1214 wprintf("<OPTION ");
1216 wprintf("SELECTED ");
1217 wprintf("VALUE=\"%d\">", i);
1218 escputs(floorlist[i]);
1219 wprintf("</OPTION>\n");
1221 wprintf("</select>\n");
1224 wprintf(_("Type of room:"));
1227 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1228 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1229 wprintf("CHECKED ");
1230 wprintf("OnChange=\""
1231 " if (this.form.type[0].checked == true) { "
1232 " this.form.er_floor.disabled = false; "
1235 wprintf(_("Public (automatically appears to everyone)"));
1238 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1239 if ((er_flags & QR_PRIVATE) &&
1240 (er_flags & QR_GUESSNAME))
1241 wprintf("CHECKED ");
1242 wprintf(" OnChange=\""
1243 " if (this.form.type[1].checked == true) { "
1244 " this.form.er_floor.disabled = false; "
1247 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1249 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1250 if ((er_flags & QR_PRIVATE) &&
1251 (er_flags & QR_PASSWORDED))
1252 wprintf("CHECKED ");
1253 wprintf(" OnChange=\""
1254 " if (this.form.type[2].checked == true) { "
1255 " this.form.er_floor.disabled = false; "
1258 wprintf(_("Private - require password: "));
1259 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1262 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1263 if ((er_flags & QR_PRIVATE)
1264 && ((er_flags & QR_GUESSNAME) == 0)
1265 && ((er_flags & QR_PASSWORDED) == 0))
1266 wprintf("CHECKED ");
1267 wprintf(" OnChange=\""
1268 " if (this.form.type[3].checked == true) { "
1269 " this.form.er_floor.disabled = false; "
1272 wprintf(_("Private - invitation only"));
1274 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1275 if (er_flags & QR_MAILBOX)
1276 wprintf("CHECKED ");
1277 wprintf (" OnChange=\""
1278 " if (this.form.type[4].checked == true) { "
1279 " this.form.er_floor.disabled = true; "
1282 wprintf(_("Personal (mailbox for you only)"));
1284 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1286 wprintf(_("If private, cause current users to forget room"));
1288 wprintf("\n</ul>\n");
1290 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1291 if (er_flags & QR_PREFONLY)
1292 wprintf("CHECKED ");
1294 wprintf(_("Preferred users only"));
1296 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1297 if (er_flags & QR_READONLY)
1298 wprintf("CHECKED ");
1300 wprintf(_("Read-only room"));
1302 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1303 if (er_flags2 & QR2_COLLABDEL)
1304 wprintf("CHECKED ");
1306 wprintf(_("All users allowed to post may also delete messages"));
1308 /** directory stuff */
1309 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1310 if (er_flags & QR_DIRECTORY)
1311 wprintf("CHECKED ");
1313 wprintf(_("File directory room"));
1315 wprintf("\n<ul><li>");
1316 wprintf(_("Directory name: "));
1317 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1320 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1321 if (er_flags & QR_UPLOAD)
1322 wprintf("CHECKED ");
1324 wprintf(_("Uploading allowed"));
1326 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1327 if (er_flags & QR_DOWNLOAD)
1328 wprintf("CHECKED ");
1330 wprintf(_("Downloading allowed"));
1332 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1333 if (er_flags & QR_VISDIR)
1334 wprintf("CHECKED ");
1336 wprintf(_("Visible directory"));
1339 /** end of directory stuff */
1341 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1342 if (er_flags & QR_NETWORK)
1343 wprintf("CHECKED ");
1345 wprintf(_("Network shared room"));
1347 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1348 if (er_flags & QR_PERMANENT)
1349 wprintf("CHECKED ");
1351 wprintf(_("Permanent (does not auto-purge)"));
1353 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1354 if (er_flags2 & QR2_SUBJECTREQ)
1355 wprintf("CHECKED ");
1357 wprintf(_("Subject Required (Force users to specify a message subject)"));
1359 /** start of anon options */
1362 wprintf(_("Anonymous messages"));
1365 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1366 if (((er_flags & QR_ANONONLY) == 0)
1367 && ((er_flags & QR_ANONOPT) == 0))
1368 wprintf("CHECKED ");
1370 wprintf(_("No anonymous messages"));
1372 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1373 if (er_flags & QR_ANONONLY)
1374 wprintf("CHECKED ");
1376 wprintf(_("All messages are anonymous"));
1378 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1379 if (er_flags & QR_ANONOPT)
1380 wprintf("CHECKED ");
1382 wprintf(_("Prompt user when entering messages"));
1385 /* end of anon options */
1388 wprintf(_("Room aide: "));
1390 serv_getln(buf, sizeof buf);
1391 if (buf[0] != '2') {
1392 wprintf("<em>%s</em>\n", &buf[4]);
1394 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1395 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1398 wprintf("</ul><CENTER>\n");
1399 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1400 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1402 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1412 /** Sharing the room with other Citadel nodes... */
1413 if (!strcmp(tab, "sharing")) {
1414 wprintf("<div class=\"tabcontent\">");
1416 shared_with = strdup("");
1417 not_shared_with = strdup("");
1419 /** Learn the current configuration */
1420 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1421 serv_getln(buf, sizeof buf);
1422 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1423 extract_token(node, buf, 0, '|', sizeof node);
1424 not_shared_with = realloc(not_shared_with,
1425 strlen(not_shared_with) + 32);
1426 strcat(not_shared_with, node);
1427 strcat(not_shared_with, "\n");
1431 serv_getln(buf, sizeof buf);
1432 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1433 extract_token(cmd, buf, 0, '|', sizeof cmd);
1434 extract_token(node, buf, 1, '|', sizeof node);
1435 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1436 if (!strcasecmp(cmd, "ignet_push_share")) {
1437 shared_with = realloc(shared_with,
1438 strlen(shared_with) + 32);
1439 strcat(shared_with, node);
1440 if (!IsEmptyStr(remote_room)) {
1441 strcat(shared_with, "|");
1442 strcat(shared_with, remote_room);
1444 strcat(shared_with, "\n");
1448 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1449 extract_token(buf, shared_with, i, '\n', sizeof buf);
1450 extract_token(node, buf, 0, '|', sizeof node);
1451 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1452 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1453 if (!strcasecmp(node, cmd)) {
1454 remove_token(not_shared_with, j, '\n');
1459 /** Display the stuff */
1460 wprintf("<CENTER><br />"
1461 "<table border=1 cellpadding=5><tr>"
1463 wprintf(_("Shared with"));
1464 wprintf("</I></B></td>"
1466 wprintf(_("Not shared with"));
1467 wprintf("</I></B></td></tr>\n"
1468 "<tr><td VALIGN=TOP>\n");
1470 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1471 wprintf(_("Remote node name"));
1472 wprintf("</td><td>");
1473 wprintf(_("Remote room name"));
1474 wprintf("</td><td>");
1475 wprintf(_("Actions"));
1476 wprintf("</td></tr>\n");
1478 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1479 extract_token(buf, shared_with, i, '\n', sizeof buf);
1480 extract_token(node, buf, 0, '|', sizeof node);
1481 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1482 if (!IsEmptyStr(node)) {
1483 wprintf("<form method=\"POST\" action=\"netedit\">");
1484 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1485 wprintf("<tr><td>%s</td>\n", node);
1488 if (!IsEmptyStr(remote_room)) {
1489 escputs(remote_room);
1495 wprintf("<input type=\"hidden\" NAME=\"line\" "
1496 "VALUE=\"ignet_push_share|");
1498 if (!IsEmptyStr(remote_room)) {
1500 urlescputs(remote_room);
1503 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1504 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1505 wprintf("<input type=\"submit\" "
1506 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1507 wprintf("</td></tr></form>\n");
1511 wprintf("</table>\n");
1512 wprintf("</td><td VALIGN=TOP>\n");
1513 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1514 wprintf(_("Remote node name"));
1515 wprintf("</td><td>");
1516 wprintf(_("Remote room name"));
1517 wprintf("</td><td>");
1518 wprintf(_("Actions"));
1519 wprintf("</td></tr>\n");
1521 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1522 extract_token(node, not_shared_with, i, '\n', sizeof node);
1523 if (!IsEmptyStr(node)) {
1524 wprintf("<form method=\"POST\" action=\"netedit\">");
1525 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1526 wprintf("<tr><td>");
1529 "<input type=\"INPUT\" "
1533 wprintf("<input type=\"hidden\" "
1535 "VALUE=\"ignet_push_share|");
1538 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1539 "VALUE=\"sharing\">\n");
1540 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1541 "VALUE=\"add\">\n");
1542 wprintf("<input type=\"submit\" "
1543 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1544 wprintf("</td></tr></form>\n");
1548 wprintf("</table>\n");
1549 wprintf("</td></tr>"
1550 "</table></CENTER><br />\n"
1551 "<I><B>%s</B><ul><li>", _("Notes:"));
1552 wprintf(_("When sharing a room, "
1553 "it must be shared from both ends. Adding a node to "
1554 "the 'shared' list sends messages out, but in order to"
1555 " receive messages, the other nodes must be configured"
1556 " to send messages out to your system as well. "
1557 "<li>If the remote room name is blank, it is assumed "
1558 "that the room name is identical on the remote node."
1559 "<li>If the remote room name is different, the remote "
1560 "node must also configure the name of the room here."
1567 /** Mailing list management */
1568 if (!strcmp(tab, "listserv")) {
1569 wprintf("<div class=\"tabcontent\">");
1571 wprintf("<br /><center>"
1572 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1573 "<tr><td VALIGN=TOP>");
1575 wprintf(_("<i>The contents of this room are being "
1576 "mailed <b>as individual messages</b> "
1577 "to the following list recipients:"
1578 "</i><br /><br />\n"));
1581 serv_getln(buf, sizeof buf);
1582 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1583 extract_token(cmd, buf, 0, '|', sizeof cmd);
1584 if (!strcasecmp(cmd, "listrecp")) {
1585 extract_token(recp, buf, 1, '|', sizeof recp);
1588 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1591 wprintf(_("(remove)"));
1592 wprintf("</A><br />");
1595 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1596 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1597 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1598 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1599 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1600 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1601 wprintf("</form>\n");
1603 wprintf("</td><td VALIGN=TOP>\n");
1605 wprintf(_("<i>The contents of this room are being "
1606 "mailed <b>in digest form</b> "
1607 "to the following list recipients:"
1608 "</i><br /><br />\n"));
1611 serv_getln(buf, sizeof buf);
1612 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1613 extract_token(cmd, buf, 0, '|', sizeof cmd);
1614 if (!strcasecmp(cmd, "digestrecp")) {
1615 extract_token(recp, buf, 1, '|', sizeof recp);
1618 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1622 wprintf(_("(remove)"));
1623 wprintf("</A><br />");
1626 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1627 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1628 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1629 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1630 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1631 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1632 wprintf("</form>\n");
1634 wprintf("</td></tr></table>\n");
1636 /** Pop open an address book -- begin **/
1637 wprintf("<div align=right>"
1638 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1640 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1645 _("Add recipients from Contacts or other address books"),
1646 _("Add recipients from Contacts or other address books")
1648 /** Pop open an address book -- end **/
1651 if (self_service(999) == 1) {
1652 wprintf(_("This room is configured to allow "
1653 "self-service subscribe/unsubscribe requests."));
1654 wprintf("<a href=\"toggle_self_service?newval=0&tab=listserv\">");
1655 wprintf(_("Click to disable."));
1656 wprintf("</A><br />\n");
1657 wprintf(_("The URL for subscribe/unsubscribe is: "));
1658 wprintf("<TT>%s://%s/listsub</TT><br />\n",
1659 (is_https ? "https" : "http"),
1663 wprintf(_("This room is <i>not</i> configured to allow "
1664 "self-service subscribe/unsubscribe requests."));
1665 wprintf(" <a href=\"toggle_self_service?newval=1&"
1667 wprintf(_("Click to enable."));
1668 wprintf("</A><br />\n");
1672 wprintf("</CENTER>\n");
1677 /** Configuration of The Dreaded Auto-Purger */
1678 if (!strcmp(tab, "expire")) {
1679 wprintf("<div class=\"tabcontent\">");
1681 serv_puts("GPEX room");
1682 serv_getln(buf, sizeof buf);
1683 if (!strncmp(buf, "550", 3)) {
1684 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1685 _("Higher access is required to access this function.")
1688 else if (buf[0] != '2') {
1689 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1692 roompolicy = extract_int(&buf[4], 0);
1693 roomvalue = extract_int(&buf[4], 1);
1695 serv_puts("GPEX floor");
1696 serv_getln(buf, sizeof buf);
1697 if (buf[0] == '2') {
1698 floorpolicy = extract_int(&buf[4], 0);
1699 floorvalue = extract_int(&buf[4], 1);
1702 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1703 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1704 wprintf("<table border=0 cellspacing=5>\n");
1705 wprintf("<tr><td>");
1706 wprintf(_("Message expire policy for this room"));
1708 escputs(WC->wc_roomname);
1709 wprintf(")</td><td>");
1710 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1711 ((roompolicy == 0) ? "CHECKED" : "") );
1712 wprintf(_("Use the default policy for this floor"));
1713 wprintf("<br />\n");
1714 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1715 ((roompolicy == 1) ? "CHECKED" : "") );
1716 wprintf(_("Never automatically expire messages"));
1717 wprintf("<br />\n");
1718 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1719 ((roompolicy == 2) ? "CHECKED" : "") );
1720 wprintf(_("Expire by message count"));
1721 wprintf("<br />\n");
1722 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1723 ((roompolicy == 3) ? "CHECKED" : "") );
1724 wprintf(_("Expire by message age"));
1726 wprintf(_("Number of messages or days: "));
1727 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1728 wprintf("</td></tr>\n");
1730 if (WC->axlevel >= 6) {
1731 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1732 wprintf("<tr><td>");
1733 wprintf(_("Message expire policy for this floor"));
1735 escputs(floorlist[WC->wc_floor]);
1736 wprintf(")</td><td>");
1737 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1738 ((floorpolicy == 0) ? "CHECKED" : "") );
1739 wprintf(_("Use the system default"));
1740 wprintf("<br />\n");
1741 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1742 ((floorpolicy == 1) ? "CHECKED" : "") );
1743 wprintf(_("Never automatically expire messages"));
1744 wprintf("<br />\n");
1745 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1746 ((floorpolicy == 2) ? "CHECKED" : "") );
1747 wprintf(_("Expire by message count"));
1748 wprintf("<br />\n");
1749 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1750 ((floorpolicy == 3) ? "CHECKED" : "") );
1751 wprintf(_("Expire by message age"));
1753 wprintf(_("Number of messages or days: "));
1754 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1758 wprintf("<CENTER>\n");
1759 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1760 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1762 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1763 wprintf("</CENTER></td><tr>\n");
1765 wprintf("</table>\n"
1766 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1774 /** Access controls */
1775 if (!strcmp(tab, "access")) {
1776 wprintf("<div class=\"tabcontent\">");
1781 /** Fetch messages from remote locations */
1782 if (!strcmp(tab, "feeds")) {
1783 wprintf("<div class=\"tabcontent\">");
1786 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1787 wprintf("</i><br />\n");
1789 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1790 "<tr class=\"even\"><th>");
1791 wprintf(_("Remote host"));
1792 wprintf("</th><th>");
1793 wprintf(_("User name"));
1794 wprintf("</th><th>");
1795 wprintf(_("Password"));
1796 wprintf("</th><th>");
1797 wprintf(_("Keep messages on server?"));
1798 wprintf("</th><th> </th></tr>");
1801 serv_getln(buf, sizeof buf);
1803 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1804 extract_token(cmd, buf, 0, '|', sizeof cmd);
1805 if (!strcasecmp(cmd, "pop3client")) {
1806 safestrncpy(recp, &buf[11], sizeof recp);
1809 wprintf("<tr class=\"%s\">",
1810 (bg ? "even" : "odd")
1814 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1819 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1823 wprintf("<td>*****</td>"); /* Don't show the password */
1825 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1827 wprintf("<td class=\"button_link\">");
1828 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
1831 wprintf(_("(remove)"));
1832 wprintf("</a></td>");
1838 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1840 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1841 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1842 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1844 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1847 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1850 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1853 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1856 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1857 wprintf("</td></tr>");
1858 wprintf("</form></table>\n");
1863 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
1864 wprintf("</i><br />\n");
1866 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1867 "<tr class=\"even\"><th>");
1868 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1869 wprintf(_("Feed URL"));
1870 wprintf("</th><th>");
1871 wprintf("</th></tr>");
1874 serv_getln(buf, sizeof buf);
1876 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1877 extract_token(cmd, buf, 0, '|', sizeof cmd);
1878 if (!strcasecmp(cmd, "rssclient")) {
1879 safestrncpy(recp, &buf[10], sizeof recp);
1882 wprintf("<tr class=\"%s\">",
1883 (bg ? "even" : "odd")
1887 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1891 wprintf("<td class=\"button_link\">");
1892 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
1895 wprintf(_("(remove)"));
1896 wprintf("</a></td>");
1902 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1904 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1905 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
1906 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1908 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
1909 "maxlength=\"256\" name=\"line_pop3host\">\n");
1912 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
1913 wprintf("</td></tr>");
1914 wprintf("</form></table>\n");
1920 /** end content of whatever tab is open now */
1921 wprintf("</div>\n");
1923 address_book_popup();
1929 * \brief Toggle self-service list subscription
1931 void toggle_self_service(void) {
1934 newval = atoi(bstr("newval"));
1935 self_service(newval);
1942 * \brief save new parameters for a room
1948 char er_password[10];
1949 char er_dirname[15];
1950 char er_roomaide[26];
1953 int er_listingorder;
1959 if (IsEmptyStr(bstr("ok_button"))) {
1960 strcpy(WC->ImportantMessage,
1961 _("Cancelled. Changes were not saved."));
1966 serv_getln(buf, sizeof buf);
1968 if (buf[0] != '2') {
1969 strcpy(WC->ImportantMessage, &buf[4]);
1973 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1974 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1975 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1976 er_flags = extract_int(&buf[4], 3);
1977 er_listingorder = extract_int(&buf[4], 5);
1978 er_defaultview = extract_int(&buf[4], 6);
1979 er_flags2 = extract_int(&buf[4], 7);
1981 strcpy(er_roomaide, bstr("er_roomaide"));
1982 if (IsEmptyStr(er_roomaide)) {
1984 serv_getln(buf, sizeof buf);
1985 if (buf[0] != '2') {
1986 strcpy(er_roomaide, "");
1988 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1991 strcpy(buf, bstr("er_name"));
1993 if (!IsEmptyStr(buf)) {
1994 strcpy(er_name, buf);
1997 strcpy(buf, bstr("er_password"));
1999 if (!IsEmptyStr(buf))
2000 strcpy(er_password, buf);
2002 strcpy(buf, bstr("er_dirname"));
2004 if (!IsEmptyStr(buf))
2005 strcpy(er_dirname, buf);
2007 strcpy(buf, bstr("type"));
2008 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2010 if (!strcmp(buf, "invonly")) {
2011 er_flags |= (QR_PRIVATE);
2013 if (!strcmp(buf, "hidden")) {
2014 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2016 if (!strcmp(buf, "passworded")) {
2017 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2019 if (!strcmp(buf, "personal")) {
2020 er_flags |= QR_MAILBOX;
2022 er_flags &= ~QR_MAILBOX;
2025 if (!strcmp(bstr("prefonly"), "yes")) {
2026 er_flags |= QR_PREFONLY;
2028 er_flags &= ~QR_PREFONLY;
2031 if (!strcmp(bstr("readonly"), "yes")) {
2032 er_flags |= QR_READONLY;
2034 er_flags &= ~QR_READONLY;
2038 if (!strcmp(bstr("collabdel"), "yes")) {
2039 er_flags2 |= QR2_COLLABDEL;
2041 er_flags2 &= ~QR2_COLLABDEL;
2044 if (!strcmp(bstr("permanent"), "yes")) {
2045 er_flags |= QR_PERMANENT;
2047 er_flags &= ~QR_PERMANENT;
2050 if (!strcmp(bstr("subjectreq"), "yes")) {
2051 er_flags2 |= QR2_SUBJECTREQ;
2053 er_flags2 &= ~QR2_SUBJECTREQ;
2056 if (!strcmp(bstr("network"), "yes")) {
2057 er_flags |= QR_NETWORK;
2059 er_flags &= ~QR_NETWORK;
2062 if (!strcmp(bstr("directory"), "yes")) {
2063 er_flags |= QR_DIRECTORY;
2065 er_flags &= ~QR_DIRECTORY;
2068 if (!strcmp(bstr("ulallowed"), "yes")) {
2069 er_flags |= QR_UPLOAD;
2071 er_flags &= ~QR_UPLOAD;
2074 if (!strcmp(bstr("dlallowed"), "yes")) {
2075 er_flags |= QR_DOWNLOAD;
2077 er_flags &= ~QR_DOWNLOAD;
2080 if (!strcmp(bstr("visdir"), "yes")) {
2081 er_flags |= QR_VISDIR;
2083 er_flags &= ~QR_VISDIR;
2086 strcpy(buf, bstr("anon"));
2088 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2089 if (!strcmp(buf, "anononly"))
2090 er_flags |= QR_ANONONLY;
2091 if (!strcmp(buf, "anon2"))
2092 er_flags |= QR_ANONOPT;
2095 if (!strcmp(bstr("bump"), "yes"))
2098 er_floor = atoi(bstr("er_floor"));
2100 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2101 er_name, er_password, er_dirname, er_flags, bump, er_floor,
2102 er_listingorder, er_defaultview, er_flags2);
2104 serv_getln(buf, sizeof buf);
2105 if (buf[0] != '2') {
2106 strcpy(WC->ImportantMessage, &buf[4]);
2112 if (!IsEmptyStr(er_roomaide)) {
2113 sprintf(buf, "SETA %s", er_roomaide);
2115 serv_getln(buf, sizeof buf);
2116 if (buf[0] != '2') {
2117 strcpy(WC->ImportantMessage, &buf[4]);
2118 display_main_menu();
2123 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2130 * \brief Display form for Invite, Kick, and show Who Knows a room
2132 void do_invt_kick(void) {
2133 char buf[SIZ], room[SIZ], username[SIZ];
2136 serv_getln(buf, sizeof buf);
2138 if (buf[0] != '2') {
2142 extract_token(room, &buf[4], 0, '|', sizeof room);
2144 strcpy(username, bstr("username"));
2146 if (!IsEmptyStr(bstr("kick_button"))) {
2147 sprintf(buf, "KICK %s", username);
2149 serv_getln(buf, sizeof buf);
2151 if (buf[0] != '2') {
2152 strcpy(WC->ImportantMessage, &buf[4]);
2154 sprintf(WC->ImportantMessage,
2155 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2160 if (!IsEmptyStr(bstr("invite_button"))) {
2161 sprintf(buf, "INVT %s", username);
2163 serv_getln(buf, sizeof buf);
2165 if (buf[0] != '2') {
2166 strcpy(WC->ImportantMessage, &buf[4]);
2168 sprintf(WC->ImportantMessage,
2169 _("<B><I>User %s invited to room %s.</I></B>\n"),
2180 * \brief Display form for Invite, Kick, and show Who Knows a room
2182 void display_whok(void)
2184 char buf[SIZ], room[SIZ], username[SIZ];
2187 serv_getln(buf, sizeof buf);
2189 if (buf[0] != '2') {
2193 extract_token(room, &buf[4], 0, '|', sizeof room);
2196 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2197 wprintf(_("The users listed below have access to this room. "
2198 "To remove a user from the access list, select the user "
2199 "name from the list and click 'Kick'."));
2200 wprintf("<br /><br />");
2202 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2203 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2204 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2205 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2207 serv_getln(buf, sizeof buf);
2208 if (buf[0] == '1') {
2209 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2210 extract_token(username, buf, 0, '|', sizeof username);
2211 wprintf("<OPTION>");
2216 wprintf("</select><br />\n");
2218 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2219 wprintf("</form></CENTER>\n");
2221 wprintf("</td><td>");
2222 wprintf(_("To grant another user access to this room, enter the "
2223 "user name in the box below and click 'Invite'."));
2224 wprintf("<br /><br />");
2226 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2227 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2228 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2229 wprintf(_("Invite:"));
2231 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2232 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2233 "<input type=\"submit\" value=\"%s\">"
2234 "</form></CENTER>\n", _("Invite"));
2235 /** Pop open an address book -- begin **/
2237 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2239 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2242 _("Users"), _("Users")
2244 /** Pop open an address book -- end **/
2246 wprintf("</td></tr></table>\n");
2247 address_book_popup();
2254 * \brief display the form for entering a new room
2256 void display_entroom(void)
2261 serv_puts("CRE8 0");
2262 serv_getln(buf, sizeof buf);
2264 if (buf[0] != '2') {
2265 strcpy(WC->ImportantMessage, &buf[4]);
2266 display_main_menu();
2270 output_headers(1, 1, 1, 0, 0, 0);
2272 svprintf("BOXTITLE", WCS_STRING, _("Create a new room"));
2273 do_template("beginbox");
2275 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2276 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2278 wprintf("<table class=\"altern\"> ");
2280 wprintf("<tr class=\"even\"><td>");
2281 wprintf(_("Name of room: "));
2282 wprintf("</td><td>");
2283 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2284 wprintf("</td></tr>");
2286 wprintf("<tr class=\"odd\"><td>");
2287 wprintf(_("Resides on floor: "));
2288 wprintf("</td><td>");
2290 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2291 for (i = 0; i < 128; ++i)
2292 if (!IsEmptyStr(floorlist[i])) {
2293 wprintf("<option ");
2294 wprintf("value=\"%d\">", i);
2295 escputs(floorlist[i]);
2296 wprintf("</option>\n");
2298 wprintf("</select>\n");
2299 wprintf("</td></tr>");
2302 * Our clever little snippet of JavaScript automatically selects
2303 * a public room if the view is set to Bulletin Board or wiki, and
2304 * it selects a mailbox room otherwise. The user can override this,
2305 * of course. We also disable the floor selector for mailboxes.
2307 wprintf("<tr class=\"even\"><td>");
2308 wprintf(_("Default view for room: "));
2309 wprintf("</td><td>");
2310 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2311 " if ( (this.form.er_view.value == 0) "
2312 " || (this.form.er_view.value == 6) ) { "
2313 " this.form.type[0].checked=true; "
2314 " this.form.er_floor.disabled = false; "
2317 " this.form.type[4].checked=true; "
2318 " this.form.er_floor.disabled = true; "
2321 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2322 if (is_view_allowed_as_default(i)) {
2323 wprintf("<option %s value=\"%d\">",
2324 ((i == 0) ? "selected" : ""), i );
2325 escputs(viewdefs[i]);
2326 wprintf("</option>\n");
2329 wprintf("</select>\n");
2330 wprintf("</td></tr>");
2332 wprintf("<tr class=\"even\"><td>");
2333 wprintf(_("Type of room:"));
2334 wprintf("</td><td>");
2335 wprintf("<ul class=\"adminlist\">\n");
2337 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2338 wprintf("CHECKED OnChange=\""
2339 " if (this.form.type[0].checked == true) { "
2340 " this.form.er_floor.disabled = false; "
2343 wprintf(_("Public (automatically appears to everyone)"));
2346 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2347 " if (this.form.type[1].checked == true) { "
2348 " this.form.er_floor.disabled = false; "
2351 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2354 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2355 " if (this.form.type[2].checked == true) { "
2356 " this.form.er_floor.disabled = false; "
2359 wprintf(_("Private - require password: "));
2360 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2363 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2364 " if (this.form.type[3].checked == true) { "
2365 " this.form.er_floor.disabled = false; "
2368 wprintf(_("Private - invitation only"));
2371 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2373 " if (this.form.type[4].checked == true) { "
2374 " this.form.er_floor.disabled = true; "
2377 wprintf(_("Personal (mailbox for you only)"));
2380 wprintf("\n</ul>\n");
2381 wprintf("</td></tr></table>\n");
2383 wprintf("<div class=\"buttons\">\n");
2384 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2386 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2387 wprintf("</div>\n");
2388 wprintf("</form>\n<hr />");
2389 serv_printf("MESG roomaccess");
2390 serv_getln(buf, sizeof buf);
2391 if (buf[0] == '1') {
2395 do_template("endbox");
2404 * \brief support function for entroom() -- sets the default view
2406 void er_set_default_view(int newview) {
2419 serv_getln(buf, sizeof buf);
2420 if (buf[0] != '2') return;
2422 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2423 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2424 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2425 rm_bits1 = extract_int(&buf[4], 3);
2426 rm_floor = extract_int(&buf[4], 4);
2427 rm_listorder = extract_int(&buf[4], 5);
2428 rm_bits2 = extract_int(&buf[4], 7);
2430 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2431 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2432 rm_listorder, newview, rm_bits2
2434 serv_getln(buf, sizeof buf);
2440 * \brief enter a new room
2447 char er_password[SIZ];
2452 if (IsEmptyStr(bstr("ok_button"))) {
2453 strcpy(WC->ImportantMessage,
2454 _("Cancelled. No new room was created."));
2455 display_main_menu();
2458 strcpy(er_name, bstr("er_name"));
2459 strcpy(er_type, bstr("type"));
2460 strcpy(er_password, bstr("er_password"));
2461 er_floor = atoi(bstr("er_floor"));
2462 er_view = atoi(bstr("er_view"));
2465 if (!strcmp(er_type, "hidden"))
2467 if (!strcmp(er_type, "passworded"))
2469 if (!strcmp(er_type, "invonly"))
2471 if (!strcmp(er_type, "personal"))
2474 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
2475 er_name, er_num_type, er_password, er_floor, 0, er_view);
2477 serv_getln(buf, sizeof buf);
2478 if (buf[0] != '2') {
2479 strcpy(WC->ImportantMessage, &buf[4]);
2480 display_main_menu();
2484 do_change_view(er_view); /* Now go there */
2489 * \brief display the screen to enter a private room
2491 void display_private(char *rname, int req_pass)
2493 output_headers(1, 1, 1, 0, 0, 0);
2495 svprintf("BOXTITLE", WCS_STRING, _("Go to a hidden room"));
2496 do_template("beginbox");
2499 wprintf(_("If you know the name of a hidden (guess-name) or "
2500 "passworded room, you can enter that room by typing "
2501 "its name below. Once you gain access to a private "
2502 "room, it will appear in your regular room listings "
2503 "so you don't have to keep returning here."));
2506 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2507 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2509 wprintf("<table class=\"altern\"> "
2510 "<tr class=\"even\"><td>");
2511 wprintf(_("Enter room name:"));
2513 "<input type=\"text\" name=\"gr_name\" "
2514 "value=\"%s\" maxlength=\"128\">\n", rname);
2517 wprintf("</td></tr><tr class=\"odd\"><td>");
2518 wprintf(_("Enter room password:"));
2519 wprintf("</td><td>");
2520 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2522 wprintf("</td></tr></table>\n");
2524 wprintf("<div class=\"buttons\">\n");
2525 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2527 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2531 wprintf("</div></form>\n");
2533 do_template("endbox");
2539 * \brief goto a private room
2541 void goto_private(void)
2546 if (IsEmptyStr(bstr("ok_button"))) {
2547 display_main_menu();
2550 strcpy(hold_rm, WC->wc_roomname);
2551 strcpy(buf, "GOTO ");
2552 strcat(buf, bstr("gr_name"));
2554 strcat(buf, bstr("gr_pass"));
2556 serv_getln(buf, sizeof buf);
2558 if (buf[0] == '2') {
2559 smart_goto(bstr("gr_name"));
2562 if (!strncmp(buf, "540", 3)) {
2563 display_private(bstr("gr_name"), 1);
2566 output_headers(1, 1, 1, 0, 0, 0);
2567 wprintf("%s\n", &buf[4]);
2574 * \brief display the screen to zap a room
2576 void display_zap(void)
2578 output_headers(1, 1, 2, 0, 0, 0);
2580 wprintf("<div id=\"banner\">\n");
2582 wprintf(_("Zap (forget/unsubscribe) the current room"));
2584 wprintf("</div>\n");
2586 wprintf("<div id=\"content\" class=\"service\">\n");
2588 wprintf(_("If you select this option, <em>%s</em> will "
2589 "disappear from your room list. Is this what you wish "
2590 "to do?<br />\n"), WC->wc_roomname);
2592 wprintf("<form method=\"POST\" action=\"zap\">\n");
2593 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2594 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2596 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2597 wprintf("</form>\n");
2608 char final_destination[SIZ];
2611 * If the forget-room routine fails for any reason, we fall back
2612 * to the current room; otherwise, we go to the Lobby
2614 strcpy(final_destination, WC->wc_roomname);
2616 if (!IsEmptyStr(bstr("ok_button"))) {
2617 serv_printf("GOTO %s", WC->wc_roomname);
2618 serv_getln(buf, sizeof buf);
2619 if (buf[0] == '2') {
2621 serv_getln(buf, sizeof buf);
2622 if (buf[0] == '2') {
2623 strcpy(final_destination, "_BASEROOM_");
2627 smart_goto(final_destination);
2633 * \brief Delete the current room
2635 void delete_room(void)
2639 serv_puts("KILL 1");
2640 serv_getln(buf, sizeof buf);
2641 if (buf[0] != '2') {
2642 strcpy(WC->ImportantMessage, &buf[4]);
2643 display_main_menu();
2646 smart_goto("_BASEROOM_");
2653 * \brief Perform changes to a room's network configuration
2655 void netedit(void) {
2665 if (!IsEmptyStr(bstr("line_pop3host"))) {
2666 strcpy(line, bstr("prefix"));
2667 strcat(line, bstr("line_pop3host"));
2669 strcat(line, bstr("line_pop3user"));
2671 strcat(line, bstr("line_pop3pass"));
2673 strcat(line, atoi(bstr("line_pop3keep")) ? "1" : "0" );
2674 strcat(line, bstr("suffix"));
2676 else if (!IsEmptyStr(bstr("line"))) {
2677 strcpy(line, bstr("prefix"));
2678 strcat(line, bstr("line"));
2679 strcat(line, bstr("suffix"));
2694 serv_getln(buf, sizeof buf);
2695 if (buf[0] != '1') {
2701 /** This loop works for add *or* remove. Spiffy, eh? */
2702 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2703 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2704 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2705 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2706 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2707 if ( (strcasecmp(cmpa0, cmpb0))
2708 || (strcasecmp(cmpa1, cmpb1)) ) {
2709 fprintf(fp, "%s\n", buf);
2715 serv_getln(buf, sizeof buf);
2716 if (buf[0] != '4') {
2722 while (fgets(buf, sizeof buf, fp) != NULL) {
2723 buf[strlen(buf)-1] = 0;
2727 if (!IsEmptyStr(bstr("add_button"))) {
2728 num_addrs = num_tokens(bstr("line"), ',');
2729 if (num_addrs < 2) {
2730 /* just adding one node or address */
2734 /* adding multiple addresses separated by commas */
2735 for (i=0; i<num_addrs; ++i) {
2736 strcpy(line, bstr("prefix"));
2737 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2740 strcat(line, bstr("suffix"));
2754 * \brief Convert a room name to a folder-ish-looking name.
2755 * \param folder the folderish name
2756 * \param room the room name
2757 * \param floor the floor name
2758 * \param is_mailbox is it a mailbox?
2760 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2765 * For mailboxes, just do it straight...
2768 sprintf(folder, "My folders|%s", room);
2772 * Otherwise, prefix the floor name as a "public folders" moniker
2775 sprintf(folder, "%s|%s", floorlist[floor], room);
2779 * Replace "\" characters with "|" for pseudo-folder-delimiting
2781 len = strlen (folder);
2782 for (i=0; i<len; ++i) {
2783 if (folder[i] == '\\') folder[i] = '|';
2791 * \brief Back end for change_view()
2792 * \param newview set newview???
2794 void do_change_view(int newview) {
2797 serv_printf("VIEW %d", newview);
2798 serv_getln(buf, sizeof buf);
2799 WC->wc_view = newview;
2800 smart_goto(WC->wc_roomname);
2806 * \brief Change the view for this room
2808 void change_view(void) {
2811 view = atol(bstr("view"));
2812 do_change_view(view);
2817 * \brief One big expanded tree list view --- like a folder list
2818 * \param fold the folder to view
2819 * \param max_folders how many folders???
2820 * \param num_floors hom many floors???
2822 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2826 int has_subfolders = 0;
2829 parents = malloc(max_folders * sizeof(int));
2831 /** BEGIN TREE MENU */
2832 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2834 /** include NanoTree */
2835 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2837 /** initialize NanoTree */
2838 wprintf("<script type=\"text/javascript\"> \n"
2839 " showRootNode = false; \n"
2840 " sortNodes = false; \n"
2841 " dragable = false; \n"
2843 " function standardClick(treeNode) { \n"
2846 " var closedGif = 'static/folder_closed.gif'; \n"
2847 " var openGif = 'static/folder_open.gif'; \n"
2849 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2853 for (i=0; i<max_folders; ++i) {
2856 if ((i+1) < max_folders) {
2858 len = strlen(fold[i].name);
2859 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
2860 && (fold[i+1].name[len] == '|') ) {
2865 levels = num_tokens(fold[i].name, '|');
2866 parents[levels] = i;
2868 wprintf("var node%d = new TreeNode(%d, '", i, i);
2870 if (fold[i].selectable) {
2871 wprintf("<a href=\"dotgoto?room=");
2872 urlescputs(fold[i].room);
2877 wprintf("<span class=\"roomlist_floor\">");
2879 else if (fold[i].hasnewmsgs) {
2880 wprintf("<span class=\"roomlist_new\">");
2883 wprintf("<span class=\"roomlist_old\">");
2885 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2890 if (has_subfolders) {
2891 wprintf("new Array(closedGif, openGif)");
2893 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2894 wprintf("'static/viewcontacts_16x.gif'");
2896 else if (fold[i].view == VIEW_CALENDAR) {
2897 wprintf("'static/calarea_16x.gif'");
2899 else if (fold[i].view == VIEW_CALBRIEF) {
2900 wprintf("'static/calarea_16x.gif'");
2902 else if (fold[i].view == VIEW_TASKS) {
2903 wprintf("'static/taskmanag_16x.gif'");
2905 else if (fold[i].view == VIEW_NOTES) {
2906 wprintf("'static/storenotes_16x.gif'");
2908 else if (fold[i].view == VIEW_MAILBOX) {
2909 wprintf("'static/privatemess_16x.gif'");
2912 wprintf("'static/chatrooms_16x.gif'");
2915 urlescputs(fold[i].name);
2919 wprintf("rootNode.addChild(node%d);\n", i);
2922 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2926 wprintf("container = document.getElementById('roomlist_div'); \n"
2932 /** END TREE MENU */
2936 * \brief Boxes and rooms and lists ... oh my!
2937 * \param fold the folder to view
2938 * \param max_folders how many folders???
2939 * \param num_floors hom many floors???
2941 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2943 char floor_name[256];
2944 char old_floor_name[256];
2946 int levels, oldlevels;
2949 static int columns = 3;
2950 int boxes_per_column = 0;
2951 int current_column = 0;
2954 strcpy(floor_name, "");
2955 strcpy(old_floor_name, "");
2958 while (nf % columns != 0) ++nf;
2959 boxes_per_column = (nf / columns);
2960 if (boxes_per_column < 1) boxes_per_column = 1;
2962 /** Outer table (for columnization) */
2963 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
2964 "<tr><td valign=top>");
2968 for (i=0; i<max_folders; ++i) {
2970 levels = num_tokens(fold[i].name, '|');
2971 extract_token(floor_name, fold[i].name, 0,
2972 '|', sizeof floor_name);
2974 if ( (strcasecmp(floor_name, old_floor_name))
2975 && (!IsEmptyStr(old_floor_name)) ) {
2977 do_template("endbox");
2981 if ((num_boxes % boxes_per_column) == 0) {
2983 if (current_column < columns) {
2984 wprintf("</td><td valign=top>\n");
2988 strcpy(old_floor_name, floor_name);
2991 /** Begin inner box */
2992 stresc(boxtitle, 256, floor_name, 1, 0);
2993 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2994 do_template("beginbox");
3001 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3002 if (fold[i].selectable) {
3003 wprintf("<a href=\"dotgoto?room=");
3004 urlescputs(fold[i].room);
3010 if (fold[i].hasnewmsgs) {
3011 wprintf("<span class=\"roomlist_new\">");
3014 wprintf("<span class=\"roomlist_old\">");
3016 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3019 if (fold[i].selectable) {
3025 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3026 wprintf(" (INBOX)");
3028 wprintf("<br />\n");
3031 /** End the final inner box */
3032 do_template("endbox");
3034 wprintf("</td></tr></table>\n");
3038 * \brief print a floor div???
3039 * \param which_floordiv name of the floordiv???
3041 void set_floordiv_expanded(char *which_floordiv) {
3042 begin_ajax_response();
3043 safestrncpy(WC->floordiv_expanded, which_floordiv, sizeof WC->floordiv_expanded);
3044 end_ajax_response();
3048 * \brief view the iconbar
3049 * \param fold the folder to view
3050 * \param max_folders how many folders???
3051 * \param num_floors hom many floors???
3053 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3055 char floor_name[256];
3056 char old_floor_name[256];
3057 char floordivtitle[256];
3058 char floordiv_id[32];
3059 int levels, oldlevels;
3061 int num_drop_targets = 0;
3064 strcpy(floor_name, "");
3065 strcpy(old_floor_name, "");
3069 for (i=0; i<max_folders; ++i) {
3071 levels = num_tokens(fold[i].name, '|');
3072 extract_token(floor_name, fold[i].name, 0,
3073 '|', sizeof floor_name);
3075 if ( (strcasecmp(floor_name, old_floor_name))
3076 && (!IsEmptyStr(old_floor_name)) ) {
3077 /** End inner box */
3079 wprintf("</div>\n"); /** floordiv */
3081 strcpy(old_floor_name, floor_name);
3085 stresc(floordivtitle, 256, floor_name, 0, 0);
3086 sprintf(floordiv_id, "floordiv%d", i);
3087 wprintf("<span class=\"ib_roomlist_floor\" "
3088 "onClick=\"expand_floor('%s')\">"
3089 "%s</span><br>\n", floordiv_id, floordivtitle);
3090 wprintf("<div id=\"%s\" style=\"display:%s\">",
3092 (!strcasecmp(floordiv_id, WC->floordiv_expanded) ? "block" : "none")
3099 wprintf("<div id=\"roomdiv%d\">", i);
3101 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3103 /** choose the icon */
3104 if (fold[i].view == VIEW_ADDRESSBOOK) {
3105 icon = "viewcontacts_16x.gif" ;
3107 else if (fold[i].view == VIEW_CALENDAR) {
3108 icon = "calarea_16x.gif" ;
3110 else if (fold[i].view == VIEW_CALBRIEF) {
3111 icon = "calarea_16x.gif" ;
3113 else if (fold[i].view == VIEW_TASKS) {
3114 icon = "taskmanag_16x.gif" ;
3116 else if (fold[i].view == VIEW_NOTES) {
3117 icon = "storenotes_16x.gif" ;
3119 else if (fold[i].view == VIEW_MAILBOX) {
3120 icon = "privatemess_16x.gif" ;
3123 icon = "chatrooms_16x.gif" ;
3126 if (fold[i].selectable) {
3127 wprintf("<a href=\"dotgoto?room=");
3128 urlescputs(fold[i].room);
3130 wprintf("<img align=\"middle\" border=0 src=\"static/%s\" alt=\"\"> ", icon);
3135 if (fold[i].hasnewmsgs) {
3136 wprintf("<span class=\"ib_roomlist_new\">");
3139 wprintf("<span class=\"ib_roomlist_old\">");
3141 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3143 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3144 wprintf(" (INBOX)");
3147 if (fold[i].selectable) {
3154 wprintf("</div>\n"); /** roomdiv */
3157 wprintf("</div>\n"); /** floordiv */
3160 /** BEGIN: The old invisible pixel trick, to get our JavaScript to initialize */
3161 wprintf("<img src=\"static/blank.gif\" onLoad=\"\n");
3163 num_drop_targets = 0;
3165 for (i=0; i<max_folders; ++i) {
3166 levels = num_tokens(fold[i].name, '|');
3168 wprintf("drop_targets_elements[%d]=$('roomdiv%d');\n", num_drop_targets, i);
3169 wprintf("drop_targets_roomnames[%d]='", num_drop_targets);
3170 jsescputs(fold[i].room);
3176 wprintf("num_drop_targets = %d;\n", num_drop_targets);
3177 if ((WC->floordiv_expanded[0] != '\0')&&
3178 (WC->floordiv_expanded[1] != '\0')){
3179 wprintf("which_div_expanded = '%s';\n", WC->floordiv_expanded);
3183 /** END: The old invisible pixel trick, to get our JavaScript to initialize */
3189 * \brief Show the room list.
3190 * (only should get called by
3191 * knrooms() because that's where output_headers() is called from)
3192 * \param viewpref the view preferences???
3195 void list_all_rooms_by_floor(char *viewpref) {
3198 struct folder *fold = NULL;
3200 int max_folders = 0;
3201 int alloc_folders = 0;
3207 int num_floors = 1; /** add an extra one for private folders */
3211 /** If our cached folder list is very old, burn it. */
3212 if (WC->cache_fold != NULL) {
3213 if ((time(NULL) - WC->cache_timestamp) > 300) {
3214 free(WC->cache_fold);
3215 WC->cache_fold = NULL;
3219 /** Can we do the iconbar roomlist from cache? */
3220 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3221 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3225 /** Grab the floor table so we know how to build the list... */
3228 /** Start with the mailboxes */
3231 fold = malloc(sizeof(struct folder));
3232 memset(fold, 0, sizeof(struct folder));
3233 strcpy(fold[0].name, "My folders");
3234 fold[0].is_mailbox = 1;
3236 /** Then add floors */
3238 serv_getln(buf, sizeof buf);
3239 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3240 if (max_folders >= alloc_folders) {
3241 alloc_folders = max_folders + 100;
3242 fold = realloc(fold,
3243 alloc_folders * sizeof(struct folder));
3245 memset(&fold[max_folders], 0, sizeof(struct folder));
3246 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3247 extract_token(buf3, buf, 0, '|', SIZ);
3248 fold[max_folders].floor = atol (buf3);
3253 for (i=0; i<num_floors; i++)
3254 if (IDMax < fold[i].floor)
3255 IDMax = fold[i].floor;
3256 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3257 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3258 for (i=0; i<num_floors; i++)
3259 floor_mapping[fold[i].floor]=i;
3261 /** refresh the messages index for this room */
3262 // serv_puts("GOTO ");
3263 // while (serv_getln(buf, sizeof buf), strcmp(buf, "000"));
3264 /** Now add rooms */
3266 serv_getln(buf, sizeof buf);
3267 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3268 if (max_folders >= alloc_folders) {
3269 alloc_folders = max_folders + 100;
3270 fold = realloc(fold,
3271 alloc_folders * sizeof(struct folder));
3273 memset(&fold[max_folders], 0, sizeof(struct folder));
3274 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3275 ra_flags = extract_int(buf, 5);
3276 flags = extract_int(buf, 1);
3277 fold[max_folders].floor = extract_int(buf, 2);
3278 fold[max_folders].hasnewmsgs =
3279 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3280 if (flags & QR_MAILBOX) {
3281 fold[max_folders].is_mailbox = 1;
3283 fold[max_folders].view = extract_int(buf, 6);
3284 room_to_folder(fold[max_folders].name,
3285 fold[max_folders].room,
3286 fold[max_folders].floor,
3287 fold[max_folders].is_mailbox);
3288 fold[max_folders].selectable = 1;
3289 /* Increase the room count for the associtaed floor */
3290 if (fold[max_folders].is_mailbox) {
3291 fold[0].num_rooms++;
3294 i = floor_mapping[fold[max_folders].floor];
3295 fold[i].num_rooms++;
3301 * Remove any floors that don't have rooms
3303 get_preference("emptyfloors", buf2, sizeof buf2);
3304 if (buf2[0]==0 || (strcasecmp(buf2, "no") == 0))
3306 for (i=0; i<num_floors; i++)
3308 if (fold[i].num_rooms == 0) {
3309 for (j=i; j<max_folders; j++) {
3310 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3319 /** Bubble-sort the folder list */
3320 for (i=0; i<max_folders; ++i) {
3321 for (j=0; j<(max_folders-1)-i; ++j) {
3322 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3323 swap = strcasecmp(fold[j].name, fold[j+1].name);
3326 if ( (fold[j+1].is_mailbox)
3327 && (!fold[j].is_mailbox)) {
3335 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3336 memcpy(&fold[j], &fold[j+1],
3337 sizeof(struct folder));
3338 memcpy(&fold[j+1], &ftmp,
3339 sizeof(struct folder));
3345 if (!strcasecmp(viewpref, "folders")) {
3346 do_folder_view(fold, max_folders, num_floors);
3348 else if (!strcasecmp(viewpref, "hackish_view")) {
3349 for (i=0; i<max_folders; ++i) {
3350 escputs(fold[i].name);
3351 wprintf("<br />\n");
3354 else if (!strcasecmp(viewpref, "iconbar")) {
3355 do_iconbar_view(fold, max_folders, num_floors);
3358 do_rooms_view(fold, max_folders, num_floors);
3361 /* Don't free the folder list ... cache it for future use! */
3362 if (WC->cache_fold != NULL) {
3363 free(WC->cache_fold);
3365 WC->cache_fold = fold;
3366 WC->cache_max_folders = max_folders;
3367 WC->cache_num_floors = num_floors;
3368 WC->cache_timestamp = time(NULL);
3369 free(floor_mapping);
3374 * \brief Do either a known rooms list or a folders list, depending on the
3379 char listviewpref[SIZ];
3381 output_headers(1, 1, 2, 0, 0, 0);
3383 /** Determine whether the user is trying to change views */
3384 if (bstr("view") != NULL) {
3385 if (!IsEmptyStr(bstr("view"))) {
3386 set_preference("roomlistview", bstr("view"), 1);
3390 get_preference("roomlistview", listviewpref, sizeof listviewpref);
3392 if ( (strcasecmp(listviewpref, "folders"))
3393 && (strcasecmp(listviewpref, "table")) ) {
3394 strcpy(listviewpref, "rooms");
3398 wprintf("<div id=\"banner\">\n");
3399 wprintf("<div class=\"room_banner\">");
3401 if (!strcasecmp(listviewpref, "rooms")) {
3402 wprintf(_("Room list"));
3404 if (!strcasecmp(listviewpref, "folders")) {
3405 wprintf(_("Folder list"));
3407 if (!strcasecmp(listviewpref, "table")) {
3408 wprintf(_("Room list"));
3410 wprintf("</h1></div>\n");
3412 /** offer the ability to switch views */
3413 wprintf("<ul class=\"room_actions\">\n");
3414 wprintf("<li class=\"start_page\">");
3417 wprintf("<li><form name=\"roomlistomatic\">\n"
3418 "<select name=\"newview\" size=\"1\" "
3419 "OnChange=\"location.href=roomlistomatic.newview.options"
3420 "[selectedIndex].value\">\n");
3422 wprintf("<option %s value=\"knrooms&view=rooms\">"
3425 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
3428 wprintf("<option %s value=\"knrooms&view=folders\">"
3429 "View as folder list"
3431 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
3434 wprintf("</select>");
3435 wprintf("</form></li>");
3436 wprintf("</ul></div>\n");
3438 wprintf("<div id=\"content\" class=\"service\">\n");
3440 /** Display the room list in the user's preferred format */
3441 list_all_rooms_by_floor(listviewpref);
3448 * \brief Set the message expire policy for this room and/or floor
3450 void set_room_policy(void) {
3453 if (IsEmptyStr(bstr("ok_button"))) {
3454 strcpy(WC->ImportantMessage,
3455 _("Cancelled. Changes were not saved."));
3460 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
3461 serv_getln(buf, sizeof buf);
3462 strcpy(WC->ImportantMessage, &buf[4]);
3464 if (WC->axlevel >= 6) {
3465 strcat(WC->ImportantMessage, "<br />\n");
3466 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
3467 serv_getln(buf, sizeof buf);
3468 strcat(WC->ImportantMessage, &buf[4]);