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("</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 and how many? */
479 if ((WC->room_flags & QR_DIRECTORY) && (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) || (file_count == 0) ? "s" : ""));
488 strcpy (with_files, "");
490 stresc(sanitized_roomname, 256, WC->wc_roomname, 1, 1);
491 svprintf("ROOMNAME", WCS_STRING, "%s", sanitized_roomname);
492 svprintf("NUMMSGS", WCS_STRING,
493 _("%d new of %d messages%s"),
494 extract_int(&got[4], 1),
495 extract_int(&got[4], 2),
498 svcallback("ROOMPIC", embed_room_graphic);
499 svcallback("ROOMINFO", readinfo);
500 svcallback("VIEWOMATIC", embed_view_o_matic);
501 svcallback("SEARCHOMATIC", embed_search_o_matic);
502 svcallback("START", offer_start_page);
504 do_template("roombanner");
505 if (navbar_style != navbar_none) {
507 wprintf("<div id=\"navbar\"><ul>");
509 if (navbar_style == navbar_default) wprintf(
510 "<li class=\"ungoto\">"
511 "<a href=\"ungoto\">"
512 "<img align=\"middle\" src=\"static/ungoto2_24x.gif\" border=\"0\">"
513 "<span class=\"navbar_link\">%s</span></A>"
514 "</li>\n", _("Ungoto")
517 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
519 "<li class=\"newmess\">"
520 "<a href=\"readnew\">"
521 "<img align=\"middle\" src=\"static/newmess2_24x.gif\" border=\"0\">"
522 "<span class=\"navbar_link\">%s</span></A>"
523 "</li>\n", _("Read new messages")
527 if (navbar_style == navbar_default) {
528 switch(WC->wc_view) {
529 case VIEW_ADDRESSBOOK:
531 "<li class=\"viewcontacts\">"
532 "<a href=\"readfwd\">"
533 "<img align=\"middle\" src=\"static/viewcontacts_24x.gif\" "
535 "<span class=\"navbar_link\">"
537 "</span></a></li>\n", _("View contacts")
542 "<li class=\"staskday\">"
543 "<a href=\"readfwd?calview=day\">"
544 "<img align=\"middle\" src=\"static/taskday2_24x.gif\" "
546 "<span class=\"navbar_link\">"
548 "</span></a></li>\n", _("Day view")
551 "<li class=\"monthview\">"
552 "<a href=\"readfwd?calview=month\">"
553 "<img align=\"middle\" src=\"static/monthview2_24x.gif\" "
555 "<span class=\"navbar_link\">"
557 "</span></a></li>\n", _("Month view")
562 "<li class=\"monthview\">"
563 "<a href=\"readfwd?calview=month\">"
564 "<img align=\"middle\" src=\"static/monthview2_24x.gif\" "
566 "<span class=\"navbar_link\">"
568 "</span></a></li>\n", _("Calendar list")
573 "<li class=\"taskmanag\">"
574 "<a href=\"readfwd\">"
575 "<img align=\"middle\" src=\"static/taskmanag_24x.gif\" "
577 "<span class=\"navbar_link\">"
579 "</span></a></li>\n", _("View tasks")
584 "<li class=\"viewnotes\">"
585 "<a href=\"readfwd\">"
586 "<img align=\"middle\" src=\"static/viewnotes_24x.gif\" "
588 "<span class=\"navbar_link\">"
590 "</span></a></li>\n", _("View notes")
595 "<li class=\"readallmess\">"
596 "<a href=\"readfwd\">"
597 "<img align=\"middle\" src=\"static/readallmess3_24x.gif\" "
599 "<span class=\"navbar_link\">"
601 "</span></a></li>\n", _("View message list")
606 "<li class=\"readallmess\">"
607 "<a href=\"readfwd\">"
608 "<img align=\"middle\" src=\"static/readallmess3_24x.gif\" "
610 "<span class=\"navbar_link\">"
612 "</span></a></li>\n", _("Wiki home")
617 "<li class=\"readallmess\">"
618 "<a href=\"readfwd\">"
619 "<img align=\"middle\" src=\"static/readallmess3_24x.gif\" "
621 "<span class=\"navbar_link\">"
623 "</span></a></li>\n", _("Read all messages")
629 if (navbar_style == navbar_default) {
630 switch(WC->wc_view) {
631 case VIEW_ADDRESSBOOK:
633 "<li class=\"addnewcontact\">"
634 "<a href=\"display_enter\">"
635 "<img align=\"middle\" src=\"static/addnewcontact_24x.gif\" "
636 "border=\"0\"><span class=\"navbar_link\">"
638 "</span></a></li>\n", _("Add new contact")
643 wprintf("<li class=\"addevent\"><a href=\"display_enter");
644 if (!IsEmptyStr(bstr("year" ))) wprintf("?year=%s", bstr("year"));
645 if (!IsEmptyStr(bstr("month"))) wprintf("?month=%s", bstr("month"));
646 if (!IsEmptyStr(bstr("day" ))) wprintf("?day=%s", bstr("day"));
648 "<img align=\"middle\" src=\"static/addevent_24x.gif\" "
649 "border=\"0\"><span class=\"navbar_link\">"
651 "</span></a></li>\n", _("Add new event")
656 "<li class=\"newmess\">"
657 "<a href=\"display_enter\">"
658 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
659 "border=\"0\"><span class=\"navbar_link\">"
661 "</span></a></li>\n", _("Add new task")
666 "<li class=\"enternewnote\">"
667 "<a href=\"javascript:add_new_note();\">"
668 "<img align=\"middle\" src=\"static/enternewnote_24x.gif\" "
669 "border=\"0\"><span class=\"navbar_link\">"
671 "</span></a></li>\n", _("Add new note")
675 safestrncpy(buf, bstr("page"), sizeof buf);
678 "<li class=\"newmess\">"
679 "<a href=\"display_enter?wikipage=%s\">"
680 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
681 "border=\"0\"><span class=\"navbar_link\">"
683 "</span></a></li>\n", buf, _("Edit this page")
688 "<li class=\"newmess\">"
689 "<a href=\"display_enter\">"
690 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
691 "border=\"0\"><span class=\"navbar_link\">"
693 "</span></a></li>\n", _("Write mail")
698 "<li class=\"newmess\">"
699 "<a href=\"display_enter\">"
700 "<img align=\"middle\" src=\"static/newmess3_24x.gif\" "
701 "border=\"0\"><span class=\"navbar_link\">"
703 "</span></a></li>\n", _("Enter a message")
709 if (navbar_style == navbar_default) wprintf(
710 "<li class=\"skipthisroom\">"
713 "<img align=\"middle\" src=\"static/skipthisroom_24x.gif\" border=\"0\">"
714 "<span class=\"navbar_link\">%s</span></a>"
716 _("Leave all messages marked as unread, go to next room with unread messages"),
720 if (navbar_style == navbar_default) wprintf(
721 "<li class=\"markngo\">"
722 "<a href=\"gotonext\" "
724 "<img align=\"middle\" src=\"static/markngo_24x.gif\" border=\"0\">"
725 "<span class=\"navbar_link\">%s</span></a>"
727 _("Mark all messages as read, go to next room with unread messages"),
731 wprintf("</ul></div>\n");
738 * \brief back end routine to take the session to a new room
739 * \param gname room to go to
742 int gotoroom(char *gname)
745 static long ls = (-1L);
748 /** store ungoto information */
749 strcpy(WC->ugname, WC->wc_roomname);
752 /** move to the new room */
753 serv_printf("GOTO %s", gname);
754 serv_getln(buf, sizeof buf);
758 serv_puts("GOTO _BASEROOM_");
759 serv_getln(buf, sizeof buf);
766 extract_token(WC->wc_roomname, &buf[4], 0, '|', sizeof WC->wc_roomname);
767 WC->room_flags = extract_int(&buf[4], 4);
768 /* highest_msg_read = extract_int(&buf[4],6);
769 maxmsgnum = extract_int(&buf[4],5);
771 WC->is_mailbox = extract_int(&buf[4],7);
772 ls = extract_long(&buf[4], 6);
773 WC->wc_floor = extract_int(&buf[4], 10);
774 WC->wc_view = extract_int(&buf[4], 11);
775 WC->wc_default_view = extract_int(&buf[4], 12);
776 WC->wc_is_trash = extract_int(&buf[4], 13);
777 WC->room_flags2 = extract_int(&buf[4], 14);
780 WC->is_room_aide = WC->is_aide;
782 WC->is_room_aide = (char) extract_int(&buf[4], 8);
784 remove_march(WC->wc_roomname);
785 if (!strcasecmp(gname, "_BASEROOM_"))
793 * \brief Locate the room on the march list which we most want to go to.
795 * is measured given a "weight" of preference based on various factors.
796 * \param desired_floor the room number on the citadel server
797 * \return the roomname
799 char *pop_march(int desired_floor)
801 static char TheRoom[128];
803 int TheOrder = 32767;
806 struct march *mptr = NULL;
808 strcpy(TheRoom, "_BASEROOM_");
809 if (WC->march == NULL)
812 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
814 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
815 weight = weight + 10000;
816 if (mptr->march_floor == desired_floor)
817 weight = weight + 5000;
819 weight = weight + ((128 - (mptr->march_floor)) * 128);
820 weight = weight + (128 - (mptr->march_order));
822 if (weight > TheWeight) {
824 strcpy(TheRoom, mptr->march_name);
825 TheFloor = mptr->march_floor;
826 TheOrder = mptr->march_order;
835 *\brief Goto next room having unread messages.
836 * We want to skip over rooms that the user has already been to, and take the
837 * user back to the lobby when done. The room we end up in is placed in
838 * newroom - which is set to 0 (the lobby) initially.
839 * We start the search in the current room rather than the beginning to prevent
840 * two or more concurrent users from dragging each other back to the same room.
845 struct march *mptr, *mptr2;
850 * First check to see if the march-mode list is already allocated.
851 * If it is, pop the first room off the list and go there.
854 if (WC->march == NULL) {
856 serv_getln(buf, sizeof buf);
858 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
859 extract_token(room_name, buf, 0, '|', sizeof room_name);
860 if (strcasecmp(room_name, WC->wc_roomname)) {
861 mptr = (struct march *) malloc(sizeof(struct march));
863 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
864 mptr->march_floor = extract_int(buf, 2);
865 mptr->march_order = extract_int(buf, 3);
866 if (WC->march == NULL) {
870 while (mptr2->next != NULL)
877 * add _BASEROOM_ to the end of the march list, so the user will end up
878 * in the system base room (usually the Lobby>) at the end of the loop
880 mptr = (struct march *) malloc(sizeof(struct march));
882 mptr->march_order = 0;
883 mptr->march_floor = 0;
884 strcpy(mptr->march_name, "_BASEROOM_");
885 if (WC->march == NULL) {
889 while (mptr2->next != NULL)
894 * ...and remove the room we're currently in, so a <G>oto doesn't make us
895 * walk around in circles
897 remove_march(WC->wc_roomname);
899 if (WC->march != NULL) {
900 strcpy(next_room, pop_march(-1));
902 strcpy(next_room, "_BASEROOM_");
906 smart_goto(next_room);
911 * \brief goto next room
912 * \param next_room next room to go to
914 void smart_goto(char *next_room) {
922 * \brief mark all messages in current room as having been read
924 void slrp_highest(void)
928 serv_puts("SLRP HIGHEST");
929 serv_getln(buf, sizeof buf);
934 * \brief un-goto the previous room
940 if (!strcmp(WC->ugname, "")) {
941 smart_goto(WC->wc_roomname);
944 serv_printf("GOTO %s", WC->ugname);
945 serv_getln(buf, sizeof buf);
947 smart_goto(WC->wc_roomname);
950 if (WC->uglsn >= 0L) {
951 serv_printf("SLRP %ld", WC->uglsn);
952 serv_getln(buf, sizeof buf);
954 strcpy(buf, WC->ugname);
955 strcpy(WC->ugname, "");
964 * \brief Set/clear/read the "self-service list subscribe" flag for a room
966 * \param newval set to 0 to clear, 1 to set, any other value to leave unchanged.
967 * \return return the new value.
970 int self_service(int newval) {
971 int current_value = 0;
977 int flags, floor, order, view, flags2;
980 serv_getln(buf, sizeof buf);
981 if (buf[0] != '2') return(0);
983 extract_token(name, &buf[4], 0, '|', sizeof name);
984 extract_token(password, &buf[4], 1, '|', sizeof password);
985 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
986 flags = extract_int(&buf[4], 3);
987 floor = extract_int(&buf[4], 4);
988 order = extract_int(&buf[4], 5);
989 view = extract_int(&buf[4], 6);
990 flags2 = extract_int(&buf[4], 7);
992 if (flags2 & QR2_SELFLIST) {
1000 flags2 = flags2 | QR2_SELFLIST;
1002 else if (newval == 0) {
1003 flags2 = flags2 & ~QR2_SELFLIST;
1006 return(current_value);
1009 if (newval != current_value) {
1010 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1011 name, password, dirname, flags,
1012 floor, order, view, flags2);
1013 serv_getln(buf, sizeof buf);
1026 * \brief display the form for editing a room
1028 void display_editroom(void)
1033 char remote_room[128];
1036 char er_password[10];
1037 char er_dirname[15];
1038 char er_roomaide[26];
1045 char *not_shared_with;
1048 int floorpolicy = 0;
1050 char pop3_host[128];
1055 if (IsEmptyStr(tab)) tab = "admin";
1058 output_headers(1, 1, 1, 0, 0, 0);
1060 wprintf("<div class=\"fix_scrollbar_bug\">");
1062 /** print the tabbed dialog */
1063 wprintf("<ul class=\"tabbed_dialog\">\n");
1065 wprintf("<li class=\"tablabel ");
1066 if (!strcmp(tab, "admin")) {
1067 wprintf(" tab_cell_label\">");
1068 wprintf(_("Administration"));
1071 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1072 wprintf(_("Administration"));
1077 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1079 wprintf("<li class=\"tablabel ");
1080 if (!strcmp(tab, "config")) {
1081 wprintf(" tab_cell_label\">");
1082 wprintf(_("Configuration"));
1085 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1086 wprintf(_("Configuration"));
1091 wprintf("<li class=\"tablabel ");
1092 if (!strcmp(tab, "expire")) {
1093 wprintf(" tab_cell_label\">");
1094 wprintf(_("Message expire policy"));
1097 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1098 wprintf(_("Message expire policy"));
1103 wprintf("<li class=\"tablabel ");
1104 if (!strcmp(tab, "access")) {
1105 wprintf(" tab_cell_label\">");
1106 wprintf(_("Access controls"));
1109 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1110 wprintf(_("Access controls"));
1115 wprintf("<li class=\"tablabel ");
1116 if (!strcmp(tab, "sharing")) {
1117 wprintf(" tab_cell_label\">");
1118 wprintf(_("Sharing"));
1121 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1122 wprintf(_("Sharing"));
1127 wprintf("<li class=\"tablabel ");
1128 if (!strcmp(tab, "listserv")) {
1129 wprintf(" tab_cell_label\">");
1130 wprintf(_("Mailing list service"));
1133 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1134 wprintf(_("Mailing list service"));
1141 wprintf("<li class=\"tablabel ");
1142 if (!strcmp(tab, "feeds")) {
1143 wprintf(" tab_cell_label\">");
1144 wprintf(_("Remote retrieval"));
1147 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1148 wprintf(_("Remote retrieval"));
1154 /** end tabbed dialog */
1156 /** begin content of whatever tab is open now */
1158 if (!strcmp(tab, "admin")) {
1159 wprintf("<div class=\"tabcontent\">");
1161 "<li><a href=\"delete_room\" "
1162 "onClick=\"return confirm('");
1163 wprintf(_("Are you sure you want to delete this room?"));
1164 wprintf("');\">\n");
1165 wprintf(_("Delete this room"));
1167 "<li><a href=\"display_editroompic\">\n");
1168 wprintf(_("Set or change the icon for this room's banner"));
1170 "<li><a href=\"display_editinfo\">\n");
1171 wprintf(_("Edit this room's Info file"));
1177 if (!strcmp(tab, "config")) {
1178 wprintf("<div class=\"tabcontent\">");
1180 serv_getln(buf, sizeof buf);
1182 if (!strncmp(buf, "550", 3)) {
1183 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1184 _("Higher access is required to access this function.")
1187 else if (buf[0] != '2') {
1188 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1191 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1192 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1193 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1194 er_flags = extract_int(&buf[4], 3);
1195 er_floor = extract_int(&buf[4], 4);
1196 er_flags2 = extract_int(&buf[4], 7);
1198 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1199 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1201 wprintf("<ul><li>");
1202 wprintf(_("Name of room: "));
1203 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1209 wprintf(_("Resides on floor: "));
1210 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1211 if (er_flags & QR_MAILBOX)
1212 wprintf("disabled >\n");
1213 for (i = 0; i < 128; ++i)
1214 if (!IsEmptyStr(floorlist[i])) {
1215 wprintf("<OPTION ");
1217 wprintf("SELECTED ");
1218 wprintf("VALUE=\"%d\">", i);
1219 escputs(floorlist[i]);
1220 wprintf("</OPTION>\n");
1222 wprintf("</select>\n");
1225 wprintf(_("Type of room:"));
1228 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1229 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1230 wprintf("CHECKED ");
1231 wprintf("OnChange=\""
1232 " if (this.form.type[0].checked == true) { "
1233 " this.form.er_floor.disabled = false; "
1236 wprintf(_("Public (automatically appears to everyone)"));
1239 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1240 if ((er_flags & QR_PRIVATE) &&
1241 (er_flags & QR_GUESSNAME))
1242 wprintf("CHECKED ");
1243 wprintf(" OnChange=\""
1244 " if (this.form.type[1].checked == true) { "
1245 " this.form.er_floor.disabled = false; "
1248 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1250 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1251 if ((er_flags & QR_PRIVATE) &&
1252 (er_flags & QR_PASSWORDED))
1253 wprintf("CHECKED ");
1254 wprintf(" OnChange=\""
1255 " if (this.form.type[2].checked == true) { "
1256 " this.form.er_floor.disabled = false; "
1259 wprintf(_("Private - require password: "));
1260 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1263 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1264 if ((er_flags & QR_PRIVATE)
1265 && ((er_flags & QR_GUESSNAME) == 0)
1266 && ((er_flags & QR_PASSWORDED) == 0))
1267 wprintf("CHECKED ");
1268 wprintf(" OnChange=\""
1269 " if (this.form.type[3].checked == true) { "
1270 " this.form.er_floor.disabled = false; "
1273 wprintf(_("Private - invitation only"));
1275 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1276 if (er_flags & QR_MAILBOX)
1277 wprintf("CHECKED ");
1278 wprintf (" OnChange=\""
1279 " if (this.form.type[4].checked == true) { "
1280 " this.form.er_floor.disabled = true; "
1283 wprintf(_("Personal (mailbox for you only)"));
1285 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1287 wprintf(_("If private, cause current users to forget room"));
1289 wprintf("\n</ul>\n");
1291 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1292 if (er_flags & QR_PREFONLY)
1293 wprintf("CHECKED ");
1295 wprintf(_("Preferred users only"));
1297 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1298 if (er_flags & QR_READONLY)
1299 wprintf("CHECKED ");
1301 wprintf(_("Read-only room"));
1303 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1304 if (er_flags2 & QR2_COLLABDEL)
1305 wprintf("CHECKED ");
1307 wprintf(_("All users allowed to post may also delete messages"));
1309 /** directory stuff */
1310 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1311 if (er_flags & QR_DIRECTORY)
1312 wprintf("CHECKED ");
1314 wprintf(_("File directory room"));
1316 wprintf("\n<ul><li>");
1317 wprintf(_("Directory name: "));
1318 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1321 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1322 if (er_flags & QR_UPLOAD)
1323 wprintf("CHECKED ");
1325 wprintf(_("Uploading allowed"));
1327 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1328 if (er_flags & QR_DOWNLOAD)
1329 wprintf("CHECKED ");
1331 wprintf(_("Downloading allowed"));
1333 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1334 if (er_flags & QR_VISDIR)
1335 wprintf("CHECKED ");
1337 wprintf(_("Visible directory"));
1340 /** end of directory stuff */
1342 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1343 if (er_flags & QR_NETWORK)
1344 wprintf("CHECKED ");
1346 wprintf(_("Network shared room"));
1348 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1349 if (er_flags & QR_PERMANENT)
1350 wprintf("CHECKED ");
1352 wprintf(_("Permanent (does not auto-purge)"));
1354 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1355 if (er_flags2 & QR2_SUBJECTREQ)
1356 wprintf("CHECKED ");
1358 wprintf(_("Subject Required (Force users to specify a message subject)"));
1360 /** start of anon options */
1363 wprintf(_("Anonymous messages"));
1366 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1367 if (((er_flags & QR_ANONONLY) == 0)
1368 && ((er_flags & QR_ANONOPT) == 0))
1369 wprintf("CHECKED ");
1371 wprintf(_("No anonymous messages"));
1373 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1374 if (er_flags & QR_ANONONLY)
1375 wprintf("CHECKED ");
1377 wprintf(_("All messages are anonymous"));
1379 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1380 if (er_flags & QR_ANONOPT)
1381 wprintf("CHECKED ");
1383 wprintf(_("Prompt user when entering messages"));
1386 /* end of anon options */
1389 wprintf(_("Room aide: "));
1391 serv_getln(buf, sizeof buf);
1392 if (buf[0] != '2') {
1393 wprintf("<em>%s</em>\n", &buf[4]);
1395 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1396 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1399 wprintf("</ul><CENTER>\n");
1400 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1401 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1403 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1413 /** Sharing the room with other Citadel nodes... */
1414 if (!strcmp(tab, "sharing")) {
1415 wprintf("<div class=\"tabcontent\">");
1417 shared_with = strdup("");
1418 not_shared_with = strdup("");
1420 /** Learn the current configuration */
1421 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1422 serv_getln(buf, sizeof buf);
1423 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1424 extract_token(node, buf, 0, '|', sizeof node);
1425 not_shared_with = realloc(not_shared_with,
1426 strlen(not_shared_with) + 32);
1427 strcat(not_shared_with, node);
1428 strcat(not_shared_with, "\n");
1432 serv_getln(buf, sizeof buf);
1433 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1434 extract_token(cmd, buf, 0, '|', sizeof cmd);
1435 extract_token(node, buf, 1, '|', sizeof node);
1436 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1437 if (!strcasecmp(cmd, "ignet_push_share")) {
1438 shared_with = realloc(shared_with,
1439 strlen(shared_with) + 32);
1440 strcat(shared_with, node);
1441 if (!IsEmptyStr(remote_room)) {
1442 strcat(shared_with, "|");
1443 strcat(shared_with, remote_room);
1445 strcat(shared_with, "\n");
1449 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1450 extract_token(buf, shared_with, i, '\n', sizeof buf);
1451 extract_token(node, buf, 0, '|', sizeof node);
1452 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1453 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1454 if (!strcasecmp(node, cmd)) {
1455 remove_token(not_shared_with, j, '\n');
1460 /** Display the stuff */
1461 wprintf("<CENTER><br />"
1462 "<table border=1 cellpadding=5><tr>"
1464 wprintf(_("Shared with"));
1465 wprintf("</I></B></td>"
1467 wprintf(_("Not shared with"));
1468 wprintf("</I></B></td></tr>\n"
1469 "<tr><td VALIGN=TOP>\n");
1471 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1472 wprintf(_("Remote node name"));
1473 wprintf("</td><td>");
1474 wprintf(_("Remote room name"));
1475 wprintf("</td><td>");
1476 wprintf(_("Actions"));
1477 wprintf("</td></tr>\n");
1479 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1480 extract_token(buf, shared_with, i, '\n', sizeof buf);
1481 extract_token(node, buf, 0, '|', sizeof node);
1482 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1483 if (!IsEmptyStr(node)) {
1484 wprintf("<form method=\"POST\" action=\"netedit\">");
1485 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1486 wprintf("<tr><td>%s</td>\n", node);
1489 if (!IsEmptyStr(remote_room)) {
1490 escputs(remote_room);
1496 wprintf("<input type=\"hidden\" NAME=\"line\" "
1497 "VALUE=\"ignet_push_share|");
1499 if (!IsEmptyStr(remote_room)) {
1501 urlescputs(remote_room);
1504 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1505 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1506 wprintf("<input type=\"submit\" "
1507 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1508 wprintf("</td></tr></form>\n");
1512 wprintf("</table>\n");
1513 wprintf("</td><td VALIGN=TOP>\n");
1514 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1515 wprintf(_("Remote node name"));
1516 wprintf("</td><td>");
1517 wprintf(_("Remote room name"));
1518 wprintf("</td><td>");
1519 wprintf(_("Actions"));
1520 wprintf("</td></tr>\n");
1522 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1523 extract_token(node, not_shared_with, i, '\n', sizeof node);
1524 if (!IsEmptyStr(node)) {
1525 wprintf("<form method=\"POST\" action=\"netedit\">");
1526 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1527 wprintf("<tr><td>");
1530 "<input type=\"INPUT\" "
1534 wprintf("<input type=\"hidden\" "
1536 "VALUE=\"ignet_push_share|");
1539 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1540 "VALUE=\"sharing\">\n");
1541 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1542 "VALUE=\"add\">\n");
1543 wprintf("<input type=\"submit\" "
1544 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1545 wprintf("</td></tr></form>\n");
1549 wprintf("</table>\n");
1550 wprintf("</td></tr>"
1551 "</table></CENTER><br />\n"
1552 "<I><B>%s</B><ul><li>", _("Notes:"));
1553 wprintf(_("When sharing a room, "
1554 "it must be shared from both ends. Adding a node to "
1555 "the 'shared' list sends messages out, but in order to"
1556 " receive messages, the other nodes must be configured"
1557 " to send messages out to your system as well. "
1558 "<li>If the remote room name is blank, it is assumed "
1559 "that the room name is identical on the remote node."
1560 "<li>If the remote room name is different, the remote "
1561 "node must also configure the name of the room here."
1568 /** Mailing list management */
1569 if (!strcmp(tab, "listserv")) {
1570 wprintf("<div class=\"tabcontent\">");
1572 wprintf("<br /><center>"
1573 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1574 "<tr><td VALIGN=TOP>");
1576 wprintf(_("<i>The contents of this room are being "
1577 "mailed <b>as individual messages</b> "
1578 "to the following list recipients:"
1579 "</i><br /><br />\n"));
1582 serv_getln(buf, sizeof buf);
1583 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1584 extract_token(cmd, buf, 0, '|', sizeof cmd);
1585 if (!strcasecmp(cmd, "listrecp")) {
1586 extract_token(recp, buf, 1, '|', sizeof recp);
1589 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1592 wprintf(_("(remove)"));
1593 wprintf("</A><br />");
1596 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1597 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1598 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1599 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1600 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1601 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1602 wprintf("</form>\n");
1604 wprintf("</td><td VALIGN=TOP>\n");
1606 wprintf(_("<i>The contents of this room are being "
1607 "mailed <b>in digest form</b> "
1608 "to the following list recipients:"
1609 "</i><br /><br />\n"));
1612 serv_getln(buf, sizeof buf);
1613 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1614 extract_token(cmd, buf, 0, '|', sizeof cmd);
1615 if (!strcasecmp(cmd, "digestrecp")) {
1616 extract_token(recp, buf, 1, '|', sizeof recp);
1619 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1623 wprintf(_("(remove)"));
1624 wprintf("</A><br />");
1627 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1628 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1629 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1630 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1631 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1632 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1633 wprintf("</form>\n");
1635 wprintf("</td></tr></table>\n");
1637 /** Pop open an address book -- begin **/
1638 wprintf("<div align=right>"
1639 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1641 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1646 _("Add recipients from Contacts or other address books"),
1647 _("Add recipients from Contacts or other address books")
1649 /** Pop open an address book -- end **/
1652 if (self_service(999) == 1) {
1653 wprintf(_("This room is configured to allow "
1654 "self-service subscribe/unsubscribe requests."));
1655 wprintf("<a href=\"toggle_self_service?newval=0&tab=listserv\">");
1656 wprintf(_("Click to disable."));
1657 wprintf("</A><br />\n");
1658 wprintf(_("The URL for subscribe/unsubscribe is: "));
1659 wprintf("<TT>%s://%s/listsub</TT><br />\n",
1660 (is_https ? "https" : "http"),
1664 wprintf(_("This room is <i>not</i> configured to allow "
1665 "self-service subscribe/unsubscribe requests."));
1666 wprintf(" <a href=\"toggle_self_service?newval=1&"
1668 wprintf(_("Click to enable."));
1669 wprintf("</A><br />\n");
1673 wprintf("</CENTER>\n");
1678 /** Configuration of The Dreaded Auto-Purger */
1679 if (!strcmp(tab, "expire")) {
1680 wprintf("<div class=\"tabcontent\">");
1682 serv_puts("GPEX room");
1683 serv_getln(buf, sizeof buf);
1684 if (!strncmp(buf, "550", 3)) {
1685 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1686 _("Higher access is required to access this function.")
1689 else if (buf[0] != '2') {
1690 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1693 roompolicy = extract_int(&buf[4], 0);
1694 roomvalue = extract_int(&buf[4], 1);
1696 serv_puts("GPEX floor");
1697 serv_getln(buf, sizeof buf);
1698 if (buf[0] == '2') {
1699 floorpolicy = extract_int(&buf[4], 0);
1700 floorvalue = extract_int(&buf[4], 1);
1703 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1704 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1705 wprintf("<table border=0 cellspacing=5>\n");
1706 wprintf("<tr><td>");
1707 wprintf(_("Message expire policy for this room"));
1709 escputs(WC->wc_roomname);
1710 wprintf(")</td><td>");
1711 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1712 ((roompolicy == 0) ? "CHECKED" : "") );
1713 wprintf(_("Use the default policy for this floor"));
1714 wprintf("<br />\n");
1715 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1716 ((roompolicy == 1) ? "CHECKED" : "") );
1717 wprintf(_("Never automatically expire messages"));
1718 wprintf("<br />\n");
1719 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1720 ((roompolicy == 2) ? "CHECKED" : "") );
1721 wprintf(_("Expire by message count"));
1722 wprintf("<br />\n");
1723 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1724 ((roompolicy == 3) ? "CHECKED" : "") );
1725 wprintf(_("Expire by message age"));
1727 wprintf(_("Number of messages or days: "));
1728 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1729 wprintf("</td></tr>\n");
1731 if (WC->axlevel >= 6) {
1732 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1733 wprintf("<tr><td>");
1734 wprintf(_("Message expire policy for this floor"));
1736 escputs(floorlist[WC->wc_floor]);
1737 wprintf(")</td><td>");
1738 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1739 ((floorpolicy == 0) ? "CHECKED" : "") );
1740 wprintf(_("Use the system default"));
1741 wprintf("<br />\n");
1742 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1743 ((floorpolicy == 1) ? "CHECKED" : "") );
1744 wprintf(_("Never automatically expire messages"));
1745 wprintf("<br />\n");
1746 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1747 ((floorpolicy == 2) ? "CHECKED" : "") );
1748 wprintf(_("Expire by message count"));
1749 wprintf("<br />\n");
1750 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1751 ((floorpolicy == 3) ? "CHECKED" : "") );
1752 wprintf(_("Expire by message age"));
1754 wprintf(_("Number of messages or days: "));
1755 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1759 wprintf("<CENTER>\n");
1760 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1761 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1763 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1764 wprintf("</CENTER></td><tr>\n");
1766 wprintf("</table>\n"
1767 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1775 /** Access controls */
1776 if (!strcmp(tab, "access")) {
1777 wprintf("<div class=\"tabcontent\">");
1782 /** Fetch messages from remote locations */
1783 if (!strcmp(tab, "feeds")) {
1784 wprintf("<div class=\"tabcontent\">");
1787 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1788 wprintf("</i><br />\n");
1790 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1791 "<tr class=\"even\"><th>");
1792 wprintf(_("Remote host"));
1793 wprintf("</th><th>");
1794 wprintf(_("User name"));
1795 wprintf("</th><th>");
1796 wprintf(_("Password"));
1797 wprintf("</th><th>");
1798 wprintf(_("Keep messages on server?"));
1799 wprintf("</th><th> </th></tr>");
1802 serv_getln(buf, sizeof buf);
1804 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1805 extract_token(cmd, buf, 0, '|', sizeof cmd);
1806 if (!strcasecmp(cmd, "pop3client")) {
1807 safestrncpy(recp, &buf[11], sizeof recp);
1810 wprintf("<tr class=\"%s\">",
1811 (bg ? "even" : "odd")
1815 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1820 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1824 wprintf("<td>*****</td>"); /* Don't show the password */
1826 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1828 wprintf("<td class=\"button_link\">");
1829 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
1832 wprintf(_("(remove)"));
1833 wprintf("</a></td>");
1839 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1841 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1842 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1843 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1845 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1848 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1851 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1854 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1857 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1858 wprintf("</td></tr>");
1859 wprintf("</form></table>\n");
1864 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
1865 wprintf("</i><br />\n");
1867 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1868 "<tr class=\"even\"><th>");
1869 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1870 wprintf(_("Feed URL"));
1871 wprintf("</th><th>");
1872 wprintf("</th></tr>");
1875 serv_getln(buf, sizeof buf);
1877 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1878 extract_token(cmd, buf, 0, '|', sizeof cmd);
1879 if (!strcasecmp(cmd, "rssclient")) {
1880 safestrncpy(recp, &buf[10], sizeof recp);
1883 wprintf("<tr class=\"%s\">",
1884 (bg ? "even" : "odd")
1888 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1892 wprintf("<td class=\"button_link\">");
1893 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
1896 wprintf(_("(remove)"));
1897 wprintf("</a></td>");
1903 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1905 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1906 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
1907 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
1909 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
1910 "maxlength=\"256\" name=\"line_pop3host\">\n");
1913 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
1914 wprintf("</td></tr>");
1915 wprintf("</form></table>\n");
1921 /** end content of whatever tab is open now */
1922 wprintf("</div>\n");
1924 address_book_popup();
1930 * \brief Toggle self-service list subscription
1932 void toggle_self_service(void) {
1935 newval = atoi(bstr("newval"));
1936 self_service(newval);
1943 * \brief save new parameters for a room
1949 char er_password[10];
1950 char er_dirname[15];
1951 char er_roomaide[26];
1954 int er_listingorder;
1960 if (IsEmptyStr(bstr("ok_button"))) {
1961 strcpy(WC->ImportantMessage,
1962 _("Cancelled. Changes were not saved."));
1967 serv_getln(buf, sizeof buf);
1969 if (buf[0] != '2') {
1970 strcpy(WC->ImportantMessage, &buf[4]);
1974 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1975 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1976 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1977 er_flags = extract_int(&buf[4], 3);
1978 er_listingorder = extract_int(&buf[4], 5);
1979 er_defaultview = extract_int(&buf[4], 6);
1980 er_flags2 = extract_int(&buf[4], 7);
1982 strcpy(er_roomaide, bstr("er_roomaide"));
1983 if (IsEmptyStr(er_roomaide)) {
1985 serv_getln(buf, sizeof buf);
1986 if (buf[0] != '2') {
1987 strcpy(er_roomaide, "");
1989 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1992 strcpy(buf, bstr("er_name"));
1994 if (!IsEmptyStr(buf)) {
1995 strcpy(er_name, buf);
1998 strcpy(buf, bstr("er_password"));
2000 if (!IsEmptyStr(buf))
2001 strcpy(er_password, buf);
2003 strcpy(buf, bstr("er_dirname"));
2005 if (!IsEmptyStr(buf))
2006 strcpy(er_dirname, buf);
2008 strcpy(buf, bstr("type"));
2009 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2011 if (!strcmp(buf, "invonly")) {
2012 er_flags |= (QR_PRIVATE);
2014 if (!strcmp(buf, "hidden")) {
2015 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2017 if (!strcmp(buf, "passworded")) {
2018 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2020 if (!strcmp(buf, "personal")) {
2021 er_flags |= QR_MAILBOX;
2023 er_flags &= ~QR_MAILBOX;
2026 if (!strcmp(bstr("prefonly"), "yes")) {
2027 er_flags |= QR_PREFONLY;
2029 er_flags &= ~QR_PREFONLY;
2032 if (!strcmp(bstr("readonly"), "yes")) {
2033 er_flags |= QR_READONLY;
2035 er_flags &= ~QR_READONLY;
2039 if (!strcmp(bstr("collabdel"), "yes")) {
2040 er_flags2 |= QR2_COLLABDEL;
2042 er_flags2 &= ~QR2_COLLABDEL;
2045 if (!strcmp(bstr("permanent"), "yes")) {
2046 er_flags |= QR_PERMANENT;
2048 er_flags &= ~QR_PERMANENT;
2051 if (!strcmp(bstr("subjectreq"), "yes")) {
2052 er_flags2 |= QR2_SUBJECTREQ;
2054 er_flags2 &= ~QR2_SUBJECTREQ;
2057 if (!strcmp(bstr("network"), "yes")) {
2058 er_flags |= QR_NETWORK;
2060 er_flags &= ~QR_NETWORK;
2063 if (!strcmp(bstr("directory"), "yes")) {
2064 er_flags |= QR_DIRECTORY;
2066 er_flags &= ~QR_DIRECTORY;
2069 if (!strcmp(bstr("ulallowed"), "yes")) {
2070 er_flags |= QR_UPLOAD;
2072 er_flags &= ~QR_UPLOAD;
2075 if (!strcmp(bstr("dlallowed"), "yes")) {
2076 er_flags |= QR_DOWNLOAD;
2078 er_flags &= ~QR_DOWNLOAD;
2081 if (!strcmp(bstr("visdir"), "yes")) {
2082 er_flags |= QR_VISDIR;
2084 er_flags &= ~QR_VISDIR;
2087 strcpy(buf, bstr("anon"));
2089 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2090 if (!strcmp(buf, "anononly"))
2091 er_flags |= QR_ANONONLY;
2092 if (!strcmp(buf, "anon2"))
2093 er_flags |= QR_ANONOPT;
2096 if (!strcmp(bstr("bump"), "yes"))
2099 er_floor = atoi(bstr("er_floor"));
2101 sprintf(buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2102 er_name, er_password, er_dirname, er_flags, bump, er_floor,
2103 er_listingorder, er_defaultview, er_flags2);
2105 serv_getln(buf, sizeof buf);
2106 if (buf[0] != '2') {
2107 strcpy(WC->ImportantMessage, &buf[4]);
2113 if (!IsEmptyStr(er_roomaide)) {
2114 sprintf(buf, "SETA %s", er_roomaide);
2116 serv_getln(buf, sizeof buf);
2117 if (buf[0] != '2') {
2118 strcpy(WC->ImportantMessage, &buf[4]);
2119 display_main_menu();
2124 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2131 * \brief Display form for Invite, Kick, and show Who Knows a room
2133 void do_invt_kick(void) {
2134 char buf[SIZ], room[SIZ], username[SIZ];
2137 serv_getln(buf, sizeof buf);
2139 if (buf[0] != '2') {
2143 extract_token(room, &buf[4], 0, '|', sizeof room);
2145 strcpy(username, bstr("username"));
2147 if (!IsEmptyStr(bstr("kick_button"))) {
2148 sprintf(buf, "KICK %s", username);
2150 serv_getln(buf, sizeof buf);
2152 if (buf[0] != '2') {
2153 strcpy(WC->ImportantMessage, &buf[4]);
2155 sprintf(WC->ImportantMessage,
2156 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2161 if (!IsEmptyStr(bstr("invite_button"))) {
2162 sprintf(buf, "INVT %s", username);
2164 serv_getln(buf, sizeof buf);
2166 if (buf[0] != '2') {
2167 strcpy(WC->ImportantMessage, &buf[4]);
2169 sprintf(WC->ImportantMessage,
2170 _("<B><I>User %s invited to room %s.</I></B>\n"),
2181 * \brief Display form for Invite, Kick, and show Who Knows a room
2183 void display_whok(void)
2185 char buf[SIZ], room[SIZ], username[SIZ];
2188 serv_getln(buf, sizeof buf);
2190 if (buf[0] != '2') {
2194 extract_token(room, &buf[4], 0, '|', sizeof room);
2197 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2198 wprintf(_("The users listed below have access to this room. "
2199 "To remove a user from the access list, select the user "
2200 "name from the list and click 'Kick'."));
2201 wprintf("<br /><br />");
2203 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2204 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2205 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2206 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2208 serv_getln(buf, sizeof buf);
2209 if (buf[0] == '1') {
2210 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2211 extract_token(username, buf, 0, '|', sizeof username);
2212 wprintf("<OPTION>");
2217 wprintf("</select><br />\n");
2219 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2220 wprintf("</form></CENTER>\n");
2222 wprintf("</td><td>");
2223 wprintf(_("To grant another user access to this room, enter the "
2224 "user name in the box below and click 'Invite'."));
2225 wprintf("<br /><br />");
2227 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2228 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2229 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2230 wprintf(_("Invite:"));
2232 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2233 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2234 "<input type=\"submit\" value=\"%s\">"
2235 "</form></CENTER>\n", _("Invite"));
2236 /** Pop open an address book -- begin **/
2238 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2240 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2243 _("Users"), _("Users")
2245 /** Pop open an address book -- end **/
2247 wprintf("</td></tr></table>\n");
2248 address_book_popup();
2255 * \brief display the form for entering a new room
2257 void display_entroom(void)
2262 serv_puts("CRE8 0");
2263 serv_getln(buf, sizeof buf);
2265 if (buf[0] != '2') {
2266 strcpy(WC->ImportantMessage, &buf[4]);
2267 display_main_menu();
2271 output_headers(1, 1, 1, 0, 0, 0);
2273 svprintf("BOXTITLE", WCS_STRING, _("Create a new room"));
2274 do_template("beginbox");
2276 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2277 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2279 wprintf("<table class=\"altern\"> ");
2281 wprintf("<tr class=\"even\"><td>");
2282 wprintf(_("Name of room: "));
2283 wprintf("</td><td>");
2284 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2285 wprintf("</td></tr>");
2287 wprintf("<tr class=\"odd\"><td>");
2288 wprintf(_("Resides on floor: "));
2289 wprintf("</td><td>");
2291 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2292 for (i = 0; i < 128; ++i)
2293 if (!IsEmptyStr(floorlist[i])) {
2294 wprintf("<option ");
2295 wprintf("value=\"%d\">", i);
2296 escputs(floorlist[i]);
2297 wprintf("</option>\n");
2299 wprintf("</select>\n");
2300 wprintf("</td></tr>");
2303 * Our clever little snippet of JavaScript automatically selects
2304 * a public room if the view is set to Bulletin Board or wiki, and
2305 * it selects a mailbox room otherwise. The user can override this,
2306 * of course. We also disable the floor selector for mailboxes.
2308 wprintf("<tr class=\"even\"><td>");
2309 wprintf(_("Default view for room: "));
2310 wprintf("</td><td>");
2311 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2312 " if ( (this.form.er_view.value == 0) "
2313 " || (this.form.er_view.value == 6) ) { "
2314 " this.form.type[0].checked=true; "
2315 " this.form.er_floor.disabled = false; "
2318 " this.form.type[4].checked=true; "
2319 " this.form.er_floor.disabled = true; "
2322 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2323 if (is_view_allowed_as_default(i)) {
2324 wprintf("<option %s value=\"%d\">",
2325 ((i == 0) ? "selected" : ""), i );
2326 escputs(viewdefs[i]);
2327 wprintf("</option>\n");
2330 wprintf("</select>\n");
2331 wprintf("</td></tr>");
2333 wprintf("<tr class=\"even\"><td>");
2334 wprintf(_("Type of room:"));
2335 wprintf("</td><td>");
2336 wprintf("<ul class=\"adminlist\">\n");
2338 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2339 wprintf("CHECKED OnChange=\""
2340 " if (this.form.type[0].checked == true) { "
2341 " this.form.er_floor.disabled = false; "
2344 wprintf(_("Public (automatically appears to everyone)"));
2347 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2348 " if (this.form.type[1].checked == true) { "
2349 " this.form.er_floor.disabled = false; "
2352 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2355 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2356 " if (this.form.type[2].checked == true) { "
2357 " this.form.er_floor.disabled = false; "
2360 wprintf(_("Private - require password: "));
2361 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2364 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2365 " if (this.form.type[3].checked == true) { "
2366 " this.form.er_floor.disabled = false; "
2369 wprintf(_("Private - invitation only"));
2372 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2374 " if (this.form.type[4].checked == true) { "
2375 " this.form.er_floor.disabled = true; "
2378 wprintf(_("Personal (mailbox for you only)"));
2381 wprintf("\n</ul>\n");
2382 wprintf("</td></tr></table>\n");
2384 wprintf("<div class=\"buttons\">\n");
2385 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2387 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2388 wprintf("</div>\n");
2389 wprintf("</form>\n<hr />");
2390 serv_printf("MESG roomaccess");
2391 serv_getln(buf, sizeof buf);
2392 if (buf[0] == '1') {
2396 do_template("endbox");
2405 * \brief support function for entroom() -- sets the default view
2407 void er_set_default_view(int newview) {
2420 serv_getln(buf, sizeof buf);
2421 if (buf[0] != '2') return;
2423 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2424 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2425 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2426 rm_bits1 = extract_int(&buf[4], 3);
2427 rm_floor = extract_int(&buf[4], 4);
2428 rm_listorder = extract_int(&buf[4], 5);
2429 rm_bits2 = extract_int(&buf[4], 7);
2431 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2432 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2433 rm_listorder, newview, rm_bits2
2435 serv_getln(buf, sizeof buf);
2441 * \brief enter a new room
2448 char er_password[SIZ];
2453 if (IsEmptyStr(bstr("ok_button"))) {
2454 strcpy(WC->ImportantMessage,
2455 _("Cancelled. No new room was created."));
2456 display_main_menu();
2459 strcpy(er_name, bstr("er_name"));
2460 strcpy(er_type, bstr("type"));
2461 strcpy(er_password, bstr("er_password"));
2462 er_floor = atoi(bstr("er_floor"));
2463 er_view = atoi(bstr("er_view"));
2466 if (!strcmp(er_type, "hidden"))
2468 if (!strcmp(er_type, "passworded"))
2470 if (!strcmp(er_type, "invonly"))
2472 if (!strcmp(er_type, "personal"))
2475 sprintf(buf, "CRE8 1|%s|%d|%s|%d|%d|%d",
2476 er_name, er_num_type, er_password, er_floor, 0, er_view);
2478 serv_getln(buf, sizeof buf);
2479 if (buf[0] != '2') {
2480 strcpy(WC->ImportantMessage, &buf[4]);
2481 display_main_menu();
2485 do_change_view(er_view); /* Now go there */
2490 * \brief display the screen to enter a private room
2492 void display_private(char *rname, int req_pass)
2494 output_headers(1, 1, 1, 0, 0, 0);
2496 svprintf("BOXTITLE", WCS_STRING, _("Go to a hidden room"));
2497 do_template("beginbox");
2500 wprintf(_("If you know the name of a hidden (guess-name) or "
2501 "passworded room, you can enter that room by typing "
2502 "its name below. Once you gain access to a private "
2503 "room, it will appear in your regular room listings "
2504 "so you don't have to keep returning here."));
2507 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2508 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2510 wprintf("<table class=\"altern\"> "
2511 "<tr class=\"even\"><td>");
2512 wprintf(_("Enter room name:"));
2514 "<input type=\"text\" name=\"gr_name\" "
2515 "value=\"%s\" maxlength=\"128\">\n", rname);
2518 wprintf("</td></tr><tr class=\"odd\"><td>");
2519 wprintf(_("Enter room password:"));
2520 wprintf("</td><td>");
2521 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2523 wprintf("</td></tr></table>\n");
2525 wprintf("<div class=\"buttons\">\n");
2526 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2528 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2532 wprintf("</div></form>\n");
2534 do_template("endbox");
2540 * \brief goto a private room
2542 void goto_private(void)
2547 if (IsEmptyStr(bstr("ok_button"))) {
2548 display_main_menu();
2551 strcpy(hold_rm, WC->wc_roomname);
2552 strcpy(buf, "GOTO ");
2553 strcat(buf, bstr("gr_name"));
2555 strcat(buf, bstr("gr_pass"));
2557 serv_getln(buf, sizeof buf);
2559 if (buf[0] == '2') {
2560 smart_goto(bstr("gr_name"));
2563 if (!strncmp(buf, "540", 3)) {
2564 display_private(bstr("gr_name"), 1);
2567 output_headers(1, 1, 1, 0, 0, 0);
2568 wprintf("%s\n", &buf[4]);
2575 * \brief display the screen to zap a room
2577 void display_zap(void)
2579 output_headers(1, 1, 2, 0, 0, 0);
2581 wprintf("<div id=\"banner\">\n");
2583 wprintf(_("Zap (forget/unsubscribe) the current room"));
2585 wprintf("</div>\n");
2587 wprintf("<div id=\"content\" class=\"service\">\n");
2589 wprintf(_("If you select this option, <em>%s</em> will "
2590 "disappear from your room list. Is this what you wish "
2591 "to do?<br />\n"), WC->wc_roomname);
2593 wprintf("<form method=\"POST\" action=\"zap\">\n");
2594 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%ld\">\n", WC->nonce);
2595 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2597 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2598 wprintf("</form>\n");
2609 char final_destination[SIZ];
2612 * If the forget-room routine fails for any reason, we fall back
2613 * to the current room; otherwise, we go to the Lobby
2615 strcpy(final_destination, WC->wc_roomname);
2617 if (!IsEmptyStr(bstr("ok_button"))) {
2618 serv_printf("GOTO %s", WC->wc_roomname);
2619 serv_getln(buf, sizeof buf);
2620 if (buf[0] == '2') {
2622 serv_getln(buf, sizeof buf);
2623 if (buf[0] == '2') {
2624 strcpy(final_destination, "_BASEROOM_");
2628 smart_goto(final_destination);
2634 * \brief Delete the current room
2636 void delete_room(void)
2640 serv_puts("KILL 1");
2641 serv_getln(buf, sizeof buf);
2642 if (buf[0] != '2') {
2643 strcpy(WC->ImportantMessage, &buf[4]);
2644 display_main_menu();
2647 smart_goto("_BASEROOM_");
2654 * \brief Perform changes to a room's network configuration
2656 void netedit(void) {
2666 if (!IsEmptyStr(bstr("line_pop3host"))) {
2667 strcpy(line, bstr("prefix"));
2668 strcat(line, bstr("line_pop3host"));
2670 strcat(line, bstr("line_pop3user"));
2672 strcat(line, bstr("line_pop3pass"));
2674 strcat(line, atoi(bstr("line_pop3keep")) ? "1" : "0" );
2675 strcat(line, bstr("suffix"));
2677 else if (!IsEmptyStr(bstr("line"))) {
2678 strcpy(line, bstr("prefix"));
2679 strcat(line, bstr("line"));
2680 strcat(line, bstr("suffix"));
2695 serv_getln(buf, sizeof buf);
2696 if (buf[0] != '1') {
2702 /** This loop works for add *or* remove. Spiffy, eh? */
2703 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2704 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2705 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2706 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2707 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2708 if ( (strcasecmp(cmpa0, cmpb0))
2709 || (strcasecmp(cmpa1, cmpb1)) ) {
2710 fprintf(fp, "%s\n", buf);
2716 serv_getln(buf, sizeof buf);
2717 if (buf[0] != '4') {
2723 while (fgets(buf, sizeof buf, fp) != NULL) {
2724 buf[strlen(buf)-1] = 0;
2728 if (!IsEmptyStr(bstr("add_button"))) {
2729 num_addrs = num_tokens(bstr("line"), ',');
2730 if (num_addrs < 2) {
2731 /* just adding one node or address */
2735 /* adding multiple addresses separated by commas */
2736 for (i=0; i<num_addrs; ++i) {
2737 strcpy(line, bstr("prefix"));
2738 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2741 strcat(line, bstr("suffix"));
2755 * \brief Convert a room name to a folder-ish-looking name.
2756 * \param folder the folderish name
2757 * \param room the room name
2758 * \param floor the floor name
2759 * \param is_mailbox is it a mailbox?
2761 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2766 * For mailboxes, just do it straight...
2769 sprintf(folder, "My folders|%s", room);
2773 * Otherwise, prefix the floor name as a "public folders" moniker
2776 sprintf(folder, "%s|%s", floorlist[floor], room);
2780 * Replace "\" characters with "|" for pseudo-folder-delimiting
2782 len = strlen (folder);
2783 for (i=0; i<len; ++i) {
2784 if (folder[i] == '\\') folder[i] = '|';
2792 * \brief Back end for change_view()
2793 * \param newview set newview???
2795 void do_change_view(int newview) {
2798 serv_printf("VIEW %d", newview);
2799 serv_getln(buf, sizeof buf);
2800 WC->wc_view = newview;
2801 smart_goto(WC->wc_roomname);
2807 * \brief Change the view for this room
2809 void change_view(void) {
2812 view = atol(bstr("view"));
2813 do_change_view(view);
2818 * \brief One big expanded tree list view --- like a folder list
2819 * \param fold the folder to view
2820 * \param max_folders how many folders???
2821 * \param num_floors hom many floors???
2823 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
2827 int has_subfolders = 0;
2830 parents = malloc(max_folders * sizeof(int));
2832 /** BEGIN TREE MENU */
2833 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
2835 /** include NanoTree */
2836 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
2838 /** initialize NanoTree */
2839 wprintf("<script type=\"text/javascript\"> \n"
2840 " showRootNode = false; \n"
2841 " sortNodes = false; \n"
2842 " dragable = false; \n"
2844 " function standardClick(treeNode) { \n"
2847 " var closedGif = 'static/folder_closed.gif'; \n"
2848 " var openGif = 'static/folder_open.gif'; \n"
2850 " rootNode = new TreeNode(1, 'root node - hide'); \n"
2854 for (i=0; i<max_folders; ++i) {
2857 if ((i+1) < max_folders) {
2859 len = strlen(fold[i].name);
2860 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
2861 && (fold[i+1].name[len] == '|') ) {
2866 levels = num_tokens(fold[i].name, '|');
2867 parents[levels] = i;
2869 wprintf("var node%d = new TreeNode(%d, '", i, i);
2871 if (fold[i].selectable) {
2872 wprintf("<a href=\"dotgoto?room=");
2873 urlescputs(fold[i].room);
2878 wprintf("<span class=\"roomlist_floor\">");
2880 else if (fold[i].hasnewmsgs) {
2881 wprintf("<span class=\"roomlist_new\">");
2884 wprintf("<span class=\"roomlist_old\">");
2886 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
2891 if (has_subfolders) {
2892 wprintf("new Array(closedGif, openGif)");
2894 else if (fold[i].view == VIEW_ADDRESSBOOK) {
2895 wprintf("'static/viewcontacts_16x.gif'");
2897 else if (fold[i].view == VIEW_CALENDAR) {
2898 wprintf("'static/calarea_16x.gif'");
2900 else if (fold[i].view == VIEW_CALBRIEF) {
2901 wprintf("'static/calarea_16x.gif'");
2903 else if (fold[i].view == VIEW_TASKS) {
2904 wprintf("'static/taskmanag_16x.gif'");
2906 else if (fold[i].view == VIEW_NOTES) {
2907 wprintf("'static/storenotes_16x.gif'");
2909 else if (fold[i].view == VIEW_MAILBOX) {
2910 wprintf("'static/privatemess_16x.gif'");
2913 wprintf("'static/chatrooms_16x.gif'");
2916 urlescputs(fold[i].name);
2920 wprintf("rootNode.addChild(node%d);\n", i);
2923 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
2927 wprintf("container = document.getElementById('roomlist_div'); \n"
2933 /** END TREE MENU */
2937 * \brief Boxes and rooms and lists ... oh my!
2938 * \param fold the folder to view
2939 * \param max_folders how many folders???
2940 * \param num_floors hom many floors???
2942 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
2944 char floor_name[256];
2945 char old_floor_name[256];
2947 int levels, oldlevels;
2950 static int columns = 3;
2951 int boxes_per_column = 0;
2952 int current_column = 0;
2955 strcpy(floor_name, "");
2956 strcpy(old_floor_name, "");
2959 while (nf % columns != 0) ++nf;
2960 boxes_per_column = (nf / columns);
2961 if (boxes_per_column < 1) boxes_per_column = 1;
2963 /** Outer table (for columnization) */
2964 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
2965 "<tr><td valign=top>");
2969 for (i=0; i<max_folders; ++i) {
2971 levels = num_tokens(fold[i].name, '|');
2972 extract_token(floor_name, fold[i].name, 0,
2973 '|', sizeof floor_name);
2975 if ( (strcasecmp(floor_name, old_floor_name))
2976 && (!IsEmptyStr(old_floor_name)) ) {
2978 do_template("endbox");
2982 if ((num_boxes % boxes_per_column) == 0) {
2984 if (current_column < columns) {
2985 wprintf("</td><td valign=top>\n");
2989 strcpy(old_floor_name, floor_name);
2992 /** Begin inner box */
2993 stresc(boxtitle, 256, floor_name, 1, 0);
2994 svprintf("BOXTITLE", WCS_STRING, boxtitle);
2995 do_template("beginbox");
3002 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3003 if (fold[i].selectable) {
3004 wprintf("<a href=\"dotgoto?room=");
3005 urlescputs(fold[i].room);
3011 if (fold[i].hasnewmsgs) {
3012 wprintf("<span class=\"roomlist_new\">");
3015 wprintf("<span class=\"roomlist_old\">");
3017 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3020 if (fold[i].selectable) {
3026 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3027 wprintf(" (INBOX)");
3029 wprintf("<br />\n");
3032 /** End the final inner box */
3033 do_template("endbox");
3035 wprintf("</td></tr></table>\n");
3039 * \brief print a floor div???
3040 * \param which_floordiv name of the floordiv???
3042 void set_floordiv_expanded(char *which_floordiv) {
3043 begin_ajax_response();
3044 safestrncpy(WC->floordiv_expanded, which_floordiv, sizeof WC->floordiv_expanded);
3045 end_ajax_response();
3049 * \brief view the iconbar
3050 * \param fold the folder to view
3051 * \param max_folders how many folders???
3052 * \param num_floors hom many floors???
3054 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3056 char floor_name[256];
3057 char old_floor_name[256];
3058 char floordivtitle[256];
3059 char floordiv_id[32];
3060 int levels, oldlevels;
3062 int num_drop_targets = 0;
3065 strcpy(floor_name, "");
3066 strcpy(old_floor_name, "");
3070 for (i=0; i<max_folders; ++i) {
3072 levels = num_tokens(fold[i].name, '|');
3073 extract_token(floor_name, fold[i].name, 0,
3074 '|', sizeof floor_name);
3076 if ( (strcasecmp(floor_name, old_floor_name))
3077 && (!IsEmptyStr(old_floor_name)) ) {
3078 /** End inner box */
3080 wprintf("</div>\n"); /** floordiv */
3082 strcpy(old_floor_name, floor_name);
3086 stresc(floordivtitle, 256, floor_name, 0, 0);
3087 sprintf(floordiv_id, "floordiv%d", i);
3088 wprintf("<span class=\"ib_roomlist_floor\" "
3089 "onClick=\"expand_floor('%s')\">"
3090 "%s</span><br>\n", floordiv_id, floordivtitle);
3091 wprintf("<div id=\"%s\" style=\"display:%s\">",
3093 (!strcasecmp(floordiv_id, WC->floordiv_expanded) ? "block" : "none")
3100 wprintf("<div id=\"roomdiv%d\">", i);
3102 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3104 /** choose the icon */
3105 if (fold[i].view == VIEW_ADDRESSBOOK) {
3106 icon = "viewcontacts_16x.gif" ;
3108 else if (fold[i].view == VIEW_CALENDAR) {
3109 icon = "calarea_16x.gif" ;
3111 else if (fold[i].view == VIEW_CALBRIEF) {
3112 icon = "calarea_16x.gif" ;
3114 else if (fold[i].view == VIEW_TASKS) {
3115 icon = "taskmanag_16x.gif" ;
3117 else if (fold[i].view == VIEW_NOTES) {
3118 icon = "storenotes_16x.gif" ;
3120 else if (fold[i].view == VIEW_MAILBOX) {
3121 icon = "privatemess_16x.gif" ;
3124 icon = "chatrooms_16x.gif" ;
3127 if (fold[i].selectable) {
3128 wprintf("<a href=\"dotgoto?room=");
3129 urlescputs(fold[i].room);
3131 wprintf("<img align=\"middle\" border=0 src=\"static/%s\" alt=\"\"> ", icon);
3136 if (fold[i].hasnewmsgs) {
3137 wprintf("<span class=\"ib_roomlist_new\">");
3140 wprintf("<span class=\"ib_roomlist_old\">");
3142 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3144 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3145 wprintf(" (INBOX)");
3148 if (fold[i].selectable) {
3155 wprintf("</div>\n"); /** roomdiv */
3158 wprintf("</div>\n"); /** floordiv */
3161 /** BEGIN: The old invisible pixel trick, to get our JavaScript to initialize */
3162 wprintf("<img src=\"static/blank.gif\" onLoad=\"\n");
3164 num_drop_targets = 0;
3166 for (i=0; i<max_folders; ++i) {
3167 levels = num_tokens(fold[i].name, '|');
3169 wprintf("drop_targets_elements[%d]=$('roomdiv%d');\n", num_drop_targets, i);
3170 wprintf("drop_targets_roomnames[%d]='", num_drop_targets);
3171 jsescputs(fold[i].room);
3177 wprintf("num_drop_targets = %d;\n", num_drop_targets);
3178 if ((WC->floordiv_expanded[0] != '\0')&&
3179 (WC->floordiv_expanded[1] != '\0')){
3180 wprintf("which_div_expanded = '%s';\n", WC->floordiv_expanded);
3184 /** END: The old invisible pixel trick, to get our JavaScript to initialize */
3190 * \brief Show the room list.
3191 * (only should get called by
3192 * knrooms() because that's where output_headers() is called from)
3193 * \param viewpref the view preferences???
3196 void list_all_rooms_by_floor(char *viewpref) {
3199 struct folder *fold = NULL;
3201 int max_folders = 0;
3202 int alloc_folders = 0;
3208 int num_floors = 1; /** add an extra one for private folders */
3212 /** If our cached folder list is very old, burn it. */
3213 if (WC->cache_fold != NULL) {
3214 if ((time(NULL) - WC->cache_timestamp) > 300) {
3215 free(WC->cache_fold);
3216 WC->cache_fold = NULL;
3220 /** Can we do the iconbar roomlist from cache? */
3221 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3222 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3226 /** Grab the floor table so we know how to build the list... */
3229 /** Start with the mailboxes */
3232 fold = malloc(sizeof(struct folder));
3233 memset(fold, 0, sizeof(struct folder));
3234 strcpy(fold[0].name, "My folders");
3235 fold[0].is_mailbox = 1;
3237 /** Then add floors */
3239 serv_getln(buf, sizeof buf);
3240 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3241 if (max_folders >= alloc_folders) {
3242 alloc_folders = max_folders + 100;
3243 fold = realloc(fold,
3244 alloc_folders * sizeof(struct folder));
3246 memset(&fold[max_folders], 0, sizeof(struct folder));
3247 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3248 extract_token(buf3, buf, 0, '|', SIZ);
3249 fold[max_folders].floor = atol (buf3);
3254 for (i=0; i<num_floors; i++)
3255 if (IDMax < fold[i].floor)
3256 IDMax = fold[i].floor;
3257 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3258 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3259 for (i=0; i<num_floors; i++)
3260 floor_mapping[fold[i].floor]=i;
3262 /** refresh the messages index for this room */
3263 // serv_puts("GOTO ");
3264 // while (serv_getln(buf, sizeof buf), strcmp(buf, "000"));
3265 /** Now add rooms */
3267 serv_getln(buf, sizeof buf);
3268 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3269 if (max_folders >= alloc_folders) {
3270 alloc_folders = max_folders + 100;
3271 fold = realloc(fold,
3272 alloc_folders * sizeof(struct folder));
3274 memset(&fold[max_folders], 0, sizeof(struct folder));
3275 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3276 ra_flags = extract_int(buf, 5);
3277 flags = extract_int(buf, 1);
3278 fold[max_folders].floor = extract_int(buf, 2);
3279 fold[max_folders].hasnewmsgs =
3280 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3281 if (flags & QR_MAILBOX) {
3282 fold[max_folders].is_mailbox = 1;
3284 fold[max_folders].view = extract_int(buf, 6);
3285 room_to_folder(fold[max_folders].name,
3286 fold[max_folders].room,
3287 fold[max_folders].floor,
3288 fold[max_folders].is_mailbox);
3289 fold[max_folders].selectable = 1;
3290 /* Increase the room count for the associtaed floor */
3291 if (fold[max_folders].is_mailbox) {
3292 fold[0].num_rooms++;
3295 i = floor_mapping[fold[max_folders].floor];
3296 fold[i].num_rooms++;
3302 * Remove any floors that don't have rooms
3304 get_preference("emptyfloors", buf2, sizeof buf2);
3305 if (buf2[0]==0 || (strcasecmp(buf2, "no") == 0))
3307 for (i=0; i<num_floors; i++)
3309 if (fold[i].num_rooms == 0) {
3310 for (j=i; j<max_folders; j++) {
3311 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3320 /** Bubble-sort the folder list */
3321 for (i=0; i<max_folders; ++i) {
3322 for (j=0; j<(max_folders-1)-i; ++j) {
3323 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3324 swap = strcasecmp(fold[j].name, fold[j+1].name);
3327 if ( (fold[j+1].is_mailbox)
3328 && (!fold[j].is_mailbox)) {
3336 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3337 memcpy(&fold[j], &fold[j+1],
3338 sizeof(struct folder));
3339 memcpy(&fold[j+1], &ftmp,
3340 sizeof(struct folder));
3346 if (!strcasecmp(viewpref, "folders")) {
3347 do_folder_view(fold, max_folders, num_floors);
3349 else if (!strcasecmp(viewpref, "hackish_view")) {
3350 for (i=0; i<max_folders; ++i) {
3351 escputs(fold[i].name);
3352 wprintf("<br />\n");
3355 else if (!strcasecmp(viewpref, "iconbar")) {
3356 do_iconbar_view(fold, max_folders, num_floors);
3359 do_rooms_view(fold, max_folders, num_floors);
3362 /* Don't free the folder list ... cache it for future use! */
3363 if (WC->cache_fold != NULL) {
3364 free(WC->cache_fold);
3366 WC->cache_fold = fold;
3367 WC->cache_max_folders = max_folders;
3368 WC->cache_num_floors = num_floors;
3369 WC->cache_timestamp = time(NULL);
3370 free(floor_mapping);
3375 * \brief Do either a known rooms list or a folders list, depending on the
3380 char listviewpref[SIZ];
3382 output_headers(1, 1, 2, 0, 0, 0);
3384 /** Determine whether the user is trying to change views */
3385 if (bstr("view") != NULL) {
3386 if (!IsEmptyStr(bstr("view"))) {
3387 set_preference("roomlistview", bstr("view"), 1);
3391 get_preference("roomlistview", listviewpref, sizeof listviewpref);
3393 if ( (strcasecmp(listviewpref, "folders"))
3394 && (strcasecmp(listviewpref, "table")) ) {
3395 strcpy(listviewpref, "rooms");
3399 wprintf("<div id=\"banner\">\n");
3400 wprintf("<div class=\"room_banner\">");
3402 if (!strcasecmp(listviewpref, "rooms")) {
3403 wprintf(_("Room list"));
3405 if (!strcasecmp(listviewpref, "folders")) {
3406 wprintf(_("Folder list"));
3408 if (!strcasecmp(listviewpref, "table")) {
3409 wprintf(_("Room list"));
3411 wprintf("</h1></div>\n");
3413 /** offer the ability to switch views */
3414 wprintf("<ul class=\"room_actions\">\n");
3415 wprintf("<li class=\"start_page\">");
3418 wprintf("<li><form name=\"roomlistomatic\">\n"
3419 "<select name=\"newview\" size=\"1\" "
3420 "OnChange=\"location.href=roomlistomatic.newview.options"
3421 "[selectedIndex].value\">\n");
3423 wprintf("<option %s value=\"knrooms&view=rooms\">"
3426 ( !strcasecmp(listviewpref, "rooms") ? "SELECTED" : "" )
3429 wprintf("<option %s value=\"knrooms&view=folders\">"
3430 "View as folder list"
3432 ( !strcasecmp(listviewpref, "folders") ? "SELECTED" : "" )
3435 wprintf("</select>");
3436 wprintf("</form></li>");
3437 wprintf("</ul></div>\n");
3439 wprintf("<div id=\"content\" class=\"service\">\n");
3441 /** Display the room list in the user's preferred format */
3442 list_all_rooms_by_floor(listviewpref);
3449 * \brief Set the message expire policy for this room and/or floor
3451 void set_room_policy(void) {
3454 if (IsEmptyStr(bstr("ok_button"))) {
3455 strcpy(WC->ImportantMessage,
3456 _("Cancelled. Changes were not saved."));
3461 serv_printf("SPEX room|%d|%d", atoi(bstr("roompolicy")), atoi(bstr("roomvalue")));
3462 serv_getln(buf, sizeof buf);
3463 strcpy(WC->ImportantMessage, &buf[4]);
3465 if (WC->axlevel >= 6) {
3466 strcat(WC->ImportantMessage, "<br />\n");
3467 serv_printf("SPEX floor|%d|%d", atoi(bstr("floorpolicy")), atoi(bstr("floorvalue")));
3468 serv_getln(buf, sizeof buf);
3469 strcat(WC->ImportantMessage, &buf[4]);