3 * Lots of different room-related operations.
10 char floorlist[MAX_FLOORS][SIZ]; /* list of our floor names */
12 char *viewdefs[9]; /* the different kinds of available views */
14 /* See GetFloorListHash and GetRoomListHash for info on these.
15 * Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys.
18 void display_whok(void);
21 * Initialize the viewdefs with localized strings
23 void initialize_viewdefs(void) {
24 viewdefs[0] = _("Bulletin Board");
25 viewdefs[1] = _("Mail Folder");
26 viewdefs[2] = _("Address Book");
27 viewdefs[3] = _("Calendar");
28 viewdefs[4] = _("Task List");
29 viewdefs[5] = _("Notes List");
30 viewdefs[6] = _("Wiki");
31 viewdefs[7] = _("Calendar List");
32 viewdefs[8] = _("Journal");
36 * Determine which views are allowed as the default for creating a new room.
38 int is_view_allowed_as_default(int which_view)
41 case VIEW_BBS: return(1);
42 case VIEW_MAILBOX: return(1);
43 case VIEW_ADDRESSBOOK: return(1);
44 case VIEW_CALENDAR: return(1);
45 case VIEW_TASKS: return(1);
46 case VIEW_NOTES: return(1);
47 case VIEW_WIKI: return(0); /* because it isn't finished yet */
48 case VIEW_CALBRIEF: return(0);
49 case VIEW_JOURNAL: return(0);
50 default: return(0); /* should never get here */
56 * load the list of floors
58 void load_floorlist(StrBuf *Buf)
63 for (a = 0; a < MAX_FLOORS; ++a)
67 StrBuf_ServGetln(Buf);
68 if (GetServerStatus(Buf, NULL) != 1) {
69 strcpy(floorlist[0], "Main Floor");
72 while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
73 if ( (StrLength(Buf)==3) &&
74 !strcmp(ChrPtr(Buf), "000")) {
78 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
86 * display rooms in tree structure
88 void room_tree_list(struct roomlisting *rp)
97 room_tree_list(rp->lnext);
99 strcpy(rmname, rp->rlname);
102 wprintf("<a href=\"dotgoto?room=");
106 escputs1(rmname, 1, 1);
107 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
109 else if (f & QR_DIRECTORY)
111 else if (f & QR_NETWORK)
115 wprintf("</a><tt> </tt>\n");
117 room_tree_list(rp->rnext);
123 * Room ordering stuff (compare first by floor, then by order)
125 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
127 if ((r1 == NULL) && (r2 == NULL))
133 if (r1->rlfloor < r2->rlfloor)
135 if (r1->rlfloor > r2->rlfloor)
137 if (r1->rlorder < r2->rlorder)
139 if (r1->rlorder > r2->rlorder)
146 * Common code for all room listings
148 void listrms(char *variety)
153 struct roomlisting *rl = NULL;
154 struct roomlisting *rp;
155 struct roomlisting *rs;
157 /* Ask the server for a room list */
159 serv_getln(buf, sizeof buf);
165 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
167 rp = malloc(sizeof(struct roomlisting));
168 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
169 rp->rlflags = extract_int(buf, 1);
170 rp->rlfloor = extract_int(buf, 2);
171 rp->rlorder = extract_int(buf, 3);
180 if (rordercmp(rp, rs) < 0) {
181 if (rs->lnext == NULL) {
188 if (rs->rnext == NULL) {
201 * If no rooms were listed, print an nbsp to make the cell
202 * borders show up anyway.
204 if (num_rooms == 0) wprintf(" ");
209 * list all forgotten rooms
211 void zapped_list(void)
213 WCTemplputParams SubTP;
216 output_headers(1, 1, 1, 0, 0, 0);
217 memset(&SubTP, 0, sizeof(WCTemplputParams));
218 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
219 SubTP.Filter.ContextType = CTX_STRBUF;
221 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
227 wprintf("<br /><br />\n");
228 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
229 do_template("endbox", NULL);
235 * read this room's info file (set v to 1 for verbose mode)
237 void readinfo(StrBuf *Target, WCTemplputParams *TP)
242 int fullinfo_len = 0;
245 serv_getln(buf, sizeof buf);
248 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
249 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
250 strcpy(&fullinfo[fullinfo_len], buf);
251 fullinfo_len += strlen(buf);
255 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
256 strcpy(&briefinfo[50], "...");
258 wprintf("<div class=\"infos\" "
259 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
263 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
264 wprintf("<img class=\"close_infos\" "
265 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
266 "src=\"static/closewindow.gif\" alt=\"%s\" width=\"16\" height=\"16\">",
281 * Display room banner icon.
282 * The server doesn't actually need the room name, but we supply it in
283 * order to keep the browser from using a cached icon from another room.
285 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
289 serv_puts("OIMG _roompic_");
290 serv_getln(buf, sizeof buf);
292 wprintf("<img height=\"64px\" src=\"image?name=_roompic_&room=");
293 urlescputs(ChrPtr(WC->wc_roomname));
296 serv_getln(buf, sizeof buf);
298 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
299 wprintf("<img class=\"roompic\" alt=\"\" src=\""
300 "static/viewcontacts_48x.gif"
304 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
305 wprintf("<img class=\"roompic\" alt=\"\" src=\""
306 "static/calarea_48x.gif"
307 "\" width=\"48\" height=\"48\">"
310 else if (WC->wc_view == VIEW_TASKS) {
311 wprintf("<img class=\"roompic\" alt=\"\" src=\""
312 "static/taskmanag_48x.gif"
313 "\" width=\"48\" height=\"48\">"
316 else if (WC->wc_view == VIEW_NOTES) {
317 wprintf("<img class=\"roompic\" alt=\"\" src=\""
318 "static/storenotes_48x.gif"
319 "\" width=\"48\" height=\"48\">"
322 else if (WC->wc_view == VIEW_MAILBOX) {
323 wprintf("<img class=\"roompic\" alt=\"\" src=\""
324 "static/privatemess_48x.gif"
325 "\" width=\"48\" height=\"48\">"
329 wprintf("<img class=\"roompic\" alt=\"\" src=\""
330 "static/chatrooms_48x.gif"
331 "\" width=\"48\" height=\"48\">"
340 * Display the current view and offer an option to change it
342 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
346 wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
347 wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
348 wprintf("<label for=\"view_name\">");
349 wprintf(_("View as:"));
351 "<select name=\"newview\" size=\"1\" "
352 "id=\"view_name\" class=\"selectbox\" "
353 "OnChange=\"location.href=viewomatic.newview.options"
354 "[selectedIndex].value\">\n");
356 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
358 * Only offer the views that make sense, given the default
359 * view for the room. For example, don't offer a Calendar
360 * view in a non-Calendar room.
364 || (i == WC->wc_default_view) /* default */
365 || ( (i == 0) && (WC->wc_default_view == 1) ) /* mail or bulletin */
366 || ( (i == 1) && (WC->wc_default_view == 0) ) /* mail or bulletin */
367 /* || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */
370 wprintf("<option %s value=\"changeview?view=%d\">",
371 ((i == WC->wc_view) ? "selected" : ""),
373 escputs(viewdefs[i]);
374 wprintf("</option>\n");
377 wprintf("</select></div></form>\n");
382 * Display a search box
384 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
386 wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
387 wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
388 wprintf("<label for=\"srchquery\">");
389 wprintf(_("Search: "));
390 wprintf("</label><input ");
391 wprintf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
392 wprintf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
394 wprintf("</div></form>\n");
399 * Embed the room banner
401 * got The information returned from a GOTO server command
402 * navbar_style Determines which navigation buttons to display
406 void embed_room_banner(char *got, int navbar_style) {
410 char with_files[256];
414 * We need to have the information returned by a GOTO server command.
415 * If it isn't supplied, we fake it by issuing our own GOTO.
418 memset(buf, '0', 20);
420 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
421 serv_getln(buf, sizeof buf);
425 /* The browser needs some information for its own use */
426 wprintf("<script type=\"text/javascript\"> \n"
427 " room_is_trash = %d; \n"
433 * If the user happens to select the "make this my start page" link,
434 * we want it to remember the URL as a "/dotskip" one instead of
435 * a "skip" or "gotonext" or something like that.
437 if (WCC->Hdr->this_page == NULL) {
438 WCC->Hdr->this_page = NewStrBuf();
440 StrBufPrintf(WCC->Hdr->this_page,
442 ChrPtr(WC->wc_roomname)
445 /* Check for new mail. */
446 WC->new_mail = extract_int(&got[4], 9);
447 WC->wc_view = extract_int(&got[4], 11);
449 /* Is this a directory room and does it contain files and how many? */
450 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
453 serv_getln(buf2, sizeof buf2);
454 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
456 snprintf (with_files, sizeof with_files,
457 "; <a href=\"do_template?template=files\"> %d %s </a>",
459 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
462 strcpy (with_files, "");
464 svprintf(HKEY("NUMMSGS"), WCS_STRING,
465 _("%d new of %d messages%s"),
466 extract_int(&got[4], 1),
467 extract_int(&got[4], 2),
470 svcallback("ROOMPIC", embed_room_graphic);
471 svcallback("ROOMINFO", readinfo);
472 svcallback("VIEWOMATIC", embed_view_o_matic);
473 svcallback("SEARCHOMATIC", embed_search_o_matic);
474 svcallback("START", offer_start_page);
476 do_template("roombanner", NULL);
477 /* roombanner contains this for mobile */
478 if (navbar_style != navbar_none && !WC->is_mobile) {
480 wprintf("<div id=\"navbar\"><ul>");
482 if (navbar_style == navbar_default) wprintf(
483 "<li class=\"ungoto\">"
484 "<a href=\"ungoto\">"
485 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
486 "<span class=\"navbar_link\">%s</span></A>"
487 "</li>\n", _("Ungoto")
490 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
492 "<li class=\"newmess\">"
493 "<a href=\"readnew\">"
494 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
495 "<span class=\"navbar_link\">%s</span></A>"
496 "</li>\n", _("Read new messages")
500 if (navbar_style == navbar_default) {
501 switch(WC->wc_view) {
502 case VIEW_ADDRESSBOOK:
504 "<li class=\"viewcontacts\">"
505 "<a href=\"readfwd\">"
506 "<img src=\"static/viewcontacts_24x.gif\" "
507 "alt=\"\" width=\"24\" height=\"24\">"
508 "<span class=\"navbar_link\">"
510 "</span></a></li>\n", _("View contacts")
515 "<li class=\"staskday\">"
516 "<a href=\"readfwd?calview=day\">"
517 "<img src=\"static/taskday2_24x.gif\" "
518 "alt=\"\" width=\"24\" height=\"24\">"
519 "<span class=\"navbar_link\">"
521 "</span></a></li>\n", _("Day view")
524 "<li class=\"monthview\">"
525 "<a href=\"readfwd?calview=month\">"
526 "<img src=\"static/monthview2_24x.gif\" "
527 "alt=\"\" width=\"24\" height=\"24\">"
528 "<span class=\"navbar_link\">"
530 "</span></a></li>\n", _("Month view")
535 "<li class=\"monthview\">"
536 "<a href=\"readfwd?calview=month\">"
537 "<img src=\"static/monthview2_24x.gif\" "
538 "alt=\"\" width=\"24\" height=\"24\">"
539 "<span class=\"navbar_link\">"
541 "</span></a></li>\n", _("Calendar list")
546 "<li class=\"taskmanag\">"
547 "<a href=\"readfwd\">"
548 "<img src=\"static/taskmanag_24x.gif\" "
549 "alt=\"\" width=\"24\" height=\"24\">"
550 "<span class=\"navbar_link\">"
552 "</span></a></li>\n", _("View tasks")
557 "<li class=\"viewnotes\">"
558 "<a href=\"readfwd\">"
559 "<img src=\"static/viewnotes_24x.gif\" "
560 "alt=\"\" width=\"24\" height=\"24\">"
561 "<span class=\"navbar_link\">"
563 "</span></a></li>\n", _("View notes")
568 "<li class=\"readallmess\">"
569 "<a id=\"m_refresh\" href=\"readfwd\">"
570 "<img src=\"static/readallmess3_24x.gif\" "
571 "alt=\"\" width=\"24\" height=\"24\">"
572 "<span class=\"navbar_link\">"
574 "</span></a></li>\n", _("Refresh message list")
579 "<li class=\"readallmess\">"
580 "<a href=\"readfwd\">"
581 "<img src=\"static/readallmess3_24x.gif\" "
582 "alt=\"\" width=\"24\" height=\"24\">"
583 "<span class=\"navbar_link\">"
585 "</span></a></li>\n", _("Wiki home")
590 "<li class=\"readallmess\">"
591 "<a href=\"readfwd\">"
592 "<img src=\"static/readallmess3_24x.gif\" "
593 "alt=\"\" width=\"24\" height=\"24\">"
594 "<span class=\"navbar_link\">"
596 "</span></a></li>\n", _("Read all messages")
602 if (navbar_style == navbar_default) {
603 switch(WC->wc_view) {
604 case VIEW_ADDRESSBOOK:
606 "<li class=\"addnewcontact\">"
607 "<a href=\"display_enter\">"
608 "<img src=\"static/addnewcontact_24x.gif\" "
609 "alt=\"\" width=\"24\" height=\"24\">"
610 "<span class=\"navbar_link\">"
612 "</span></a></li>\n", _("Add new contact")
617 wprintf("<li class=\"addevent\"><a href=\"display_enter");
618 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
619 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
620 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
622 "<img src=\"static/addevent_24x.gif\" "
623 "alt=\"\" width=\"24\" height=\"24\">"
624 "<span class=\"navbar_link\">"
626 "</span></a></li>\n", _("Add new event")
631 "<li class=\"newmess\">"
632 "<a href=\"display_enter\">"
633 "<img src=\"static/newmess3_24x.gif\" "
634 "alt=\"\" width=\"24\" height=\"24\">"
635 "<span class=\"navbar_link\">"
637 "</span></a></li>\n", _("Add new task")
642 "<li class=\"enternewnote\">"
643 "<a href=\"add_new_note\">"
644 "<img src=\"static/enternewnote_24x.gif\" "
645 "alt=\"\" width=\"24\" height=\"24\">"
646 "<span class=\"navbar_link\">"
648 "</span></a></li>\n", _("Add new note")
652 safestrncpy(buf, bstr("page"), sizeof buf);
653 if (IsEmptyStr(buf)) {
654 safestrncpy(buf, "home", sizeof buf);
658 "<li class=\"newmess\">"
659 "<a href=\"display_enter?wikipage=%s\">"
660 "<img src=\"static/newmess3_24x.gif\" "
661 "alt=\"\" width=\"24\" height=\"24\">"
662 "<span class=\"navbar_link\">"
664 "</span></a></li>\n", buf, _("Edit this page")
669 "<li class=\"newmess\">"
670 "<a href=\"display_enter\">"
671 "<img src=\"static/newmess3_24x.gif\" "
672 "alt=\"\" width=\"24\" height=\"24\">"
673 "<span class=\"navbar_link\">"
675 "</span></a></li>\n", _("Write mail")
678 "<li class=\"newmess\">"
679 "<a href=\"javascript:deleteAllSelectedMessages();\">"
680 "<img src=\"static/delete.gif\" "
681 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
683 "</span></a></li>\n", _("Delete")
688 "<li class=\"newmess\">"
689 "<a href=\"display_enter\">"
690 "<img src=\"static/newmess3_24x.gif\" "
691 "alt=\"\" width=\"24\" height=\"24\">"
692 "<span class=\"navbar_link\">"
694 "</span></a></li>\n", _("Enter a message")
700 if (navbar_style == navbar_default) wprintf(
701 "<li class=\"skipthisroom\">"
704 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
705 "width=\"24\" height=\"24\">"
706 "<span class=\"navbar_link\">%s</span></a>"
708 _("Leave all messages marked as unread, go to next room with unread messages"),
712 if (navbar_style == navbar_default) wprintf(
713 "<li class=\"markngo\">"
714 "<a href=\"gotonext\" "
716 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
717 "width=\"24\" height=\"24\">"
718 "<span class=\"navbar_link\">%s</span></a>"
720 _("Mark all messages as read, go to next room with unread messages"),
724 wprintf("</ul></div>\n");
731 * back end routine to take the session to a new room
733 long gotoroom(const StrBuf *gname)
736 static long ls = (-1L);
739 /* store ungoto information */
740 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
744 /* move to the new room */
745 serv_printf("GOTO %s", ChrPtr(gname));
746 StrBuf_ServGetln(Buf);
747 if (GetServerStatus(Buf, &err) != 2) {
748 serv_puts("GOTO _BASEROOM_");
749 StrBuf_ServGetln(Buf);
751 * well, we know that this is the fallback case,
752 * but we're interested that the first command
753 * didn't work out in first place.
755 if (GetServerStatus(Buf, NULL) != 2) {
761 if (WC->wc_roomname == NULL)
762 WC->wc_roomname = NewStrBuf();
764 FlushStrBuf(WC->wc_roomname);
766 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
767 StrBufCutLeft(WC->wc_roomname, 4);
768 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
769 /* highest_msg_read = extract_int(&buf[4],6);
770 maxmsgnum = extract_int(&buf[4],5);
772 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
773 ls = StrBufExtract_long(Buf, 6, '|');
774 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
775 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
776 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
777 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
778 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
781 WC->is_room_aide = WC->is_aide;
783 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
785 remove_march(WC->wc_roomname);
786 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
797 void smart_goto(const StrBuf *next_room) {
805 * mark all messages in current room as having been read
807 void slrp_highest(void)
811 serv_puts("SLRP HIGHEST");
812 serv_getln(buf, sizeof buf);
816 typedef struct __room_states {
831 * Set/clear/read the "self-service list subscribe" flag for a room
833 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
834 * returns the new value.
837 int self_service(int newval) {
838 int current_value = 0;
844 int flags, floor, order, view, flags2;
847 serv_getln(buf, sizeof buf);
848 if (buf[0] != '2') return(0);
850 extract_token(name, &buf[4], 0, '|', sizeof name);
851 extract_token(password, &buf[4], 1, '|', sizeof password);
852 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
853 flags = extract_int(&buf[4], 3);
854 floor = extract_int(&buf[4], 4);
855 order = extract_int(&buf[4], 5);
856 view = extract_int(&buf[4], 6);
857 flags2 = extract_int(&buf[4], 7);
859 if (flags2 & QR2_SELFLIST) {
867 flags2 = flags2 | QR2_SELFLIST;
869 else if (newval == 0) {
870 flags2 = flags2 & ~QR2_SELFLIST;
873 return(current_value);
876 if (newval != current_value) {
877 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
878 name, password, dirname, flags,
879 floor, order, view, flags2);
880 serv_getln(buf, sizeof buf);
887 int is_selflist(room_states *RoomFlags)
889 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
892 int is_publiclist(room_states *RoomFlags)
894 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
897 int is_moderatedlist(room_states *RoomFlags)
899 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
903 * Set/clear/read the "self-service list subscribe" flag for a room
905 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
906 * returns the new value.
909 int get_roomflags(room_states *RoomOps)
914 serv_getln(buf, sizeof buf);
915 if (buf[0] != '2') return(0);
917 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
918 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
919 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
920 RoomOps->flags = extract_int(&buf[4], 3);
921 RoomOps->floor = extract_int(&buf[4], 4);
922 RoomOps->order = extract_int(&buf[4], 5);
923 RoomOps->view = extract_int(&buf[4], 6);
924 RoomOps->flags2 = extract_int(&buf[4], 7);
928 int set_roomflags(room_states *RoomOps)
932 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
941 serv_getln(buf, sizeof buf);
951 * display the form for editing a room
953 void display_editroom(void)
959 char remote_room[128];
962 char er_password[10];
964 char er_roomaide[26];
971 char *not_shared_with;
981 if (IsEmptyStr(tab)) tab = "admin";
986 output_headers(1, 1, 1, 0, 0, 0);
988 wprintf("<div class=\"fix_scrollbar_bug\">");
992 /* print the tabbed dialog */
993 wprintf("<div align=\"center\">");
994 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
995 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
998 wprintf("<td class=\"");
999 if (!strcmp(tab, "admin")) {
1000 wprintf(" tab_cell_label\">");
1001 wprintf(_("Administration"));
1004 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1005 wprintf(_("Administration"));
1009 wprintf("<td> </td>\n");
1011 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1013 wprintf("<td class=\"");
1014 if (!strcmp(tab, "config")) {
1015 wprintf(" tab_cell_label\">");
1016 wprintf(_("Configuration"));
1019 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1020 wprintf(_("Configuration"));
1024 wprintf("<td> </td>\n");
1026 wprintf("<td class=\"");
1027 if (!strcmp(tab, "expire")) {
1028 wprintf(" tab_cell_label\">");
1029 wprintf(_("Message expire policy"));
1032 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1033 wprintf(_("Message expire policy"));
1037 wprintf("<td> </td>\n");
1039 wprintf("<td class=\"");
1040 if (!strcmp(tab, "access")) {
1041 wprintf(" tab_cell_label\">");
1042 wprintf(_("Access controls"));
1045 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1046 wprintf(_("Access controls"));
1050 wprintf("<td> </td>\n");
1052 wprintf("<td class=\"");
1053 if (!strcmp(tab, "sharing")) {
1054 wprintf(" tab_cell_label\">");
1055 wprintf(_("Sharing"));
1058 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1059 wprintf(_("Sharing"));
1063 wprintf("<td> </td>\n");
1065 wprintf("<td class=\"");
1066 if (!strcmp(tab, "listserv")) {
1067 wprintf(" tab_cell_label\">");
1068 wprintf(_("Mailing list service"));
1071 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1072 wprintf(_("Mailing list service"));
1076 wprintf("<td> </td>\n");
1080 wprintf("<td class=\"");
1081 if (!strcmp(tab, "feeds")) {
1082 wprintf(" tab_cell_label\">");
1083 wprintf(_("Remote retrieval"));
1086 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1087 wprintf(_("Remote retrieval"));
1091 wprintf("<td> </td>\n");
1093 wprintf("</tr></table>\n");
1094 wprintf("</div>\n");
1095 /* end tabbed dialog */
1097 wprintf("<script type=\"text/javascript\">"
1098 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1102 /* begin content of whatever tab is open now */
1104 if (!strcmp(tab, "admin")) {
1105 wprintf("<div class=\"tabcontent\">");
1107 "<li><a href=\"delete_room\" "
1108 "onClick=\"return confirm('");
1109 wprintf(_("Are you sure you want to delete this room?"));
1110 wprintf("');\">\n");
1111 wprintf(_("Delete this room"));
1113 "<li><a href=\"display_editroompic?which_room=");
1114 urlescputs(ChrPtr(WC->wc_roomname));
1116 wprintf(_("Set or change the icon for this room's banner"));
1118 "<li><a href=\"display_editinfo\">\n");
1119 wprintf(_("Edit this room's Info file"));
1125 if (!strcmp(tab, "config")) {
1126 wprintf("<div class=\"tabcontent\">");
1128 serv_getln(buf, sizeof buf);
1130 if (!strncmp(buf, "550", 3)) {
1131 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1132 _("Higher access is required to access this function.")
1135 else if (buf[0] != '2') {
1136 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1139 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1140 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1141 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1142 er_flags = extract_int(&buf[4], 3);
1143 er_floor = extract_int(&buf[4], 4);
1144 er_flags2 = extract_int(&buf[4], 7);
1146 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1147 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1149 wprintf("<ul><li>");
1150 wprintf(_("Name of room: "));
1151 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1157 wprintf(_("Resides on floor: "));
1158 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1159 if (er_flags & QR_MAILBOX)
1160 wprintf("disabled >\n");
1161 for (i = 0; i < 128; ++i)
1162 if (!IsEmptyStr(floorlist[i])) {
1163 wprintf("<OPTION ");
1165 wprintf("SELECTED ");
1166 wprintf("VALUE=\"%d\">", i);
1167 escputs(floorlist[i]);
1168 wprintf("</OPTION>\n");
1170 wprintf("</select>\n");
1173 wprintf(_("Type of room:"));
1176 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1177 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1178 wprintf("CHECKED ");
1179 wprintf("OnChange=\""
1180 " if (this.form.type[0].checked == true) { "
1181 " this.form.er_floor.disabled = false; "
1184 wprintf(_("Public (automatically appears to everyone)"));
1187 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1188 if ((er_flags & QR_PRIVATE) &&
1189 (er_flags & QR_GUESSNAME))
1190 wprintf("CHECKED ");
1191 wprintf(" OnChange=\""
1192 " if (this.form.type[1].checked == true) { "
1193 " this.form.er_floor.disabled = false; "
1196 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1198 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1199 if ((er_flags & QR_PRIVATE) &&
1200 (er_flags & QR_PASSWORDED))
1201 wprintf("CHECKED ");
1202 wprintf(" OnChange=\""
1203 " if (this.form.type[2].checked == true) { "
1204 " this.form.er_floor.disabled = false; "
1207 wprintf(_("Private - require password: "));
1208 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1211 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1212 if ((er_flags & QR_PRIVATE)
1213 && ((er_flags & QR_GUESSNAME) == 0)
1214 && ((er_flags & QR_PASSWORDED) == 0))
1215 wprintf("CHECKED ");
1216 wprintf(" OnChange=\""
1217 " if (this.form.type[3].checked == true) { "
1218 " this.form.er_floor.disabled = false; "
1221 wprintf(_("Private - invitation only"));
1223 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1224 if (er_flags & QR_MAILBOX)
1225 wprintf("CHECKED ");
1226 wprintf (" OnChange=\""
1227 " if (this.form.type[4].checked == true) { "
1228 " this.form.er_floor.disabled = true; "
1231 wprintf(_("Personal (mailbox for you only)"));
1233 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1235 wprintf(_("If private, cause current users to forget room"));
1237 wprintf("\n</ul>\n");
1239 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1240 if (er_flags & QR_PREFONLY)
1241 wprintf("CHECKED ");
1243 wprintf(_("Preferred users only"));
1245 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1246 if (er_flags & QR_READONLY)
1247 wprintf("CHECKED ");
1249 wprintf(_("Read-only room"));
1251 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1252 if (er_flags2 & QR2_COLLABDEL)
1253 wprintf("CHECKED ");
1255 wprintf(_("All users allowed to post may also delete messages"));
1257 /** directory stuff */
1258 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1259 if (er_flags & QR_DIRECTORY)
1260 wprintf("CHECKED ");
1262 wprintf(_("File directory room"));
1264 wprintf("\n<ul><li>");
1265 wprintf(_("Directory name: "));
1266 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1269 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1270 if (er_flags & QR_UPLOAD)
1271 wprintf("CHECKED ");
1273 wprintf(_("Uploading allowed"));
1275 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1276 if (er_flags & QR_DOWNLOAD)
1277 wprintf("CHECKED ");
1279 wprintf(_("Downloading allowed"));
1281 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1282 if (er_flags & QR_VISDIR)
1283 wprintf("CHECKED ");
1285 wprintf(_("Visible directory"));
1288 /** end of directory stuff */
1290 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1291 if (er_flags & QR_NETWORK)
1292 wprintf("CHECKED ");
1294 wprintf(_("Network shared room"));
1296 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1297 if (er_flags & QR_PERMANENT)
1298 wprintf("CHECKED ");
1300 wprintf(_("Permanent (does not auto-purge)"));
1302 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1303 if (er_flags2 & QR2_SUBJECTREQ)
1304 wprintf("CHECKED ");
1306 wprintf(_("Subject Required (Force users to specify a message subject)"));
1308 /** start of anon options */
1311 wprintf(_("Anonymous messages"));
1314 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1315 if (((er_flags & QR_ANONONLY) == 0)
1316 && ((er_flags & QR_ANONOPT) == 0))
1317 wprintf("CHECKED ");
1319 wprintf(_("No anonymous messages"));
1321 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1322 if (er_flags & QR_ANONONLY)
1323 wprintf("CHECKED ");
1325 wprintf(_("All messages are anonymous"));
1327 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1328 if (er_flags & QR_ANONOPT)
1329 wprintf("CHECKED ");
1331 wprintf(_("Prompt user when entering messages"));
1334 /* end of anon options */
1337 wprintf(_("Room aide: "));
1339 serv_getln(buf, sizeof buf);
1340 if (buf[0] != '2') {
1341 wprintf("<em>%s</em>\n", &buf[4]);
1343 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1344 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1347 wprintf("</ul><CENTER>\n");
1348 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1349 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1351 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1361 /* Sharing the room with other Citadel nodes... */
1362 if (!strcmp(tab, "sharing")) {
1363 wprintf("<div class=\"tabcontent\">");
1365 shared_with = strdup("");
1366 not_shared_with = strdup("");
1368 /** Learn the current configuration */
1369 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1370 serv_getln(buf, sizeof buf);
1371 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1372 extract_token(node, buf, 0, '|', sizeof node);
1373 not_shared_with = realloc(not_shared_with,
1374 strlen(not_shared_with) + 32);
1375 strcat(not_shared_with, node);
1376 strcat(not_shared_with, "\n");
1380 serv_getln(buf, sizeof buf);
1381 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1382 extract_token(cmd, buf, 0, '|', sizeof cmd);
1383 extract_token(node, buf, 1, '|', sizeof node);
1384 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1385 if (!strcasecmp(cmd, "ignet_push_share")) {
1386 shared_with = realloc(shared_with,
1387 strlen(shared_with) + 32);
1388 strcat(shared_with, node);
1389 if (!IsEmptyStr(remote_room)) {
1390 strcat(shared_with, "|");
1391 strcat(shared_with, remote_room);
1393 strcat(shared_with, "\n");
1397 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1398 extract_token(buf, shared_with, i, '\n', sizeof buf);
1399 extract_token(node, buf, 0, '|', sizeof node);
1400 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1401 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1402 if (!strcasecmp(node, cmd)) {
1403 remove_token(not_shared_with, j, '\n');
1408 /* Display the stuff */
1409 wprintf("<CENTER><br />"
1410 "<table border=1 cellpadding=5><tr>"
1412 wprintf(_("Shared with"));
1413 wprintf("</I></B></td>"
1415 wprintf(_("Not shared with"));
1416 wprintf("</I></B></td></tr>\n"
1417 "<tr><td VALIGN=TOP>\n");
1419 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1420 wprintf(_("Remote node name"));
1421 wprintf("</td><td>");
1422 wprintf(_("Remote room name"));
1423 wprintf("</td><td>");
1424 wprintf(_("Actions"));
1425 wprintf("</td></tr>\n");
1427 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1428 extract_token(buf, shared_with, i, '\n', sizeof buf);
1429 extract_token(node, buf, 0, '|', sizeof node);
1430 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1431 if (!IsEmptyStr(node)) {
1432 wprintf("<form method=\"POST\" action=\"netedit\">");
1433 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1434 wprintf("<tr><td>%s</td>\n", node);
1437 if (!IsEmptyStr(remote_room)) {
1438 escputs(remote_room);
1444 wprintf("<input type=\"hidden\" NAME=\"line\" "
1445 "VALUE=\"ignet_push_share|");
1447 if (!IsEmptyStr(remote_room)) {
1449 urlescputs(remote_room);
1452 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1453 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1454 wprintf("<input type=\"submit\" "
1455 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1456 wprintf("</td></tr></form>\n");
1460 wprintf("</table>\n");
1461 wprintf("</td><td VALIGN=TOP>\n");
1462 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1463 wprintf(_("Remote node name"));
1464 wprintf("</td><td>");
1465 wprintf(_("Remote room name"));
1466 wprintf("</td><td>");
1467 wprintf(_("Actions"));
1468 wprintf("</td></tr>\n");
1470 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1471 extract_token(node, not_shared_with, i, '\n', sizeof node);
1472 if (!IsEmptyStr(node)) {
1473 wprintf("<form method=\"POST\" action=\"netedit\">");
1474 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1475 wprintf("<tr><td>");
1478 "<input type=\"INPUT\" "
1482 wprintf("<input type=\"hidden\" "
1484 "VALUE=\"ignet_push_share|");
1487 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1488 "VALUE=\"sharing\">\n");
1489 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1490 "VALUE=\"add\">\n");
1491 wprintf("<input type=\"submit\" "
1492 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1493 wprintf("</td></tr></form>\n");
1497 wprintf("</table>\n");
1498 wprintf("</td></tr>"
1499 "</table></CENTER><br />\n"
1500 "<I><B>%s</B><ul><li>", _("Notes:"));
1501 wprintf(_("When sharing a room, "
1502 "it must be shared from both ends. Adding a node to "
1503 "the 'shared' list sends messages out, but in order to"
1504 " receive messages, the other nodes must be configured"
1505 " to send messages out to your system as well. "
1506 "<li>If the remote room name is blank, it is assumed "
1507 "that the room name is identical on the remote node."
1508 "<li>If the remote room name is different, the remote "
1509 "node must also configure the name of the room here."
1516 /* Mailing list management */
1517 if (!strcmp(tab, "listserv")) {
1518 room_states RoomFlags;
1519 wprintf("<div class=\"tabcontent\">");
1521 wprintf("<br /><center>"
1522 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1523 "<tr><td VALIGN=TOP>");
1525 wprintf(_("<i>The contents of this room are being "
1526 "mailed <b>as individual messages</b> "
1527 "to the following list recipients:"
1528 "</i><br /><br />\n"));
1531 serv_getln(buf, sizeof buf);
1532 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1533 extract_token(cmd, buf, 0, '|', sizeof cmd);
1534 if (!strcasecmp(cmd, "listrecp")) {
1535 extract_token(recp, buf, 1, '|', sizeof recp);
1538 wprintf(" <a href=\"netedit?cmd=remove&tab=listserv&line=listrecp|");
1541 wprintf(_("(remove)"));
1542 wprintf("</A><br />");
1545 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1546 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1547 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1548 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1549 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1550 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1551 wprintf("</form>\n");
1553 wprintf("</td><td VALIGN=TOP>\n");
1555 wprintf(_("<i>The contents of this room are being "
1556 "mailed <b>in digest form</b> "
1557 "to the following list recipients:"
1558 "</i><br /><br />\n"));
1561 serv_getln(buf, sizeof buf);
1562 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1563 extract_token(cmd, buf, 0, '|', sizeof cmd);
1564 if (!strcasecmp(cmd, "digestrecp")) {
1565 extract_token(recp, buf, 1, '|', sizeof recp);
1568 wprintf(" <a href=\"netedit?cmd=remove&tab=listserv&line="
1572 wprintf(_("(remove)"));
1573 wprintf("</A><br />");
1576 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1577 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1578 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1579 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1580 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1581 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1582 wprintf("</form>\n");
1584 wprintf("</td></tr></table>\n");
1586 /** Pop open an address book -- begin **/
1587 wprintf("<div align=right>"
1588 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1590 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1595 _("Add recipients from Contacts or other address books"),
1596 _("Add recipients from Contacts or other address books")
1598 /* Pop open an address book -- end **/
1600 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1602 get_roomflags (&RoomFlags);
1604 /* Self Service subscription? */
1605 wprintf("<table><tr><td>\n");
1606 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1607 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1608 " <tr><td colspan=\"2\">\n",
1609 (is_selflist(&RoomFlags))?"checked":"");
1610 wprintf(_("The URL for subscribe/unsubscribe is: "));
1611 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1612 (is_https ? "https" : "http"),
1613 ChrPtr(WC->Hdr->HR.http_host));
1614 /* Public posting? */
1615 wprintf("<tr><td>");
1616 wprintf(_("Allow non-subscribers to mail to this room."));
1617 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1618 (is_publiclist(&RoomFlags))?"checked":"");
1620 /* Moderated List? */
1621 wprintf("<tr><td>");
1622 wprintf(_("Room post publication needs Aide permission."));
1623 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1624 (is_moderatedlist(&RoomFlags))?"checked":"");
1627 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1628 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1629 wprintf("</table></form>");
1632 wprintf("</CENTER>\n");
1637 /* Configuration of The Dreaded Auto-Purger */
1638 if (!strcmp(tab, "expire")) {
1639 wprintf("<div class=\"tabcontent\">");
1641 serv_puts("GPEX room");
1642 serv_getln(buf, sizeof buf);
1643 if (!strncmp(buf, "550", 3)) {
1644 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1645 _("Higher access is required to access this function.")
1648 else if (buf[0] != '2') {
1649 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1652 roompolicy = extract_int(&buf[4], 0);
1653 roomvalue = extract_int(&buf[4], 1);
1655 serv_puts("GPEX floor");
1656 serv_getln(buf, sizeof buf);
1657 if (buf[0] == '2') {
1658 floorpolicy = extract_int(&buf[4], 0);
1659 floorvalue = extract_int(&buf[4], 1);
1662 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1663 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1664 wprintf("<table border=0 cellspacing=5>\n");
1665 wprintf("<tr><td>");
1666 wprintf(_("Message expire policy for this room"));
1668 escputs(ChrPtr(WC->wc_roomname));
1669 wprintf(")</td><td>");
1670 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1671 ((roompolicy == 0) ? "CHECKED" : "") );
1672 wprintf(_("Use the default policy for this floor"));
1673 wprintf("<br />\n");
1674 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1675 ((roompolicy == 1) ? "CHECKED" : "") );
1676 wprintf(_("Never automatically expire messages"));
1677 wprintf("<br />\n");
1678 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1679 ((roompolicy == 2) ? "CHECKED" : "") );
1680 wprintf(_("Expire by message count"));
1681 wprintf("<br />\n");
1682 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1683 ((roompolicy == 3) ? "CHECKED" : "") );
1684 wprintf(_("Expire by message age"));
1686 wprintf(_("Number of messages or days: "));
1687 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1688 wprintf("</td></tr>\n");
1690 if (WC->axlevel >= 6) {
1691 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1692 wprintf("<tr><td>");
1693 wprintf(_("Message expire policy for this floor"));
1695 escputs(floorlist[WC->wc_floor]);
1696 wprintf(")</td><td>");
1697 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1698 ((floorpolicy == 0) ? "CHECKED" : "") );
1699 wprintf(_("Use the system default"));
1700 wprintf("<br />\n");
1701 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1702 ((floorpolicy == 1) ? "CHECKED" : "") );
1703 wprintf(_("Never automatically expire messages"));
1704 wprintf("<br />\n");
1705 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1706 ((floorpolicy == 2) ? "CHECKED" : "") );
1707 wprintf(_("Expire by message count"));
1708 wprintf("<br />\n");
1709 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1710 ((floorpolicy == 3) ? "CHECKED" : "") );
1711 wprintf(_("Expire by message age"));
1713 wprintf(_("Number of messages or days: "));
1714 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1718 wprintf("<CENTER>\n");
1719 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1720 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1722 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1723 wprintf("</CENTER></td><tr>\n");
1725 wprintf("</table>\n"
1726 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1734 /* Access controls */
1735 if (!strcmp(tab, "access")) {
1736 wprintf("<div class=\"tabcontent\">");
1741 /* Fetch messages from remote locations */
1742 if (!strcmp(tab, "feeds")) {
1743 wprintf("<div class=\"tabcontent\">");
1746 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1747 wprintf("</i><br />\n");
1749 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1750 "<tr class=\"even\"><th>");
1751 wprintf(_("Remote host"));
1752 wprintf("</th><th>");
1753 wprintf(_("User name"));
1754 wprintf("</th><th>");
1755 wprintf(_("Password"));
1756 wprintf("</th><th>");
1757 wprintf(_("Keep messages on server?"));
1758 wprintf("</th><th>");
1759 wprintf(_("Interval"));
1760 wprintf("</th><th> </th></tr>");
1763 serv_getln(buf, sizeof buf);
1765 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1766 extract_token(cmd, buf, 0, '|', sizeof cmd);
1767 if (!strcasecmp(cmd, "pop3client")) {
1768 safestrncpy(recp, &buf[11], sizeof recp);
1771 wprintf("<tr class=\"%s\">",
1772 (bg ? "even" : "odd")
1776 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1781 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1785 wprintf("<td>*****</td>"); /* Don't show the password */
1787 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1789 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1791 wprintf("<td class=\"button_link\">");
1792 wprintf(" <a href=\"netedit?cmd=remove&tab=feeds&line=pop3client|");
1795 wprintf(_("(remove)"));
1796 wprintf("</a></td>");
1802 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1804 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1805 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1806 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1808 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1811 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1814 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1817 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1820 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
1823 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1824 wprintf("</td></tr>");
1825 wprintf("</form></table>\n");
1830 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
1831 wprintf("</i><br />\n");
1833 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1834 "<tr class=\"even\"><th>");
1835 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1836 wprintf(_("Feed URL"));
1837 wprintf("</th><th>");
1838 wprintf("</th></tr>");
1841 serv_getln(buf, sizeof buf);
1843 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1844 extract_token(cmd, buf, 0, '|', sizeof cmd);
1845 if (!strcasecmp(cmd, "rssclient")) {
1846 safestrncpy(recp, &buf[10], sizeof recp);
1849 wprintf("<tr class=\"%s\">",
1850 (bg ? "even" : "odd")
1854 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1858 wprintf("<td class=\"button_link\">");
1859 wprintf(" <a href=\"netedit?cmd=remove&tab=feeds&line=rssclient|");
1862 wprintf(_("(remove)"));
1863 wprintf("</a></td>");
1869 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1871 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1872 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
1873 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1875 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
1876 "maxlength=\"256\" name=\"line_pop3host\">\n");
1879 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
1880 wprintf("</td></tr>");
1881 wprintf("</form></table>\n");
1887 /* end content of whatever tab is open now */
1888 wprintf("</div>\n");
1890 address_book_popup();
1896 * Toggle self-service list subscription
1898 void toggle_self_service(void) {
1899 room_states RoomFlags;
1901 get_roomflags (&RoomFlags);
1903 if (yesbstr("QR2_SelfList"))
1904 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
1906 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
1908 if (yesbstr("QR2_SMTP_PUBLIC"))
1909 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
1911 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
1913 if (yesbstr("QR2_Moderated"))
1914 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
1916 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
1917 if (yesbstr("QR2_SubsOnly"))
1918 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
1920 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
1922 set_roomflags (&RoomFlags);
1930 * save new parameters for a room
1937 StrBuf *er_password;
1939 StrBuf *er_roomaide;
1942 int er_listingorder;
1948 if (!havebstr("ok_button")) {
1949 strcpy(WC->ImportantMessage,
1950 _("Cancelled. Changes were not saved."));
1956 StrBuf_ServGetln(Buf);
1957 if (GetServerStatus(Buf, NULL) != 2) {
1958 StrBufCutLeft(Buf, 4);
1959 strcpy(WC->ImportantMessage, ChrPtr(Buf));
1965 er_name = NewStrBuf();
1966 er_password = NewStrBuf();
1967 er_dirname = NewStrBuf();
1968 er_roomaide = NewStrBuf();
1970 StrBufCutLeft(Buf, 4);
1971 StrBufExtract_token(er_name, Buf, 0, '|');
1972 StrBufExtract_token(er_password, Buf, 1, '|');
1973 StrBufExtract_token(er_dirname, Buf, 2, '|');
1974 er_flags = StrBufExtract_int(Buf, 3, '|');
1975 er_listingorder = StrBufExtract_int(Buf, 5, '|');
1976 er_defaultview = StrBufExtract_int(Buf, 6, '|');
1977 er_flags2 = StrBufExtract_int(Buf, 7, '|');
1979 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
1980 if (StrLength(er_roomaide) == 0) {
1982 StrBuf_ServGetln(Buf);
1983 if (GetServerStatus(Buf, NULL) != 2) {
1984 FlushStrBuf(er_roomaide);
1986 StrBufCutLeft(Buf, 4);
1987 StrBufExtract_token(er_roomaide, Buf, 0, '|');
1990 Ptr = sbstr("er_name");
1991 if (StrLength(Ptr) > 0) {
1992 FlushStrBuf(er_name);
1993 StrBufAppendBuf(er_name, Ptr, 0);
1996 Ptr = sbstr("er_password");
1997 if (StrLength(Ptr) > 0) {
1998 FlushStrBuf(er_password);
1999 StrBufAppendBuf(er_password, Ptr, 0);
2003 Ptr = sbstr("er_dirname");
2004 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2005 FlushStrBuf(er_dirname);
2006 StrBufAppendBuf(er_dirname, Ptr, 0);
2010 Ptr = sbstr("type");
2011 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2013 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2014 er_flags |= (QR_PRIVATE);
2016 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2017 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2019 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2020 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2022 if (!strcmp(ChrPtr(Ptr), "personal")) {
2023 er_flags |= QR_MAILBOX;
2025 er_flags &= ~QR_MAILBOX;
2028 if (yesbstr("prefonly")) {
2029 er_flags |= QR_PREFONLY;
2031 er_flags &= ~QR_PREFONLY;
2034 if (yesbstr("readonly")) {
2035 er_flags |= QR_READONLY;
2037 er_flags &= ~QR_READONLY;
2041 if (yesbstr("collabdel")) {
2042 er_flags2 |= QR2_COLLABDEL;
2044 er_flags2 &= ~QR2_COLLABDEL;
2047 if (yesbstr("permanent")) {
2048 er_flags |= QR_PERMANENT;
2050 er_flags &= ~QR_PERMANENT;
2053 if (yesbstr("subjectreq")) {
2054 er_flags2 |= QR2_SUBJECTREQ;
2056 er_flags2 &= ~QR2_SUBJECTREQ;
2059 if (yesbstr("network")) {
2060 er_flags |= QR_NETWORK;
2062 er_flags &= ~QR_NETWORK;
2065 if (yesbstr("directory")) {
2066 er_flags |= QR_DIRECTORY;
2068 er_flags &= ~QR_DIRECTORY;
2071 if (yesbstr("ulallowed")) {
2072 er_flags |= QR_UPLOAD;
2074 er_flags &= ~QR_UPLOAD;
2077 if (yesbstr("dlallowed")) {
2078 er_flags |= QR_DOWNLOAD;
2080 er_flags &= ~QR_DOWNLOAD;
2083 if (yesbstr("visdir")) {
2084 er_flags |= QR_VISDIR;
2086 er_flags &= ~QR_VISDIR;
2089 Ptr = sbstr("anon");
2091 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2092 if (!strcmp(ChrPtr(Ptr), "anononly"))
2093 er_flags |= QR_ANONONLY;
2094 if (!strcmp(ChrPtr(Ptr), "anon2"))
2095 er_flags |= QR_ANONOPT;
2097 bump = yesbstr("bump");
2099 er_floor = ibstr("er_floor");
2101 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2103 ChrPtr(er_password),
2112 StrBuf_ServGetln(Buf);
2113 if (GetServerStatus(Buf, NULL) != 2) {
2114 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2117 FreeStrBuf(&er_name);
2118 FreeStrBuf(&er_password);
2119 FreeStrBuf(&er_dirname);
2120 FreeStrBuf(&er_roomaide);
2125 if (StrLength(er_roomaide) > 0) {
2126 serv_printf("SETA %s", ChrPtr(er_roomaide));
2127 StrBuf_ServGetln(Buf);
2128 if (GetServerStatus(Buf, NULL) != 2) {
2129 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2130 display_main_menu();
2132 FreeStrBuf(&er_name);
2133 FreeStrBuf(&er_password);
2134 FreeStrBuf(&er_dirname);
2135 FreeStrBuf(&er_roomaide);
2140 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2143 FreeStrBuf(&er_name);
2144 FreeStrBuf(&er_password);
2145 FreeStrBuf(&er_dirname);
2146 FreeStrBuf(&er_roomaide);
2152 * Display form for Invite, Kick, and show Who Knows a room
2154 void do_invt_kick(void) {
2155 char buf[SIZ], room[SIZ], username[SIZ];
2158 serv_getln(buf, sizeof buf);
2160 if (buf[0] != '2') {
2164 extract_token(room, &buf[4], 0, '|', sizeof room);
2166 strcpy(username, bstr("username"));
2168 if (havebstr("kick_button")) {
2169 sprintf(buf, "KICK %s", username);
2171 serv_getln(buf, sizeof buf);
2173 if (buf[0] != '2') {
2174 strcpy(WC->ImportantMessage, &buf[4]);
2176 sprintf(WC->ImportantMessage,
2177 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2182 if (havebstr("invite_button")) {
2183 sprintf(buf, "INVT %s", username);
2185 serv_getln(buf, sizeof buf);
2187 if (buf[0] != '2') {
2188 strcpy(WC->ImportantMessage, &buf[4]);
2190 sprintf(WC->ImportantMessage,
2191 _("<B><I>User %s invited to room %s.</I></B>\n"),
2202 * Display form for Invite, Kick, and show Who Knows a room
2204 void display_whok(void)
2206 char buf[SIZ], room[SIZ], username[SIZ];
2209 serv_getln(buf, sizeof buf);
2211 if (buf[0] != '2') {
2215 extract_token(room, &buf[4], 0, '|', sizeof room);
2218 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2219 wprintf(_("The users listed below have access to this room. "
2220 "To remove a user from the access list, select the user "
2221 "name from the list and click 'Kick'."));
2222 wprintf("<br /><br />");
2224 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2225 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2226 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2227 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2229 serv_getln(buf, sizeof buf);
2230 if (buf[0] == '1') {
2231 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2232 extract_token(username, buf, 0, '|', sizeof username);
2233 wprintf("<OPTION>");
2238 wprintf("</select><br />\n");
2240 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2241 wprintf("</form></CENTER>\n");
2243 wprintf("</td><td>");
2244 wprintf(_("To grant another user access to this room, enter the "
2245 "user name in the box below and click 'Invite'."));
2246 wprintf("<br /><br />");
2248 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2249 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2250 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2251 wprintf(_("Invite:"));
2253 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2254 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2255 "<input type=\"submit\" value=\"%s\">"
2256 "</form></CENTER>\n", _("Invite"));
2257 /* Pop open an address book -- begin **/
2259 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2261 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2264 _("Users"), _("Users")
2266 /* Pop open an address book -- end **/
2268 wprintf("</td></tr></table>\n");
2269 address_book_popup();
2276 * display the form for entering a new room
2278 void display_entroom(void)
2285 serv_puts("CRE8 0");
2286 serv_getln(buf, sizeof buf);
2288 if (buf[0] != '2') {
2289 strcpy(WC->ImportantMessage, &buf[4]);
2290 display_main_menu();
2295 output_headers(1, 1, 1, 0, 0, 0);
2297 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2298 do_template("beginbox", NULL);
2300 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2301 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2303 wprintf("<table class=\"altern\"> ");
2305 wprintf("<tr class=\"even\"><td>");
2306 wprintf(_("Name of room: "));
2307 wprintf("</td><td>");
2308 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2309 wprintf("</td></tr>");
2311 wprintf("<tr class=\"odd\"><td>");
2312 wprintf(_("Resides on floor: "));
2313 wprintf("</td><td>");
2314 load_floorlist(Buf);
2315 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2316 for (i = 0; i < 128; ++i)
2317 if (!IsEmptyStr(floorlist[i])) {
2318 wprintf("<option ");
2319 wprintf("value=\"%d\">", i);
2320 escputs(floorlist[i]);
2321 wprintf("</option>\n");
2323 wprintf("</select>\n");
2324 wprintf("</td></tr>");
2327 * Our clever little snippet of JavaScript automatically selects
2328 * a public room if the view is set to Bulletin Board or wiki, and
2329 * it selects a mailbox room otherwise. The user can override this,
2330 * of course. We also disable the floor selector for mailboxes.
2332 wprintf("<tr class=\"even\"><td>");
2333 wprintf(_("Default view for room: "));
2334 wprintf("</td><td>");
2335 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2336 " if ( (this.form.er_view.value == 0) "
2337 " || (this.form.er_view.value == 6) ) { "
2338 " this.form.type[0].checked=true; "
2339 " this.form.er_floor.disabled = false; "
2342 " this.form.type[4].checked=true; "
2343 " this.form.er_floor.disabled = true; "
2346 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2347 if (is_view_allowed_as_default(i)) {
2348 wprintf("<option %s value=\"%d\">",
2349 ((i == 0) ? "selected" : ""), i );
2350 escputs(viewdefs[i]);
2351 wprintf("</option>\n");
2354 wprintf("</select>\n");
2355 wprintf("</td></tr>");
2357 wprintf("<tr class=\"even\"><td>");
2358 wprintf(_("Type of room:"));
2359 wprintf("</td><td>");
2360 wprintf("<ul class=\"adminlist\">\n");
2362 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2363 wprintf("CHECKED OnChange=\""
2364 " if (this.form.type[0].checked == true) { "
2365 " this.form.er_floor.disabled = false; "
2368 wprintf(_("Public (automatically appears to everyone)"));
2371 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2372 " if (this.form.type[1].checked == true) { "
2373 " this.form.er_floor.disabled = false; "
2376 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2379 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2380 " if (this.form.type[2].checked == true) { "
2381 " this.form.er_floor.disabled = false; "
2384 wprintf(_("Private - require password: "));
2385 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2388 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2389 " if (this.form.type[3].checked == true) { "
2390 " this.form.er_floor.disabled = false; "
2393 wprintf(_("Private - invitation only"));
2396 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2398 " if (this.form.type[4].checked == true) { "
2399 " this.form.er_floor.disabled = true; "
2402 wprintf(_("Personal (mailbox for you only)"));
2405 wprintf("\n</ul>\n");
2406 wprintf("</td></tr></table>\n");
2408 wprintf("<div class=\"buttons\">\n");
2409 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2411 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2412 wprintf("</div>\n");
2413 wprintf("</form>\n<hr />");
2414 serv_printf("MESG roomaccess");
2415 serv_getln(buf, sizeof buf);
2416 if (buf[0] == '1') {
2420 do_template("endbox", NULL);
2430 * support function for entroom() -- sets the default view
2432 void er_set_default_view(int newview) {
2445 serv_getln(buf, sizeof buf);
2446 if (buf[0] != '2') return;
2448 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2449 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2450 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2451 rm_bits1 = extract_int(&buf[4], 3);
2452 rm_floor = extract_int(&buf[4], 4);
2453 rm_listorder = extract_int(&buf[4], 5);
2454 rm_bits2 = extract_int(&buf[4], 7);
2456 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2457 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2458 rm_listorder, newview, rm_bits2
2460 serv_getln(buf, sizeof buf);
2471 const StrBuf *er_name;
2472 const StrBuf *er_type;
2473 const StrBuf *er_password;
2478 if (!havebstr("ok_button")) {
2479 strcpy(WC->ImportantMessage,
2480 _("Cancelled. No new room was created."));
2481 display_main_menu();
2484 er_name = sbstr("er_name");
2485 er_type = sbstr("type");
2486 er_password = sbstr("er_password");
2487 er_floor = ibstr("er_floor");
2488 er_view = ibstr("er_view");
2491 if (!strcmp(ChrPtr(er_type), "hidden"))
2493 else if (!strcmp(ChrPtr(er_type), "passworded"))
2495 else if (!strcmp(ChrPtr(er_type), "invonly"))
2497 else if (!strcmp(ChrPtr(er_type), "personal"))
2500 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2503 ChrPtr(er_password),
2508 serv_getln(buf, sizeof buf);
2509 if (buf[0] != '2') {
2510 strcpy(WC->ImportantMessage, &buf[4]);
2511 display_main_menu();
2514 /** TODO: Room created, now udate the left hand icon bar for this user */
2515 burn_folder_cache(0); /* burn the old folder cache */
2519 do_change_view(er_view); /* Now go there */
2524 * \brief display the screen to enter a private room
2526 void display_private(char *rname, int req_pass)
2528 WCTemplputParams SubTP;
2530 output_headers(1, 1, 1, 0, 0, 0);
2532 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2533 memset(&SubTP, 0, sizeof(WCTemplputParams));
2534 SubTP.Filter.ContextType = CTX_STRBUF;
2535 SubTP.Context = Buf;
2536 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2541 wprintf(_("If you know the name of a hidden (guess-name) or "
2542 "passworded room, you can enter that room by typing "
2543 "its name below. Once you gain access to a private "
2544 "room, it will appear in your regular room listings "
2545 "so you don't have to keep returning here."));
2548 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2549 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2551 wprintf("<table class=\"altern\"> "
2552 "<tr class=\"even\"><td>");
2553 wprintf(_("Enter room name:"));
2555 "<input type=\"text\" name=\"gr_name\" "
2556 "value=\"%s\" maxlength=\"128\">\n", rname);
2559 wprintf("</td></tr><tr class=\"odd\"><td>");
2560 wprintf(_("Enter room password:"));
2561 wprintf("</td><td>");
2562 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2564 wprintf("</td></tr></table>\n");
2566 wprintf("<div class=\"buttons\">\n");
2567 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2569 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2573 wprintf("</div></form>\n");
2575 do_template("endbox", NULL);
2581 * \brief goto a private room
2583 void goto_private(void)
2588 if (!havebstr("ok_button")) {
2589 display_main_menu();
2592 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2593 serv_printf("GOTO %s|%s",
2596 serv_getln(buf, sizeof buf);
2598 if (buf[0] == '2') {
2599 smart_goto(sbstr("gr_name"));
2602 if (!strncmp(buf, "540", 3)) {
2603 display_private(bstr("gr_name"), 1);
2606 output_headers(1, 1, 1, 0, 0, 0);
2607 wprintf("%s\n", &buf[4]);
2614 * \brief display the screen to zap a room
2616 void display_zap(void)
2618 output_headers(1, 1, 2, 0, 0, 0);
2620 wprintf("<div id=\"banner\">\n");
2622 wprintf(_("Zap (forget/unsubscribe) the current room"));
2624 wprintf("</div>\n");
2626 wprintf("<div id=\"content\" class=\"service\">\n");
2628 wprintf(_("If you select this option, <em>%s</em> will "
2629 "disappear from your room list. Is this what you wish "
2630 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2632 wprintf("<form method=\"POST\" action=\"zap\">\n");
2633 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2634 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2636 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2637 wprintf("</form>\n");
2648 StrBuf *final_destination;
2651 * If the forget-room routine fails for any reason, we fall back
2652 * to the current room; otherwise, we go to the Lobby
2654 final_destination = NewStrBufDup(WC->wc_roomname);
2656 if (havebstr("ok_button")) {
2657 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2658 serv_getln(buf, sizeof buf);
2659 if (buf[0] == '2') {
2661 serv_getln(buf, sizeof buf);
2662 if (buf[0] == '2') {
2663 FlushStrBuf(final_destination);
2664 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2668 smart_goto(final_destination);
2669 FreeStrBuf(&final_destination);
2675 * \brief Delete the current room
2677 void delete_room(void)
2682 serv_puts("KILL 1");
2683 serv_getln(buf, sizeof buf);
2684 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2685 if (buf[0] != '2') {
2686 strcpy(WC->ImportantMessage, &buf[4]);
2687 display_main_menu();
2692 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2701 * \brief Perform changes to a room's network configuration
2703 void netedit(void) {
2712 /*/ TODO: do line dynamic! */
2713 if (havebstr("line_pop3host")) {
2714 strcpy(line, bstr("prefix"));
2715 strcat(line, bstr("line_pop3host"));
2717 strcat(line, bstr("line_pop3user"));
2719 strcat(line, bstr("line_pop3pass"));
2721 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2723 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2724 strcat(line, bstr("suffix"));
2726 else if (havebstr("line")) {
2727 strcpy(line, bstr("prefix"));
2728 strcat(line, bstr("line"));
2729 strcat(line, bstr("suffix"));
2744 serv_getln(buf, sizeof buf);
2745 if (buf[0] != '1') {
2751 /** This loop works for add *or* remove. Spiffy, eh? */
2752 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2753 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2754 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2755 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2756 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2757 if ( (strcasecmp(cmpa0, cmpb0))
2758 || (strcasecmp(cmpa1, cmpb1)) ) {
2759 fprintf(fp, "%s\n", buf);
2765 serv_getln(buf, sizeof buf);
2766 if (buf[0] != '4') {
2772 while (fgets(buf, sizeof buf, fp) != NULL) {
2773 buf[strlen(buf)-1] = 0;
2777 if (havebstr("add_button")) {
2778 num_addrs = num_tokens(bstr("line"), ',');
2779 if (num_addrs < 2) {
2780 /* just adding one node or address */
2784 /* adding multiple addresses separated by commas */
2785 for (i=0; i<num_addrs; ++i) {
2786 strcpy(line, bstr("prefix"));
2787 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2790 strcat(line, bstr("suffix"));
2804 * \brief Convert a room name to a folder-ish-looking name.
2805 * \param folder the folderish name
2806 * \param room the room name
2807 * \param floor the floor name
2808 * \param is_mailbox is it a mailbox?
2810 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2815 * For mailboxes, just do it straight...
2818 sprintf(folder, "My folders|%s", room);
2822 * Otherwise, prefix the floor name as a "public folders" moniker
2825 if (floor > MAX_FLOORS) {
2827 sprintf(folder, "%%%%%%|%s", room);
2830 sprintf(folder, "%s|%s", floorlist[floor], room);
2835 * Replace "\" characters with "|" for pseudo-folder-delimiting
2837 len = strlen (folder);
2838 for (i=0; i<len; ++i) {
2839 if (folder[i] == '\\') folder[i] = '|';
2847 * \brief Back end for change_view()
2848 * \param newview set newview???
2850 void do_change_view(int newview) {
2853 serv_printf("VIEW %d", newview);
2854 serv_getln(buf, sizeof buf);
2855 WC->wc_view = newview;
2856 smart_goto(WC->wc_roomname);
2862 * \brief Change the view for this room
2864 void change_view(void) {
2867 view = lbstr("view");
2868 do_change_view(view);
2872 * \brief Burn the cached folder list.
2873 * \param age How old the cahce needs to be before we burn it.
2876 void burn_folder_cache(time_t age)
2878 /** If our cached folder list is very old, burn it. */
2879 if (WC->cache_fold != NULL) {
2880 if ((time(NULL) - WC->cache_timestamp) > age) {
2881 free(WC->cache_fold);
2882 WC->cache_fold = NULL;
2890 * \brief Do either a known rooms list or a folders list, depending on the
2895 StrBuf *ListView = NULL;
2897 /** Determine whether the user is trying to change views */
2898 if (havebstr("view")) {
2899 ListView = NewStrBufDup(SBSTR("view"));
2900 set_preference("roomlistview", ListView, 1);
2902 /** Sanitize the input so its safe */
2903 if(!get_preference("roomlistview", &ListView) ||
2904 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
2905 (strcasecmp(ChrPtr(ListView), "table") != 0)))
2907 if (ListView == NULL) {
2908 ListView = NewStrBufPlain(HKEY("rooms"));
2909 set_preference("roomlistview", ListView, 0);
2912 StrBufPlain(ListView, HKEY("rooms"));
2922 * \brief Set the message expire policy for this room and/or floor
2924 void set_room_policy(void) {
2927 if (!havebstr("ok_button")) {
2928 strcpy(WC->ImportantMessage,
2929 _("Cancelled. Changes were not saved."));
2934 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
2935 serv_getln(buf, sizeof buf);
2936 strcpy(WC->ImportantMessage, &buf[4]);
2938 if (WC->axlevel >= 6) {
2939 strcat(WC->ImportantMessage, "<br />\n");
2940 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
2941 serv_getln(buf, sizeof buf);
2942 strcat(WC->ImportantMessage, &buf[4]);
2948 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
2950 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
2954 void _display_private(void) {
2955 display_private("", 0);
2958 void dotgoto(void) {
2959 if (!havebstr("room")) {
2963 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
2966 smart_goto(sbstr("room"));
2969 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
2971 wprintf("<div id=\"banner\">\n");
2972 embed_room_banner(NULL, navbar_default);
2973 wprintf("</div>\n");
2977 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
2979 wcsession *WCC = WC;
2982 (!IsEmptyStr(WCC->ugname)))
2983 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
2987 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
2989 wcsession *WCC = WC;
2991 return ((WCC!=NULL) &&
2992 (!IsEmptyStr(WCC->ugname)) &&
2993 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
2996 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
2998 wcsession *WCC = WC;
3000 return ((WCC!=NULL) &&
3001 ((WCC->room_flags & QR_PERMANENT) != 0));
3004 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3006 wcsession *WCC = WC;
3008 return ((WCC!=NULL) &&
3009 ((WCC->room_flags & QR_INUSE) != 0));
3012 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3014 wcsession *WCC = WC;
3016 return ((WCC!=NULL) &&
3017 ((WCC->room_flags & QR_PRIVATE) != 0));
3020 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3022 wcsession *WCC = WC;
3024 return ((WCC!=NULL) &&
3025 ((WCC->room_flags & QR_PASSWORDED) != 0));
3028 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3030 wcsession *WCC = WC;
3032 return ((WCC!=NULL) &&
3033 ((WCC->room_flags & QR_GUESSNAME) != 0));
3036 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3038 wcsession *WCC = WC;
3040 return ((WCC!=NULL) &&
3041 ((WCC->room_flags & QR_DIRECTORY) != 0));
3044 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3046 wcsession *WCC = WC;
3048 return ((WCC!=NULL) &&
3049 ((WCC->room_flags & QR_UPLOAD) != 0));
3052 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3054 wcsession *WCC = WC;
3056 return ((WCC!=NULL) &&
3057 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3060 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3062 wcsession *WCC = WC;
3064 return ((WCC!=NULL) &&
3065 ((WCC->room_flags & QR_VISDIR) != 0));
3068 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3070 wcsession *WCC = WC;
3072 return ((WCC!=NULL) &&
3073 ((WCC->room_flags & QR_ANONONLY) != 0));
3076 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3078 wcsession *WCC = WC;
3080 return ((WCC!=NULL) &&
3081 ((WCC->room_flags & QR_ANONOPT) != 0));
3084 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
3086 wcsession *WCC = WC;
3088 return ((WCC!=NULL) &&
3089 ((WCC->room_flags & QR_NETWORK) != 0));
3092 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
3094 wcsession *WCC = WC;
3096 return ((WCC!=NULL) &&
3097 ((WCC->room_flags & QR_PREFONLY) != 0));
3100 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
3102 wcsession *WCC = WC;
3104 return ((WCC!=NULL) &&
3105 ((WCC->room_flags & QR_READONLY) != 0));
3108 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
3110 wcsession *WCC = WC;
3112 return ((WCC!=NULL) &&
3113 ((WCC->room_flags & QR_MAILBOX) != 0));
3120 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3122 wcsession *WCC = WC;
3124 return ( (WCC!= NULL) &&
3125 ((WCC->axlevel >= 6) ||
3126 (WCC->is_room_aide) ||
3127 (WCC->is_mailbox) ));
3130 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
3132 wcsession *WCC = WC;
3134 if ((WCC == NULL) ||
3135 (TP->Tokens->nParameters < 3) ||
3136 (TP->Tokens->Params[2]->Type != TYPE_STR)||
3137 (TP->Tokens->Params[2]->len < 7))
3140 switch(WCC->wc_view) {
3142 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
3144 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
3145 case VIEW_ADDRESSBOOK:
3146 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
3148 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
3150 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
3152 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
3154 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
3156 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
3158 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
3168 RegisterPreference("roomlistview",
3169 _("Room list view"),
3172 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
3174 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
3176 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
3177 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
3178 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
3179 WebcitAddUrlHandler(HKEY("display_private"), "", 0, _display_private, 0);
3180 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
3181 WebcitAddUrlHandler(HKEY("zapped_list"), "", 0, zapped_list, 0);
3182 WebcitAddUrlHandler(HKEY("display_zap"), "", 0, display_zap, 0);
3183 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
3184 WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0);
3185 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
3186 WebcitAddUrlHandler(HKEY("display_whok"), "", 0, display_whok, 0);
3187 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
3188 WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0);
3189 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
3190 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
3191 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
3192 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
3193 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
3194 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
3195 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
3197 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
3198 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
3199 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
3200 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
3201 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
3202 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
3203 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
3204 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
3205 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
3206 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
3207 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
3208 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
3209 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
3210 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
3211 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
3212 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
3214 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
3215 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
3217 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
3218 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
3225 SessionDestroyModule_ROOMOPS
3228 if (sess->cache_fold != NULL) {
3229 free(sess->cache_fold);
3232 free_march_list(sess);
3233 DeleteHash(&sess->Floors);