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 #define FLOOR_PARAM_LEN 3
19 const ConstStr FLOOR_PARAM_NAMES[] = {{HKEY("ID")},
23 #define ROOM_PARAM_LEN 8
24 const ConstStr ROOM_PARAM_NAMES[] = {{HKEY("NAME")},
31 {HKEY("LASTCHANGE")}};
34 void display_whok(void);
37 * Initialize the viewdefs with localized strings
39 void initialize_viewdefs(void) {
40 viewdefs[0] = _("Bulletin Board");
41 viewdefs[1] = _("Mail Folder");
42 viewdefs[2] = _("Address Book");
43 viewdefs[3] = _("Calendar");
44 viewdefs[4] = _("Task List");
45 viewdefs[5] = _("Notes List");
46 viewdefs[6] = _("Wiki");
47 viewdefs[7] = _("Calendar List");
48 viewdefs[8] = _("Journal");
52 * Determine which views are allowed as the default for creating a new room.
54 int is_view_allowed_as_default(int which_view)
57 case VIEW_BBS: return(1);
58 case VIEW_MAILBOX: return(1);
59 case VIEW_ADDRESSBOOK: return(1);
60 case VIEW_CALENDAR: return(1);
61 case VIEW_TASKS: return(1);
62 case VIEW_NOTES: return(1);
65 case VIEW_WIKI: return(1);
66 #else /* TECH_PREVIEW */
67 case VIEW_WIKI: return(0); /* because it isn't finished yet */
68 #endif /* TECH_PREVIEW */
70 case VIEW_CALBRIEF: return(0);
71 case VIEW_JOURNAL: return(0);
72 default: return(0); /* should never get here */
78 * load the list of floors
80 void load_floorlist(StrBuf *Buf)
85 for (a = 0; a < MAX_FLOORS; ++a)
89 StrBuf_ServGetln(Buf);
90 if (GetServerStatus(Buf, NULL) != 1) {
91 strcpy(floorlist[0], "Main Floor");
94 while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
95 if ( (StrLength(Buf)==3) &&
96 !strcmp(ChrPtr(Buf), "000")) {
100 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
106 * Free a session's march list
108 void free_march_list(wcsession *wcf)
112 while (wcf->march != NULL) {
113 mptr = wcf->march->next;
123 * remove a room from the march list
125 void remove_march(const StrBuf *aaa)
127 struct march *mptr, *mptr2;
129 if (WC->march == NULL)
132 if (!strcasecmp(WC->march->march_name, ChrPtr(aaa))) {
133 mptr = WC->march->next;
139 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
140 if (!strcasecmp(mptr->march_name, ChrPtr(aaa))) {
141 mptr2->next = mptr->next;
154 * display rooms in tree structure
156 void room_tree_list(struct roomlisting *rp)
165 room_tree_list(rp->lnext);
167 strcpy(rmname, rp->rlname);
170 wprintf("<a href=\"dotgoto?room=");
174 escputs1(rmname, 1, 1);
175 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
177 else if (f & QR_DIRECTORY)
179 else if (f & QR_NETWORK)
183 wprintf("</a><tt> </tt>\n");
185 room_tree_list(rp->rnext);
191 * Room ordering stuff (compare first by floor, then by order)
193 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
195 if ((r1 == NULL) && (r2 == NULL))
201 if (r1->rlfloor < r2->rlfloor)
203 if (r1->rlfloor > r2->rlfloor)
205 if (r1->rlorder < r2->rlorder)
207 if (r1->rlorder > r2->rlorder)
214 * Common code for all room listings
216 void listrms(char *variety)
221 struct roomlisting *rl = NULL;
222 struct roomlisting *rp;
223 struct roomlisting *rs;
225 /* Ask the server for a room list */
227 serv_getln(buf, sizeof buf);
233 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
235 rp = malloc(sizeof(struct roomlisting));
236 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
237 rp->rlflags = extract_int(buf, 1);
238 rp->rlfloor = extract_int(buf, 2);
239 rp->rlorder = extract_int(buf, 3);
248 if (rordercmp(rp, rs) < 0) {
249 if (rs->lnext == NULL) {
256 if (rs->rnext == NULL) {
269 * If no rooms were listed, print an nbsp to make the cell
270 * borders show up anyway.
272 if (num_rooms == 0) wprintf(" ");
277 * list all forgotten rooms
279 void zapped_list(void)
281 WCTemplputParams SubTP;
284 output_headers(1, 1, 1, 0, 0, 0);
285 memset(&SubTP, 0, sizeof(WCTemplputParams));
286 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
287 SubTP.Filter.ContextType = CTX_STRBUF;
289 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
295 wprintf("<br /><br />\n");
296 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
297 do_template("endbox", NULL);
303 * read this room's info file (set v to 1 for verbose mode)
305 void readinfo(StrBuf *Target, WCTemplputParams *TP)
310 int fullinfo_len = 0;
313 serv_getln(buf, sizeof buf);
316 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
317 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
318 strcpy(&fullinfo[fullinfo_len], buf);
319 fullinfo_len += strlen(buf);
323 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
324 strcpy(&briefinfo[50], "...");
326 wprintf("<div class=\"infos\" "
327 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
331 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
332 wprintf("<img class=\"close_infos\" "
333 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
334 "src=\"static/closewindow.gif\" alt=\"%s\" width=\"16\" height=\"16\">",
349 * Display room banner icon.
350 * The server doesn't actually need the room name, but we supply it in
351 * order to keep the browser from using a cached icon from another room.
353 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
357 serv_puts("OIMG _roompic_");
358 serv_getln(buf, sizeof buf);
360 wprintf("<img height=\"64px\" src=\"image?name=_roompic_&room=");
361 urlescputs(ChrPtr(WC->wc_roomname));
364 serv_getln(buf, sizeof buf);
366 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
367 wprintf("<img class=\"roompic\" alt=\"\" src=\""
368 "static/viewcontacts_48x.gif"
372 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
373 wprintf("<img class=\"roompic\" alt=\"\" src=\""
374 "static/calarea_48x.gif"
375 "\" width=\"48\" height=\"48\">"
378 else if (WC->wc_view == VIEW_TASKS) {
379 wprintf("<img class=\"roompic\" alt=\"\" src=\""
380 "static/taskmanag_48x.gif"
381 "\" width=\"48\" height=\"48\">"
384 else if (WC->wc_view == VIEW_NOTES) {
385 wprintf("<img class=\"roompic\" alt=\"\" src=\""
386 "static/storenotes_48x.gif"
387 "\" width=\"48\" height=\"48\">"
390 else if (WC->wc_view == VIEW_MAILBOX) {
391 wprintf("<img class=\"roompic\" alt=\"\" src=\""
392 "static/privatemess_48x.gif"
393 "\" width=\"48\" height=\"48\">"
397 wprintf("<img class=\"roompic\" alt=\"\" src=\""
398 "static/chatrooms_48x.gif"
399 "\" width=\"48\" height=\"48\">"
408 * Display the current view and offer an option to change it
410 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
414 wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
415 wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
416 wprintf("<label for=\"view_name\">");
417 wprintf(_("View as:"));
419 "<select name=\"newview\" size=\"1\" "
420 "id=\"view_name\" class=\"selectbox\" "
421 "OnChange=\"location.href=viewomatic.newview.options"
422 "[selectedIndex].value\">\n");
424 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
426 * Only offer the views that make sense, given the default
427 * view for the room. For example, don't offer a Calendar
428 * view in a non-Calendar room.
432 || (i == WC->wc_default_view) /* default */
433 || ( (i == 0) && (WC->wc_default_view == 1) ) /* mail or bulletin */
434 || ( (i == 1) && (WC->wc_default_view == 0) ) /* mail or bulletin */
435 /* || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */
438 wprintf("<option %s value=\"changeview?view=%d\">",
439 ((i == WC->wc_view) ? "selected" : ""),
441 escputs(viewdefs[i]);
442 wprintf("</option>\n");
445 wprintf("</select></div></form>\n");
450 * Display a search box
452 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
454 wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
455 wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
456 wprintf("<label for=\"srchquery\">");
457 wprintf(_("Search: "));
458 wprintf("</label><input ");
459 wprintf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
460 wprintf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
462 wprintf("</div></form>\n");
467 * Embed the room banner
469 * got The information returned from a GOTO server command
470 * navbar_style Determines which navigation buttons to display
474 void embed_room_banner(char *got, int navbar_style) {
478 char with_files[256];
482 * We need to have the information returned by a GOTO server command.
483 * If it isn't supplied, we fake it by issuing our own GOTO.
486 memset(buf, '0', 20);
488 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
489 serv_getln(buf, sizeof buf);
493 /* The browser needs some information for its own use */
494 wprintf("<script type=\"text/javascript\"> \n"
495 " room_is_trash = %d; \n"
501 * If the user happens to select the "make this my start page" link,
502 * we want it to remember the URL as a "/dotskip" one instead of
503 * a "skip" or "gotonext" or something like that.
505 if (WCC->Hdr->this_page == NULL) {
506 WCC->Hdr->this_page = NewStrBuf();
508 StrBufPrintf(WCC->Hdr->this_page,
510 ChrPtr(WC->wc_roomname)
513 /* Check for new mail. */
514 WC->new_mail = extract_int(&got[4], 9);
515 WC->wc_view = extract_int(&got[4], 11);
517 /* Is this a directory room and does it contain files and how many? */
518 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
521 serv_getln(buf2, sizeof buf2);
522 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
524 snprintf (with_files, sizeof with_files,
525 "; <a href=\"do_template?template=files\"> %d %s </a>",
527 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
530 strcpy (with_files, "");
532 svprintf(HKEY("NUMMSGS"), WCS_STRING,
533 _("%d new of %d messages%s"),
534 extract_int(&got[4], 1),
535 extract_int(&got[4], 2),
538 svcallback("ROOMPIC", embed_room_graphic);
539 svcallback("ROOMINFO", readinfo);
540 svcallback("VIEWOMATIC", embed_view_o_matic);
541 svcallback("SEARCHOMATIC", embed_search_o_matic);
542 svcallback("START", offer_start_page);
544 do_template("roombanner", NULL);
545 /* roombanner contains this for mobile */
546 if (navbar_style != navbar_none && !WC->is_mobile) {
548 wprintf("<div id=\"navbar\"><ul>");
550 if (navbar_style == navbar_default) wprintf(
551 "<li class=\"ungoto\">"
552 "<a href=\"ungoto\">"
553 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
554 "<span class=\"navbar_link\">%s</span></A>"
555 "</li>\n", _("Ungoto")
558 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
560 "<li class=\"newmess\">"
561 "<a href=\"readnew\">"
562 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
563 "<span class=\"navbar_link\">%s</span></A>"
564 "</li>\n", _("Read new messages")
568 if (navbar_style == navbar_default) {
569 switch(WC->wc_view) {
570 case VIEW_ADDRESSBOOK:
572 "<li class=\"viewcontacts\">"
573 "<a href=\"readfwd\">"
574 "<img src=\"static/viewcontacts_24x.gif\" "
575 "alt=\"\" width=\"24\" height=\"24\">"
576 "<span class=\"navbar_link\">"
578 "</span></a></li>\n", _("View contacts")
583 "<li class=\"staskday\">"
584 "<a href=\"readfwd?calview=day\">"
585 "<img src=\"static/taskday2_24x.gif\" "
586 "alt=\"\" width=\"24\" height=\"24\">"
587 "<span class=\"navbar_link\">"
589 "</span></a></li>\n", _("Day view")
592 "<li class=\"monthview\">"
593 "<a href=\"readfwd?calview=month\">"
594 "<img src=\"static/monthview2_24x.gif\" "
595 "alt=\"\" width=\"24\" height=\"24\">"
596 "<span class=\"navbar_link\">"
598 "</span></a></li>\n", _("Month view")
603 "<li class=\"monthview\">"
604 "<a href=\"readfwd?calview=month\">"
605 "<img src=\"static/monthview2_24x.gif\" "
606 "alt=\"\" width=\"24\" height=\"24\">"
607 "<span class=\"navbar_link\">"
609 "</span></a></li>\n", _("Calendar list")
614 "<li class=\"taskmanag\">"
615 "<a href=\"readfwd\">"
616 "<img src=\"static/taskmanag_24x.gif\" "
617 "alt=\"\" width=\"24\" height=\"24\">"
618 "<span class=\"navbar_link\">"
620 "</span></a></li>\n", _("View tasks")
625 "<li class=\"viewnotes\">"
626 "<a href=\"readfwd\">"
627 "<img src=\"static/viewnotes_24x.gif\" "
628 "alt=\"\" width=\"24\" height=\"24\">"
629 "<span class=\"navbar_link\">"
631 "</span></a></li>\n", _("View notes")
636 "<li class=\"readallmess\">"
637 "<a id=\"m_refresh\" href=\"readfwd\">"
638 "<img src=\"static/readallmess3_24x.gif\" "
639 "alt=\"\" width=\"24\" height=\"24\">"
640 "<span class=\"navbar_link\">"
642 "</span></a></li>\n", _("Refresh message list")
647 "<li class=\"readallmess\">"
648 "<a href=\"readfwd\">"
649 "<img src=\"static/readallmess3_24x.gif\" "
650 "alt=\"\" width=\"24\" height=\"24\">"
651 "<span class=\"navbar_link\">"
653 "</span></a></li>\n", _("Wiki home")
658 "<li class=\"readallmess\">"
659 "<a href=\"readfwd\">"
660 "<img src=\"static/readallmess3_24x.gif\" "
661 "alt=\"\" width=\"24\" height=\"24\">"
662 "<span class=\"navbar_link\">"
664 "</span></a></li>\n", _("Read all messages")
670 if (navbar_style == navbar_default) {
671 switch(WC->wc_view) {
672 case VIEW_ADDRESSBOOK:
674 "<li class=\"addnewcontact\">"
675 "<a href=\"display_enter\">"
676 "<img src=\"static/addnewcontact_24x.gif\" "
677 "alt=\"\" width=\"24\" height=\"24\">"
678 "<span class=\"navbar_link\">"
680 "</span></a></li>\n", _("Add new contact")
685 wprintf("<li class=\"addevent\"><a href=\"display_enter");
686 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
687 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
688 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
690 "<img src=\"static/addevent_24x.gif\" "
691 "alt=\"\" width=\"24\" height=\"24\">"
692 "<span class=\"navbar_link\">"
694 "</span></a></li>\n", _("Add new event")
699 "<li class=\"newmess\">"
700 "<a href=\"display_enter\">"
701 "<img src=\"static/newmess3_24x.gif\" "
702 "alt=\"\" width=\"24\" height=\"24\">"
703 "<span class=\"navbar_link\">"
705 "</span></a></li>\n", _("Add new task")
710 "<li class=\"enternewnote\">"
711 "<a href=\"add_new_note\">"
712 "<img src=\"static/enternewnote_24x.gif\" "
713 "alt=\"\" width=\"24\" height=\"24\">"
714 "<span class=\"navbar_link\">"
716 "</span></a></li>\n", _("Add new note")
720 safestrncpy(buf, bstr("page"), sizeof buf);
723 "<li class=\"newmess\">"
724 "<a href=\"display_enter?wikipage=%s\">"
725 "<img src=\"static/newmess3_24x.gif\" "
726 "alt=\"\" width=\"24\" height=\"24\">"
727 "<span class=\"navbar_link\">"
729 "</span></a></li>\n", buf, _("Edit this page")
734 "<li class=\"newmess\">"
735 "<a href=\"display_enter\">"
736 "<img src=\"static/newmess3_24x.gif\" "
737 "alt=\"\" width=\"24\" height=\"24\">"
738 "<span class=\"navbar_link\">"
740 "</span></a></li>\n", _("Write mail")
743 "<li class=\"newmess\">"
744 "<a href=\"javascript:deleteAllSelectedMessages();\">"
745 "<img src=\"static/delete.gif\" "
746 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
748 "</span></a></li>\n", _("Delete")
753 "<li class=\"newmess\">"
754 "<a href=\"display_enter\">"
755 "<img src=\"static/newmess3_24x.gif\" "
756 "alt=\"\" width=\"24\" height=\"24\">"
757 "<span class=\"navbar_link\">"
759 "</span></a></li>\n", _("Enter a message")
765 if (navbar_style == navbar_default) wprintf(
766 "<li class=\"skipthisroom\">"
769 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
770 "width=\"24\" height=\"24\">"
771 "<span class=\"navbar_link\">%s</span></a>"
773 _("Leave all messages marked as unread, go to next room with unread messages"),
777 if (navbar_style == navbar_default) wprintf(
778 "<li class=\"markngo\">"
779 "<a href=\"gotonext\" "
781 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
782 "width=\"24\" height=\"24\">"
783 "<span class=\"navbar_link\">%s</span></a>"
785 _("Mark all messages as read, go to next room with unread messages"),
789 wprintf("</ul></div>\n");
796 * back end routine to take the session to a new room
798 long gotoroom(const StrBuf *gname)
801 static long ls = (-1L);
804 /* store ungoto information */
805 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
809 /* move to the new room */
810 serv_printf("GOTO %s", ChrPtr(gname));
811 StrBuf_ServGetln(Buf);
812 if (GetServerStatus(Buf, &err) != 2) {
813 serv_puts("GOTO _BASEROOM_");
814 StrBuf_ServGetln(Buf);
816 * well, we know that this is the fallback case,
817 * but we're interested that the first command
818 * didn't work out in first place.
820 if (GetServerStatus(Buf, NULL) != 2) {
826 if (WC->wc_roomname == NULL)
827 WC->wc_roomname = NewStrBuf();
829 FlushStrBuf(WC->wc_roomname);
831 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
832 StrBufCutLeft(WC->wc_roomname, 4);
833 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
834 /* highest_msg_read = extract_int(&buf[4],6);
835 maxmsgnum = extract_int(&buf[4],5);
837 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
838 ls = StrBufExtract_long(Buf, 6, '|');
839 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
840 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
841 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
842 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
843 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
846 WC->is_room_aide = WC->is_aide;
848 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
850 remove_march(WC->wc_roomname);
851 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
860 * \brief Locate the room on the march list which we most want to go to.
862 * is measured given a "weight" of preference based on various factors.
863 * \param desired_floor the room number on the citadel server
864 * \return the roomname
866 char *pop_march(int desired_floor)
868 static char TheRoom[128];
870 int TheOrder = 32767;
873 struct march *mptr = NULL;
875 strcpy(TheRoom, "_BASEROOM_");
876 if (WC->march == NULL)
879 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
881 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
882 weight = weight + 10000;
883 if (mptr->march_floor == desired_floor)
884 weight = weight + 5000;
886 weight = weight + ((128 - (mptr->march_floor)) * 128);
887 weight = weight + (128 - (mptr->march_order));
889 if (weight > TheWeight) {
891 strcpy(TheRoom, mptr->march_name);
892 TheFloor = mptr->march_floor;
893 TheOrder = mptr->march_order;
902 * Goto next room having unread messages.
904 * We want to skip over rooms that the user has already been to, and take the
905 * user back to the lobby when done. The room we end up in is placed in
906 * newroom - which is set to 0 (the lobby) initially.
907 * We start the search in the current room rather than the beginning to prevent
908 * two or more concurrent users from dragging each other back to the same room.
913 struct march *mptr = NULL;
914 struct march *mptr2 = NULL;
920 * First check to see if the march-mode list is already allocated.
921 * If it is, pop the first room off the list and go there.
923 if (havebstr("startmsg")) {
928 if (WC->march == NULL) {
930 serv_getln(buf, sizeof buf);
932 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
933 if (IsEmptyStr(buf)) {
936 if (ELoop % 100 == 0)
941 extract_token(room_name, buf, 0, '|', sizeof room_name);
942 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
943 mptr = (struct march *) malloc(sizeof(struct march));
945 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
946 mptr->march_floor = extract_int(buf, 2);
947 mptr->march_order = extract_int(buf, 3);
948 if (WC->march == NULL)
957 * add _BASEROOM_ to the end of the march list, so the user will end up
958 * in the system base room (usually the Lobby>) at the end of the loop
960 mptr = (struct march *) malloc(sizeof(struct march));
962 mptr->march_order = 0;
963 mptr->march_floor = 0;
964 strcpy(mptr->march_name, "_BASEROOM_");
965 if (WC->march == NULL) {
969 while (mptr2->next != NULL)
974 * ...and remove the room we're currently in, so a <G>oto doesn't make us
975 * walk around in circles
977 remove_march(WC->wc_roomname);
979 if (WC->march != NULL) {
980 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
982 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
986 smart_goto(next_room);
987 FreeStrBuf(&next_room);
994 void smart_goto(const StrBuf *next_room) {
1002 * mark all messages in current room as having been read
1004 void slrp_highest(void)
1008 serv_puts("SLRP HIGHEST");
1009 serv_getln(buf, sizeof buf);
1014 * un-goto the previous room
1020 if (havebstr("startmsg")) {
1025 if (!strcmp(WC->ugname, "")) {
1026 smart_goto(WC->wc_roomname);
1029 serv_printf("GOTO %s", WC->ugname);
1031 StrBuf_ServGetln(Buf);
1032 if (GetServerStatus(Buf, NULL) != 2) {
1033 smart_goto(WC->wc_roomname);
1037 if (WC->uglsn >= 0L) {
1038 serv_printf("SLRP %ld", WC->uglsn);
1039 StrBuf_ServGetln(Buf);
1042 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1043 strcpy(WC->ugname, "");
1048 typedef struct __room_states {
1063 * Set/clear/read the "self-service list subscribe" flag for a room
1065 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1066 * returns the new value.
1069 int self_service(int newval) {
1070 int current_value = 0;
1076 int flags, floor, order, view, flags2;
1079 serv_getln(buf, sizeof buf);
1080 if (buf[0] != '2') return(0);
1082 extract_token(name, &buf[4], 0, '|', sizeof name);
1083 extract_token(password, &buf[4], 1, '|', sizeof password);
1084 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1085 flags = extract_int(&buf[4], 3);
1086 floor = extract_int(&buf[4], 4);
1087 order = extract_int(&buf[4], 5);
1088 view = extract_int(&buf[4], 6);
1089 flags2 = extract_int(&buf[4], 7);
1091 if (flags2 & QR2_SELFLIST) {
1099 flags2 = flags2 | QR2_SELFLIST;
1101 else if (newval == 0) {
1102 flags2 = flags2 & ~QR2_SELFLIST;
1105 return(current_value);
1108 if (newval != current_value) {
1109 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1110 name, password, dirname, flags,
1111 floor, order, view, flags2);
1112 serv_getln(buf, sizeof buf);
1119 int is_selflist(room_states *RoomFlags)
1121 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1124 int is_publiclist(room_states *RoomFlags)
1126 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1129 int is_moderatedlist(room_states *RoomFlags)
1131 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1135 * Set/clear/read the "self-service list subscribe" flag for a room
1137 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1138 * returns the new value.
1141 int get_roomflags(room_states *RoomOps)
1146 serv_getln(buf, sizeof buf);
1147 if (buf[0] != '2') return(0);
1149 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1150 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1151 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1152 RoomOps->flags = extract_int(&buf[4], 3);
1153 RoomOps->floor = extract_int(&buf[4], 4);
1154 RoomOps->order = extract_int(&buf[4], 5);
1155 RoomOps->view = extract_int(&buf[4], 6);
1156 RoomOps->flags2 = extract_int(&buf[4], 7);
1160 int set_roomflags(room_states *RoomOps)
1164 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1173 serv_getln(buf, sizeof buf);
1183 * display the form for editing a room
1185 void display_editroom(void)
1191 char remote_room[128];
1194 char er_password[10];
1195 char er_dirname[15];
1196 char er_roomaide[26];
1203 char *not_shared_with;
1206 int floorpolicy = 0;
1208 char pop3_host[128];
1213 if (IsEmptyStr(tab)) tab = "admin";
1216 load_floorlist(Buf);
1218 output_headers(1, 1, 1, 0, 0, 0);
1220 wprintf("<div class=\"fix_scrollbar_bug\">");
1222 wprintf("<br />\n");
1224 /* print the tabbed dialog */
1225 wprintf("<div align=\"center\">");
1226 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
1227 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1230 wprintf("<td class=\"");
1231 if (!strcmp(tab, "admin")) {
1232 wprintf(" tab_cell_label\">");
1233 wprintf(_("Administration"));
1236 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1237 wprintf(_("Administration"));
1241 wprintf("<td> </td>\n");
1243 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1245 wprintf("<td class=\"");
1246 if (!strcmp(tab, "config")) {
1247 wprintf(" tab_cell_label\">");
1248 wprintf(_("Configuration"));
1251 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1252 wprintf(_("Configuration"));
1256 wprintf("<td> </td>\n");
1258 wprintf("<td class=\"");
1259 if (!strcmp(tab, "expire")) {
1260 wprintf(" tab_cell_label\">");
1261 wprintf(_("Message expire policy"));
1264 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1265 wprintf(_("Message expire policy"));
1269 wprintf("<td> </td>\n");
1271 wprintf("<td class=\"");
1272 if (!strcmp(tab, "access")) {
1273 wprintf(" tab_cell_label\">");
1274 wprintf(_("Access controls"));
1277 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1278 wprintf(_("Access controls"));
1282 wprintf("<td> </td>\n");
1284 wprintf("<td class=\"");
1285 if (!strcmp(tab, "sharing")) {
1286 wprintf(" tab_cell_label\">");
1287 wprintf(_("Sharing"));
1290 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1291 wprintf(_("Sharing"));
1295 wprintf("<td> </td>\n");
1297 wprintf("<td class=\"");
1298 if (!strcmp(tab, "listserv")) {
1299 wprintf(" tab_cell_label\">");
1300 wprintf(_("Mailing list service"));
1303 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1304 wprintf(_("Mailing list service"));
1308 wprintf("<td> </td>\n");
1312 wprintf("<td class=\"");
1313 if (!strcmp(tab, "feeds")) {
1314 wprintf(" tab_cell_label\">");
1315 wprintf(_("Remote retrieval"));
1318 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1319 wprintf(_("Remote retrieval"));
1323 wprintf("<td> </td>\n");
1325 wprintf("</tr></table>\n");
1326 wprintf("</div>\n");
1327 /* end tabbed dialog */
1329 wprintf("<script type=\"text/javascript\">"
1330 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1334 /* begin content of whatever tab is open now */
1336 if (!strcmp(tab, "admin")) {
1337 wprintf("<div class=\"tabcontent\">");
1339 "<li><a href=\"delete_room\" "
1340 "onClick=\"return confirm('");
1341 wprintf(_("Are you sure you want to delete this room?"));
1342 wprintf("');\">\n");
1343 wprintf(_("Delete this room"));
1345 "<li><a href=\"display_editroompic\">\n");
1346 wprintf(_("Set or change the icon for this room's banner"));
1348 "<li><a href=\"display_editinfo\">\n");
1349 wprintf(_("Edit this room's Info file"));
1355 if (!strcmp(tab, "config")) {
1356 wprintf("<div class=\"tabcontent\">");
1358 serv_getln(buf, sizeof buf);
1360 if (!strncmp(buf, "550", 3)) {
1361 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1362 _("Higher access is required to access this function.")
1365 else if (buf[0] != '2') {
1366 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1369 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1370 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1371 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1372 er_flags = extract_int(&buf[4], 3);
1373 er_floor = extract_int(&buf[4], 4);
1374 er_flags2 = extract_int(&buf[4], 7);
1376 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1377 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1379 wprintf("<ul><li>");
1380 wprintf(_("Name of room: "));
1381 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1387 wprintf(_("Resides on floor: "));
1388 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1389 if (er_flags & QR_MAILBOX)
1390 wprintf("disabled >\n");
1391 for (i = 0; i < 128; ++i)
1392 if (!IsEmptyStr(floorlist[i])) {
1393 wprintf("<OPTION ");
1395 wprintf("SELECTED ");
1396 wprintf("VALUE=\"%d\">", i);
1397 escputs(floorlist[i]);
1398 wprintf("</OPTION>\n");
1400 wprintf("</select>\n");
1403 wprintf(_("Type of room:"));
1406 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1407 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1408 wprintf("CHECKED ");
1409 wprintf("OnChange=\""
1410 " if (this.form.type[0].checked == true) { "
1411 " this.form.er_floor.disabled = false; "
1414 wprintf(_("Public (automatically appears to everyone)"));
1417 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1418 if ((er_flags & QR_PRIVATE) &&
1419 (er_flags & QR_GUESSNAME))
1420 wprintf("CHECKED ");
1421 wprintf(" OnChange=\""
1422 " if (this.form.type[1].checked == true) { "
1423 " this.form.er_floor.disabled = false; "
1426 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1428 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1429 if ((er_flags & QR_PRIVATE) &&
1430 (er_flags & QR_PASSWORDED))
1431 wprintf("CHECKED ");
1432 wprintf(" OnChange=\""
1433 " if (this.form.type[2].checked == true) { "
1434 " this.form.er_floor.disabled = false; "
1437 wprintf(_("Private - require password: "));
1438 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1441 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1442 if ((er_flags & QR_PRIVATE)
1443 && ((er_flags & QR_GUESSNAME) == 0)
1444 && ((er_flags & QR_PASSWORDED) == 0))
1445 wprintf("CHECKED ");
1446 wprintf(" OnChange=\""
1447 " if (this.form.type[3].checked == true) { "
1448 " this.form.er_floor.disabled = false; "
1451 wprintf(_("Private - invitation only"));
1453 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1454 if (er_flags & QR_MAILBOX)
1455 wprintf("CHECKED ");
1456 wprintf (" OnChange=\""
1457 " if (this.form.type[4].checked == true) { "
1458 " this.form.er_floor.disabled = true; "
1461 wprintf(_("Personal (mailbox for you only)"));
1463 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1465 wprintf(_("If private, cause current users to forget room"));
1467 wprintf("\n</ul>\n");
1469 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1470 if (er_flags & QR_PREFONLY)
1471 wprintf("CHECKED ");
1473 wprintf(_("Preferred users only"));
1475 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1476 if (er_flags & QR_READONLY)
1477 wprintf("CHECKED ");
1479 wprintf(_("Read-only room"));
1481 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1482 if (er_flags2 & QR2_COLLABDEL)
1483 wprintf("CHECKED ");
1485 wprintf(_("All users allowed to post may also delete messages"));
1487 /** directory stuff */
1488 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1489 if (er_flags & QR_DIRECTORY)
1490 wprintf("CHECKED ");
1492 wprintf(_("File directory room"));
1494 wprintf("\n<ul><li>");
1495 wprintf(_("Directory name: "));
1496 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1499 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1500 if (er_flags & QR_UPLOAD)
1501 wprintf("CHECKED ");
1503 wprintf(_("Uploading allowed"));
1505 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1506 if (er_flags & QR_DOWNLOAD)
1507 wprintf("CHECKED ");
1509 wprintf(_("Downloading allowed"));
1511 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1512 if (er_flags & QR_VISDIR)
1513 wprintf("CHECKED ");
1515 wprintf(_("Visible directory"));
1518 /** end of directory stuff */
1520 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1521 if (er_flags & QR_NETWORK)
1522 wprintf("CHECKED ");
1524 wprintf(_("Network shared room"));
1526 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1527 if (er_flags & QR_PERMANENT)
1528 wprintf("CHECKED ");
1530 wprintf(_("Permanent (does not auto-purge)"));
1532 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1533 if (er_flags2 & QR2_SUBJECTREQ)
1534 wprintf("CHECKED ");
1536 wprintf(_("Subject Required (Force users to specify a message subject)"));
1538 /** start of anon options */
1541 wprintf(_("Anonymous messages"));
1544 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1545 if (((er_flags & QR_ANONONLY) == 0)
1546 && ((er_flags & QR_ANONOPT) == 0))
1547 wprintf("CHECKED ");
1549 wprintf(_("No anonymous messages"));
1551 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1552 if (er_flags & QR_ANONONLY)
1553 wprintf("CHECKED ");
1555 wprintf(_("All messages are anonymous"));
1557 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1558 if (er_flags & QR_ANONOPT)
1559 wprintf("CHECKED ");
1561 wprintf(_("Prompt user when entering messages"));
1564 /* end of anon options */
1567 wprintf(_("Room aide: "));
1569 serv_getln(buf, sizeof buf);
1570 if (buf[0] != '2') {
1571 wprintf("<em>%s</em>\n", &buf[4]);
1573 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1574 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1577 wprintf("</ul><CENTER>\n");
1578 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1579 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1581 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1591 /* Sharing the room with other Citadel nodes... */
1592 if (!strcmp(tab, "sharing")) {
1593 wprintf("<div class=\"tabcontent\">");
1595 shared_with = strdup("");
1596 not_shared_with = strdup("");
1598 /** Learn the current configuration */
1599 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1600 serv_getln(buf, sizeof buf);
1601 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1602 extract_token(node, buf, 0, '|', sizeof node);
1603 not_shared_with = realloc(not_shared_with,
1604 strlen(not_shared_with) + 32);
1605 strcat(not_shared_with, node);
1606 strcat(not_shared_with, "\n");
1610 serv_getln(buf, sizeof buf);
1611 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1612 extract_token(cmd, buf, 0, '|', sizeof cmd);
1613 extract_token(node, buf, 1, '|', sizeof node);
1614 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1615 if (!strcasecmp(cmd, "ignet_push_share")) {
1616 shared_with = realloc(shared_with,
1617 strlen(shared_with) + 32);
1618 strcat(shared_with, node);
1619 if (!IsEmptyStr(remote_room)) {
1620 strcat(shared_with, "|");
1621 strcat(shared_with, remote_room);
1623 strcat(shared_with, "\n");
1627 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1628 extract_token(buf, shared_with, i, '\n', sizeof buf);
1629 extract_token(node, buf, 0, '|', sizeof node);
1630 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1631 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1632 if (!strcasecmp(node, cmd)) {
1633 remove_token(not_shared_with, j, '\n');
1638 /* Display the stuff */
1639 wprintf("<CENTER><br />"
1640 "<table border=1 cellpadding=5><tr>"
1642 wprintf(_("Shared with"));
1643 wprintf("</I></B></td>"
1645 wprintf(_("Not shared with"));
1646 wprintf("</I></B></td></tr>\n"
1647 "<tr><td VALIGN=TOP>\n");
1649 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1650 wprintf(_("Remote node name"));
1651 wprintf("</td><td>");
1652 wprintf(_("Remote room name"));
1653 wprintf("</td><td>");
1654 wprintf(_("Actions"));
1655 wprintf("</td></tr>\n");
1657 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1658 extract_token(buf, shared_with, i, '\n', sizeof buf);
1659 extract_token(node, buf, 0, '|', sizeof node);
1660 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1661 if (!IsEmptyStr(node)) {
1662 wprintf("<form method=\"POST\" action=\"netedit\">");
1663 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1664 wprintf("<tr><td>%s</td>\n", node);
1667 if (!IsEmptyStr(remote_room)) {
1668 escputs(remote_room);
1674 wprintf("<input type=\"hidden\" NAME=\"line\" "
1675 "VALUE=\"ignet_push_share|");
1677 if (!IsEmptyStr(remote_room)) {
1679 urlescputs(remote_room);
1682 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1683 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1684 wprintf("<input type=\"submit\" "
1685 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1686 wprintf("</td></tr></form>\n");
1690 wprintf("</table>\n");
1691 wprintf("</td><td VALIGN=TOP>\n");
1692 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1693 wprintf(_("Remote node name"));
1694 wprintf("</td><td>");
1695 wprintf(_("Remote room name"));
1696 wprintf("</td><td>");
1697 wprintf(_("Actions"));
1698 wprintf("</td></tr>\n");
1700 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1701 extract_token(node, not_shared_with, i, '\n', sizeof node);
1702 if (!IsEmptyStr(node)) {
1703 wprintf("<form method=\"POST\" action=\"netedit\">");
1704 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1705 wprintf("<tr><td>");
1708 "<input type=\"INPUT\" "
1712 wprintf("<input type=\"hidden\" "
1714 "VALUE=\"ignet_push_share|");
1717 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1718 "VALUE=\"sharing\">\n");
1719 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1720 "VALUE=\"add\">\n");
1721 wprintf("<input type=\"submit\" "
1722 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1723 wprintf("</td></tr></form>\n");
1727 wprintf("</table>\n");
1728 wprintf("</td></tr>"
1729 "</table></CENTER><br />\n"
1730 "<I><B>%s</B><ul><li>", _("Notes:"));
1731 wprintf(_("When sharing a room, "
1732 "it must be shared from both ends. Adding a node to "
1733 "the 'shared' list sends messages out, but in order to"
1734 " receive messages, the other nodes must be configured"
1735 " to send messages out to your system as well. "
1736 "<li>If the remote room name is blank, it is assumed "
1737 "that the room name is identical on the remote node."
1738 "<li>If the remote room name is different, the remote "
1739 "node must also configure the name of the room here."
1746 /* Mailing list management */
1747 if (!strcmp(tab, "listserv")) {
1748 room_states RoomFlags;
1749 wprintf("<div class=\"tabcontent\">");
1751 wprintf("<br /><center>"
1752 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1753 "<tr><td VALIGN=TOP>");
1755 wprintf(_("<i>The contents of this room are being "
1756 "mailed <b>as individual messages</b> "
1757 "to the following list recipients:"
1758 "</i><br /><br />\n"));
1761 serv_getln(buf, sizeof buf);
1762 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1763 extract_token(cmd, buf, 0, '|', sizeof cmd);
1764 if (!strcasecmp(cmd, "listrecp")) {
1765 extract_token(recp, buf, 1, '|', sizeof recp);
1768 wprintf(" <a href=\"netedit?cmd=remove&tab=listserv&line=listrecp|");
1771 wprintf(_("(remove)"));
1772 wprintf("</A><br />");
1775 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1776 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1777 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1778 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1779 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1780 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1781 wprintf("</form>\n");
1783 wprintf("</td><td VALIGN=TOP>\n");
1785 wprintf(_("<i>The contents of this room are being "
1786 "mailed <b>in digest form</b> "
1787 "to the following list recipients:"
1788 "</i><br /><br />\n"));
1791 serv_getln(buf, sizeof buf);
1792 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1793 extract_token(cmd, buf, 0, '|', sizeof cmd);
1794 if (!strcasecmp(cmd, "digestrecp")) {
1795 extract_token(recp, buf, 1, '|', sizeof recp);
1798 wprintf(" <a href=\"netedit?cmd=remove&tab=listserv&line="
1802 wprintf(_("(remove)"));
1803 wprintf("</A><br />");
1806 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1807 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1808 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1809 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1810 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1811 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1812 wprintf("</form>\n");
1814 wprintf("</td></tr></table>\n");
1816 /** Pop open an address book -- begin **/
1817 wprintf("<div align=right>"
1818 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1820 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1825 _("Add recipients from Contacts or other address books"),
1826 _("Add recipients from Contacts or other address books")
1828 /* Pop open an address book -- end **/
1830 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1832 get_roomflags (&RoomFlags);
1834 /* Self Service subscription? */
1835 wprintf("<table><tr><td>\n");
1836 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1837 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1838 " <tr><td colspan=\"2\">\n",
1839 (is_selflist(&RoomFlags))?"checked":"");
1840 wprintf(_("The URL for subscribe/unsubscribe is: "));
1841 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1842 (is_https ? "https" : "http"),
1843 ChrPtr(WC->Hdr->HR.http_host));
1844 /* Public posting? */
1845 wprintf("<tr><td>");
1846 wprintf(_("Allow non-subscribers to mail to this room."));
1847 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1848 (is_publiclist(&RoomFlags))?"checked":"");
1850 /* Moderated List? */
1851 wprintf("<tr><td>");
1852 wprintf(_("Room post publication needs Aide permission."));
1853 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1854 (is_moderatedlist(&RoomFlags))?"checked":"");
1857 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1858 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1859 wprintf("</table></form>");
1862 wprintf("</CENTER>\n");
1867 /* Configuration of The Dreaded Auto-Purger */
1868 if (!strcmp(tab, "expire")) {
1869 wprintf("<div class=\"tabcontent\">");
1871 serv_puts("GPEX room");
1872 serv_getln(buf, sizeof buf);
1873 if (!strncmp(buf, "550", 3)) {
1874 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1875 _("Higher access is required to access this function.")
1878 else if (buf[0] != '2') {
1879 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1882 roompolicy = extract_int(&buf[4], 0);
1883 roomvalue = extract_int(&buf[4], 1);
1885 serv_puts("GPEX floor");
1886 serv_getln(buf, sizeof buf);
1887 if (buf[0] == '2') {
1888 floorpolicy = extract_int(&buf[4], 0);
1889 floorvalue = extract_int(&buf[4], 1);
1892 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1893 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1894 wprintf("<table border=0 cellspacing=5>\n");
1895 wprintf("<tr><td>");
1896 wprintf(_("Message expire policy for this room"));
1898 escputs(ChrPtr(WC->wc_roomname));
1899 wprintf(")</td><td>");
1900 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1901 ((roompolicy == 0) ? "CHECKED" : "") );
1902 wprintf(_("Use the default policy for this floor"));
1903 wprintf("<br />\n");
1904 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1905 ((roompolicy == 1) ? "CHECKED" : "") );
1906 wprintf(_("Never automatically expire messages"));
1907 wprintf("<br />\n");
1908 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1909 ((roompolicy == 2) ? "CHECKED" : "") );
1910 wprintf(_("Expire by message count"));
1911 wprintf("<br />\n");
1912 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1913 ((roompolicy == 3) ? "CHECKED" : "") );
1914 wprintf(_("Expire by message age"));
1916 wprintf(_("Number of messages or days: "));
1917 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1918 wprintf("</td></tr>\n");
1920 if (WC->axlevel >= 6) {
1921 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1922 wprintf("<tr><td>");
1923 wprintf(_("Message expire policy for this floor"));
1925 escputs(floorlist[WC->wc_floor]);
1926 wprintf(")</td><td>");
1927 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1928 ((floorpolicy == 0) ? "CHECKED" : "") );
1929 wprintf(_("Use the system default"));
1930 wprintf("<br />\n");
1931 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1932 ((floorpolicy == 1) ? "CHECKED" : "") );
1933 wprintf(_("Never automatically expire messages"));
1934 wprintf("<br />\n");
1935 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1936 ((floorpolicy == 2) ? "CHECKED" : "") );
1937 wprintf(_("Expire by message count"));
1938 wprintf("<br />\n");
1939 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1940 ((floorpolicy == 3) ? "CHECKED" : "") );
1941 wprintf(_("Expire by message age"));
1943 wprintf(_("Number of messages or days: "));
1944 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1948 wprintf("<CENTER>\n");
1949 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1950 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1952 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1953 wprintf("</CENTER></td><tr>\n");
1955 wprintf("</table>\n"
1956 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1964 /* Access controls */
1965 if (!strcmp(tab, "access")) {
1966 wprintf("<div class=\"tabcontent\">");
1971 /* Fetch messages from remote locations */
1972 if (!strcmp(tab, "feeds")) {
1973 wprintf("<div class=\"tabcontent\">");
1976 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1977 wprintf("</i><br />\n");
1979 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1980 "<tr class=\"even\"><th>");
1981 wprintf(_("Remote host"));
1982 wprintf("</th><th>");
1983 wprintf(_("User name"));
1984 wprintf("</th><th>");
1985 wprintf(_("Password"));
1986 wprintf("</th><th>");
1987 wprintf(_("Keep messages on server?"));
1988 wprintf("</th><th>");
1989 wprintf(_("Interval"));
1990 wprintf("</th><th> </th></tr>");
1993 serv_getln(buf, sizeof buf);
1995 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1996 extract_token(cmd, buf, 0, '|', sizeof cmd);
1997 if (!strcasecmp(cmd, "pop3client")) {
1998 safestrncpy(recp, &buf[11], sizeof recp);
2001 wprintf("<tr class=\"%s\">",
2002 (bg ? "even" : "odd")
2006 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2011 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
2015 wprintf("<td>*****</td>"); /* Don't show the password */
2017 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
2019 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
2021 wprintf("<td class=\"button_link\">");
2022 wprintf(" <a href=\"netedit?cmd=remove&tab=feeds&line=pop3client|");
2025 wprintf(_("(remove)"));
2026 wprintf("</a></td>");
2032 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2034 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2035 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
2036 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2038 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
2041 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
2044 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2047 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2050 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2053 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2054 wprintf("</td></tr>");
2055 wprintf("</form></table>\n");
2060 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2061 wprintf("</i><br />\n");
2063 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2064 "<tr class=\"even\"><th>");
2065 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2066 wprintf(_("Feed URL"));
2067 wprintf("</th><th>");
2068 wprintf("</th></tr>");
2071 serv_getln(buf, sizeof buf);
2073 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2074 extract_token(cmd, buf, 0, '|', sizeof cmd);
2075 if (!strcasecmp(cmd, "rssclient")) {
2076 safestrncpy(recp, &buf[10], sizeof recp);
2079 wprintf("<tr class=\"%s\">",
2080 (bg ? "even" : "odd")
2084 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2088 wprintf("<td class=\"button_link\">");
2089 wprintf(" <a href=\"netedit?cmd=remove&tab=feeds&line=rssclient|");
2092 wprintf(_("(remove)"));
2093 wprintf("</a></td>");
2099 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2101 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2102 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2103 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2105 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2106 "maxlength=\"256\" name=\"line_pop3host\">\n");
2109 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2110 wprintf("</td></tr>");
2111 wprintf("</form></table>\n");
2117 /* end content of whatever tab is open now */
2118 wprintf("</div>\n");
2120 address_book_popup();
2126 * Toggle self-service list subscription
2128 void toggle_self_service(void) {
2129 room_states RoomFlags;
2131 get_roomflags (&RoomFlags);
2133 if (yesbstr("QR2_SelfList"))
2134 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2136 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2138 if (yesbstr("QR2_SMTP_PUBLIC"))
2139 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2141 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2143 if (yesbstr("QR2_Moderated"))
2144 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2146 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2147 if (yesbstr("QR2_SubsOnly"))
2148 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2150 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2152 set_roomflags (&RoomFlags);
2160 * save new parameters for a room
2167 StrBuf *er_password;
2169 StrBuf *er_roomaide;
2172 int er_listingorder;
2178 if (!havebstr("ok_button")) {
2179 strcpy(WC->ImportantMessage,
2180 _("Cancelled. Changes were not saved."));
2186 StrBuf_ServGetln(Buf);
2187 if (GetServerStatus(Buf, NULL) != 2) {
2188 StrBufCutLeft(Buf, 4);
2189 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2195 er_name = NewStrBuf();
2196 er_password = NewStrBuf();
2197 er_dirname = NewStrBuf();
2198 er_roomaide = NewStrBuf();
2200 StrBufCutLeft(Buf, 4);
2201 StrBufExtract_token(er_name, Buf, 0, '|');
2202 StrBufExtract_token(er_password, Buf, 1, '|');
2203 StrBufExtract_token(er_dirname, Buf, 2, '|');
2204 er_flags = StrBufExtract_int(Buf, 3, '|');
2205 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2206 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2207 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2209 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2210 if (StrLength(er_roomaide) == 0) {
2212 StrBuf_ServGetln(Buf);
2213 if (GetServerStatus(Buf, NULL) != 2) {
2214 FlushStrBuf(er_roomaide);
2216 StrBufCutLeft(Buf, 4);
2217 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2220 Ptr = sbstr("er_name");
2221 if (StrLength(Ptr) > 0) {
2222 FlushStrBuf(er_name);
2223 StrBufAppendBuf(er_name, Ptr, 0);
2226 Ptr = sbstr("er_password");
2227 if (StrLength(Ptr) > 0) {
2228 FlushStrBuf(er_password);
2229 StrBufAppendBuf(er_password, Ptr, 0);
2233 Ptr = sbstr("er_dirname");
2234 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2235 FlushStrBuf(er_dirname);
2236 StrBufAppendBuf(er_dirname, Ptr, 0);
2240 Ptr = sbstr("type");
2241 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2243 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2244 er_flags |= (QR_PRIVATE);
2246 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2247 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2249 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2250 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2252 if (!strcmp(ChrPtr(Ptr), "personal")) {
2253 er_flags |= QR_MAILBOX;
2255 er_flags &= ~QR_MAILBOX;
2258 if (yesbstr("prefonly")) {
2259 er_flags |= QR_PREFONLY;
2261 er_flags &= ~QR_PREFONLY;
2264 if (yesbstr("readonly")) {
2265 er_flags |= QR_READONLY;
2267 er_flags &= ~QR_READONLY;
2271 if (yesbstr("collabdel")) {
2272 er_flags2 |= QR2_COLLABDEL;
2274 er_flags2 &= ~QR2_COLLABDEL;
2277 if (yesbstr("permanent")) {
2278 er_flags |= QR_PERMANENT;
2280 er_flags &= ~QR_PERMANENT;
2283 if (yesbstr("subjectreq")) {
2284 er_flags2 |= QR2_SUBJECTREQ;
2286 er_flags2 &= ~QR2_SUBJECTREQ;
2289 if (yesbstr("network")) {
2290 er_flags |= QR_NETWORK;
2292 er_flags &= ~QR_NETWORK;
2295 if (yesbstr("directory")) {
2296 er_flags |= QR_DIRECTORY;
2298 er_flags &= ~QR_DIRECTORY;
2301 if (yesbstr("ulallowed")) {
2302 er_flags |= QR_UPLOAD;
2304 er_flags &= ~QR_UPLOAD;
2307 if (yesbstr("dlallowed")) {
2308 er_flags |= QR_DOWNLOAD;
2310 er_flags &= ~QR_DOWNLOAD;
2313 if (yesbstr("visdir")) {
2314 er_flags |= QR_VISDIR;
2316 er_flags &= ~QR_VISDIR;
2319 Ptr = sbstr("anon");
2321 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2322 if (!strcmp(ChrPtr(Ptr), "anononly"))
2323 er_flags |= QR_ANONONLY;
2324 if (!strcmp(ChrPtr(Ptr), "anon2"))
2325 er_flags |= QR_ANONOPT;
2327 bump = yesbstr("bump");
2329 er_floor = ibstr("er_floor");
2331 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2333 ChrPtr(er_password),
2342 StrBuf_ServGetln(Buf);
2343 if (GetServerStatus(Buf, NULL) != 2) {
2344 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2347 FreeStrBuf(&er_name);
2348 FreeStrBuf(&er_password);
2349 FreeStrBuf(&er_dirname);
2350 FreeStrBuf(&er_roomaide);
2355 if (StrLength(er_roomaide) > 0) {
2356 serv_printf("SETA %s", ChrPtr(er_roomaide));
2357 StrBuf_ServGetln(Buf);
2358 if (GetServerStatus(Buf, NULL) != 2) {
2359 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2360 display_main_menu();
2362 FreeStrBuf(&er_name);
2363 FreeStrBuf(&er_password);
2364 FreeStrBuf(&er_dirname);
2365 FreeStrBuf(&er_roomaide);
2370 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2373 FreeStrBuf(&er_name);
2374 FreeStrBuf(&er_password);
2375 FreeStrBuf(&er_dirname);
2376 FreeStrBuf(&er_roomaide);
2382 * Display form for Invite, Kick, and show Who Knows a room
2384 void do_invt_kick(void) {
2385 char buf[SIZ], room[SIZ], username[SIZ];
2388 serv_getln(buf, sizeof buf);
2390 if (buf[0] != '2') {
2394 extract_token(room, &buf[4], 0, '|', sizeof room);
2396 strcpy(username, bstr("username"));
2398 if (havebstr("kick_button")) {
2399 sprintf(buf, "KICK %s", username);
2401 serv_getln(buf, sizeof buf);
2403 if (buf[0] != '2') {
2404 strcpy(WC->ImportantMessage, &buf[4]);
2406 sprintf(WC->ImportantMessage,
2407 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2412 if (havebstr("invite_button")) {
2413 sprintf(buf, "INVT %s", username);
2415 serv_getln(buf, sizeof buf);
2417 if (buf[0] != '2') {
2418 strcpy(WC->ImportantMessage, &buf[4]);
2420 sprintf(WC->ImportantMessage,
2421 _("<B><I>User %s invited to room %s.</I></B>\n"),
2432 * Display form for Invite, Kick, and show Who Knows a room
2434 void display_whok(void)
2436 char buf[SIZ], room[SIZ], username[SIZ];
2439 serv_getln(buf, sizeof buf);
2441 if (buf[0] != '2') {
2445 extract_token(room, &buf[4], 0, '|', sizeof room);
2448 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2449 wprintf(_("The users listed below have access to this room. "
2450 "To remove a user from the access list, select the user "
2451 "name from the list and click 'Kick'."));
2452 wprintf("<br /><br />");
2454 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2455 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2456 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2457 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2459 serv_getln(buf, sizeof buf);
2460 if (buf[0] == '1') {
2461 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2462 extract_token(username, buf, 0, '|', sizeof username);
2463 wprintf("<OPTION>");
2468 wprintf("</select><br />\n");
2470 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2471 wprintf("</form></CENTER>\n");
2473 wprintf("</td><td>");
2474 wprintf(_("To grant another user access to this room, enter the "
2475 "user name in the box below and click 'Invite'."));
2476 wprintf("<br /><br />");
2478 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2479 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2480 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2481 wprintf(_("Invite:"));
2483 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2484 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2485 "<input type=\"submit\" value=\"%s\">"
2486 "</form></CENTER>\n", _("Invite"));
2487 /* Pop open an address book -- begin **/
2489 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2491 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2494 _("Users"), _("Users")
2496 /* Pop open an address book -- end **/
2498 wprintf("</td></tr></table>\n");
2499 address_book_popup();
2506 * display the form for entering a new room
2508 void display_entroom(void)
2515 serv_puts("CRE8 0");
2516 serv_getln(buf, sizeof buf);
2518 if (buf[0] != '2') {
2519 strcpy(WC->ImportantMessage, &buf[4]);
2520 display_main_menu();
2525 output_headers(1, 1, 1, 0, 0, 0);
2527 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2528 do_template("beginbox", NULL);
2530 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2531 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2533 wprintf("<table class=\"altern\"> ");
2535 wprintf("<tr class=\"even\"><td>");
2536 wprintf(_("Name of room: "));
2537 wprintf("</td><td>");
2538 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2539 wprintf("</td></tr>");
2541 wprintf("<tr class=\"odd\"><td>");
2542 wprintf(_("Resides on floor: "));
2543 wprintf("</td><td>");
2544 load_floorlist(Buf);
2545 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2546 for (i = 0; i < 128; ++i)
2547 if (!IsEmptyStr(floorlist[i])) {
2548 wprintf("<option ");
2549 wprintf("value=\"%d\">", i);
2550 escputs(floorlist[i]);
2551 wprintf("</option>\n");
2553 wprintf("</select>\n");
2554 wprintf("</td></tr>");
2557 * Our clever little snippet of JavaScript automatically selects
2558 * a public room if the view is set to Bulletin Board or wiki, and
2559 * it selects a mailbox room otherwise. The user can override this,
2560 * of course. We also disable the floor selector for mailboxes.
2562 wprintf("<tr class=\"even\"><td>");
2563 wprintf(_("Default view for room: "));
2564 wprintf("</td><td>");
2565 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2566 " if ( (this.form.er_view.value == 0) "
2567 " || (this.form.er_view.value == 6) ) { "
2568 " this.form.type[0].checked=true; "
2569 " this.form.er_floor.disabled = false; "
2572 " this.form.type[4].checked=true; "
2573 " this.form.er_floor.disabled = true; "
2576 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2577 if (is_view_allowed_as_default(i)) {
2578 wprintf("<option %s value=\"%d\">",
2579 ((i == 0) ? "selected" : ""), i );
2580 escputs(viewdefs[i]);
2581 wprintf("</option>\n");
2584 wprintf("</select>\n");
2585 wprintf("</td></tr>");
2587 wprintf("<tr class=\"even\"><td>");
2588 wprintf(_("Type of room:"));
2589 wprintf("</td><td>");
2590 wprintf("<ul class=\"adminlist\">\n");
2592 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2593 wprintf("CHECKED OnChange=\""
2594 " if (this.form.type[0].checked == true) { "
2595 " this.form.er_floor.disabled = false; "
2598 wprintf(_("Public (automatically appears to everyone)"));
2601 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2602 " if (this.form.type[1].checked == true) { "
2603 " this.form.er_floor.disabled = false; "
2606 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2609 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2610 " if (this.form.type[2].checked == true) { "
2611 " this.form.er_floor.disabled = false; "
2614 wprintf(_("Private - require password: "));
2615 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2618 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2619 " if (this.form.type[3].checked == true) { "
2620 " this.form.er_floor.disabled = false; "
2623 wprintf(_("Private - invitation only"));
2626 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2628 " if (this.form.type[4].checked == true) { "
2629 " this.form.er_floor.disabled = true; "
2632 wprintf(_("Personal (mailbox for you only)"));
2635 wprintf("\n</ul>\n");
2636 wprintf("</td></tr></table>\n");
2638 wprintf("<div class=\"buttons\">\n");
2639 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2641 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2642 wprintf("</div>\n");
2643 wprintf("</form>\n<hr />");
2644 serv_printf("MESG roomaccess");
2645 serv_getln(buf, sizeof buf);
2646 if (buf[0] == '1') {
2650 do_template("endbox", NULL);
2660 * support function for entroom() -- sets the default view
2662 void er_set_default_view(int newview) {
2675 serv_getln(buf, sizeof buf);
2676 if (buf[0] != '2') return;
2678 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2679 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2680 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2681 rm_bits1 = extract_int(&buf[4], 3);
2682 rm_floor = extract_int(&buf[4], 4);
2683 rm_listorder = extract_int(&buf[4], 5);
2684 rm_bits2 = extract_int(&buf[4], 7);
2686 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2687 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2688 rm_listorder, newview, rm_bits2
2690 serv_getln(buf, sizeof buf);
2701 const StrBuf *er_name;
2702 const StrBuf *er_type;
2703 const StrBuf *er_password;
2708 if (!havebstr("ok_button")) {
2709 strcpy(WC->ImportantMessage,
2710 _("Cancelled. No new room was created."));
2711 display_main_menu();
2714 er_name = sbstr("er_name");
2715 er_type = sbstr("type");
2716 er_password = sbstr("er_password");
2717 er_floor = ibstr("er_floor");
2718 er_view = ibstr("er_view");
2721 if (!strcmp(ChrPtr(er_type), "hidden"))
2723 else if (!strcmp(ChrPtr(er_type), "passworded"))
2725 else if (!strcmp(ChrPtr(er_type), "invonly"))
2727 else if (!strcmp(ChrPtr(er_type), "personal"))
2730 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2733 ChrPtr(er_password),
2738 serv_getln(buf, sizeof buf);
2739 if (buf[0] != '2') {
2740 strcpy(WC->ImportantMessage, &buf[4]);
2741 display_main_menu();
2744 /** TODO: Room created, now udate the left hand icon bar for this user */
2745 burn_folder_cache(0); /* burn the old folder cache */
2749 do_change_view(er_view); /* Now go there */
2754 * \brief display the screen to enter a private room
2756 void display_private(char *rname, int req_pass)
2758 WCTemplputParams SubTP;
2760 output_headers(1, 1, 1, 0, 0, 0);
2762 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2763 memset(&SubTP, 0, sizeof(WCTemplputParams));
2764 SubTP.Filter.ContextType = CTX_STRBUF;
2765 SubTP.Context = Buf;
2766 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2771 wprintf(_("If you know the name of a hidden (guess-name) or "
2772 "passworded room, you can enter that room by typing "
2773 "its name below. Once you gain access to a private "
2774 "room, it will appear in your regular room listings "
2775 "so you don't have to keep returning here."));
2778 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2779 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2781 wprintf("<table class=\"altern\"> "
2782 "<tr class=\"even\"><td>");
2783 wprintf(_("Enter room name:"));
2785 "<input type=\"text\" name=\"gr_name\" "
2786 "value=\"%s\" maxlength=\"128\">\n", rname);
2789 wprintf("</td></tr><tr class=\"odd\"><td>");
2790 wprintf(_("Enter room password:"));
2791 wprintf("</td><td>");
2792 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2794 wprintf("</td></tr></table>\n");
2796 wprintf("<div class=\"buttons\">\n");
2797 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2799 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2803 wprintf("</div></form>\n");
2805 do_template("endbox", NULL);
2811 * \brief goto a private room
2813 void goto_private(void)
2818 if (!havebstr("ok_button")) {
2819 display_main_menu();
2822 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2823 serv_printf("GOTO %s|%s",
2826 serv_getln(buf, sizeof buf);
2828 if (buf[0] == '2') {
2829 smart_goto(sbstr("gr_name"));
2832 if (!strncmp(buf, "540", 3)) {
2833 display_private(bstr("gr_name"), 1);
2836 output_headers(1, 1, 1, 0, 0, 0);
2837 wprintf("%s\n", &buf[4]);
2844 * \brief display the screen to zap a room
2846 void display_zap(void)
2848 output_headers(1, 1, 2, 0, 0, 0);
2850 wprintf("<div id=\"banner\">\n");
2852 wprintf(_("Zap (forget/unsubscribe) the current room"));
2854 wprintf("</div>\n");
2856 wprintf("<div id=\"content\" class=\"service\">\n");
2858 wprintf(_("If you select this option, <em>%s</em> will "
2859 "disappear from your room list. Is this what you wish "
2860 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2862 wprintf("<form method=\"POST\" action=\"zap\">\n");
2863 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2864 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2866 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2867 wprintf("</form>\n");
2878 StrBuf *final_destination;
2881 * If the forget-room routine fails for any reason, we fall back
2882 * to the current room; otherwise, we go to the Lobby
2884 final_destination = NewStrBufDup(WC->wc_roomname);
2886 if (havebstr("ok_button")) {
2887 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2888 serv_getln(buf, sizeof buf);
2889 if (buf[0] == '2') {
2891 serv_getln(buf, sizeof buf);
2892 if (buf[0] == '2') {
2893 FlushStrBuf(final_destination);
2894 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2898 smart_goto(final_destination);
2899 FreeStrBuf(&final_destination);
2905 * \brief Delete the current room
2907 void delete_room(void)
2912 serv_puts("KILL 1");
2913 serv_getln(buf, sizeof buf);
2914 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2915 if (buf[0] != '2') {
2916 strcpy(WC->ImportantMessage, &buf[4]);
2917 display_main_menu();
2922 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2931 * \brief Perform changes to a room's network configuration
2933 void netedit(void) {
2942 /*/ TODO: do line dynamic! */
2943 if (havebstr("line_pop3host")) {
2944 strcpy(line, bstr("prefix"));
2945 strcat(line, bstr("line_pop3host"));
2947 strcat(line, bstr("line_pop3user"));
2949 strcat(line, bstr("line_pop3pass"));
2951 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2953 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2954 strcat(line, bstr("suffix"));
2956 else if (havebstr("line")) {
2957 strcpy(line, bstr("prefix"));
2958 strcat(line, bstr("line"));
2959 strcat(line, bstr("suffix"));
2974 serv_getln(buf, sizeof buf);
2975 if (buf[0] != '1') {
2981 /** This loop works for add *or* remove. Spiffy, eh? */
2982 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2983 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2984 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2985 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2986 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2987 if ( (strcasecmp(cmpa0, cmpb0))
2988 || (strcasecmp(cmpa1, cmpb1)) ) {
2989 fprintf(fp, "%s\n", buf);
2995 serv_getln(buf, sizeof buf);
2996 if (buf[0] != '4') {
3002 while (fgets(buf, sizeof buf, fp) != NULL) {
3003 buf[strlen(buf)-1] = 0;
3007 if (havebstr("add_button")) {
3008 num_addrs = num_tokens(bstr("line"), ',');
3009 if (num_addrs < 2) {
3010 /* just adding one node or address */
3014 /* adding multiple addresses separated by commas */
3015 for (i=0; i<num_addrs; ++i) {
3016 strcpy(line, bstr("prefix"));
3017 extract_token(buf, bstr("line"), i, ',', sizeof buf);
3020 strcat(line, bstr("suffix"));
3034 * \brief Convert a room name to a folder-ish-looking name.
3035 * \param folder the folderish name
3036 * \param room the room name
3037 * \param floor the floor name
3038 * \param is_mailbox is it a mailbox?
3040 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
3045 * For mailboxes, just do it straight...
3048 sprintf(folder, "My folders|%s", room);
3052 * Otherwise, prefix the floor name as a "public folders" moniker
3055 if (floor > MAX_FLOORS) {
3057 sprintf(folder, "%%%%%%|%s", room);
3060 sprintf(folder, "%s|%s", floorlist[floor], room);
3065 * Replace "\" characters with "|" for pseudo-folder-delimiting
3067 len = strlen (folder);
3068 for (i=0; i<len; ++i) {
3069 if (folder[i] == '\\') folder[i] = '|';
3077 * \brief Back end for change_view()
3078 * \param newview set newview???
3080 void do_change_view(int newview) {
3083 serv_printf("VIEW %d", newview);
3084 serv_getln(buf, sizeof buf);
3085 WC->wc_view = newview;
3086 smart_goto(WC->wc_roomname);
3092 * \brief Change the view for this room
3094 void change_view(void) {
3097 view = lbstr("view");
3098 do_change_view(view);
3103 * \brief One big expanded tree list view --- like a folder list
3104 * \param fold the folder to view
3105 * \param max_folders how many folders???
3106 * \param num_floors hom many floors???
3108 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3112 int has_subfolders = 0;
3115 parents = malloc(max_folders * sizeof(int));
3117 /** BEGIN TREE MENU */
3118 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3120 /** include NanoTree */
3121 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3123 /** initialize NanoTree */
3124 wprintf("<script type=\"text/javascript\"> \n"
3125 " showRootNode = false; \n"
3126 " sortNodes = false; \n"
3127 " dragable = false; \n"
3129 " function standardClick(treeNode) { \n"
3132 " var closedGif = 'static/folder_closed.gif'; \n"
3133 " var openGif = 'static/folder_open.gif'; \n"
3135 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3139 for (i=0; i<max_folders; ++i) {
3142 if ((i+1) < max_folders) {
3144 len = strlen(fold[i].name);
3145 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3146 && (fold[i+1].name[len] == '|') ) {
3151 levels = num_tokens(fold[i].name, '|');
3152 parents[levels] = i;
3154 wprintf("var node%d = new TreeNode(%d, '", i, i);
3156 if (fold[i].selectable) {
3157 wprintf("<a href=\"dotgoto?room=");
3158 urlescputs(fold[i].room);
3163 wprintf("<span class=\"roomlist_floor\">");
3165 else if (fold[i].hasnewmsgs) {
3166 wprintf("<span class=\"roomlist_new\">");
3169 wprintf("<span class=\"roomlist_old\">");
3171 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3176 if (has_subfolders) {
3177 wprintf("new Array(closedGif, openGif)");
3179 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3180 wprintf("'static/viewcontacts_16x.gif'");
3182 else if (fold[i].view == VIEW_CALENDAR) {
3183 wprintf("'static/calarea_16x.gif'");
3185 else if (fold[i].view == VIEW_CALBRIEF) {
3186 wprintf("'static/calarea_16x.gif'");
3188 else if (fold[i].view == VIEW_TASKS) {
3189 wprintf("'static/taskmanag_16x.gif'");
3191 else if (fold[i].view == VIEW_NOTES) {
3192 wprintf("'static/storenotes_16x.gif'");
3194 else if (fold[i].view == VIEW_MAILBOX) {
3195 wprintf("'static/privatemess_16x.gif'");
3198 wprintf("'static/chatrooms_16x.gif'");
3201 urlescputs(fold[i].name);
3205 wprintf("rootNode.addChild(node%d);\n", i);
3208 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3212 wprintf("container = document.getElementById('roomlist_div'); \n"
3218 /** END TREE MENU */
3222 * \brief Boxes and rooms and lists ... oh my!
3223 * \param fold the folder to view
3224 * \param max_folders how many folders???
3225 * \param num_floors hom many floors???
3227 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3229 char floor_name[256];
3230 char old_floor_name[256];
3231 int levels, oldlevels;
3234 static int columns = 3;
3235 int boxes_per_column = 0;
3236 int current_column = 0;
3239 strcpy(floor_name, "");
3240 strcpy(old_floor_name, "");
3243 while (nf % columns != 0) ++nf;
3244 boxes_per_column = (nf / columns);
3245 if (boxes_per_column < 1) boxes_per_column = 1;
3247 /** Outer table (for columnization) */
3248 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3249 "<tr><td valign=top>");
3253 for (i=0; i<max_folders; ++i) {
3255 levels = num_tokens(fold[i].name, '|');
3256 extract_token(floor_name, fold[i].name, 0,
3257 '|', sizeof floor_name);
3259 if ( (strcasecmp(floor_name, old_floor_name))
3260 && (!IsEmptyStr(old_floor_name)) ) {
3262 do_template("endbox", NULL);
3266 if ((num_boxes % boxes_per_column) == 0) {
3268 if (current_column < columns) {
3269 wprintf("</td><td valign=top>\n");
3273 strcpy(old_floor_name, floor_name);
3277 WCTemplputParams SubTP;
3279 Buf = NewStrBufPlain(floor_name, -1);
3280 memset(&SubTP, 0, sizeof(WCTemplputParams));
3281 SubTP.Filter.ContextType = CTX_STRBUF;
3282 SubTP.Context = Buf;
3283 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3292 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3293 if (fold[i].selectable) {
3294 wprintf("<a href=\"dotgoto?room=");
3295 urlescputs(fold[i].room);
3301 if (fold[i].hasnewmsgs) {
3302 wprintf("<span class=\"roomlist_new\">");
3305 wprintf("<span class=\"roomlist_old\">");
3307 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3310 if (fold[i].selectable) {
3316 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3317 wprintf(" (INBOX)");
3319 wprintf("<br />\n");
3322 /** End the final inner box */
3323 do_template("endbox", NULL);
3325 wprintf("</td></tr></table>\n");
3329 * \brief print a floor div???
3330 * \param which_floordiv name of the floordiv???
3332 void set_floordiv_expanded(void) {
3333 wcsession *WCC = WC;
3336 FloorDiv = NewStrBuf();
3337 StrBufExtract_token(FloorDiv, WCC->Hdr->HR.ReqLine, 0, '/');
3338 set_preference("floordiv_expanded", FloorDiv, 1);
3339 WCC->floordiv_expanded = FloorDiv;
3343 * \brief view the iconbar
3344 * \param fold the folder to view
3345 * \param max_folders how many folders???
3346 * \param num_floors hom many floors???
3348 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3350 char floor_name[256];
3351 char old_floor_name[256];
3352 char floordivtitle[256];
3353 char floordiv_id[32];
3354 int levels, oldlevels;
3358 strcpy(floor_name, "");
3359 strcpy(old_floor_name, "");
3363 for (i=0; i<max_folders; ++i) {
3365 levels = num_tokens(fold[i].name, '|');
3366 extract_token(floor_name, fold[i].name, 0,
3367 '|', sizeof floor_name);
3369 if ( (strcasecmp(floor_name, old_floor_name))
3370 && (!IsEmptyStr(old_floor_name)) ) {
3371 /** End inner box */
3373 wprintf("</div>\n"); /** floordiv */
3375 strcpy(old_floor_name, floor_name);
3379 stresc(floordivtitle, 256, floor_name, 0, 0);
3380 sprintf(floordiv_id, "floordiv%d", i);
3381 wprintf("<span class=\"ib_roomlist_floor\" "
3382 "onClick=\"expand_floor('%s')\">"
3383 "%s</span><br>\n", floordiv_id, floordivtitle);
3384 wprintf("<div id=\"%s\" style=\"display:%s\">",
3386 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3393 wprintf("<div id=\"roomdiv%d\">", i);
3395 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3397 /** choose the icon */
3398 if (fold[i].view == VIEW_ADDRESSBOOK) {
3399 icon = "viewcontacts_16x.gif" ;
3401 else if (fold[i].view == VIEW_CALENDAR) {
3402 icon = "calarea_16x.gif" ;
3404 else if (fold[i].view == VIEW_CALBRIEF) {
3405 icon = "calarea_16x.gif" ;
3407 else if (fold[i].view == VIEW_TASKS) {
3408 icon = "taskmanag_16x.gif" ;
3410 else if (fold[i].view == VIEW_NOTES) {
3411 icon = "storenotes_16x.gif" ;
3413 else if (fold[i].view == VIEW_MAILBOX) {
3414 icon = "privatemess_16x.gif" ;
3417 icon = "chatrooms_16x.gif" ;
3420 if (fold[i].selectable) {
3421 wprintf("<a href=\"dotgoto?room=");
3422 urlescputs(fold[i].room);
3424 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3429 if (fold[i].hasnewmsgs) {
3430 wprintf("<span class=\"ib_roomlist_new\">");
3433 wprintf("<span class=\"ib_roomlist_old\">");
3435 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3437 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3438 wprintf(" (INBOX)");
3441 if (fold[i].selectable) {
3448 wprintf("</div>\n"); /** roomdiv */
3451 wprintf("</div>\n"); /** floordiv */
3459 * \brief Burn the cached folder list.
3460 * \param age How old the cahce needs to be before we burn it.
3463 void burn_folder_cache(time_t age)
3465 /** If our cached folder list is very old, burn it. */
3466 if (WC->cache_fold != NULL) {
3467 if ((time(NULL) - WC->cache_timestamp) > age) {
3468 free(WC->cache_fold);
3469 WC->cache_fold = NULL;
3478 * \brief Show the room list.
3479 * (only should get called by
3480 * knrooms() because that's where output_headers() is called from)
3481 * \param viewpref the view preferences???
3484 void list_all_rooms_by_floor(const char *viewpref) {
3488 struct folder *fold = NULL;
3490 int max_folders = 0;
3491 int alloc_folders = 0;
3495 int ShowEmptyFloors;
3498 int num_floors = 1; /** add an extra one for private folders */
3501 /** If our cached folder list is very old, burn it. */
3502 burn_folder_cache(300);
3504 /** Can we do the iconbar roomlist from cache? */
3505 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3506 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3511 /** Grab the floor table so we know how to build the list... */
3512 load_floorlist(Buf);
3514 /** Start with the mailboxes */
3517 fold = malloc(sizeof(struct folder));
3518 memset(fold, 0, sizeof(struct folder));
3519 strcpy(fold[0].name, "My folders");
3520 fold[0].is_mailbox = 1;
3522 /** Then add floors */
3524 serv_getln(buf, sizeof buf);
3525 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3526 if (max_folders >= alloc_folders) {
3527 alloc_folders = max_folders + 100;
3528 fold = realloc(fold,
3529 alloc_folders * sizeof(struct folder));
3531 memset(&fold[max_folders], 0, sizeof(struct folder));
3532 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3533 extract_token(buf3, buf, 0, '|', SIZ);
3534 fold[max_folders].floor = atol (buf3);
3539 for (i=0; i<num_floors; i++)
3540 if (IDMax < fold[i].floor)
3541 IDMax = fold[i].floor;
3542 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3543 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3544 for (i=0; i<num_floors; i++)
3545 floor_mapping[fold[i].floor]=i;
3547 /** refresh the messages index for this room */
3548 /* TODO serv_puts("GOTO ");
3549 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3550 /** Now add rooms */
3552 serv_getln(buf, sizeof buf);
3553 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3554 if (max_folders >= alloc_folders) {
3555 alloc_folders = max_folders + 100;
3556 fold = realloc(fold,
3557 alloc_folders * sizeof(struct folder));
3559 memset(&fold[max_folders], 0, sizeof(struct folder));
3560 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3561 ra_flags = extract_int(buf, 5);
3562 flags = extract_int(buf, 1);
3563 fold[max_folders].floor = extract_int(buf, 2);
3564 fold[max_folders].hasnewmsgs =
3565 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3566 if (flags & QR_MAILBOX) {
3567 fold[max_folders].is_mailbox = 1;
3569 fold[max_folders].view = extract_int(buf, 6);
3570 room_to_folder(fold[max_folders].name,
3571 fold[max_folders].room,
3572 fold[max_folders].floor,
3573 fold[max_folders].is_mailbox);
3574 fold[max_folders].selectable = 1;
3575 /* Increase the room count for the associtaed floor */
3576 if (fold[max_folders].is_mailbox) {
3577 fold[0].num_rooms++;
3580 i = floor_mapping[fold[max_folders].floor];
3581 fold[i].num_rooms++;
3587 * Remove any floors that don't have rooms
3589 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3590 if (ShowEmptyFloors)
3592 for (i=0; i<num_floors; i++)
3594 if (fold[i].num_rooms == 0) {
3595 for (j=i; j<max_folders; j++) {
3596 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3605 /** Bubble-sort the folder list */
3606 for (i=0; i<max_folders; ++i) {
3607 for (j=0; j<(max_folders-1)-i; ++j) {
3608 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3609 swap = strcasecmp(fold[j].name, fold[j+1].name);
3612 if ( (fold[j+1].is_mailbox)
3613 && (!fold[j].is_mailbox)) {
3621 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3622 memcpy(&fold[j], &fold[j+1],
3623 sizeof(struct folder));
3624 memcpy(&fold[j+1], &ftmp,
3625 sizeof(struct folder));
3631 if (!strcasecmp(viewpref, "folders")) {
3632 do_folder_view(fold, max_folders, num_floors);
3634 else if (!strcasecmp(viewpref, "hackish_view")) {
3635 for (i=0; i<max_folders; ++i) {
3636 escputs(fold[i].name);
3637 wprintf("<br />\n");
3640 else if (!strcasecmp(viewpref, "iconbar")) {
3641 do_iconbar_view(fold, max_folders, num_floors);
3644 do_rooms_view(fold, max_folders, num_floors);
3647 /* Don't free the folder list ... cache it for future use! */
3648 if (WC->cache_fold != NULL) {
3649 free(WC->cache_fold);
3651 WC->cache_fold = fold;
3652 WC->cache_max_folders = max_folders;
3653 WC->cache_num_floors = num_floors;
3654 WC->cache_timestamp = time(NULL);
3655 free(floor_mapping);
3660 * \brief Do either a known rooms list or a folders list, depending on the
3665 StrBuf *ListView = NULL;
3667 output_headers(1, 1, 2, 0, 0, 0);
3669 /** Determine whether the user is trying to change views */
3670 if (havebstr("view")) {
3671 ListView = NewStrBufPlain(bstr("view"), -1);
3672 set_preference("roomlistview", ListView, 1);
3674 /** Sanitize the input so its safe */
3675 if(!get_preference("roomlistview", &ListView) ||
3676 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3677 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3679 if (ListView == NULL) {
3680 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3681 set_preference("roomlistview", ListView, 0);
3684 StrBufPrintf(ListView, "rooms");
3690 wprintf("<div id=\"banner\">\n");
3691 wprintf("<div class=\"room_banner\" id=\"room_banner\">");
3693 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3694 wprintf(_("Room list"));
3696 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3697 wprintf(_("Folder list"));
3699 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3700 wprintf(_("Room list"));
3702 wprintf("</h1></div>\n");
3704 /** offer the ability to switch views */
3705 wprintf("<div id=\"actiondiv\">");
3706 wprintf("<ul class=\"room_actions\">\n");
3707 wprintf("<li class=\"start_page\">");
3708 offer_start_page(NULL, &NoCtx);
3710 wprintf("<li><form name=\"roomlistomatic\">\n"
3711 "<select name=\"newview\" size=\"1\" "
3712 "OnChange=\"location.href=roomlistomatic.newview.options"
3713 "[selectedIndex].value\">\n");
3715 wprintf("<option %s value=\"knrooms?view=rooms\">"
3718 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3721 wprintf("<option %s value=\"knrooms?view=folders\">"
3722 "View as folder list"
3724 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3727 wprintf("</select>");
3728 wprintf("</form></li>");
3729 wprintf("</ul></div></div>\n");
3731 wprintf("<div id=\"content\" class=\"service\">\n");
3733 /** Display the room list in the user's preferred format */
3734 list_all_rooms_by_floor(ChrPtr(ListView));
3741 * \brief Set the message expire policy for this room and/or floor
3743 void set_room_policy(void) {
3746 if (!havebstr("ok_button")) {
3747 strcpy(WC->ImportantMessage,
3748 _("Cancelled. Changes were not saved."));
3753 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3754 serv_getln(buf, sizeof buf);
3755 strcpy(WC->ImportantMessage, &buf[4]);
3757 if (WC->axlevel >= 6) {
3758 strcat(WC->ImportantMessage, "<br />\n");
3759 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3760 serv_getln(buf, sizeof buf);
3761 strcat(WC->ImportantMessage, &buf[4]);
3767 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3768 /* todo: check context */
3774 floors = NewHash(1, NULL);
3776 serv_puts("LFLR"); /* get floors */
3777 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
3778 if (GetServerStatus(Buf, NULL) == 1)
3779 while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3781 const StrBuf *floorNum = NULL;
3782 floor = NewHash(1, NULL);
3783 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3785 StrBufExtract_token(Buf2, Buf, a, '|');
3787 floorNum = Buf2; /* hmm, should we copy Buf2 first? */
3790 Put(floor, CKEY(FLOOR_PARAM_NAMES[a]), Buf2, HFreeStrBuf);
3792 Put(floors, SKEY(floorNum), floor, HDeleteHash);
3798 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3801 HashList *floor = (HashList *)(TP->Context);
3803 GetHash(floor, TKEY(0), &value);
3804 val = (StrBuf *)value;
3805 StrECMAEscAppend(TemplBuffer, val, 0);
3807 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP)
3810 return GetRoomListHash(Target, TP);
3812 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
3814 /* TODO: Check context */
3821 rooms = NewHash(1, NULL);
3822 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3823 if (GetServerStatus(buf, NULL) == 1)
3824 while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3826 StrBuf *rmName = NULL;
3827 room = NewHash(1, NULL);
3828 for(i=0; i<ROOM_PARAM_LEN; i++) {
3830 StrBufExtract_token(buf2, buf, i, '|');
3834 Put(room, CKEY(ROOM_PARAM_NAMES[i]), buf2, HFreeStrBuf);
3836 Put(rooms, SKEY(rmName), room, HDeleteHash);
3838 SortByHashKey(rooms, 1);
3839 /*SortByPayload(rooms, SortRoomsByListOrder); */
3843 /** Unused function that orders rooms by the listorder flag */
3844 int SortRoomsByListOrder(const void *room1, const void *room2)
3848 HashList *r1 = (HashList *)GetSearchPayload(room1);
3849 HashList *r2 = (HashList *)GetSearchPayload(room2);
3850 StrBuf *listOrderBuf1;
3851 StrBuf *listOrderBuf2;
3853 GetHash(r1, CKEY(ROOM_PARAM_NAMES[3]), (void *)&listOrderBuf1);
3854 GetHash(r2, CKEY(ROOM_PARAM_NAMES[3]), (void *)&listOrderBuf2);
3855 l1 = atoi(ChrPtr(listOrderBuf1));
3856 l2 = atoi(ChrPtr(listOrderBuf2));
3857 if (l1 < l2) return -1;
3858 else if (l1 > l2) return +1;
3861 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3865 HashList *room = (HashList *)(TP->Context);
3867 GetHash(room, TKEY(0), &value);
3868 val = (StrBuf *)value;
3869 StrECMAEscAppend(TemplBuffer, val, 0);
3871 void jsonRoomFlr(void)
3873 /* Send as our own (application/json) content type */
3874 hprintf("HTTP/1.1 200 OK\r\n");
3875 hprintf("Content-type: application/json; charset=utf-8\r\n");
3876 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
3877 hprintf("Connection: close\r\n");
3878 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3880 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3884 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3886 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3889 void _gotonext(void) {
3894 void dotskip(void) {
3895 smart_goto(sbstr("room"));
3898 void _display_private(void) {
3899 display_private("", 0);
3902 void dotgoto(void) {
3903 if (!havebstr("room")) {
3907 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3910 smart_goto(sbstr("room"));
3913 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3915 wprintf("<div id=\"banner\">\n");
3916 embed_room_banner(NULL, navbar_default);
3917 wprintf("</div>\n");
3921 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3923 wcsession *WCC = WC;
3926 (!IsEmptyStr(WCC->ugname)))
3927 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3931 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3933 wcsession *WCC = WC;
3935 return ((WCC!=NULL) &&
3936 (!IsEmptyStr(WCC->ugname)) &&
3937 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3940 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3942 wcsession *WCC = WC;
3944 return ((WCC!=NULL) &&
3945 ((WCC->room_flags & QR_PERMANENT) != 0));
3948 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3950 wcsession *WCC = WC;
3952 return ((WCC!=NULL) &&
3953 ((WCC->room_flags & QR_INUSE) != 0));
3956 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3958 wcsession *WCC = WC;
3960 return ((WCC!=NULL) &&
3961 ((WCC->room_flags & QR_PRIVATE) != 0));
3964 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3966 wcsession *WCC = WC;
3968 return ((WCC!=NULL) &&
3969 ((WCC->room_flags & QR_PASSWORDED) != 0));
3972 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3974 wcsession *WCC = WC;
3976 return ((WCC!=NULL) &&
3977 ((WCC->room_flags & QR_GUESSNAME) != 0));
3980 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3982 wcsession *WCC = WC;
3984 return ((WCC!=NULL) &&
3985 ((WCC->room_flags & QR_DIRECTORY) != 0));
3988 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3990 wcsession *WCC = WC;
3992 return ((WCC!=NULL) &&
3993 ((WCC->room_flags & QR_UPLOAD) != 0));
3996 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3998 wcsession *WCC = WC;
4000 return ((WCC!=NULL) &&
4001 ((WCC->room_flags & QR_DOWNLOAD) != 0));
4004 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
4006 wcsession *WCC = WC;
4008 return ((WCC!=NULL) &&
4009 ((WCC->room_flags & QR_VISDIR) != 0));
4012 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
4014 wcsession *WCC = WC;
4016 return ((WCC!=NULL) &&
4017 ((WCC->room_flags & QR_ANONONLY) != 0));
4020 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
4022 wcsession *WCC = WC;
4024 return ((WCC!=NULL) &&
4025 ((WCC->room_flags & QR_ANONOPT) != 0));
4028 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
4030 wcsession *WCC = WC;
4032 return ((WCC!=NULL) &&
4033 ((WCC->room_flags & QR_NETWORK) != 0));
4036 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
4038 wcsession *WCC = WC;
4040 return ((WCC!=NULL) &&
4041 ((WCC->room_flags & QR_PREFONLY) != 0));
4044 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
4046 wcsession *WCC = WC;
4048 return ((WCC!=NULL) &&
4049 ((WCC->room_flags & QR_READONLY) != 0));
4052 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
4054 wcsession *WCC = WC;
4056 return ((WCC!=NULL) &&
4057 ((WCC->room_flags & QR_MAILBOX) != 0));
4061 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
4063 wcsession *WCC = WC;
4065 return ( (WCC!= NULL) &&
4066 ((WCC->axlevel >= 6) ||
4067 (WCC->is_room_aide) ||
4068 (WCC->is_mailbox) ));
4071 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
4073 wcsession *WCC = WC;
4075 if ((WCC == NULL) ||
4076 (TP->Tokens->nParameters < 3) ||
4077 (TP->Tokens->Params[2]->Type != TYPE_STR)||
4078 (TP->Tokens->Params[2]->len < 7))
4081 switch(WCC->wc_view) {
4083 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
4085 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
4086 case VIEW_ADDRESSBOOK:
4087 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
4089 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
4091 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
4093 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
4095 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
4097 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
4099 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
4109 RegisterPreference("roomlistview",
4110 _("Room list view"),
4113 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
4115 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
4117 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
4118 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
4119 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
4120 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4121 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4122 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4123 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4124 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4125 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4126 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4127 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4128 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4129 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4130 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4131 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4132 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4133 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4134 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4135 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4136 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4137 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4138 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4139 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4140 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4141 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4143 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
4144 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4145 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4146 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4147 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4148 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4149 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4150 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4151 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4152 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4153 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4154 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4155 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4156 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4157 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4158 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4160 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4161 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4163 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4164 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4165 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4166 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, DeleteHash, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4167 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);
4173 SessionDestroyModule_ROOMOPS
4176 if (sess->cache_fold != NULL) {
4177 free(sess->cache_fold);
4180 free_march_list(sess);