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(1);
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 wc_printf("<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 wc_printf("</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) wc_printf(" ");
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 wc_printf("<br /><br />\n");
228 wc_printf(_("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 wc_printf("<div class=\"infos\" "
259 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
263 wc_printf("</div><div id=\"room_infos\" style=\"display:none;\">");
264 wc_printf("<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 wc_printf("<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 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
300 "static/viewcontacts_48x.gif"
304 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
305 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
306 "static/calarea_48x.gif"
307 "\" width=\"48\" height=\"48\">"
310 else if (WC->wc_view == VIEW_TASKS) {
311 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
312 "static/taskmanag_48x.gif"
313 "\" width=\"48\" height=\"48\">"
316 else if (WC->wc_view == VIEW_NOTES) {
317 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
318 "static/storenotes_48x.gif"
319 "\" width=\"48\" height=\"48\">"
322 else if (WC->wc_view == VIEW_MAILBOX) {
323 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
324 "static/privatemess_48x.gif"
325 "\" width=\"48\" height=\"48\">"
329 wc_printf("<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 wc_printf("<form name=\"viewomatic\" action=\"changeview\">\n");
347 wc_printf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
348 wc_printf("<label for=\"view_name\">");
349 wc_printf(_("View as:"));
350 wc_printf("</label> "
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 wc_printf("<option %s value=\"changeview?view=%d\">",
371 ((i == WC->wc_view) ? "selected" : ""),
373 escputs(viewdefs[i]);
374 wc_printf("</option>\n");
377 wc_printf("</select></div></form>\n");
382 * Display a search box
384 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
386 wc_printf("<form name=\"searchomatic\" action=\"do_search\">\n");
387 wc_printf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
388 wc_printf("<label for=\"srchquery\">");
389 wc_printf(_("Search: "));
390 wc_printf("</label><input ");
391 wc_printf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
392 wc_printf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
394 wc_printf("</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 wc_printf("<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 wc_printf("<div id=\"navbar\"><ul>");
482 if (navbar_style == navbar_default) wc_printf(
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 wc_printf("<li class=\"addevent\"><a href=\"display_enter");
618 if (havebstr("year" )) wc_printf("?year=%s", bstr("year"));
619 if (havebstr("month")) wc_printf("?month=%s", bstr("month"));
620 if (havebstr("day" )) wc_printf("?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")
667 if (bmstrcasestr((char *)ChrPtr(WCC->Hdr->HR.ReqLine), "wiki_history")) {
668 /* already viewing history; display a link to the current page */
670 "<li class=\"newmess\">"
671 "<a href=\"wiki?page=%s\">"
672 "<img src=\"static/newmess3_24x.gif\" "
673 "alt=\"\" width=\"24\" height=\"24\">"
674 "<span class=\"navbar_link\">"
676 "</span></a></li>\n", buf, _("Current version")
680 /* display a link to the history */
682 "<li class=\"newmess\">"
683 "<a href=\"wiki_history?page=%s\">"
684 "<img src=\"static/newmess3_24x.gif\" "
685 "alt=\"\" width=\"24\" height=\"24\">"
686 "<span class=\"navbar_link\">"
688 "</span></a></li>\n", buf, _("History")
694 "<li class=\"newmess\">"
695 "<a href=\"display_enter\">"
696 "<img src=\"static/newmess3_24x.gif\" "
697 "alt=\"\" width=\"24\" height=\"24\">"
698 "<span class=\"navbar_link\">"
700 "</span></a></li>\n", _("Write mail")
703 "<li class=\"newmess\">"
704 "<a href=\"javascript:deleteAllSelectedMessages();\">"
705 "<img src=\"static/delete.gif\" "
706 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
708 "</span></a></li>\n", _("Delete")
713 "<li class=\"newmess\">"
714 "<a href=\"display_enter\">"
715 "<img src=\"static/newmess3_24x.gif\" "
716 "alt=\"\" width=\"24\" height=\"24\">"
717 "<span class=\"navbar_link\">"
719 "</span></a></li>\n", _("Enter a message")
725 if (navbar_style == navbar_default) wc_printf(
726 "<li class=\"skipthisroom\">"
729 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
730 "width=\"24\" height=\"24\">"
731 "<span class=\"navbar_link\">%s</span></a>"
733 _("Leave all messages marked as unread, go to next room with unread messages"),
737 if (navbar_style == navbar_default) wc_printf(
738 "<li class=\"markngo\">"
739 "<a href=\"gotonext\" "
741 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
742 "width=\"24\" height=\"24\">"
743 "<span class=\"navbar_link\">%s</span></a>"
745 _("Mark all messages as read, go to next room with unread messages"),
749 wc_printf("</ul></div>\n");
756 * back end routine to take the session to a new room
758 long gotoroom(const StrBuf *gname)
761 static long ls = (-1L);
764 /* store ungoto information */
765 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
769 /* move to the new room */
770 serv_printf("GOTO %s", ChrPtr(gname));
771 StrBuf_ServGetln(Buf);
772 if (GetServerStatus(Buf, &err) != 2) {
773 serv_puts("GOTO _BASEROOM_");
774 StrBuf_ServGetln(Buf);
776 * well, we know that this is the fallback case,
777 * but we're interested that the first command
778 * didn't work out in first place.
780 if (GetServerStatus(Buf, NULL) != 2) {
786 if (WC->wc_roomname == NULL)
787 WC->wc_roomname = NewStrBuf();
789 FlushStrBuf(WC->wc_roomname);
791 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
792 StrBufCutLeft(WC->wc_roomname, 4);
793 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
794 /* highest_msg_read = extract_int(&buf[4],6);
795 maxmsgnum = extract_int(&buf[4],5);
797 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
798 ls = StrBufExtract_long(Buf, 6, '|');
799 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
800 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
801 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
802 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
803 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
806 WC->is_room_aide = WC->is_aide;
808 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
810 remove_march(WC->wc_roomname);
811 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
822 void smart_goto(const StrBuf *next_room) {
830 * mark all messages in current room as having been read
832 void slrp_highest(void)
836 serv_puts("SLRP HIGHEST");
837 serv_getln(buf, sizeof buf);
841 typedef struct __room_states {
856 * Set/clear/read the "self-service list subscribe" flag for a room
858 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
859 * returns the new value.
862 int self_service(int newval) {
863 int current_value = 0;
869 int flags, floor, order, view, flags2;
872 serv_getln(buf, sizeof buf);
873 if (buf[0] != '2') return(0);
875 extract_token(name, &buf[4], 0, '|', sizeof name);
876 extract_token(password, &buf[4], 1, '|', sizeof password);
877 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
878 flags = extract_int(&buf[4], 3);
879 floor = extract_int(&buf[4], 4);
880 order = extract_int(&buf[4], 5);
881 view = extract_int(&buf[4], 6);
882 flags2 = extract_int(&buf[4], 7);
884 if (flags2 & QR2_SELFLIST) {
892 flags2 = flags2 | QR2_SELFLIST;
894 else if (newval == 0) {
895 flags2 = flags2 & ~QR2_SELFLIST;
898 return(current_value);
901 if (newval != current_value) {
902 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
903 name, password, dirname, flags,
904 floor, order, view, flags2);
905 serv_getln(buf, sizeof buf);
912 int is_selflist(room_states *RoomFlags)
914 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
917 int is_publiclist(room_states *RoomFlags)
919 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
922 int is_moderatedlist(room_states *RoomFlags)
924 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
928 * Set/clear/read the "self-service list subscribe" flag for a room
930 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
931 * returns the new value.
934 int get_roomflags(room_states *RoomOps)
939 serv_getln(buf, sizeof buf);
940 if (buf[0] != '2') return(0);
942 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
943 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
944 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
945 RoomOps->flags = extract_int(&buf[4], 3);
946 RoomOps->floor = extract_int(&buf[4], 4);
947 RoomOps->order = extract_int(&buf[4], 5);
948 RoomOps->view = extract_int(&buf[4], 6);
949 RoomOps->flags2 = extract_int(&buf[4], 7);
953 int set_roomflags(room_states *RoomOps)
957 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
966 serv_getln(buf, sizeof buf);
976 * display the form for editing a room
978 void display_editroom(void)
984 char remote_room[128];
987 char er_password[10];
989 char er_roomaide[26];
996 char *not_shared_with;
1001 char pop3_host[128];
1006 if (IsEmptyStr(tab)) tab = "admin";
1009 load_floorlist(Buf);
1011 output_headers(1, 1, 1, 0, 0, 0);
1013 wc_printf("<div class=\"fix_scrollbar_bug\">");
1015 wc_printf("<br />\n");
1017 /* print the tabbed dialog */
1018 wc_printf("<div align=\"center\">");
1019 wc_printf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
1020 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1023 wc_printf("<td class=\"");
1024 if (!strcmp(tab, "admin")) {
1025 wc_printf(" tab_cell_label\">");
1026 wc_printf(_("Administration"));
1029 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1030 wc_printf(_("Administration"));
1033 wc_printf("</td>\n");
1034 wc_printf("<td> </td>\n");
1036 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1038 wc_printf("<td class=\"");
1039 if (!strcmp(tab, "config")) {
1040 wc_printf(" tab_cell_label\">");
1041 wc_printf(_("Configuration"));
1044 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1045 wc_printf(_("Configuration"));
1048 wc_printf("</td>\n");
1049 wc_printf("<td> </td>\n");
1051 wc_printf("<td class=\"");
1052 if (!strcmp(tab, "expire")) {
1053 wc_printf(" tab_cell_label\">");
1054 wc_printf(_("Message expire policy"));
1057 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1058 wc_printf(_("Message expire policy"));
1061 wc_printf("</td>\n");
1062 wc_printf("<td> </td>\n");
1064 wc_printf("<td class=\"");
1065 if (!strcmp(tab, "access")) {
1066 wc_printf(" tab_cell_label\">");
1067 wc_printf(_("Access controls"));
1070 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1071 wc_printf(_("Access controls"));
1074 wc_printf("</td>\n");
1075 wc_printf("<td> </td>\n");
1077 wc_printf("<td class=\"");
1078 if (!strcmp(tab, "sharing")) {
1079 wc_printf(" tab_cell_label\">");
1080 wc_printf(_("Sharing"));
1083 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1084 wc_printf(_("Sharing"));
1087 wc_printf("</td>\n");
1088 wc_printf("<td> </td>\n");
1090 wc_printf("<td class=\"");
1091 if (!strcmp(tab, "listserv")) {
1092 wc_printf(" tab_cell_label\">");
1093 wc_printf(_("Mailing list service"));
1096 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1097 wc_printf(_("Mailing list service"));
1100 wc_printf("</td>\n");
1101 wc_printf("<td> </td>\n");
1105 wc_printf("<td class=\"");
1106 if (!strcmp(tab, "feeds")) {
1107 wc_printf(" tab_cell_label\">");
1108 wc_printf(_("Remote retrieval"));
1111 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1112 wc_printf(_("Remote retrieval"));
1115 wc_printf("</td>\n");
1116 wc_printf("<td> </td>\n");
1118 wc_printf("</tr></table>\n");
1119 wc_printf("</div>\n");
1120 /* end tabbed dialog */
1122 wc_printf("<script type=\"text/javascript\">"
1123 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1127 /* begin content of whatever tab is open now */
1129 if (!strcmp(tab, "admin")) {
1130 wc_printf("<div class=\"tabcontent\">");
1132 "<li><a href=\"delete_room\" "
1133 "onClick=\"return confirm('");
1134 wc_printf(_("Are you sure you want to delete this room?"));
1135 wc_printf("');\">\n");
1136 wc_printf(_("Delete this room"));
1138 "<li><a href=\"display_editroompic?which_room=");
1139 urlescputs(ChrPtr(WC->wc_roomname));
1141 wc_printf(_("Set or change the icon for this room's banner"));
1143 "<li><a href=\"display_editinfo\">\n");
1144 wc_printf(_("Edit this room's Info file"));
1147 wc_printf("</div>");
1150 if (!strcmp(tab, "config")) {
1151 wc_printf("<div class=\"tabcontent\">");
1153 serv_getln(buf, sizeof buf);
1155 if (!strncmp(buf, "550", 3)) {
1156 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1157 _("Higher access is required to access this function.")
1160 else if (buf[0] != '2') {
1161 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1164 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1165 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1166 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1167 er_flags = extract_int(&buf[4], 3);
1168 er_floor = extract_int(&buf[4], 4);
1169 er_flags2 = extract_int(&buf[4], 7);
1171 wc_printf("<form method=\"POST\" action=\"editroom\">\n");
1172 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1174 wc_printf("<ul><li>");
1175 wc_printf(_("Name of room: "));
1176 wc_printf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1182 wc_printf(_("Resides on floor: "));
1183 wc_printf("<select NAME=\"er_floor\" SIZE=\"1\"");
1184 if (er_flags & QR_MAILBOX)
1185 wc_printf("disabled >\n");
1186 for (i = 0; i < 128; ++i)
1187 if (!IsEmptyStr(floorlist[i])) {
1188 wc_printf("<OPTION ");
1190 wc_printf("SELECTED ");
1191 wc_printf("VALUE=\"%d\">", i);
1192 escputs(floorlist[i]);
1193 wc_printf("</OPTION>\n");
1195 wc_printf("</select>\n");
1198 wc_printf(_("Type of room:"));
1199 wc_printf("<ul>\n");
1201 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1202 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1203 wc_printf("CHECKED ");
1204 wc_printf("OnChange=\""
1205 " if (this.form.type[0].checked == true) { "
1206 " this.form.er_floor.disabled = false; "
1209 wc_printf(_("Public (automatically appears to everyone)"));
1212 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1213 if ((er_flags & QR_PRIVATE) &&
1214 (er_flags & QR_GUESSNAME))
1215 wc_printf("CHECKED ");
1216 wc_printf(" OnChange=\""
1217 " if (this.form.type[1].checked == true) { "
1218 " this.form.er_floor.disabled = false; "
1221 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
1223 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1224 if ((er_flags & QR_PRIVATE) &&
1225 (er_flags & QR_PASSWORDED))
1226 wc_printf("CHECKED ");
1227 wc_printf(" OnChange=\""
1228 " if (this.form.type[2].checked == true) { "
1229 " this.form.er_floor.disabled = false; "
1232 wc_printf(_("Private - require password: "));
1233 wc_printf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1236 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1237 if ((er_flags & QR_PRIVATE)
1238 && ((er_flags & QR_GUESSNAME) == 0)
1239 && ((er_flags & QR_PASSWORDED) == 0))
1240 wc_printf("CHECKED ");
1241 wc_printf(" OnChange=\""
1242 " if (this.form.type[3].checked == true) { "
1243 " this.form.er_floor.disabled = false; "
1246 wc_printf(_("Private - invitation only"));
1248 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1249 if (er_flags & QR_MAILBOX)
1250 wc_printf("CHECKED ");
1251 wc_printf (" OnChange=\""
1252 " if (this.form.type[4].checked == true) { "
1253 " this.form.er_floor.disabled = true; "
1256 wc_printf(_("Personal (mailbox for you only)"));
1258 wc_printf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1260 wc_printf(_("If private, cause current users to forget room"));
1262 wc_printf("\n</ul>\n");
1264 wc_printf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1265 if (er_flags & QR_PREFONLY)
1266 wc_printf("CHECKED ");
1268 wc_printf(_("Preferred users only"));
1270 wc_printf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1271 if (er_flags & QR_READONLY)
1272 wc_printf("CHECKED ");
1274 wc_printf(_("Read-only room"));
1276 wc_printf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1277 if (er_flags2 & QR2_COLLABDEL)
1278 wc_printf("CHECKED ");
1280 wc_printf(_("All users allowed to post may also delete messages"));
1282 /** directory stuff */
1283 wc_printf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1284 if (er_flags & QR_DIRECTORY)
1285 wc_printf("CHECKED ");
1287 wc_printf(_("File directory room"));
1289 wc_printf("\n<ul><li>");
1290 wc_printf(_("Directory name: "));
1291 wc_printf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1294 wc_printf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1295 if (er_flags & QR_UPLOAD)
1296 wc_printf("CHECKED ");
1298 wc_printf(_("Uploading allowed"));
1300 wc_printf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1301 if (er_flags & QR_DOWNLOAD)
1302 wc_printf("CHECKED ");
1304 wc_printf(_("Downloading allowed"));
1306 wc_printf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1307 if (er_flags & QR_VISDIR)
1308 wc_printf("CHECKED ");
1310 wc_printf(_("Visible directory"));
1311 wc_printf("</ul>\n");
1313 /** end of directory stuff */
1315 wc_printf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1316 if (er_flags & QR_NETWORK)
1317 wc_printf("CHECKED ");
1319 wc_printf(_("Network shared room"));
1321 wc_printf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1322 if (er_flags & QR_PERMANENT)
1323 wc_printf("CHECKED ");
1325 wc_printf(_("Permanent (does not auto-purge)"));
1327 wc_printf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1328 if (er_flags2 & QR2_SUBJECTREQ)
1329 wc_printf("CHECKED ");
1331 wc_printf(_("Subject Required (Force users to specify a message subject)"));
1333 /** start of anon options */
1335 wc_printf("\n<li>");
1336 wc_printf(_("Anonymous messages"));
1337 wc_printf("<ul>\n");
1339 wc_printf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1340 if (((er_flags & QR_ANONONLY) == 0)
1341 && ((er_flags & QR_ANONOPT) == 0))
1342 wc_printf("CHECKED ");
1344 wc_printf(_("No anonymous messages"));
1346 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1347 if (er_flags & QR_ANONONLY)
1348 wc_printf("CHECKED ");
1350 wc_printf(_("All messages are anonymous"));
1352 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1353 if (er_flags & QR_ANONOPT)
1354 wc_printf("CHECKED ");
1356 wc_printf(_("Prompt user when entering messages"));
1357 wc_printf("</ul>\n");
1359 /* end of anon options */
1362 wc_printf(_("Room aide: "));
1364 serv_getln(buf, sizeof buf);
1365 if (buf[0] != '2') {
1366 wc_printf("<em>%s</em>\n", &buf[4]);
1368 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1369 wc_printf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1372 wc_printf("</ul><CENTER>\n");
1373 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1374 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1376 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1382 wc_printf("</div>");
1386 /* Sharing the room with other Citadel nodes... */
1387 if (!strcmp(tab, "sharing")) {
1388 wc_printf("<div class=\"tabcontent\">");
1390 shared_with = strdup("");
1391 not_shared_with = strdup("");
1393 /** Learn the current configuration */
1394 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1395 serv_getln(buf, sizeof buf);
1396 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1397 extract_token(node, buf, 0, '|', sizeof node);
1398 not_shared_with = realloc(not_shared_with,
1399 strlen(not_shared_with) + 32);
1400 strcat(not_shared_with, node);
1401 strcat(not_shared_with, "\n");
1405 serv_getln(buf, sizeof buf);
1406 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1407 extract_token(cmd, buf, 0, '|', sizeof cmd);
1408 extract_token(node, buf, 1, '|', sizeof node);
1409 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1410 if (!strcasecmp(cmd, "ignet_push_share")) {
1411 shared_with = realloc(shared_with,
1412 strlen(shared_with) + 32);
1413 strcat(shared_with, node);
1414 if (!IsEmptyStr(remote_room)) {
1415 strcat(shared_with, "|");
1416 strcat(shared_with, remote_room);
1418 strcat(shared_with, "\n");
1422 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1423 extract_token(buf, shared_with, i, '\n', sizeof buf);
1424 extract_token(node, buf, 0, '|', sizeof node);
1425 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1426 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1427 if (!strcasecmp(node, cmd)) {
1428 remove_token(not_shared_with, j, '\n');
1433 /* Display the stuff */
1434 wc_printf("<CENTER><br />"
1435 "<table border=1 cellpadding=5><tr>"
1437 wc_printf(_("Shared with"));
1438 wc_printf("</I></B></td>"
1440 wc_printf(_("Not shared with"));
1441 wc_printf("</I></B></td></tr>\n"
1442 "<tr><td VALIGN=TOP>\n");
1444 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1445 wc_printf(_("Remote node name"));
1446 wc_printf("</td><td>");
1447 wc_printf(_("Remote room name"));
1448 wc_printf("</td><td>");
1449 wc_printf(_("Actions"));
1450 wc_printf("</td></tr>\n");
1452 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1453 extract_token(buf, shared_with, i, '\n', sizeof buf);
1454 extract_token(node, buf, 0, '|', sizeof node);
1455 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1456 if (!IsEmptyStr(node)) {
1457 wc_printf("<form method=\"POST\" action=\"netedit\">");
1458 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1459 wc_printf("<tr><td>%s</td>\n", node);
1462 if (!IsEmptyStr(remote_room)) {
1463 escputs(remote_room);
1469 wc_printf("<input type=\"hidden\" NAME=\"line\" "
1470 "VALUE=\"ignet_push_share|");
1472 if (!IsEmptyStr(remote_room)) {
1474 urlescputs(remote_room);
1477 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1478 wc_printf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1479 wc_printf("<input type=\"submit\" "
1480 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1481 wc_printf("</td></tr></form>\n");
1485 wc_printf("</table>\n");
1486 wc_printf("</td><td VALIGN=TOP>\n");
1487 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1488 wc_printf(_("Remote node name"));
1489 wc_printf("</td><td>");
1490 wc_printf(_("Remote room name"));
1491 wc_printf("</td><td>");
1492 wc_printf(_("Actions"));
1493 wc_printf("</td></tr>\n");
1495 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1496 extract_token(node, not_shared_with, i, '\n', sizeof node);
1497 if (!IsEmptyStr(node)) {
1498 wc_printf("<form method=\"POST\" action=\"netedit\">");
1499 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1500 wc_printf("<tr><td>");
1502 wc_printf("</td><td>"
1503 "<input type=\"INPUT\" "
1507 wc_printf("<input type=\"hidden\" "
1509 "VALUE=\"ignet_push_share|");
1512 wc_printf("<input type=\"hidden\" NAME=\"tab\" "
1513 "VALUE=\"sharing\">\n");
1514 wc_printf("<input type=\"hidden\" NAME=\"cmd\" "
1515 "VALUE=\"add\">\n");
1516 wc_printf("<input type=\"submit\" "
1517 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1518 wc_printf("</td></tr></form>\n");
1522 wc_printf("</table>\n");
1523 wc_printf("</td></tr>"
1524 "</table></CENTER><br />\n"
1525 "<I><B>%s</B><ul><li>", _("Notes:"));
1526 wc_printf(_("When sharing a room, "
1527 "it must be shared from both ends. Adding a node to "
1528 "the 'shared' list sends messages out, but in order to"
1529 " receive messages, the other nodes must be configured"
1530 " to send messages out to your system as well. "
1531 "<li>If the remote room name is blank, it is assumed "
1532 "that the room name is identical on the remote node."
1533 "<li>If the remote room name is different, the remote "
1534 "node must also configure the name of the room here."
1538 wc_printf("</div>");
1541 /* Mailing list management */
1542 if (!strcmp(tab, "listserv")) {
1543 room_states RoomFlags;
1544 wc_printf("<div class=\"tabcontent\">");
1546 wc_printf("<br /><center>"
1547 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1548 "<tr><td VALIGN=TOP>");
1550 wc_printf(_("<i>The contents of this room are being "
1551 "mailed <b>as individual messages</b> "
1552 "to the following list recipients:"
1553 "</i><br /><br />\n"));
1556 serv_getln(buf, sizeof buf);
1557 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1558 extract_token(cmd, buf, 0, '|', sizeof cmd);
1559 if (!strcasecmp(cmd, "listrecp")) {
1560 extract_token(recp, buf, 1, '|', sizeof recp);
1563 wc_printf(" <a href=\"netedit?cmd=remove&tab=listserv&line=listrecp|");
1566 wc_printf(_("(remove)"));
1567 wc_printf("</A><br />");
1570 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1571 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1572 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1573 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1574 wc_printf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1575 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1576 wc_printf("</form>\n");
1578 wc_printf("</td><td VALIGN=TOP>\n");
1580 wc_printf(_("<i>The contents of this room are being "
1581 "mailed <b>in digest form</b> "
1582 "to the following list recipients:"
1583 "</i><br /><br />\n"));
1586 serv_getln(buf, sizeof buf);
1587 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1588 extract_token(cmd, buf, 0, '|', sizeof cmd);
1589 if (!strcasecmp(cmd, "digestrecp")) {
1590 extract_token(recp, buf, 1, '|', sizeof recp);
1593 wc_printf(" <a href=\"netedit?cmd=remove&tab=listserv&line="
1597 wc_printf(_("(remove)"));
1598 wc_printf("</A><br />");
1601 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1602 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1603 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1604 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1605 wc_printf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1606 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1607 wc_printf("</form>\n");
1609 wc_printf("</td></tr></table>\n");
1611 /** Pop open an address book -- begin **/
1612 wc_printf("<div align=right>"
1613 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1615 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1620 _("Add recipients from Contacts or other address books"),
1621 _("Add recipients from Contacts or other address books")
1623 /* Pop open an address book -- end **/
1625 wc_printf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1627 get_roomflags (&RoomFlags);
1629 /* Self Service subscription? */
1630 wc_printf("<table><tr><td>\n");
1631 wc_printf(_("Allow self-service subscribe/unsubscribe requests."));
1632 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1633 " <tr><td colspan=\"2\">\n",
1634 (is_selflist(&RoomFlags))?"checked":"");
1635 wc_printf(_("The URL for subscribe/unsubscribe is: "));
1636 wc_printf("<TT>%s://%s/listsub</TT></td></tr>\n",
1637 (is_https ? "https" : "http"),
1638 ChrPtr(WC->Hdr->HR.http_host));
1639 /* Public posting? */
1640 wc_printf("<tr><td>");
1641 wc_printf(_("Allow non-subscribers to mail to this room."));
1642 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1643 (is_publiclist(&RoomFlags))?"checked":"");
1645 /* Moderated List? */
1646 wc_printf("<tr><td>");
1647 wc_printf(_("Room post publication needs Aide permission."));
1648 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1649 (is_moderatedlist(&RoomFlags))?"checked":"");
1652 wc_printf("<tr><td colspan=\"2\" align=\"center\">"
1653 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1654 wc_printf("</table></form>");
1657 wc_printf("</CENTER>\n");
1658 wc_printf("</div>");
1662 /* Configuration of The Dreaded Auto-Purger */
1663 if (!strcmp(tab, "expire")) {
1664 wc_printf("<div class=\"tabcontent\">");
1666 serv_puts("GPEX room");
1667 serv_getln(buf, sizeof buf);
1668 if (!strncmp(buf, "550", 3)) {
1669 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1670 _("Higher access is required to access this function.")
1673 else if (buf[0] != '2') {
1674 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1677 roompolicy = extract_int(&buf[4], 0);
1678 roomvalue = extract_int(&buf[4], 1);
1680 serv_puts("GPEX floor");
1681 serv_getln(buf, sizeof buf);
1682 if (buf[0] == '2') {
1683 floorpolicy = extract_int(&buf[4], 0);
1684 floorvalue = extract_int(&buf[4], 1);
1687 wc_printf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1688 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1689 wc_printf("<table border=0 cellspacing=5>\n");
1690 wc_printf("<tr><td>");
1691 wc_printf(_("Message expire policy for this room"));
1692 wc_printf("<br />(");
1693 escputs(ChrPtr(WC->wc_roomname));
1694 wc_printf(")</td><td>");
1695 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1696 ((roompolicy == 0) ? "CHECKED" : "") );
1697 wc_printf(_("Use the default policy for this floor"));
1698 wc_printf("<br />\n");
1699 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1700 ((roompolicy == 1) ? "CHECKED" : "") );
1701 wc_printf(_("Never automatically expire messages"));
1702 wc_printf("<br />\n");
1703 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1704 ((roompolicy == 2) ? "CHECKED" : "") );
1705 wc_printf(_("Expire by message count"));
1706 wc_printf("<br />\n");
1707 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1708 ((roompolicy == 3) ? "CHECKED" : "") );
1709 wc_printf(_("Expire by message age"));
1710 wc_printf("<br />");
1711 wc_printf(_("Number of messages or days: "));
1712 wc_printf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1713 wc_printf("</td></tr>\n");
1715 if (WC->axlevel >= 6) {
1716 wc_printf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1717 wc_printf("<tr><td>");
1718 wc_printf(_("Message expire policy for this floor"));
1719 wc_printf("<br />(");
1720 escputs(floorlist[WC->wc_floor]);
1721 wc_printf(")</td><td>");
1722 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1723 ((floorpolicy == 0) ? "CHECKED" : "") );
1724 wc_printf(_("Use the system default"));
1725 wc_printf("<br />\n");
1726 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1727 ((floorpolicy == 1) ? "CHECKED" : "") );
1728 wc_printf(_("Never automatically expire messages"));
1729 wc_printf("<br />\n");
1730 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1731 ((floorpolicy == 2) ? "CHECKED" : "") );
1732 wc_printf(_("Expire by message count"));
1733 wc_printf("<br />\n");
1734 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1735 ((floorpolicy == 3) ? "CHECKED" : "") );
1736 wc_printf(_("Expire by message age"));
1737 wc_printf("<br />");
1738 wc_printf(_("Number of messages or days: "));
1739 wc_printf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1743 wc_printf("<CENTER>\n");
1744 wc_printf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1745 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1746 wc_printf(" ");
1747 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1748 wc_printf("</CENTER></td><tr>\n");
1750 wc_printf("</table>\n"
1751 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1756 wc_printf("</div>");
1759 /* Access controls */
1760 if (!strcmp(tab, "access")) {
1761 wc_printf("<div class=\"tabcontent\">");
1763 wc_printf("</div>");
1766 /* Fetch messages from remote locations */
1767 if (!strcmp(tab, "feeds")) {
1768 wc_printf("<div class=\"tabcontent\">");
1771 wc_printf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1772 wc_printf("</i><br />\n");
1774 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1775 "<tr class=\"even\"><th>");
1776 wc_printf(_("Remote host"));
1777 wc_printf("</th><th>");
1778 wc_printf(_("User name"));
1779 wc_printf("</th><th>");
1780 wc_printf(_("Password"));
1781 wc_printf("</th><th>");
1782 wc_printf(_("Keep messages on server?"));
1783 wc_printf("</th><th>");
1784 wc_printf(_("Interval"));
1785 wc_printf("</th><th> </th></tr>");
1788 serv_getln(buf, sizeof buf);
1790 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1791 extract_token(cmd, buf, 0, '|', sizeof cmd);
1792 if (!strcasecmp(cmd, "pop3client")) {
1793 safestrncpy(recp, &buf[11], sizeof recp);
1796 wc_printf("<tr class=\"%s\">",
1797 (bg ? "even" : "odd")
1801 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1806 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1810 wc_printf("<td>*****</td>"); /* Don't show the password */
1812 wc_printf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1814 wc_printf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1816 wc_printf("<td class=\"button_link\">");
1817 wc_printf(" <a href=\"netedit?cmd=remove&tab=feeds&line=pop3client|");
1820 wc_printf(_("(remove)"));
1821 wc_printf("</a></td>");
1827 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1829 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1830 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1831 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1833 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1836 wc_printf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1839 wc_printf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1842 wc_printf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1845 wc_printf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
1848 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1849 wc_printf("</td></tr>");
1850 wc_printf("</form></table>\n");
1852 wc_printf("<hr>\n");
1855 wc_printf(_("Fetch the following RSS feeds and store them in this room:"));
1856 wc_printf("</i><br />\n");
1858 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1859 "<tr class=\"even\"><th>");
1860 wc_printf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1861 wc_printf(_("Feed URL"));
1862 wc_printf("</th><th>");
1863 wc_printf("</th></tr>");
1866 serv_getln(buf, sizeof buf);
1868 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1869 extract_token(cmd, buf, 0, '|', sizeof cmd);
1870 if (!strcasecmp(cmd, "rssclient")) {
1871 safestrncpy(recp, &buf[10], sizeof recp);
1874 wc_printf("<tr class=\"%s\">",
1875 (bg ? "even" : "odd")
1879 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1883 wc_printf("<td class=\"button_link\">");
1884 wc_printf(" <a href=\"netedit?cmd=remove&tab=feeds&line=rssclient|");
1887 wc_printf(_("(remove)"));
1888 wc_printf("</a></td>");
1894 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1896 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1897 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
1898 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1900 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
1901 "maxlength=\"256\" name=\"line_pop3host\">\n");
1904 wc_printf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
1905 wc_printf("</td></tr>");
1906 wc_printf("</form></table>\n");
1908 wc_printf("</div>");
1912 /* end content of whatever tab is open now */
1913 wc_printf("</div>\n");
1915 address_book_popup();
1921 * Toggle self-service list subscription
1923 void toggle_self_service(void) {
1924 room_states RoomFlags;
1926 get_roomflags (&RoomFlags);
1928 if (yesbstr("QR2_SelfList"))
1929 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
1931 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
1933 if (yesbstr("QR2_SMTP_PUBLIC"))
1934 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
1936 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
1938 if (yesbstr("QR2_Moderated"))
1939 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
1941 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
1942 if (yesbstr("QR2_SubsOnly"))
1943 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
1945 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
1947 set_roomflags (&RoomFlags);
1955 * save new parameters for a room
1962 StrBuf *er_password;
1964 StrBuf *er_roomaide;
1967 int er_listingorder;
1973 if (!havebstr("ok_button")) {
1974 strcpy(WC->ImportantMessage,
1975 _("Cancelled. Changes were not saved."));
1981 StrBuf_ServGetln(Buf);
1982 if (GetServerStatus(Buf, NULL) != 2) {
1983 StrBufCutLeft(Buf, 4);
1984 strcpy(WC->ImportantMessage, ChrPtr(Buf));
1990 er_name = NewStrBuf();
1991 er_password = NewStrBuf();
1992 er_dirname = NewStrBuf();
1993 er_roomaide = NewStrBuf();
1995 StrBufCutLeft(Buf, 4);
1996 StrBufExtract_token(er_name, Buf, 0, '|');
1997 StrBufExtract_token(er_password, Buf, 1, '|');
1998 StrBufExtract_token(er_dirname, Buf, 2, '|');
1999 er_flags = StrBufExtract_int(Buf, 3, '|');
2000 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2001 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2002 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2004 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2005 if (StrLength(er_roomaide) == 0) {
2007 StrBuf_ServGetln(Buf);
2008 if (GetServerStatus(Buf, NULL) != 2) {
2009 FlushStrBuf(er_roomaide);
2011 StrBufCutLeft(Buf, 4);
2012 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2015 Ptr = sbstr("er_name");
2016 if (StrLength(Ptr) > 0) {
2017 FlushStrBuf(er_name);
2018 StrBufAppendBuf(er_name, Ptr, 0);
2021 Ptr = sbstr("er_password");
2022 if (StrLength(Ptr) > 0) {
2023 FlushStrBuf(er_password);
2024 StrBufAppendBuf(er_password, Ptr, 0);
2028 Ptr = sbstr("er_dirname");
2029 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2030 FlushStrBuf(er_dirname);
2031 StrBufAppendBuf(er_dirname, Ptr, 0);
2035 Ptr = sbstr("type");
2036 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2038 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2039 er_flags |= (QR_PRIVATE);
2041 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2042 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2044 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2045 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2047 if (!strcmp(ChrPtr(Ptr), "personal")) {
2048 er_flags |= QR_MAILBOX;
2050 er_flags &= ~QR_MAILBOX;
2053 if (yesbstr("prefonly")) {
2054 er_flags |= QR_PREFONLY;
2056 er_flags &= ~QR_PREFONLY;
2059 if (yesbstr("readonly")) {
2060 er_flags |= QR_READONLY;
2062 er_flags &= ~QR_READONLY;
2066 if (yesbstr("collabdel")) {
2067 er_flags2 |= QR2_COLLABDEL;
2069 er_flags2 &= ~QR2_COLLABDEL;
2072 if (yesbstr("permanent")) {
2073 er_flags |= QR_PERMANENT;
2075 er_flags &= ~QR_PERMANENT;
2078 if (yesbstr("subjectreq")) {
2079 er_flags2 |= QR2_SUBJECTREQ;
2081 er_flags2 &= ~QR2_SUBJECTREQ;
2084 if (yesbstr("network")) {
2085 er_flags |= QR_NETWORK;
2087 er_flags &= ~QR_NETWORK;
2090 if (yesbstr("directory")) {
2091 er_flags |= QR_DIRECTORY;
2093 er_flags &= ~QR_DIRECTORY;
2096 if (yesbstr("ulallowed")) {
2097 er_flags |= QR_UPLOAD;
2099 er_flags &= ~QR_UPLOAD;
2102 if (yesbstr("dlallowed")) {
2103 er_flags |= QR_DOWNLOAD;
2105 er_flags &= ~QR_DOWNLOAD;
2108 if (yesbstr("visdir")) {
2109 er_flags |= QR_VISDIR;
2111 er_flags &= ~QR_VISDIR;
2114 Ptr = sbstr("anon");
2116 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2117 if (!strcmp(ChrPtr(Ptr), "anononly"))
2118 er_flags |= QR_ANONONLY;
2119 if (!strcmp(ChrPtr(Ptr), "anon2"))
2120 er_flags |= QR_ANONOPT;
2122 bump = yesbstr("bump");
2124 er_floor = ibstr("er_floor");
2126 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2128 ChrPtr(er_password),
2137 StrBuf_ServGetln(Buf);
2138 if (GetServerStatus(Buf, NULL) != 2) {
2139 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2142 FreeStrBuf(&er_name);
2143 FreeStrBuf(&er_password);
2144 FreeStrBuf(&er_dirname);
2145 FreeStrBuf(&er_roomaide);
2150 if (StrLength(er_roomaide) > 0) {
2151 serv_printf("SETA %s", ChrPtr(er_roomaide));
2152 StrBuf_ServGetln(Buf);
2153 if (GetServerStatus(Buf, NULL) != 2) {
2154 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2155 display_main_menu();
2157 FreeStrBuf(&er_name);
2158 FreeStrBuf(&er_password);
2159 FreeStrBuf(&er_dirname);
2160 FreeStrBuf(&er_roomaide);
2165 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2168 FreeStrBuf(&er_name);
2169 FreeStrBuf(&er_password);
2170 FreeStrBuf(&er_dirname);
2171 FreeStrBuf(&er_roomaide);
2177 * Display form for Invite, Kick, and show Who Knows a room
2179 void do_invt_kick(void) {
2180 char buf[SIZ], room[SIZ], username[SIZ];
2183 serv_getln(buf, sizeof buf);
2185 if (buf[0] != '2') {
2189 extract_token(room, &buf[4], 0, '|', sizeof room);
2191 strcpy(username, bstr("username"));
2193 if (havebstr("kick_button")) {
2194 sprintf(buf, "KICK %s", username);
2196 serv_getln(buf, sizeof buf);
2198 if (buf[0] != '2') {
2199 strcpy(WC->ImportantMessage, &buf[4]);
2201 sprintf(WC->ImportantMessage,
2202 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2207 if (havebstr("invite_button")) {
2208 sprintf(buf, "INVT %s", username);
2210 serv_getln(buf, sizeof buf);
2212 if (buf[0] != '2') {
2213 strcpy(WC->ImportantMessage, &buf[4]);
2215 sprintf(WC->ImportantMessage,
2216 _("<B><I>User %s invited to room %s.</I></B>\n"),
2227 * Display form for Invite, Kick, and show Who Knows a room
2229 void display_whok(void)
2231 char buf[SIZ], room[SIZ], username[SIZ];
2234 serv_getln(buf, sizeof buf);
2236 if (buf[0] != '2') {
2240 extract_token(room, &buf[4], 0, '|', sizeof room);
2243 wc_printf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2244 wc_printf(_("The users listed below have access to this room. "
2245 "To remove a user from the access list, select the user "
2246 "name from the list and click 'Kick'."));
2247 wc_printf("<br /><br />");
2249 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2250 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2251 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2252 wc_printf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2254 serv_getln(buf, sizeof buf);
2255 if (buf[0] == '1') {
2256 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2257 extract_token(username, buf, 0, '|', sizeof username);
2258 wc_printf("<OPTION>");
2263 wc_printf("</select><br />\n");
2265 wc_printf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2266 wc_printf("</form></CENTER>\n");
2268 wc_printf("</td><td>");
2269 wc_printf(_("To grant another user access to this room, enter the "
2270 "user name in the box below and click 'Invite'."));
2271 wc_printf("<br /><br />");
2273 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2274 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2275 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2276 wc_printf(_("Invite:"));
2278 wc_printf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2279 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2280 "<input type=\"submit\" value=\"%s\">"
2281 "</form></CENTER>\n", _("Invite"));
2282 /* Pop open an address book -- begin **/
2284 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2286 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2289 _("Users"), _("Users")
2291 /* Pop open an address book -- end **/
2293 wc_printf("</td></tr></table>\n");
2294 address_book_popup();
2301 * display the form for entering a new room
2303 void display_entroom(void)
2310 serv_puts("CRE8 0");
2311 serv_getln(buf, sizeof buf);
2313 if (buf[0] != '2') {
2314 strcpy(WC->ImportantMessage, &buf[4]);
2315 display_main_menu();
2320 output_headers(1, 1, 1, 0, 0, 0);
2322 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2323 do_template("beginbox", NULL);
2325 wc_printf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2326 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2328 wc_printf("<table class=\"altern\"> ");
2330 wc_printf("<tr class=\"even\"><td>");
2331 wc_printf(_("Name of room: "));
2332 wc_printf("</td><td>");
2333 wc_printf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2334 wc_printf("</td></tr>");
2336 wc_printf("<tr class=\"odd\"><td>");
2337 wc_printf(_("Resides on floor: "));
2338 wc_printf("</td><td>");
2339 load_floorlist(Buf);
2340 wc_printf("<select name=\"er_floor\" size=\"1\">\n");
2341 for (i = 0; i < 128; ++i)
2342 if (!IsEmptyStr(floorlist[i])) {
2343 wc_printf("<option ");
2344 wc_printf("value=\"%d\">", i);
2345 escputs(floorlist[i]);
2346 wc_printf("</option>\n");
2348 wc_printf("</select>\n");
2349 wc_printf("</td></tr>");
2352 * Our clever little snippet of JavaScript automatically selects
2353 * a public room if the view is set to Bulletin Board or wiki, and
2354 * it selects a mailbox room otherwise. The user can override this,
2355 * of course. We also disable the floor selector for mailboxes.
2357 wc_printf("<tr class=\"even\"><td>");
2358 wc_printf(_("Default view for room: "));
2359 wc_printf("</td><td>");
2360 wc_printf("<select name=\"er_view\" size=\"1\" OnChange=\""
2361 " if ( (this.form.er_view.value == 0) "
2362 " || (this.form.er_view.value == 6) ) { "
2363 " this.form.type[0].checked=true; "
2364 " this.form.er_floor.disabled = false; "
2367 " this.form.type[4].checked=true; "
2368 " this.form.er_floor.disabled = true; "
2371 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2372 if (is_view_allowed_as_default(i)) {
2373 wc_printf("<option %s value=\"%d\">",
2374 ((i == 0) ? "selected" : ""), i );
2375 escputs(viewdefs[i]);
2376 wc_printf("</option>\n");
2379 wc_printf("</select>\n");
2380 wc_printf("</td></tr>");
2382 wc_printf("<tr class=\"even\"><td>");
2383 wc_printf(_("Type of room:"));
2384 wc_printf("</td><td>");
2385 wc_printf("<ul class=\"adminlist\">\n");
2387 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2388 wc_printf("CHECKED OnChange=\""
2389 " if (this.form.type[0].checked == true) { "
2390 " this.form.er_floor.disabled = false; "
2393 wc_printf(_("Public (automatically appears to everyone)"));
2396 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2397 " if (this.form.type[1].checked == true) { "
2398 " this.form.er_floor.disabled = false; "
2401 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
2404 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2405 " if (this.form.type[2].checked == true) { "
2406 " this.form.er_floor.disabled = false; "
2409 wc_printf(_("Private - require password: "));
2410 wc_printf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2413 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2414 " if (this.form.type[3].checked == true) { "
2415 " this.form.er_floor.disabled = false; "
2418 wc_printf(_("Private - invitation only"));
2421 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2423 " if (this.form.type[4].checked == true) { "
2424 " this.form.er_floor.disabled = true; "
2427 wc_printf(_("Personal (mailbox for you only)"));
2430 wc_printf("\n</ul>\n");
2431 wc_printf("</td></tr></table>\n");
2433 wc_printf("<div class=\"buttons\">\n");
2434 wc_printf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2435 wc_printf(" ");
2436 wc_printf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2437 wc_printf("</div>\n");
2438 wc_printf("</form>\n<hr />");
2439 serv_printf("MESG roomaccess");
2440 serv_getln(buf, sizeof buf);
2441 if (buf[0] == '1') {
2445 do_template("endbox", NULL);
2455 * support function for entroom() -- sets the default view
2457 void er_set_default_view(int newview) {
2470 serv_getln(buf, sizeof buf);
2471 if (buf[0] != '2') return;
2473 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2474 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2475 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2476 rm_bits1 = extract_int(&buf[4], 3);
2477 rm_floor = extract_int(&buf[4], 4);
2478 rm_listorder = extract_int(&buf[4], 5);
2479 rm_bits2 = extract_int(&buf[4], 7);
2481 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2482 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2483 rm_listorder, newview, rm_bits2
2485 serv_getln(buf, sizeof buf);
2496 const StrBuf *er_name;
2497 const StrBuf *er_type;
2498 const StrBuf *er_password;
2503 if (!havebstr("ok_button")) {
2504 strcpy(WC->ImportantMessage,
2505 _("Cancelled. No new room was created."));
2506 display_main_menu();
2509 er_name = sbstr("er_name");
2510 er_type = sbstr("type");
2511 er_password = sbstr("er_password");
2512 er_floor = ibstr("er_floor");
2513 er_view = ibstr("er_view");
2516 if (!strcmp(ChrPtr(er_type), "hidden"))
2518 else if (!strcmp(ChrPtr(er_type), "passworded"))
2520 else if (!strcmp(ChrPtr(er_type), "invonly"))
2522 else if (!strcmp(ChrPtr(er_type), "personal"))
2525 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2528 ChrPtr(er_password),
2533 serv_getln(buf, sizeof buf);
2534 if (buf[0] != '2') {
2535 strcpy(WC->ImportantMessage, &buf[4]);
2536 display_main_menu();
2539 /** TODO: Room created, now udate the left hand icon bar for this user */
2540 burn_folder_cache(0); /* burn the old folder cache */
2544 do_change_view(er_view); /* Now go there */
2549 * \brief display the screen to enter a private room
2551 void display_private(char *rname, int req_pass)
2553 WCTemplputParams SubTP;
2555 output_headers(1, 1, 1, 0, 0, 0);
2557 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2558 memset(&SubTP, 0, sizeof(WCTemplputParams));
2559 SubTP.Filter.ContextType = CTX_STRBUF;
2560 SubTP.Context = Buf;
2561 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2566 wc_printf(_("If you know the name of a hidden (guess-name) or "
2567 "passworded room, you can enter that room by typing "
2568 "its name below. Once you gain access to a private "
2569 "room, it will appear in your regular room listings "
2570 "so you don't have to keep returning here."));
2573 wc_printf("<form method=\"post\" action=\"goto_private\">\n");
2574 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2576 wc_printf("<table class=\"altern\"> "
2577 "<tr class=\"even\"><td>");
2578 wc_printf(_("Enter room name:"));
2579 wc_printf("</td><td>"
2580 "<input type=\"text\" name=\"gr_name\" "
2581 "value=\"%s\" maxlength=\"128\">\n", rname);
2584 wc_printf("</td></tr><tr class=\"odd\"><td>");
2585 wc_printf(_("Enter room password:"));
2586 wc_printf("</td><td>");
2587 wc_printf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2589 wc_printf("</td></tr></table>\n");
2591 wc_printf("<div class=\"buttons\">\n");
2592 wc_printf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2594 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2598 wc_printf("</div></form>\n");
2600 do_template("endbox", NULL);
2606 * \brief goto a private room
2608 void goto_private(void)
2613 if (!havebstr("ok_button")) {
2614 display_main_menu();
2617 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2618 serv_printf("GOTO %s|%s",
2621 serv_getln(buf, sizeof buf);
2623 if (buf[0] == '2') {
2624 smart_goto(sbstr("gr_name"));
2627 if (!strncmp(buf, "540", 3)) {
2628 display_private(bstr("gr_name"), 1);
2631 output_headers(1, 1, 1, 0, 0, 0);
2632 wc_printf("%s\n", &buf[4]);
2639 * \brief display the screen to zap a room
2641 void display_zap(void)
2643 output_headers(1, 1, 2, 0, 0, 0);
2645 wc_printf("<div id=\"banner\">\n");
2647 wc_printf(_("Zap (forget/unsubscribe) the current room"));
2648 wc_printf("</h1>\n");
2649 wc_printf("</div>\n");
2651 wc_printf("<div id=\"content\" class=\"service\">\n");
2653 wc_printf(_("If you select this option, <em>%s</em> will "
2654 "disappear from your room list. Is this what you wish "
2655 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2657 wc_printf("<form method=\"POST\" action=\"zap\">\n");
2658 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2659 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2660 wc_printf(" ");
2661 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2662 wc_printf("</form>\n");
2673 StrBuf *final_destination;
2676 * If the forget-room routine fails for any reason, we fall back
2677 * to the current room; otherwise, we go to the Lobby
2679 final_destination = NewStrBufDup(WC->wc_roomname);
2681 if (havebstr("ok_button")) {
2682 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2683 serv_getln(buf, sizeof buf);
2684 if (buf[0] == '2') {
2686 serv_getln(buf, sizeof buf);
2687 if (buf[0] == '2') {
2688 FlushStrBuf(final_destination);
2689 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2693 smart_goto(final_destination);
2694 FreeStrBuf(&final_destination);
2700 * \brief Delete the current room
2702 void delete_room(void)
2707 serv_puts("KILL 1");
2708 serv_getln(buf, sizeof buf);
2709 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2710 if (buf[0] != '2') {
2711 strcpy(WC->ImportantMessage, &buf[4]);
2712 display_main_menu();
2717 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2726 * \brief Perform changes to a room's network configuration
2728 void netedit(void) {
2737 /*/ TODO: do line dynamic! */
2738 if (havebstr("line_pop3host")) {
2739 strcpy(line, bstr("prefix"));
2740 strcat(line, bstr("line_pop3host"));
2742 strcat(line, bstr("line_pop3user"));
2744 strcat(line, bstr("line_pop3pass"));
2746 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2748 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2749 strcat(line, bstr("suffix"));
2751 else if (havebstr("line")) {
2752 strcpy(line, bstr("prefix"));
2753 strcat(line, bstr("line"));
2754 strcat(line, bstr("suffix"));
2769 serv_getln(buf, sizeof buf);
2770 if (buf[0] != '1') {
2776 /** This loop works for add *or* remove. Spiffy, eh? */
2777 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2778 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2779 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2780 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2781 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2782 if ( (strcasecmp(cmpa0, cmpb0))
2783 || (strcasecmp(cmpa1, cmpb1)) ) {
2784 fprintf(fp, "%s\n", buf);
2790 serv_getln(buf, sizeof buf);
2791 if (buf[0] != '4') {
2797 while (fgets(buf, sizeof buf, fp) != NULL) {
2798 buf[strlen(buf)-1] = 0;
2802 if (havebstr("add_button")) {
2803 num_addrs = num_tokens(bstr("line"), ',');
2804 if (num_addrs < 2) {
2805 /* just adding one node or address */
2809 /* adding multiple addresses separated by commas */
2810 for (i=0; i<num_addrs; ++i) {
2811 strcpy(line, bstr("prefix"));
2812 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2815 strcat(line, bstr("suffix"));
2829 * \brief Convert a room name to a folder-ish-looking name.
2830 * \param folder the folderish name
2831 * \param room the room name
2832 * \param floor the floor name
2833 * \param is_mailbox is it a mailbox?
2835 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2840 * For mailboxes, just do it straight...
2843 sprintf(folder, "My folders|%s", room);
2847 * Otherwise, prefix the floor name as a "public folders" moniker
2850 if (floor > MAX_FLOORS) {
2852 sprintf(folder, "%%%%%%|%s", room);
2855 sprintf(folder, "%s|%s", floorlist[floor], room);
2860 * Replace "\" characters with "|" for pseudo-folder-delimiting
2862 len = strlen (folder);
2863 for (i=0; i<len; ++i) {
2864 if (folder[i] == '\\') folder[i] = '|';
2872 * \brief Back end for change_view()
2873 * \param newview set newview???
2875 void do_change_view(int newview) {
2878 serv_printf("VIEW %d", newview);
2879 serv_getln(buf, sizeof buf);
2880 WC->wc_view = newview;
2881 smart_goto(WC->wc_roomname);
2887 * \brief Change the view for this room
2889 void change_view(void) {
2892 view = lbstr("view");
2893 do_change_view(view);
2897 * \brief Burn the cached folder list.
2898 * \param age How old the cahce needs to be before we burn it.
2901 void burn_folder_cache(time_t age)
2903 /** If our cached folder list is very old, burn it. */
2904 if (WC->cache_fold != NULL) {
2905 if ((time(NULL) - WC->cache_timestamp) > age) {
2906 free(WC->cache_fold);
2907 WC->cache_fold = NULL;
2915 * \brief Do either a known rooms list or a folders list, depending on the
2920 StrBuf *ListView = NULL;
2922 /** Determine whether the user is trying to change views */
2923 if (havebstr("view")) {
2924 ListView = NewStrBufDup(SBSTR("view"));
2925 set_preference("roomlistview", ListView, 1);
2927 /** Sanitize the input so its safe */
2928 if(!get_preference("roomlistview", &ListView) ||
2929 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
2930 (strcasecmp(ChrPtr(ListView), "table") != 0)))
2932 if (ListView == NULL) {
2933 ListView = NewStrBufPlain(HKEY("rooms"));
2934 set_preference("roomlistview", ListView, 0);
2937 StrBufPlain(ListView, HKEY("rooms"));
2947 * \brief Set the message expire policy for this room and/or floor
2949 void set_room_policy(void) {
2952 if (!havebstr("ok_button")) {
2953 strcpy(WC->ImportantMessage,
2954 _("Cancelled. Changes were not saved."));
2959 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
2960 serv_getln(buf, sizeof buf);
2961 strcpy(WC->ImportantMessage, &buf[4]);
2963 if (WC->axlevel >= 6) {
2964 strcat(WC->ImportantMessage, "<br />\n");
2965 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
2966 serv_getln(buf, sizeof buf);
2967 strcat(WC->ImportantMessage, &buf[4]);
2973 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
2975 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
2979 void _display_private(void) {
2980 display_private("", 0);
2983 void dotgoto(void) {
2984 if (!havebstr("room")) {
2988 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
2991 smart_goto(sbstr("room"));
2994 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
2996 wc_printf("<div id=\"banner\">\n");
2997 embed_room_banner(NULL, navbar_default);
2998 wc_printf("</div>\n");
3002 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3004 wcsession *WCC = WC;
3007 (!IsEmptyStr(WCC->ugname)))
3008 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3012 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3014 wcsession *WCC = WC;
3016 return ((WCC!=NULL) &&
3017 (!IsEmptyStr(WCC->ugname)) &&
3018 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3021 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3023 wcsession *WCC = WC;
3025 return ((WCC!=NULL) &&
3026 ((WCC->room_flags & QR_PERMANENT) != 0));
3029 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3031 wcsession *WCC = WC;
3033 return ((WCC!=NULL) &&
3034 ((WCC->room_flags & QR_INUSE) != 0));
3037 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3039 wcsession *WCC = WC;
3041 return ((WCC!=NULL) &&
3042 ((WCC->room_flags & QR_PRIVATE) != 0));
3045 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3047 wcsession *WCC = WC;
3049 return ((WCC!=NULL) &&
3050 ((WCC->room_flags & QR_PASSWORDED) != 0));
3053 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3055 wcsession *WCC = WC;
3057 return ((WCC!=NULL) &&
3058 ((WCC->room_flags & QR_GUESSNAME) != 0));
3061 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3063 wcsession *WCC = WC;
3065 return ((WCC!=NULL) &&
3066 ((WCC->room_flags & QR_DIRECTORY) != 0));
3069 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3071 wcsession *WCC = WC;
3073 return ((WCC!=NULL) &&
3074 ((WCC->room_flags & QR_UPLOAD) != 0));
3077 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3079 wcsession *WCC = WC;
3081 return ((WCC!=NULL) &&
3082 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3085 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3087 wcsession *WCC = WC;
3089 return ((WCC!=NULL) &&
3090 ((WCC->room_flags & QR_VISDIR) != 0));
3093 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3095 wcsession *WCC = WC;
3097 return ((WCC!=NULL) &&
3098 ((WCC->room_flags & QR_ANONONLY) != 0));
3101 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3103 wcsession *WCC = WC;
3105 return ((WCC!=NULL) &&
3106 ((WCC->room_flags & QR_ANONOPT) != 0));
3109 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
3111 wcsession *WCC = WC;
3113 return ((WCC!=NULL) &&
3114 ((WCC->room_flags & QR_NETWORK) != 0));
3117 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
3119 wcsession *WCC = WC;
3121 return ((WCC!=NULL) &&
3122 ((WCC->room_flags & QR_PREFONLY) != 0));
3125 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
3127 wcsession *WCC = WC;
3129 return ((WCC!=NULL) &&
3130 ((WCC->room_flags & QR_READONLY) != 0));
3133 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
3135 wcsession *WCC = WC;
3137 return ((WCC!=NULL) &&
3138 ((WCC->room_flags & QR_MAILBOX) != 0));
3145 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3147 wcsession *WCC = WC;
3149 return ( (WCC!= NULL) &&
3150 ((WCC->axlevel >= 6) ||
3151 (WCC->is_room_aide) ||
3152 (WCC->is_mailbox) ));
3155 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
3157 wcsession *WCC = WC;
3159 if ((WCC == NULL) ||
3160 (TP->Tokens->nParameters < 3) ||
3161 (TP->Tokens->Params[2]->Type != TYPE_STR)||
3162 (TP->Tokens->Params[2]->len < 7))
3165 switch(WCC->wc_view) {
3167 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
3169 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
3170 case VIEW_ADDRESSBOOK:
3171 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
3173 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
3175 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
3177 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
3179 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
3181 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
3183 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
3193 RegisterPreference("roomlistview",
3194 _("Room list view"),
3197 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
3199 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
3201 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
3202 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
3203 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
3204 WebcitAddUrlHandler(HKEY("display_private"), "", 0, _display_private, 0);
3205 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
3206 WebcitAddUrlHandler(HKEY("zapped_list"), "", 0, zapped_list, 0);
3207 WebcitAddUrlHandler(HKEY("display_zap"), "", 0, display_zap, 0);
3208 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
3209 WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0);
3210 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
3211 WebcitAddUrlHandler(HKEY("display_whok"), "", 0, display_whok, 0);
3212 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
3213 WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0);
3214 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
3215 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
3216 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
3217 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
3218 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
3219 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
3220 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
3222 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
3223 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
3224 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
3225 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
3226 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
3227 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
3228 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
3229 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
3230 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
3231 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
3232 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
3233 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
3234 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
3235 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
3236 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
3237 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
3239 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
3240 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
3242 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
3243 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
3250 SessionDestroyModule_ROOMOPS
3253 if (sess->cache_fold != NULL) {
3254 free(sess->cache_fold);
3257 free_march_list(sess);
3258 DeleteHash(&sess->Floors);