3 * Lots of different room-related operations.
9 char floorlist[MAX_FLOORS][SIZ]; /**< list of our floor names */
11 char *viewdefs[9]; /**< the different kinds of available views */
13 /** See GetFloorListHash and GetRoomListHash for info on these. Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys. */
14 const char FLOOR_PARAM_NAMES[(FLOOR_PARAM_LEN + 1)][15] = {"ID",
17 const char ROOM_PARAM_NAMES[(ROOM_PARAM_LEN + 1)][20] = {"NAME",
25 /* Because avoiding strlen at run time is a Good Thing(TM) */
26 const int FLOOR_PARAM_NAMELEN[(FLOOR_PARAM_LEN +1)] = {2, 4, 5};
27 const int ROOM_PARAM_NAMELEN[(ROOM_PARAM_LEN +1)] = {4, 4, 5, 9, 3, 7, 7, 8};
29 void display_whok(void);
32 * Initialize the viewdefs with localized strings
34 void initialize_viewdefs(void) {
35 viewdefs[0] = _("Bulletin Board");
36 viewdefs[1] = _("Mail Folder");
37 viewdefs[2] = _("Address Book");
38 viewdefs[3] = _("Calendar");
39 viewdefs[4] = _("Task List");
40 viewdefs[5] = _("Notes List");
41 viewdefs[6] = _("Wiki");
42 viewdefs[7] = _("Calendar List");
43 viewdefs[8] = _("Journal");
47 * Determine which views are allowed as the default for creating a new room.
49 int is_view_allowed_as_default(int which_view)
52 case VIEW_BBS: return(1);
53 case VIEW_MAILBOX: return(1);
54 case VIEW_ADDRESSBOOK: return(1);
55 case VIEW_CALENDAR: return(1);
56 case VIEW_TASKS: return(1);
57 case VIEW_NOTES: return(1);
60 case VIEW_WIKI: return(1);
61 #else /* TECH_PREVIEW */
62 case VIEW_WIKI: return(0); /* because it isn't finished yet */
63 #endif /* TECH_PREVIEW */
65 case VIEW_CALBRIEF: return(0);
66 case VIEW_JOURNAL: return(0);
67 default: return(0); /* should never get here */
73 * load the list of floors
75 void load_floorlist(StrBuf *Buf)
80 for (a = 0; a < MAX_FLOORS; ++a)
84 StrBuf_ServGetln(Buf);
85 if (GetServerStatus(Buf, NULL) != 1) {
86 strcpy(floorlist[0], "Main Floor");
89 while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
90 if ( (StrLength(Buf)==3) &&
91 !strcmp(ChrPtr(Buf), "000")) {
95 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
101 * Free a session's march list
103 void free_march_list(wcsession *wcf)
107 while (wcf->march != NULL) {
108 mptr = wcf->march->next;
118 * remove a room from the march list
120 void remove_march(const StrBuf *aaa)
122 struct march *mptr, *mptr2;
124 if (WC->march == NULL)
127 if (!strcasecmp(WC->march->march_name, ChrPtr(aaa))) {
128 mptr = WC->march->next;
134 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
135 if (!strcasecmp(mptr->march_name, ChrPtr(aaa))) {
136 mptr2->next = mptr->next;
149 * display rooms in tree structure
151 void room_tree_list(struct roomlisting *rp)
160 room_tree_list(rp->lnext);
162 strcpy(rmname, rp->rlname);
165 wprintf("<a href=\"dotgoto&room=");
169 escputs1(rmname, 1, 1);
170 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
172 else if (f & QR_DIRECTORY)
174 else if (f & QR_NETWORK)
178 wprintf("</a><tt> </tt>\n");
180 room_tree_list(rp->rnext);
186 * \brief Room ordering stuff (compare first by floor, then by order)
187 * \param r1 first roomlist to compare
188 * \param r2 second roomlist co compare
189 * \return are they the same???
191 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
193 if ((r1 == NULL) && (r2 == NULL))
199 if (r1->rlfloor < r2->rlfloor)
201 if (r1->rlfloor > r2->rlfloor)
203 if (r1->rlorder < r2->rlorder)
205 if (r1->rlorder > r2->rlorder)
212 * \brief Common code for all room listings
213 * \param variety what???
215 void listrms(char *variety)
220 struct roomlisting *rl = NULL;
221 struct roomlisting *rp;
222 struct roomlisting *rs;
224 /** Ask the server for a room list */
226 serv_getln(buf, sizeof buf);
232 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
234 rp = malloc(sizeof(struct roomlisting));
235 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
236 rp->rlflags = extract_int(buf, 1);
237 rp->rlfloor = extract_int(buf, 2);
238 rp->rlorder = extract_int(buf, 3);
247 if (rordercmp(rp, rs) < 0) {
248 if (rs->lnext == NULL) {
255 if (rs->rnext == NULL) {
268 * If no rooms were listed, print an nbsp to make the cell
269 * borders show up anyway.
271 if (num_rooms == 0) wprintf(" ");
276 * \brief list all forgotten rooms
278 void zapped_list(void)
280 WCTemplputParams SubTP;
283 output_headers(1, 1, 1, 0, 0, 0);
284 memset(&SubTP, 0, sizeof(WCTemplputParams));
285 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
286 SubTP.Filter.ContextType = CTX_STRBUF;
288 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
294 wprintf("<br /><br />\n");
295 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
296 do_template("endbox", NULL);
302 * \brief read this room's info file (set v to 1 for verbose mode)
304 void readinfo(StrBuf *Target, WCTemplputParams *TP)
309 int fullinfo_len = 0;
312 serv_getln(buf, sizeof buf);
315 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
316 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
317 strcpy(&fullinfo[fullinfo_len], buf);
318 fullinfo_len += strlen(buf);
322 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
323 strcpy(&briefinfo[50], "...");
325 wprintf("<div class=\"infos\" "
326 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
329 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
330 wprintf("<img class=\"close_infos\" "
331 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
332 "src=\"static/closewindow.gif\" alt=\"%s\" width=\"16\" height=\"16\">",
347 * \brief Display room banner icon.
348 * The server doesn't actually
349 * need the room name, but we supply it in order to
350 * keep the browser from using a cached icon from
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 * \brief 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 * \brief 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 * \brief Embed the room banner
469 * \param got The information returned from a GOTO server command
470 * \param 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();
507 StrBufPrintf(WCC->Hdr->this_page,
509 ChrPtr(WC->wc_roomname));
511 /** Check for new mail. */
512 WC->new_mail = extract_int(&got[4], 9);
513 WC->wc_view = extract_int(&got[4], 11);
515 /* Is this a directory room and does it contain files and how many? */
516 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
519 serv_getln(buf2, sizeof buf2);
520 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
522 snprintf (with_files, sizeof with_files,
523 "; <a href=\"do_template?template=files\"> %d %s </a>",
525 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
528 strcpy (with_files, "");
530 svprintf(HKEY("NUMMSGS"), WCS_STRING,
531 _("%d new of %d messages%s"),
532 extract_int(&got[4], 1),
533 extract_int(&got[4], 2),
536 svcallback("ROOMPIC", embed_room_graphic);
537 svcallback("ROOMINFO", readinfo);
538 svcallback("VIEWOMATIC", embed_view_o_matic);
539 svcallback("SEARCHOMATIC", embed_search_o_matic);
540 svcallback("START", offer_start_page);
542 do_template("roombanner", NULL);
543 /* roombanner contains this for mobile */
544 if (navbar_style != navbar_none && !WC->is_mobile) {
546 wprintf("<div id=\"navbar\"><ul>");
548 if (navbar_style == navbar_default) wprintf(
549 "<li class=\"ungoto\">"
550 "<a href=\"ungoto\">"
551 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
552 "<span class=\"navbar_link\">%s</span></A>"
553 "</li>\n", _("Ungoto")
556 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
558 "<li class=\"newmess\">"
559 "<a href=\"readnew\">"
560 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
561 "<span class=\"navbar_link\">%s</span></A>"
562 "</li>\n", _("Read new messages")
566 if (navbar_style == navbar_default) {
567 switch(WC->wc_view) {
568 case VIEW_ADDRESSBOOK:
570 "<li class=\"viewcontacts\">"
571 "<a href=\"readfwd\">"
572 "<img src=\"static/viewcontacts_24x.gif\" "
573 "alt=\"\" width=\"24\" height=\"24\">"
574 "<span class=\"navbar_link\">"
576 "</span></a></li>\n", _("View contacts")
581 "<li class=\"staskday\">"
582 "<a href=\"readfwd?calview=day\">"
583 "<img src=\"static/taskday2_24x.gif\" "
584 "alt=\"\" width=\"24\" height=\"24\">"
585 "<span class=\"navbar_link\">"
587 "</span></a></li>\n", _("Day view")
590 "<li class=\"monthview\">"
591 "<a href=\"readfwd?calview=month\">"
592 "<img src=\"static/monthview2_24x.gif\" "
593 "alt=\"\" width=\"24\" height=\"24\">"
594 "<span class=\"navbar_link\">"
596 "</span></a></li>\n", _("Month view")
601 "<li class=\"monthview\">"
602 "<a href=\"readfwd?calview=month\">"
603 "<img src=\"static/monthview2_24x.gif\" "
604 "alt=\"\" width=\"24\" height=\"24\">"
605 "<span class=\"navbar_link\">"
607 "</span></a></li>\n", _("Calendar list")
612 "<li class=\"taskmanag\">"
613 "<a href=\"readfwd\">"
614 "<img src=\"static/taskmanag_24x.gif\" "
615 "alt=\"\" width=\"24\" height=\"24\">"
616 "<span class=\"navbar_link\">"
618 "</span></a></li>\n", _("View tasks")
623 "<li class=\"viewnotes\">"
624 "<a href=\"readfwd\">"
625 "<img src=\"static/viewnotes_24x.gif\" "
626 "alt=\"\" width=\"24\" height=\"24\">"
627 "<span class=\"navbar_link\">"
629 "</span></a></li>\n", _("View notes")
634 "<li class=\"readallmess\">"
635 "<a id=\"m_refresh\" href=\"readfwd\">"
636 "<img src=\"static/readallmess3_24x.gif\" "
637 "alt=\"\" width=\"24\" height=\"24\">"
638 "<span class=\"navbar_link\">"
640 "</span></a></li>\n", _("Refresh message list")
645 "<li class=\"readallmess\">"
646 "<a href=\"readfwd\">"
647 "<img src=\"static/readallmess3_24x.gif\" "
648 "alt=\"\" width=\"24\" height=\"24\">"
649 "<span class=\"navbar_link\">"
651 "</span></a></li>\n", _("Wiki home")
656 "<li class=\"readallmess\">"
657 "<a href=\"readfwd\">"
658 "<img src=\"static/readallmess3_24x.gif\" "
659 "alt=\"\" width=\"24\" height=\"24\">"
660 "<span class=\"navbar_link\">"
662 "</span></a></li>\n", _("Read all messages")
668 if (navbar_style == navbar_default) {
669 switch(WC->wc_view) {
670 case VIEW_ADDRESSBOOK:
672 "<li class=\"addnewcontact\">"
673 "<a href=\"display_enter\">"
674 "<img src=\"static/addnewcontact_24x.gif\" "
675 "alt=\"\" width=\"24\" height=\"24\">"
676 "<span class=\"navbar_link\">"
678 "</span></a></li>\n", _("Add new contact")
683 wprintf("<li class=\"addevent\"><a href=\"display_enter");
684 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
685 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
686 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
688 "<img src=\"static/addevent_24x.gif\" "
689 "alt=\"\" width=\"24\" height=\"24\">"
690 "<span class=\"navbar_link\">"
692 "</span></a></li>\n", _("Add new event")
697 "<li class=\"newmess\">"
698 "<a href=\"display_enter\">"
699 "<img src=\"static/newmess3_24x.gif\" "
700 "alt=\"\" width=\"24\" height=\"24\">"
701 "<span class=\"navbar_link\">"
703 "</span></a></li>\n", _("Add new task")
708 "<li class=\"enternewnote\">"
709 "<a href=\"add_new_note\">"
710 "<img src=\"static/enternewnote_24x.gif\" "
711 "alt=\"\" width=\"24\" height=\"24\">"
712 "<span class=\"navbar_link\">"
714 "</span></a></li>\n", _("Add new note")
718 safestrncpy(buf, bstr("page"), sizeof buf);
721 "<li class=\"newmess\">"
722 "<a href=\"display_enter?wikipage=%s\">"
723 "<img src=\"static/newmess3_24x.gif\" "
724 "alt=\"\" width=\"24\" height=\"24\">"
725 "<span class=\"navbar_link\">"
727 "</span></a></li>\n", buf, _("Edit this page")
732 "<li class=\"newmess\">"
733 "<a href=\"display_enter\">"
734 "<img src=\"static/newmess3_24x.gif\" "
735 "alt=\"\" width=\"24\" height=\"24\">"
736 "<span class=\"navbar_link\">"
738 "</span></a></li>\n", _("Write mail")
741 "<li class=\"newmess\">"
742 "<a href=\"javascript:deleteAllSelectedMessages();\">"
743 "<img src=\"static/delete.gif\" "
744 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
746 "</span></a></li>\n", _("Delete")
751 "<li class=\"newmess\">"
752 "<a href=\"display_enter\">"
753 "<img src=\"static/newmess3_24x.gif\" "
754 "alt=\"\" width=\"24\" height=\"24\">"
755 "<span class=\"navbar_link\">"
757 "</span></a></li>\n", _("Enter a message")
763 if (navbar_style == navbar_default) wprintf(
764 "<li class=\"skipthisroom\">"
767 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
768 "width=\"24\" height=\"24\">"
769 "<span class=\"navbar_link\">%s</span></a>"
771 _("Leave all messages marked as unread, go to next room with unread messages"),
775 if (navbar_style == navbar_default) wprintf(
776 "<li class=\"markngo\">"
777 "<a href=\"gotonext\" "
779 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
780 "width=\"24\" height=\"24\">"
781 "<span class=\"navbar_link\">%s</span></a>"
783 _("Mark all messages as read, go to next room with unread messages"),
787 wprintf("</ul></div>\n");
794 * back end routine to take the session to a new room
796 long gotoroom(const StrBuf *gname)
799 static long ls = (-1L);
802 /* store ungoto information */
803 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
806 /** move to the new room */
807 serv_printf("GOTO %s", ChrPtr(gname));
808 StrBuf_ServGetln(Buf);
809 if (GetServerStatus(Buf, &err) != 2) {
810 serv_puts("GOTO _BASEROOM_");
811 StrBuf_ServGetln(Buf);
813 * well, we know that this is the fallback case,
814 * but we're interested that the first command
815 * didn't work out in first place.
817 if (GetServerStatus(Buf, NULL) != 2) {
823 if (WC->wc_roomname == NULL)
824 WC->wc_roomname = NewStrBuf();
826 FlushStrBuf(WC->wc_roomname);
828 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
829 StrBufCutLeft(WC->wc_roomname, 4);
830 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
831 /* highest_msg_read = extract_int(&buf[4],6);
832 maxmsgnum = extract_int(&buf[4],5);
834 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
835 ls = StrBufExtract_long(Buf, 6, '|');
836 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
837 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
838 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
839 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
840 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
843 WC->is_room_aide = WC->is_aide;
845 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
847 remove_march(WC->wc_roomname);
848 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
857 * \brief Locate the room on the march list which we most want to go to.
859 * is measured given a "weight" of preference based on various factors.
860 * \param desired_floor the room number on the citadel server
861 * \return the roomname
863 char *pop_march(int desired_floor)
865 static char TheRoom[128];
867 int TheOrder = 32767;
870 struct march *mptr = NULL;
872 strcpy(TheRoom, "_BASEROOM_");
873 if (WC->march == NULL)
876 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
878 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
879 weight = weight + 10000;
880 if (mptr->march_floor == desired_floor)
881 weight = weight + 5000;
883 weight = weight + ((128 - (mptr->march_floor)) * 128);
884 weight = weight + (128 - (mptr->march_order));
886 if (weight > TheWeight) {
888 strcpy(TheRoom, mptr->march_name);
889 TheFloor = mptr->march_floor;
890 TheOrder = mptr->march_order;
899 * Goto next room having unread messages.
901 * We want to skip over rooms that the user has already been to, and take the
902 * user back to the lobby when done. The room we end up in is placed in
903 * newroom - which is set to 0 (the lobby) initially.
904 * We start the search in the current room rather than the beginning to prevent
905 * two or more concurrent users from dragging each other back to the same room.
910 struct march *mptr = NULL;
911 struct march *mptr2 = NULL;
917 * First check to see if the march-mode list is already allocated.
918 * If it is, pop the first room off the list and go there.
921 if (WC->march == NULL) {
923 serv_getln(buf, sizeof buf);
925 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
926 if (IsEmptyStr(buf)) {
929 if (ELoop % 100 == 0)
934 extract_token(room_name, buf, 0, '|', sizeof room_name);
935 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
936 mptr = (struct march *) malloc(sizeof(struct march));
938 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
939 mptr->march_floor = extract_int(buf, 2);
940 mptr->march_order = extract_int(buf, 3);
941 if (WC->march == NULL)
950 * add _BASEROOM_ to the end of the march list, so the user will end up
951 * in the system base room (usually the Lobby>) at the end of the loop
953 mptr = (struct march *) malloc(sizeof(struct march));
955 mptr->march_order = 0;
956 mptr->march_floor = 0;
957 strcpy(mptr->march_name, "_BASEROOM_");
958 if (WC->march == NULL) {
962 while (mptr2->next != NULL)
967 * ...and remove the room we're currently in, so a <G>oto doesn't make us
968 * walk around in circles
970 remove_march(WC->wc_roomname);
972 if (WC->march != NULL) {
973 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
975 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
979 smart_goto(next_room);
980 FreeStrBuf(&next_room);
987 void smart_goto(const StrBuf *next_room) {
995 * mark all messages in current room as having been read
997 void slrp_highest(void)
1001 serv_puts("SLRP HIGHEST");
1002 serv_getln(buf, sizeof buf);
1007 * un-goto the previous room
1013 if (!strcmp(WC->ugname, "")) {
1014 smart_goto(WC->wc_roomname);
1017 serv_printf("GOTO %s", WC->ugname);
1019 StrBuf_ServGetln(Buf);
1020 if (GetServerStatus(Buf, NULL) != 2) {
1021 smart_goto(WC->wc_roomname);
1025 if (WC->uglsn >= 0L) {
1026 serv_printf("SLRP %ld", WC->uglsn);
1027 StrBuf_ServGetln(Buf);
1030 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1031 strcpy(WC->ugname, "");
1036 typedef struct __room_states {
1051 * Set/clear/read the "self-service list subscribe" flag for a room
1053 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1054 * returns the new value.
1057 int self_service(int newval) {
1058 int current_value = 0;
1064 int flags, floor, order, view, flags2;
1067 serv_getln(buf, sizeof buf);
1068 if (buf[0] != '2') return(0);
1070 extract_token(name, &buf[4], 0, '|', sizeof name);
1071 extract_token(password, &buf[4], 1, '|', sizeof password);
1072 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1073 flags = extract_int(&buf[4], 3);
1074 floor = extract_int(&buf[4], 4);
1075 order = extract_int(&buf[4], 5);
1076 view = extract_int(&buf[4], 6);
1077 flags2 = extract_int(&buf[4], 7);
1079 if (flags2 & QR2_SELFLIST) {
1087 flags2 = flags2 | QR2_SELFLIST;
1089 else if (newval == 0) {
1090 flags2 = flags2 & ~QR2_SELFLIST;
1093 return(current_value);
1096 if (newval != current_value) {
1097 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1098 name, password, dirname, flags,
1099 floor, order, view, flags2);
1100 serv_getln(buf, sizeof buf);
1107 int is_selflist(room_states *RoomFlags)
1109 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1112 int is_publiclist(room_states *RoomFlags)
1114 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1117 int is_moderatedlist(room_states *RoomFlags)
1119 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1123 * Set/clear/read the "self-service list subscribe" flag for a room
1125 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1126 * returns the new value.
1129 int get_roomflags(room_states *RoomOps)
1134 serv_getln(buf, sizeof buf);
1135 if (buf[0] != '2') return(0);
1137 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1138 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1139 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1140 RoomOps->flags = extract_int(&buf[4], 3);
1141 RoomOps->floor = extract_int(&buf[4], 4);
1142 RoomOps->order = extract_int(&buf[4], 5);
1143 RoomOps->view = extract_int(&buf[4], 6);
1144 RoomOps->flags2 = extract_int(&buf[4], 7);
1148 int set_roomflags(room_states *RoomOps)
1152 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1161 serv_getln(buf, sizeof buf);
1171 * display the form for editing a room
1173 void display_editroom(void)
1179 char remote_room[128];
1182 char er_password[10];
1183 char er_dirname[15];
1184 char er_roomaide[26];
1191 char *not_shared_with;
1194 int floorpolicy = 0;
1196 char pop3_host[128];
1201 if (IsEmptyStr(tab)) tab = "admin";
1204 load_floorlist(Buf);
1206 output_headers(1, 1, 1, 0, 0, 0);
1208 wprintf("<div class=\"fix_scrollbar_bug\">");
1210 wprintf("<br />\n");
1212 /* print the tabbed dialog */
1213 wprintf("<div align=\"center\">");
1214 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""
1215 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1218 wprintf("<td class=\"");
1219 if (!strcmp(tab, "admin")) {
1220 wprintf(" tab_cell_label\">");
1221 wprintf(_("Administration"));
1224 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1225 wprintf(_("Administration"));
1229 wprintf("<td> </td>\n");
1231 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1233 wprintf("<td class=\"");
1234 if (!strcmp(tab, "config")) {
1235 wprintf(" tab_cell_label\">");
1236 wprintf(_("Configuration"));
1239 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1240 wprintf(_("Configuration"));
1244 wprintf("<td> </td>\n");
1246 wprintf("<td class=\"");
1247 if (!strcmp(tab, "expire")) {
1248 wprintf(" tab_cell_label\">");
1249 wprintf(_("Message expire policy"));
1252 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1253 wprintf(_("Message expire policy"));
1257 wprintf("<td> </td>\n");
1259 wprintf("<td class=\"");
1260 if (!strcmp(tab, "access")) {
1261 wprintf(" tab_cell_label\">");
1262 wprintf(_("Access controls"));
1265 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1266 wprintf(_("Access controls"));
1270 wprintf("<td> </td>\n");
1272 wprintf("<td class=\"");
1273 if (!strcmp(tab, "sharing")) {
1274 wprintf(" tab_cell_label\">");
1275 wprintf(_("Sharing"));
1278 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1279 wprintf(_("Sharing"));
1283 wprintf("<td> </td>\n");
1285 wprintf("<td class=\"");
1286 if (!strcmp(tab, "listserv")) {
1287 wprintf(" tab_cell_label\">");
1288 wprintf(_("Mailing list service"));
1291 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1292 wprintf(_("Mailing list service"));
1296 wprintf("<td> </td>\n");
1300 wprintf("<td class=\"");
1301 if (!strcmp(tab, "feeds")) {
1302 wprintf(" tab_cell_label\">");
1303 wprintf(_("Remote retrieval"));
1306 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1307 wprintf(_("Remote retrieval"));
1311 wprintf("<td> </td>\n");
1313 wprintf("</tr></table>\n");
1314 wprintf("</div>\n");
1315 /* end tabbed dialog */
1317 wprintf("<script type=\"text/javascript\">"
1318 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1322 /* begin content of whatever tab is open now */
1324 if (!strcmp(tab, "admin")) {
1325 wprintf("<div class=\"tabcontent\">");
1327 "<li><a href=\"delete_room\" "
1328 "onClick=\"return confirm('");
1329 wprintf(_("Are you sure you want to delete this room?"));
1330 wprintf("');\">\n");
1331 wprintf(_("Delete this room"));
1333 "<li><a href=\"display_editroompic\">\n");
1334 wprintf(_("Set or change the icon for this room's banner"));
1336 "<li><a href=\"display_editinfo\">\n");
1337 wprintf(_("Edit this room's Info file"));
1343 if (!strcmp(tab, "config")) {
1344 wprintf("<div class=\"tabcontent\">");
1346 serv_getln(buf, sizeof buf);
1348 if (!strncmp(buf, "550", 3)) {
1349 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1350 _("Higher access is required to access this function.")
1353 else if (buf[0] != '2') {
1354 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1357 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1358 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1359 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1360 er_flags = extract_int(&buf[4], 3);
1361 er_floor = extract_int(&buf[4], 4);
1362 er_flags2 = extract_int(&buf[4], 7);
1364 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1365 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1367 wprintf("<ul><li>");
1368 wprintf(_("Name of room: "));
1369 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1375 wprintf(_("Resides on floor: "));
1376 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1377 if (er_flags & QR_MAILBOX)
1378 wprintf("disabled >\n");
1379 for (i = 0; i < 128; ++i)
1380 if (!IsEmptyStr(floorlist[i])) {
1381 wprintf("<OPTION ");
1383 wprintf("SELECTED ");
1384 wprintf("VALUE=\"%d\">", i);
1385 escputs(floorlist[i]);
1386 wprintf("</OPTION>\n");
1388 wprintf("</select>\n");
1391 wprintf(_("Type of room:"));
1394 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1395 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1396 wprintf("CHECKED ");
1397 wprintf("OnChange=\""
1398 " if (this.form.type[0].checked == true) { "
1399 " this.form.er_floor.disabled = false; "
1402 wprintf(_("Public (automatically appears to everyone)"));
1405 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1406 if ((er_flags & QR_PRIVATE) &&
1407 (er_flags & QR_GUESSNAME))
1408 wprintf("CHECKED ");
1409 wprintf(" OnChange=\""
1410 " if (this.form.type[1].checked == true) { "
1411 " this.form.er_floor.disabled = false; "
1414 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1416 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1417 if ((er_flags & QR_PRIVATE) &&
1418 (er_flags & QR_PASSWORDED))
1419 wprintf("CHECKED ");
1420 wprintf(" OnChange=\""
1421 " if (this.form.type[2].checked == true) { "
1422 " this.form.er_floor.disabled = false; "
1425 wprintf(_("Private - require password: "));
1426 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1429 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1430 if ((er_flags & QR_PRIVATE)
1431 && ((er_flags & QR_GUESSNAME) == 0)
1432 && ((er_flags & QR_PASSWORDED) == 0))
1433 wprintf("CHECKED ");
1434 wprintf(" OnChange=\""
1435 " if (this.form.type[3].checked == true) { "
1436 " this.form.er_floor.disabled = false; "
1439 wprintf(_("Private - invitation only"));
1441 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1442 if (er_flags & QR_MAILBOX)
1443 wprintf("CHECKED ");
1444 wprintf (" OnChange=\""
1445 " if (this.form.type[4].checked == true) { "
1446 " this.form.er_floor.disabled = true; "
1449 wprintf(_("Personal (mailbox for you only)"));
1451 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1453 wprintf(_("If private, cause current users to forget room"));
1455 wprintf("\n</ul>\n");
1457 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1458 if (er_flags & QR_PREFONLY)
1459 wprintf("CHECKED ");
1461 wprintf(_("Preferred users only"));
1463 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1464 if (er_flags & QR_READONLY)
1465 wprintf("CHECKED ");
1467 wprintf(_("Read-only room"));
1469 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1470 if (er_flags2 & QR2_COLLABDEL)
1471 wprintf("CHECKED ");
1473 wprintf(_("All users allowed to post may also delete messages"));
1475 /** directory stuff */
1476 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1477 if (er_flags & QR_DIRECTORY)
1478 wprintf("CHECKED ");
1480 wprintf(_("File directory room"));
1482 wprintf("\n<ul><li>");
1483 wprintf(_("Directory name: "));
1484 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1487 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1488 if (er_flags & QR_UPLOAD)
1489 wprintf("CHECKED ");
1491 wprintf(_("Uploading allowed"));
1493 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1494 if (er_flags & QR_DOWNLOAD)
1495 wprintf("CHECKED ");
1497 wprintf(_("Downloading allowed"));
1499 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1500 if (er_flags & QR_VISDIR)
1501 wprintf("CHECKED ");
1503 wprintf(_("Visible directory"));
1506 /** end of directory stuff */
1508 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1509 if (er_flags & QR_NETWORK)
1510 wprintf("CHECKED ");
1512 wprintf(_("Network shared room"));
1514 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1515 if (er_flags & QR_PERMANENT)
1516 wprintf("CHECKED ");
1518 wprintf(_("Permanent (does not auto-purge)"));
1520 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1521 if (er_flags2 & QR2_SUBJECTREQ)
1522 wprintf("CHECKED ");
1524 wprintf(_("Subject Required (Force users to specify a message subject)"));
1526 /** start of anon options */
1529 wprintf(_("Anonymous messages"));
1532 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1533 if (((er_flags & QR_ANONONLY) == 0)
1534 && ((er_flags & QR_ANONOPT) == 0))
1535 wprintf("CHECKED ");
1537 wprintf(_("No anonymous messages"));
1539 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1540 if (er_flags & QR_ANONONLY)
1541 wprintf("CHECKED ");
1543 wprintf(_("All messages are anonymous"));
1545 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1546 if (er_flags & QR_ANONOPT)
1547 wprintf("CHECKED ");
1549 wprintf(_("Prompt user when entering messages"));
1552 /* end of anon options */
1555 wprintf(_("Room aide: "));
1557 serv_getln(buf, sizeof buf);
1558 if (buf[0] != '2') {
1559 wprintf("<em>%s</em>\n", &buf[4]);
1561 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1562 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1565 wprintf("</ul><CENTER>\n");
1566 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1567 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1569 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1579 /* Sharing the room with other Citadel nodes... */
1580 if (!strcmp(tab, "sharing")) {
1581 wprintf("<div class=\"tabcontent\">");
1583 shared_with = strdup("");
1584 not_shared_with = strdup("");
1586 /** Learn the current configuration */
1587 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1588 serv_getln(buf, sizeof buf);
1589 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1590 extract_token(node, buf, 0, '|', sizeof node);
1591 not_shared_with = realloc(not_shared_with,
1592 strlen(not_shared_with) + 32);
1593 strcat(not_shared_with, node);
1594 strcat(not_shared_with, "\n");
1598 serv_getln(buf, sizeof buf);
1599 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1600 extract_token(cmd, buf, 0, '|', sizeof cmd);
1601 extract_token(node, buf, 1, '|', sizeof node);
1602 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1603 if (!strcasecmp(cmd, "ignet_push_share")) {
1604 shared_with = realloc(shared_with,
1605 strlen(shared_with) + 32);
1606 strcat(shared_with, node);
1607 if (!IsEmptyStr(remote_room)) {
1608 strcat(shared_with, "|");
1609 strcat(shared_with, remote_room);
1611 strcat(shared_with, "\n");
1615 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1616 extract_token(buf, shared_with, i, '\n', sizeof buf);
1617 extract_token(node, buf, 0, '|', sizeof node);
1618 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1619 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1620 if (!strcasecmp(node, cmd)) {
1621 remove_token(not_shared_with, j, '\n');
1626 /* Display the stuff */
1627 wprintf("<CENTER><br />"
1628 "<table border=1 cellpadding=5><tr>"
1630 wprintf(_("Shared with"));
1631 wprintf("</I></B></td>"
1633 wprintf(_("Not shared with"));
1634 wprintf("</I></B></td></tr>\n"
1635 "<tr><td VALIGN=TOP>\n");
1637 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1638 wprintf(_("Remote node name"));
1639 wprintf("</td><td>");
1640 wprintf(_("Remote room name"));
1641 wprintf("</td><td>");
1642 wprintf(_("Actions"));
1643 wprintf("</td></tr>\n");
1645 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1646 extract_token(buf, shared_with, i, '\n', sizeof buf);
1647 extract_token(node, buf, 0, '|', sizeof node);
1648 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1649 if (!IsEmptyStr(node)) {
1650 wprintf("<form method=\"POST\" action=\"netedit\">");
1651 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1652 wprintf("<tr><td>%s</td>\n", node);
1655 if (!IsEmptyStr(remote_room)) {
1656 escputs(remote_room);
1662 wprintf("<input type=\"hidden\" NAME=\"line\" "
1663 "VALUE=\"ignet_push_share|");
1665 if (!IsEmptyStr(remote_room)) {
1667 urlescputs(remote_room);
1670 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1671 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1672 wprintf("<input type=\"submit\" "
1673 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1674 wprintf("</td></tr></form>\n");
1678 wprintf("</table>\n");
1679 wprintf("</td><td VALIGN=TOP>\n");
1680 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1681 wprintf(_("Remote node name"));
1682 wprintf("</td><td>");
1683 wprintf(_("Remote room name"));
1684 wprintf("</td><td>");
1685 wprintf(_("Actions"));
1686 wprintf("</td></tr>\n");
1688 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1689 extract_token(node, not_shared_with, i, '\n', sizeof node);
1690 if (!IsEmptyStr(node)) {
1691 wprintf("<form method=\"POST\" action=\"netedit\">");
1692 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1693 wprintf("<tr><td>");
1696 "<input type=\"INPUT\" "
1700 wprintf("<input type=\"hidden\" "
1702 "VALUE=\"ignet_push_share|");
1705 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1706 "VALUE=\"sharing\">\n");
1707 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1708 "VALUE=\"add\">\n");
1709 wprintf("<input type=\"submit\" "
1710 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1711 wprintf("</td></tr></form>\n");
1715 wprintf("</table>\n");
1716 wprintf("</td></tr>"
1717 "</table></CENTER><br />\n"
1718 "<I><B>%s</B><ul><li>", _("Notes:"));
1719 wprintf(_("When sharing a room, "
1720 "it must be shared from both ends. Adding a node to "
1721 "the 'shared' list sends messages out, but in order to"
1722 " receive messages, the other nodes must be configured"
1723 " to send messages out to your system as well. "
1724 "<li>If the remote room name is blank, it is assumed "
1725 "that the room name is identical on the remote node."
1726 "<li>If the remote room name is different, the remote "
1727 "node must also configure the name of the room here."
1734 /* Mailing list management */
1735 if (!strcmp(tab, "listserv")) {
1736 room_states RoomFlags;
1737 wprintf("<div class=\"tabcontent\">");
1739 wprintf("<br /><center>"
1740 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1741 "<tr><td VALIGN=TOP>");
1743 wprintf(_("<i>The contents of this room are being "
1744 "mailed <b>as individual messages</b> "
1745 "to the following list recipients:"
1746 "</i><br /><br />\n"));
1749 serv_getln(buf, sizeof buf);
1750 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1751 extract_token(cmd, buf, 0, '|', sizeof cmd);
1752 if (!strcasecmp(cmd, "listrecp")) {
1753 extract_token(recp, buf, 1, '|', sizeof recp);
1756 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1759 wprintf(_("(remove)"));
1760 wprintf("</A><br />");
1763 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1764 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1765 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1766 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1767 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1768 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1769 wprintf("</form>\n");
1771 wprintf("</td><td VALIGN=TOP>\n");
1773 wprintf(_("<i>The contents of this room are being "
1774 "mailed <b>in digest form</b> "
1775 "to the following list recipients:"
1776 "</i><br /><br />\n"));
1779 serv_getln(buf, sizeof buf);
1780 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1781 extract_token(cmd, buf, 0, '|', sizeof cmd);
1782 if (!strcasecmp(cmd, "digestrecp")) {
1783 extract_token(recp, buf, 1, '|', sizeof recp);
1786 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1790 wprintf(_("(remove)"));
1791 wprintf("</A><br />");
1794 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1795 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1796 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1797 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1798 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1799 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1800 wprintf("</form>\n");
1802 wprintf("</td></tr></table>\n");
1804 /** Pop open an address book -- begin **/
1805 wprintf("<div align=right>"
1806 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1808 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1813 _("Add recipients from Contacts or other address books"),
1814 _("Add recipients from Contacts or other address books")
1816 /* Pop open an address book -- end **/
1818 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1820 get_roomflags (&RoomFlags);
1822 /* Self Service subscription? */
1823 wprintf("<table><tr><td>\n");
1824 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1825 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1826 " <tr><td colspan=\"2\">\n",
1827 (is_selflist(&RoomFlags))?"checked":"");
1828 wprintf(_("The URL for subscribe/unsubscribe is: "));
1829 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1830 (is_https ? "https" : "http"),
1831 ChrPtr(WC->Hdr->HR.http_host));
1832 /* Public posting? */
1833 wprintf("<tr><td>");
1834 wprintf(_("Allow non-subscribers to mail to this room."));
1835 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1836 (is_publiclist(&RoomFlags))?"checked":"");
1838 /* Moderated List? */
1839 wprintf("<tr><td>");
1840 wprintf(_("Room post publication needs Aide permission."));
1841 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1842 (is_moderatedlist(&RoomFlags))?"checked":"");
1845 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1846 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1847 wprintf("</table></form>");
1850 wprintf("</CENTER>\n");
1855 /* Configuration of The Dreaded Auto-Purger */
1856 if (!strcmp(tab, "expire")) {
1857 wprintf("<div class=\"tabcontent\">");
1859 serv_puts("GPEX room");
1860 serv_getln(buf, sizeof buf);
1861 if (!strncmp(buf, "550", 3)) {
1862 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1863 _("Higher access is required to access this function.")
1866 else if (buf[0] != '2') {
1867 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1870 roompolicy = extract_int(&buf[4], 0);
1871 roomvalue = extract_int(&buf[4], 1);
1873 serv_puts("GPEX floor");
1874 serv_getln(buf, sizeof buf);
1875 if (buf[0] == '2') {
1876 floorpolicy = extract_int(&buf[4], 0);
1877 floorvalue = extract_int(&buf[4], 1);
1880 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1881 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1882 wprintf("<table border=0 cellspacing=5>\n");
1883 wprintf("<tr><td>");
1884 wprintf(_("Message expire policy for this room"));
1886 escputs(ChrPtr(WC->wc_roomname));
1887 wprintf(")</td><td>");
1888 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1889 ((roompolicy == 0) ? "CHECKED" : "") );
1890 wprintf(_("Use the default policy for this floor"));
1891 wprintf("<br />\n");
1892 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1893 ((roompolicy == 1) ? "CHECKED" : "") );
1894 wprintf(_("Never automatically expire messages"));
1895 wprintf("<br />\n");
1896 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1897 ((roompolicy == 2) ? "CHECKED" : "") );
1898 wprintf(_("Expire by message count"));
1899 wprintf("<br />\n");
1900 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1901 ((roompolicy == 3) ? "CHECKED" : "") );
1902 wprintf(_("Expire by message age"));
1904 wprintf(_("Number of messages or days: "));
1905 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1906 wprintf("</td></tr>\n");
1908 if (WC->axlevel >= 6) {
1909 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1910 wprintf("<tr><td>");
1911 wprintf(_("Message expire policy for this floor"));
1913 escputs(floorlist[WC->wc_floor]);
1914 wprintf(")</td><td>");
1915 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1916 ((floorpolicy == 0) ? "CHECKED" : "") );
1917 wprintf(_("Use the system default"));
1918 wprintf("<br />\n");
1919 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1920 ((floorpolicy == 1) ? "CHECKED" : "") );
1921 wprintf(_("Never automatically expire messages"));
1922 wprintf("<br />\n");
1923 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1924 ((floorpolicy == 2) ? "CHECKED" : "") );
1925 wprintf(_("Expire by message count"));
1926 wprintf("<br />\n");
1927 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1928 ((floorpolicy == 3) ? "CHECKED" : "") );
1929 wprintf(_("Expire by message age"));
1931 wprintf(_("Number of messages or days: "));
1932 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1936 wprintf("<CENTER>\n");
1937 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1938 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1940 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1941 wprintf("</CENTER></td><tr>\n");
1943 wprintf("</table>\n"
1944 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1952 /* Access controls */
1953 if (!strcmp(tab, "access")) {
1954 wprintf("<div class=\"tabcontent\">");
1959 /* Fetch messages from remote locations */
1960 if (!strcmp(tab, "feeds")) {
1961 wprintf("<div class=\"tabcontent\">");
1964 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1965 wprintf("</i><br />\n");
1967 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1968 "<tr class=\"even\"><th>");
1969 wprintf(_("Remote host"));
1970 wprintf("</th><th>");
1971 wprintf(_("User name"));
1972 wprintf("</th><th>");
1973 wprintf(_("Password"));
1974 wprintf("</th><th>");
1975 wprintf(_("Keep messages on server?"));
1976 wprintf("</th><th>");
1977 wprintf(_("Interval"));
1978 wprintf("</th><th> </th></tr>");
1981 serv_getln(buf, sizeof buf);
1983 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1984 extract_token(cmd, buf, 0, '|', sizeof cmd);
1985 if (!strcasecmp(cmd, "pop3client")) {
1986 safestrncpy(recp, &buf[11], sizeof recp);
1989 wprintf("<tr class=\"%s\">",
1990 (bg ? "even" : "odd")
1994 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1999 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
2003 wprintf("<td>*****</td>"); /* Don't show the password */
2005 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
2007 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
2009 wprintf("<td class=\"button_link\">");
2010 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
2013 wprintf(_("(remove)"));
2014 wprintf("</a></td>");
2020 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2022 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2023 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
2024 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2026 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
2029 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
2032 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2035 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2038 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2041 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2042 wprintf("</td></tr>");
2043 wprintf("</form></table>\n");
2048 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2049 wprintf("</i><br />\n");
2051 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2052 "<tr class=\"even\"><th>");
2053 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2054 wprintf(_("Feed URL"));
2055 wprintf("</th><th>");
2056 wprintf("</th></tr>");
2059 serv_getln(buf, sizeof buf);
2061 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2062 extract_token(cmd, buf, 0, '|', sizeof cmd);
2063 if (!strcasecmp(cmd, "rssclient")) {
2064 safestrncpy(recp, &buf[10], sizeof recp);
2067 wprintf("<tr class=\"%s\">",
2068 (bg ? "even" : "odd")
2072 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2076 wprintf("<td class=\"button_link\">");
2077 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
2080 wprintf(_("(remove)"));
2081 wprintf("</a></td>");
2087 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2089 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2090 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2091 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2093 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2094 "maxlength=\"256\" name=\"line_pop3host\">\n");
2097 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2098 wprintf("</td></tr>");
2099 wprintf("</form></table>\n");
2105 /* end content of whatever tab is open now */
2106 wprintf("</div>\n");
2108 address_book_popup();
2114 * Toggle self-service list subscription
2116 void toggle_self_service(void) {
2117 room_states RoomFlags;
2119 get_roomflags (&RoomFlags);
2121 if (yesbstr("QR2_SelfList"))
2122 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2124 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2126 if (yesbstr("QR2_SMTP_PUBLIC"))
2127 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2129 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2131 if (yesbstr("QR2_Moderated"))
2132 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2134 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2135 if (yesbstr("QR2_SubsOnly"))
2136 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2138 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2140 set_roomflags (&RoomFlags);
2148 * save new parameters for a room
2155 StrBuf *er_password;
2157 StrBuf *er_roomaide;
2160 int er_listingorder;
2166 if (!havebstr("ok_button")) {
2167 strcpy(WC->ImportantMessage,
2168 _("Cancelled. Changes were not saved."));
2174 StrBuf_ServGetln(Buf);
2175 if (GetServerStatus(Buf, NULL) != 2) {
2176 StrBufCutLeft(Buf, 4);
2177 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2183 er_name = NewStrBuf();
2184 er_password = NewStrBuf();
2185 er_dirname = NewStrBuf();
2186 er_roomaide = NewStrBuf();
2188 StrBufCutLeft(Buf, 4);
2189 StrBufExtract_token(er_name, Buf, 0, '|');
2190 StrBufExtract_token(er_password, Buf, 1, '|');
2191 StrBufExtract_token(er_dirname, Buf, 2, '|');
2192 er_flags = StrBufExtract_int(Buf, 3, '|');
2193 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2194 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2195 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2197 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2198 if (StrLength(er_roomaide) == 0) {
2200 StrBuf_ServGetln(Buf);
2201 if (GetServerStatus(Buf, NULL) != 2) {
2202 FlushStrBuf(er_roomaide);
2204 StrBufCutLeft(Buf, 4);
2205 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2208 Ptr = sbstr("er_name");
2209 if (StrLength(Ptr) > 0) {
2210 FlushStrBuf(er_name);
2211 StrBufAppendBuf(er_name, Ptr, 0);
2214 Ptr = sbstr("er_password");
2215 if (StrLength(Ptr) > 0) {
2216 FlushStrBuf(er_password);
2217 StrBufAppendBuf(er_password, Ptr, 0);
2221 Ptr = sbstr("er_dirname");
2222 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2223 FlushStrBuf(er_dirname);
2224 StrBufAppendBuf(er_dirname, Ptr, 0);
2228 Ptr = sbstr("type");
2229 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2231 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2232 er_flags |= (QR_PRIVATE);
2234 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2235 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2237 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2238 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2240 if (!strcmp(ChrPtr(Ptr), "personal")) {
2241 er_flags |= QR_MAILBOX;
2243 er_flags &= ~QR_MAILBOX;
2246 if (yesbstr("prefonly")) {
2247 er_flags |= QR_PREFONLY;
2249 er_flags &= ~QR_PREFONLY;
2252 if (yesbstr("readonly")) {
2253 er_flags |= QR_READONLY;
2255 er_flags &= ~QR_READONLY;
2259 if (yesbstr("collabdel")) {
2260 er_flags2 |= QR2_COLLABDEL;
2262 er_flags2 &= ~QR2_COLLABDEL;
2265 if (yesbstr("permanent")) {
2266 er_flags |= QR_PERMANENT;
2268 er_flags &= ~QR_PERMANENT;
2271 if (yesbstr("subjectreq")) {
2272 er_flags2 |= QR2_SUBJECTREQ;
2274 er_flags2 &= ~QR2_SUBJECTREQ;
2277 if (yesbstr("network")) {
2278 er_flags |= QR_NETWORK;
2280 er_flags &= ~QR_NETWORK;
2283 if (yesbstr("directory")) {
2284 er_flags |= QR_DIRECTORY;
2286 er_flags &= ~QR_DIRECTORY;
2289 if (yesbstr("ulallowed")) {
2290 er_flags |= QR_UPLOAD;
2292 er_flags &= ~QR_UPLOAD;
2295 if (yesbstr("dlallowed")) {
2296 er_flags |= QR_DOWNLOAD;
2298 er_flags &= ~QR_DOWNLOAD;
2301 if (yesbstr("visdir")) {
2302 er_flags |= QR_VISDIR;
2304 er_flags &= ~QR_VISDIR;
2307 Ptr = sbstr("anon");
2309 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2310 if (!strcmp(ChrPtr(Ptr), "anononly"))
2311 er_flags |= QR_ANONONLY;
2312 if (!strcmp(ChrPtr(Ptr), "anon2"))
2313 er_flags |= QR_ANONOPT;
2315 bump = yesbstr("bump");
2317 er_floor = ibstr("er_floor");
2319 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2321 ChrPtr(er_password),
2330 StrBuf_ServGetln(Buf);
2331 if (GetServerStatus(Buf, NULL) != 2) {
2332 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2335 FreeStrBuf(&er_name);
2336 FreeStrBuf(&er_password);
2337 FreeStrBuf(&er_dirname);
2338 FreeStrBuf(&er_roomaide);
2343 if (StrLength(er_roomaide) > 0) {
2344 serv_printf("SETA %s", ChrPtr(er_roomaide));
2345 StrBuf_ServGetln(Buf);
2346 if (GetServerStatus(Buf, NULL) != 2) {
2347 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2348 display_main_menu();
2350 FreeStrBuf(&er_name);
2351 FreeStrBuf(&er_password);
2352 FreeStrBuf(&er_dirname);
2353 FreeStrBuf(&er_roomaide);
2358 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2361 FreeStrBuf(&er_name);
2362 FreeStrBuf(&er_password);
2363 FreeStrBuf(&er_dirname);
2364 FreeStrBuf(&er_roomaide);
2370 * Display form for Invite, Kick, and show Who Knows a room
2372 void do_invt_kick(void) {
2373 char buf[SIZ], room[SIZ], username[SIZ];
2376 serv_getln(buf, sizeof buf);
2378 if (buf[0] != '2') {
2382 extract_token(room, &buf[4], 0, '|', sizeof room);
2384 strcpy(username, bstr("username"));
2386 if (havebstr("kick_button")) {
2387 sprintf(buf, "KICK %s", username);
2389 serv_getln(buf, sizeof buf);
2391 if (buf[0] != '2') {
2392 strcpy(WC->ImportantMessage, &buf[4]);
2394 sprintf(WC->ImportantMessage,
2395 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2400 if (havebstr("invite_button")) {
2401 sprintf(buf, "INVT %s", username);
2403 serv_getln(buf, sizeof buf);
2405 if (buf[0] != '2') {
2406 strcpy(WC->ImportantMessage, &buf[4]);
2408 sprintf(WC->ImportantMessage,
2409 _("<B><I>User %s invited to room %s.</I></B>\n"),
2420 * Display form for Invite, Kick, and show Who Knows a room
2422 void display_whok(void)
2424 char buf[SIZ], room[SIZ], username[SIZ];
2427 serv_getln(buf, sizeof buf);
2429 if (buf[0] != '2') {
2433 extract_token(room, &buf[4], 0, '|', sizeof room);
2436 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2437 wprintf(_("The users listed below have access to this room. "
2438 "To remove a user from the access list, select the user "
2439 "name from the list and click 'Kick'."));
2440 wprintf("<br /><br />");
2442 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2443 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2444 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2445 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2447 serv_getln(buf, sizeof buf);
2448 if (buf[0] == '1') {
2449 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2450 extract_token(username, buf, 0, '|', sizeof username);
2451 wprintf("<OPTION>");
2456 wprintf("</select><br />\n");
2458 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2459 wprintf("</form></CENTER>\n");
2461 wprintf("</td><td>");
2462 wprintf(_("To grant another user access to this room, enter the "
2463 "user name in the box below and click 'Invite'."));
2464 wprintf("<br /><br />");
2466 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2467 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2468 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2469 wprintf(_("Invite:"));
2471 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2472 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2473 "<input type=\"submit\" value=\"%s\">"
2474 "</form></CENTER>\n", _("Invite"));
2475 /* Pop open an address book -- begin **/
2477 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2479 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2482 _("Users"), _("Users")
2484 /* Pop open an address book -- end **/
2486 wprintf("</td></tr></table>\n");
2487 address_book_popup();
2494 * display the form for entering a new room
2496 void display_entroom(void)
2503 serv_puts("CRE8 0");
2504 serv_getln(buf, sizeof buf);
2506 if (buf[0] != '2') {
2507 strcpy(WC->ImportantMessage, &buf[4]);
2508 display_main_menu();
2513 output_headers(1, 1, 1, 0, 0, 0);
2515 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2516 do_template("beginbox", NULL);
2518 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2519 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2521 wprintf("<table class=\"altern\"> ");
2523 wprintf("<tr class=\"even\"><td>");
2524 wprintf(_("Name of room: "));
2525 wprintf("</td><td>");
2526 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2527 wprintf("</td></tr>");
2529 wprintf("<tr class=\"odd\"><td>");
2530 wprintf(_("Resides on floor: "));
2531 wprintf("</td><td>");
2532 load_floorlist(Buf);
2533 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2534 for (i = 0; i < 128; ++i)
2535 if (!IsEmptyStr(floorlist[i])) {
2536 wprintf("<option ");
2537 wprintf("value=\"%d\">", i);
2538 escputs(floorlist[i]);
2539 wprintf("</option>\n");
2541 wprintf("</select>\n");
2542 wprintf("</td></tr>");
2545 * Our clever little snippet of JavaScript automatically selects
2546 * a public room if the view is set to Bulletin Board or wiki, and
2547 * it selects a mailbox room otherwise. The user can override this,
2548 * of course. We also disable the floor selector for mailboxes.
2550 wprintf("<tr class=\"even\"><td>");
2551 wprintf(_("Default view for room: "));
2552 wprintf("</td><td>");
2553 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2554 " if ( (this.form.er_view.value == 0) "
2555 " || (this.form.er_view.value == 6) ) { "
2556 " this.form.type[0].checked=true; "
2557 " this.form.er_floor.disabled = false; "
2560 " this.form.type[4].checked=true; "
2561 " this.form.er_floor.disabled = true; "
2564 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2565 if (is_view_allowed_as_default(i)) {
2566 wprintf("<option %s value=\"%d\">",
2567 ((i == 0) ? "selected" : ""), i );
2568 escputs(viewdefs[i]);
2569 wprintf("</option>\n");
2572 wprintf("</select>\n");
2573 wprintf("</td></tr>");
2575 wprintf("<tr class=\"even\"><td>");
2576 wprintf(_("Type of room:"));
2577 wprintf("</td><td>");
2578 wprintf("<ul class=\"adminlist\">\n");
2580 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2581 wprintf("CHECKED OnChange=\""
2582 " if (this.form.type[0].checked == true) { "
2583 " this.form.er_floor.disabled = false; "
2586 wprintf(_("Public (automatically appears to everyone)"));
2589 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2590 " if (this.form.type[1].checked == true) { "
2591 " this.form.er_floor.disabled = false; "
2594 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2597 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2598 " if (this.form.type[2].checked == true) { "
2599 " this.form.er_floor.disabled = false; "
2602 wprintf(_("Private - require password: "));
2603 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2606 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2607 " if (this.form.type[3].checked == true) { "
2608 " this.form.er_floor.disabled = false; "
2611 wprintf(_("Private - invitation only"));
2614 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2616 " if (this.form.type[4].checked == true) { "
2617 " this.form.er_floor.disabled = true; "
2620 wprintf(_("Personal (mailbox for you only)"));
2623 wprintf("\n</ul>\n");
2624 wprintf("</td></tr></table>\n");
2626 wprintf("<div class=\"buttons\">\n");
2627 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2629 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2630 wprintf("</div>\n");
2631 wprintf("</form>\n<hr />");
2632 serv_printf("MESG roomaccess");
2633 serv_getln(buf, sizeof buf);
2634 if (buf[0] == '1') {
2638 do_template("endbox", NULL);
2648 * support function for entroom() -- sets the default view
2650 void er_set_default_view(int newview) {
2663 serv_getln(buf, sizeof buf);
2664 if (buf[0] != '2') return;
2666 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2667 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2668 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2669 rm_bits1 = extract_int(&buf[4], 3);
2670 rm_floor = extract_int(&buf[4], 4);
2671 rm_listorder = extract_int(&buf[4], 5);
2672 rm_bits2 = extract_int(&buf[4], 7);
2674 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2675 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2676 rm_listorder, newview, rm_bits2
2678 serv_getln(buf, sizeof buf);
2689 const StrBuf *er_name;
2690 const StrBuf *er_type;
2691 const StrBuf *er_password;
2696 if (!havebstr("ok_button")) {
2697 strcpy(WC->ImportantMessage,
2698 _("Cancelled. No new room was created."));
2699 display_main_menu();
2702 er_name = sbstr("er_name");
2703 er_type = sbstr("type");
2704 er_password = sbstr("er_password");
2705 er_floor = ibstr("er_floor");
2706 er_view = ibstr("er_view");
2709 if (!strcmp(ChrPtr(er_type), "hidden"))
2711 else if (!strcmp(ChrPtr(er_type), "passworded"))
2713 else if (!strcmp(ChrPtr(er_type), "invonly"))
2715 else if (!strcmp(ChrPtr(er_type), "personal"))
2718 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2721 ChrPtr(er_password),
2726 serv_getln(buf, sizeof buf);
2727 if (buf[0] != '2') {
2728 strcpy(WC->ImportantMessage, &buf[4]);
2729 display_main_menu();
2732 /** TODO: Room created, now udate the left hand icon bar for this user */
2733 burn_folder_cache(0); /* burn the old folder cache */
2737 do_change_view(er_view); /* Now go there */
2742 * \brief display the screen to enter a private room
2744 void display_private(char *rname, int req_pass)
2746 WCTemplputParams SubTP;
2748 output_headers(1, 1, 1, 0, 0, 0);
2750 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2751 memset(&SubTP, 0, sizeof(WCTemplputParams));
2752 SubTP.Filter.ContextType = CTX_STRBUF;
2753 SubTP.Context = Buf;
2754 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2759 wprintf(_("If you know the name of a hidden (guess-name) or "
2760 "passworded room, you can enter that room by typing "
2761 "its name below. Once you gain access to a private "
2762 "room, it will appear in your regular room listings "
2763 "so you don't have to keep returning here."));
2766 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2767 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2769 wprintf("<table class=\"altern\"> "
2770 "<tr class=\"even\"><td>");
2771 wprintf(_("Enter room name:"));
2773 "<input type=\"text\" name=\"gr_name\" "
2774 "value=\"%s\" maxlength=\"128\">\n", rname);
2777 wprintf("</td></tr><tr class=\"odd\"><td>");
2778 wprintf(_("Enter room password:"));
2779 wprintf("</td><td>");
2780 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2782 wprintf("</td></tr></table>\n");
2784 wprintf("<div class=\"buttons\">\n");
2785 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2787 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2791 wprintf("</div></form>\n");
2793 do_template("endbox", NULL);
2799 * \brief goto a private room
2801 void goto_private(void)
2806 if (!havebstr("ok_button")) {
2807 display_main_menu();
2810 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2811 serv_printf("GOTO %s|%s",
2814 serv_getln(buf, sizeof buf);
2816 if (buf[0] == '2') {
2817 smart_goto(sbstr("gr_name"));
2820 if (!strncmp(buf, "540", 3)) {
2821 display_private(bstr("gr_name"), 1);
2824 output_headers(1, 1, 1, 0, 0, 0);
2825 wprintf("%s\n", &buf[4]);
2832 * \brief display the screen to zap a room
2834 void display_zap(void)
2836 output_headers(1, 1, 2, 0, 0, 0);
2838 wprintf("<div id=\"banner\">\n");
2840 wprintf(_("Zap (forget/unsubscribe) the current room"));
2842 wprintf("</div>\n");
2844 wprintf("<div id=\"content\" class=\"service\">\n");
2846 wprintf(_("If you select this option, <em>%s</em> will "
2847 "disappear from your room list. Is this what you wish "
2848 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2850 wprintf("<form method=\"POST\" action=\"zap\">\n");
2851 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2852 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2854 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2855 wprintf("</form>\n");
2866 StrBuf *final_destination;
2869 * If the forget-room routine fails for any reason, we fall back
2870 * to the current room; otherwise, we go to the Lobby
2872 final_destination = NewStrBufDup(WC->wc_roomname);
2874 if (havebstr("ok_button")) {
2875 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2876 serv_getln(buf, sizeof buf);
2877 if (buf[0] == '2') {
2879 serv_getln(buf, sizeof buf);
2880 if (buf[0] == '2') {
2881 FlushStrBuf(final_destination);
2882 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2886 smart_goto(final_destination);
2887 FreeStrBuf(&final_destination);
2893 * \brief Delete the current room
2895 void delete_room(void)
2900 serv_puts("KILL 1");
2901 serv_getln(buf, sizeof buf);
2902 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2903 if (buf[0] != '2') {
2904 strcpy(WC->ImportantMessage, &buf[4]);
2905 display_main_menu();
2910 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2919 * \brief Perform changes to a room's network configuration
2921 void netedit(void) {
2930 /*/ TODO: do line dynamic! */
2931 if (havebstr("line_pop3host")) {
2932 strcpy(line, bstr("prefix"));
2933 strcat(line, bstr("line_pop3host"));
2935 strcat(line, bstr("line_pop3user"));
2937 strcat(line, bstr("line_pop3pass"));
2939 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2941 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2942 strcat(line, bstr("suffix"));
2944 else if (havebstr("line")) {
2945 strcpy(line, bstr("prefix"));
2946 strcat(line, bstr("line"));
2947 strcat(line, bstr("suffix"));
2962 serv_getln(buf, sizeof buf);
2963 if (buf[0] != '1') {
2969 /** This loop works for add *or* remove. Spiffy, eh? */
2970 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2971 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2972 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2973 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2974 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2975 if ( (strcasecmp(cmpa0, cmpb0))
2976 || (strcasecmp(cmpa1, cmpb1)) ) {
2977 fprintf(fp, "%s\n", buf);
2983 serv_getln(buf, sizeof buf);
2984 if (buf[0] != '4') {
2990 while (fgets(buf, sizeof buf, fp) != NULL) {
2991 buf[strlen(buf)-1] = 0;
2995 if (havebstr("add_button")) {
2996 num_addrs = num_tokens(bstr("line"), ',');
2997 if (num_addrs < 2) {
2998 /* just adding one node or address */
3002 /* adding multiple addresses separated by commas */
3003 for (i=0; i<num_addrs; ++i) {
3004 strcpy(line, bstr("prefix"));
3005 extract_token(buf, bstr("line"), i, ',', sizeof buf);
3008 strcat(line, bstr("suffix"));
3022 * \brief Convert a room name to a folder-ish-looking name.
3023 * \param folder the folderish name
3024 * \param room the room name
3025 * \param floor the floor name
3026 * \param is_mailbox is it a mailbox?
3028 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
3033 * For mailboxes, just do it straight...
3036 sprintf(folder, "My folders|%s", room);
3040 * Otherwise, prefix the floor name as a "public folders" moniker
3043 if (floor > MAX_FLOORS) {
3045 sprintf(folder, "%%%%%%|%s", room);
3048 sprintf(folder, "%s|%s", floorlist[floor], room);
3053 * Replace "\" characters with "|" for pseudo-folder-delimiting
3055 len = strlen (folder);
3056 for (i=0; i<len; ++i) {
3057 if (folder[i] == '\\') folder[i] = '|';
3065 * \brief Back end for change_view()
3066 * \param newview set newview???
3068 void do_change_view(int newview) {
3071 serv_printf("VIEW %d", newview);
3072 serv_getln(buf, sizeof buf);
3073 WC->wc_view = newview;
3074 smart_goto(WC->wc_roomname);
3080 * \brief Change the view for this room
3082 void change_view(void) {
3085 view = lbstr("view");
3086 do_change_view(view);
3091 * \brief One big expanded tree list view --- like a folder list
3092 * \param fold the folder to view
3093 * \param max_folders how many folders???
3094 * \param num_floors hom many floors???
3096 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3100 int has_subfolders = 0;
3103 parents = malloc(max_folders * sizeof(int));
3105 /** BEGIN TREE MENU */
3106 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3108 /** include NanoTree */
3109 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3111 /** initialize NanoTree */
3112 wprintf("<script type=\"text/javascript\"> \n"
3113 " showRootNode = false; \n"
3114 " sortNodes = false; \n"
3115 " dragable = false; \n"
3117 " function standardClick(treeNode) { \n"
3120 " var closedGif = 'static/folder_closed.gif'; \n"
3121 " var openGif = 'static/folder_open.gif'; \n"
3123 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3127 for (i=0; i<max_folders; ++i) {
3130 if ((i+1) < max_folders) {
3132 len = strlen(fold[i].name);
3133 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3134 && (fold[i+1].name[len] == '|') ) {
3139 levels = num_tokens(fold[i].name, '|');
3140 parents[levels] = i;
3142 wprintf("var node%d = new TreeNode(%d, '", i, i);
3144 if (fold[i].selectable) {
3145 wprintf("<a href=\"dotgoto?room=");
3146 urlescputs(fold[i].room);
3151 wprintf("<span class=\"roomlist_floor\">");
3153 else if (fold[i].hasnewmsgs) {
3154 wprintf("<span class=\"roomlist_new\">");
3157 wprintf("<span class=\"roomlist_old\">");
3159 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3164 if (has_subfolders) {
3165 wprintf("new Array(closedGif, openGif)");
3167 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3168 wprintf("'static/viewcontacts_16x.gif'");
3170 else if (fold[i].view == VIEW_CALENDAR) {
3171 wprintf("'static/calarea_16x.gif'");
3173 else if (fold[i].view == VIEW_CALBRIEF) {
3174 wprintf("'static/calarea_16x.gif'");
3176 else if (fold[i].view == VIEW_TASKS) {
3177 wprintf("'static/taskmanag_16x.gif'");
3179 else if (fold[i].view == VIEW_NOTES) {
3180 wprintf("'static/storenotes_16x.gif'");
3182 else if (fold[i].view == VIEW_MAILBOX) {
3183 wprintf("'static/privatemess_16x.gif'");
3186 wprintf("'static/chatrooms_16x.gif'");
3189 urlescputs(fold[i].name);
3193 wprintf("rootNode.addChild(node%d);\n", i);
3196 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3200 wprintf("container = document.getElementById('roomlist_div'); \n"
3206 /** END TREE MENU */
3210 * \brief Boxes and rooms and lists ... oh my!
3211 * \param fold the folder to view
3212 * \param max_folders how many folders???
3213 * \param num_floors hom many floors???
3215 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3217 char floor_name[256];
3218 char old_floor_name[256];
3219 int levels, oldlevels;
3222 static int columns = 3;
3223 int boxes_per_column = 0;
3224 int current_column = 0;
3227 strcpy(floor_name, "");
3228 strcpy(old_floor_name, "");
3231 while (nf % columns != 0) ++nf;
3232 boxes_per_column = (nf / columns);
3233 if (boxes_per_column < 1) boxes_per_column = 1;
3235 /** Outer table (for columnization) */
3236 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3237 "<tr><td valign=top>");
3241 for (i=0; i<max_folders; ++i) {
3243 levels = num_tokens(fold[i].name, '|');
3244 extract_token(floor_name, fold[i].name, 0,
3245 '|', sizeof floor_name);
3247 if ( (strcasecmp(floor_name, old_floor_name))
3248 && (!IsEmptyStr(old_floor_name)) ) {
3250 do_template("endbox", NULL);
3254 if ((num_boxes % boxes_per_column) == 0) {
3256 if (current_column < columns) {
3257 wprintf("</td><td valign=top>\n");
3261 strcpy(old_floor_name, floor_name);
3265 WCTemplputParams SubTP;
3267 Buf = NewStrBufPlain(floor_name, -1);
3268 memset(&SubTP, 0, sizeof(WCTemplputParams));
3269 SubTP.Filter.ContextType = CTX_STRBUF;
3270 SubTP.Context = Buf;
3271 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3280 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3281 if (fold[i].selectable) {
3282 wprintf("<a href=\"dotgoto?room=");
3283 urlescputs(fold[i].room);
3289 if (fold[i].hasnewmsgs) {
3290 wprintf("<span class=\"roomlist_new\">");
3293 wprintf("<span class=\"roomlist_old\">");
3295 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3298 if (fold[i].selectable) {
3304 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3305 wprintf(" (INBOX)");
3307 wprintf("<br />\n");
3310 /** End the final inner box */
3311 do_template("endbox", NULL);
3313 wprintf("</td></tr></table>\n");
3317 * \brief print a floor div???
3318 * \param which_floordiv name of the floordiv???
3320 void set_floordiv_expanded(void) {
3321 wcsession *WCC = WC;
3324 FloorDiv = NewStrBuf();
3325 StrBufExtract_token(FloorDiv, WCC->Hdr->HR.ReqLine, 0, '/');
3326 set_preference("floordiv_expanded", FloorDiv, 1);
3327 WCC->floordiv_expanded = FloorDiv;
3331 * \brief view the iconbar
3332 * \param fold the folder to view
3333 * \param max_folders how many folders???
3334 * \param num_floors hom many floors???
3336 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3338 char floor_name[256];
3339 char old_floor_name[256];
3340 char floordivtitle[256];
3341 char floordiv_id[32];
3342 int levels, oldlevels;
3346 strcpy(floor_name, "");
3347 strcpy(old_floor_name, "");
3351 for (i=0; i<max_folders; ++i) {
3353 levels = num_tokens(fold[i].name, '|');
3354 extract_token(floor_name, fold[i].name, 0,
3355 '|', sizeof floor_name);
3357 if ( (strcasecmp(floor_name, old_floor_name))
3358 && (!IsEmptyStr(old_floor_name)) ) {
3359 /** End inner box */
3361 wprintf("</div>\n"); /** floordiv */
3363 strcpy(old_floor_name, floor_name);
3367 stresc(floordivtitle, 256, floor_name, 0, 0);
3368 sprintf(floordiv_id, "floordiv%d", i);
3369 wprintf("<span class=\"ib_roomlist_floor\" "
3370 "onClick=\"expand_floor('%s')\">"
3371 "%s</span><br>\n", floordiv_id, floordivtitle);
3372 wprintf("<div id=\"%s\" style=\"display:%s\">",
3374 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3381 wprintf("<div id=\"roomdiv%d\">", i);
3383 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3385 /** choose the icon */
3386 if (fold[i].view == VIEW_ADDRESSBOOK) {
3387 icon = "viewcontacts_16x.gif" ;
3389 else if (fold[i].view == VIEW_CALENDAR) {
3390 icon = "calarea_16x.gif" ;
3392 else if (fold[i].view == VIEW_CALBRIEF) {
3393 icon = "calarea_16x.gif" ;
3395 else if (fold[i].view == VIEW_TASKS) {
3396 icon = "taskmanag_16x.gif" ;
3398 else if (fold[i].view == VIEW_NOTES) {
3399 icon = "storenotes_16x.gif" ;
3401 else if (fold[i].view == VIEW_MAILBOX) {
3402 icon = "privatemess_16x.gif" ;
3405 icon = "chatrooms_16x.gif" ;
3408 if (fold[i].selectable) {
3409 wprintf("<a href=\"dotgoto?room=");
3410 urlescputs(fold[i].room);
3412 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3417 if (fold[i].hasnewmsgs) {
3418 wprintf("<span class=\"ib_roomlist_new\">");
3421 wprintf("<span class=\"ib_roomlist_old\">");
3423 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3425 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3426 wprintf(" (INBOX)");
3429 if (fold[i].selectable) {
3436 wprintf("</div>\n"); /** roomdiv */
3439 wprintf("</div>\n"); /** floordiv */
3447 * \brief Burn the cached folder list.
3448 * \param age How old the cahce needs to be before we burn it.
3451 void burn_folder_cache(time_t age)
3453 /** If our cached folder list is very old, burn it. */
3454 if (WC->cache_fold != NULL) {
3455 if ((time(NULL) - WC->cache_timestamp) > age) {
3456 free(WC->cache_fold);
3457 WC->cache_fold = NULL;
3466 * \brief Show the room list.
3467 * (only should get called by
3468 * knrooms() because that's where output_headers() is called from)
3469 * \param viewpref the view preferences???
3472 void list_all_rooms_by_floor(const char *viewpref) {
3476 struct folder *fold = NULL;
3478 int max_folders = 0;
3479 int alloc_folders = 0;
3483 int ShowEmptyFloors;
3486 int num_floors = 1; /** add an extra one for private folders */
3489 /** If our cached folder list is very old, burn it. */
3490 burn_folder_cache(300);
3492 /** Can we do the iconbar roomlist from cache? */
3493 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3494 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3499 /** Grab the floor table so we know how to build the list... */
3500 load_floorlist(Buf);
3502 /** Start with the mailboxes */
3505 fold = malloc(sizeof(struct folder));
3506 memset(fold, 0, sizeof(struct folder));
3507 strcpy(fold[0].name, "My folders");
3508 fold[0].is_mailbox = 1;
3510 /** Then add floors */
3512 serv_getln(buf, sizeof buf);
3513 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3514 if (max_folders >= alloc_folders) {
3515 alloc_folders = max_folders + 100;
3516 fold = realloc(fold,
3517 alloc_folders * sizeof(struct folder));
3519 memset(&fold[max_folders], 0, sizeof(struct folder));
3520 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3521 extract_token(buf3, buf, 0, '|', SIZ);
3522 fold[max_folders].floor = atol (buf3);
3527 for (i=0; i<num_floors; i++)
3528 if (IDMax < fold[i].floor)
3529 IDMax = fold[i].floor;
3530 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3531 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3532 for (i=0; i<num_floors; i++)
3533 floor_mapping[fold[i].floor]=i;
3535 /** refresh the messages index for this room */
3536 /* TODO serv_puts("GOTO ");
3537 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3538 /** Now add rooms */
3540 serv_getln(buf, sizeof buf);
3541 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3542 if (max_folders >= alloc_folders) {
3543 alloc_folders = max_folders + 100;
3544 fold = realloc(fold,
3545 alloc_folders * sizeof(struct folder));
3547 memset(&fold[max_folders], 0, sizeof(struct folder));
3548 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3549 ra_flags = extract_int(buf, 5);
3550 flags = extract_int(buf, 1);
3551 fold[max_folders].floor = extract_int(buf, 2);
3552 fold[max_folders].hasnewmsgs =
3553 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3554 if (flags & QR_MAILBOX) {
3555 fold[max_folders].is_mailbox = 1;
3557 fold[max_folders].view = extract_int(buf, 6);
3558 room_to_folder(fold[max_folders].name,
3559 fold[max_folders].room,
3560 fold[max_folders].floor,
3561 fold[max_folders].is_mailbox);
3562 fold[max_folders].selectable = 1;
3563 /* Increase the room count for the associtaed floor */
3564 if (fold[max_folders].is_mailbox) {
3565 fold[0].num_rooms++;
3568 i = floor_mapping[fold[max_folders].floor];
3569 fold[i].num_rooms++;
3575 * Remove any floors that don't have rooms
3577 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3578 if (ShowEmptyFloors)
3580 for (i=0; i<num_floors; i++)
3582 if (fold[i].num_rooms == 0) {
3583 for (j=i; j<max_folders; j++) {
3584 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3593 /** Bubble-sort the folder list */
3594 for (i=0; i<max_folders; ++i) {
3595 for (j=0; j<(max_folders-1)-i; ++j) {
3596 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3597 swap = strcasecmp(fold[j].name, fold[j+1].name);
3600 if ( (fold[j+1].is_mailbox)
3601 && (!fold[j].is_mailbox)) {
3609 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3610 memcpy(&fold[j], &fold[j+1],
3611 sizeof(struct folder));
3612 memcpy(&fold[j+1], &ftmp,
3613 sizeof(struct folder));
3619 if (!strcasecmp(viewpref, "folders")) {
3620 do_folder_view(fold, max_folders, num_floors);
3622 else if (!strcasecmp(viewpref, "hackish_view")) {
3623 for (i=0; i<max_folders; ++i) {
3624 escputs(fold[i].name);
3625 wprintf("<br />\n");
3628 else if (!strcasecmp(viewpref, "iconbar")) {
3629 do_iconbar_view(fold, max_folders, num_floors);
3632 do_rooms_view(fold, max_folders, num_floors);
3635 /* Don't free the folder list ... cache it for future use! */
3636 if (WC->cache_fold != NULL) {
3637 free(WC->cache_fold);
3639 WC->cache_fold = fold;
3640 WC->cache_max_folders = max_folders;
3641 WC->cache_num_floors = num_floors;
3642 WC->cache_timestamp = time(NULL);
3643 free(floor_mapping);
3648 * \brief Do either a known rooms list or a folders list, depending on the
3653 StrBuf *ListView = NULL;
3655 output_headers(1, 1, 2, 0, 0, 0);
3657 /** Determine whether the user is trying to change views */
3658 if (havebstr("view")) {
3659 ListView = NewStrBufPlain(bstr("view"), -1);
3660 set_preference("roomlistview", ListView, 1);
3662 /** Sanitize the input so its safe */
3663 if(!get_preference("roomlistview", &ListView) ||
3664 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3665 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3667 if (ListView == NULL) {
3668 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3669 set_preference("roomlistview", ListView, 0);
3672 StrBufPrintf(ListView, "rooms");
3678 wprintf("<div id=\"banner\">\n");
3679 wprintf("<div class=\"room_banner\" id=\"room_banner\">");
3681 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3682 wprintf(_("Room list"));
3684 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3685 wprintf(_("Folder list"));
3687 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3688 wprintf(_("Room list"));
3690 wprintf("</h1></div>\n");
3692 /** offer the ability to switch views */
3693 wprintf("<div id=\"actiondiv\">");
3694 wprintf("<ul class=\"room_actions\">\n");
3695 wprintf("<li class=\"start_page\">");
3696 offer_start_page(NULL, &NoCtx);
3698 wprintf("<li><form name=\"roomlistomatic\">\n"
3699 "<select name=\"newview\" size=\"1\" "
3700 "OnChange=\"location.href=roomlistomatic.newview.options"
3701 "[selectedIndex].value\">\n");
3703 wprintf("<option %s value=\"knrooms&view=rooms\">"
3706 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3709 wprintf("<option %s value=\"knrooms&view=folders\">"
3710 "View as folder list"
3712 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3715 wprintf("</select>");
3716 wprintf("</form></li>");
3717 wprintf("</ul></div></div>\n");
3719 wprintf("<div id=\"content\" class=\"service\">\n");
3721 /** Display the room list in the user's preferred format */
3722 list_all_rooms_by_floor(ChrPtr(ListView));
3729 * \brief Set the message expire policy for this room and/or floor
3731 void set_room_policy(void) {
3734 if (!havebstr("ok_button")) {
3735 strcpy(WC->ImportantMessage,
3736 _("Cancelled. Changes were not saved."));
3741 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3742 serv_getln(buf, sizeof buf);
3743 strcpy(WC->ImportantMessage, &buf[4]);
3745 if (WC->axlevel >= 6) {
3746 strcat(WC->ImportantMessage, "<br />\n");
3747 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3748 serv_getln(buf, sizeof buf);
3749 strcat(WC->ImportantMessage, &buf[4]);
3755 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3756 /* todo: check context */
3762 floors = NewHash(1, NULL);
3764 serv_puts("LFLR"); /* get floors */
3765 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
3766 if (GetServerStatus(Buf, NULL) == 1)
3767 while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3769 const char *floorNum = NULL;
3770 floor = NewHash(1, NULL);
3771 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3773 StrBufExtract_token(Buf2, Buf, a, '|');
3775 floorNum = ChrPtr(Buf2); /* hmm, should we copy Buf2 first? */
3777 Put(floor, FPKEY(a), Buf2, NULL);
3779 Put(floors, HKEY(floorNum), floor, NULL);
3785 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3788 HashList *floor = (HashList *)(TP->Context);
3790 GetHash(floor, TKEY(0), &value);
3791 val = (StrBuf *)value;
3792 StrECMAEscAppend(TemplBuffer, val, 0);
3794 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP)
3797 return GetRoomListHash(Target, TP);
3799 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
3801 /* TODO: Check context */
3808 rooms = NewHash(1, NULL);
3809 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3810 if (GetServerStatus(buf, NULL) == 1)
3811 while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3813 const char *rmName = NULL;
3814 room = NewHash(1, NULL);
3815 for(i=0; i<ROOM_PARAM_LEN; i++) {
3817 StrBufExtract_token(buf2, buf, i, '|');
3819 rmName = ChrPtr(buf2);
3821 Put(room, RPKEY(i), buf2, NULL);
3823 Put(rooms, rmName, strlen(rmName), room, NULL);
3825 SortByHashKey(rooms, 1);
3826 /*SortByPayload(rooms, SortRoomsByListOrder); */
3830 /** Unused function that orders rooms by the listorder flag */
3831 int SortRoomsByListOrder(const void *room1, const void *room2)
3835 HashList *r1 = (HashList *)GetSearchPayload(room1);
3836 HashList *r2 = (HashList *)GetSearchPayload(room2);
3837 StrBuf *listOrderBuf1;
3838 StrBuf *listOrderBuf2;
3840 GetHash(r1, RPKEY(3), (void *)&listOrderBuf1);
3841 GetHash(r2, RPKEY(3), (void *)&listOrderBuf2);
3842 l1 = atoi(ChrPtr(listOrderBuf1));
3843 l2 = atoi(ChrPtr(listOrderBuf2));
3844 if (l1 < l2) return -1;
3845 else if (l1 > l2) return +1;
3848 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3852 HashList *room = (HashList *)(TP->Context);
3854 GetHash(room, TKEY(0), &value);
3855 val = (StrBuf *)value;
3856 StrECMAEscAppend(TemplBuffer, val, 0);
3858 void jsonRoomFlr(void)
3860 /* Send as our own (application/json) content type */
3861 hprintf("HTTP/1.1 200 OK\r\n");
3862 hprintf("Content-type: application/json; charset=utf-8\r\n");
3863 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
3864 hprintf("Connection: close\r\n");
3865 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3867 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3870 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3872 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3875 void _gotonext(void) { slrp_highest(); gotonext(); }
3876 void dotskip(void) {smart_goto(sbstr("room"));}
3877 void _display_private(void) { display_private("", 0); }
3878 void dotgoto(void) {
3879 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3882 smart_goto(sbstr("room"));
3885 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3887 wprintf("<div id=\"banner\">\n");
3888 embed_room_banner(NULL, navbar_default);
3889 wprintf("</div>\n");
3893 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3895 wcsession *WCC = WC;
3898 (!IsEmptyStr(WCC->ugname)))
3899 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3903 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3905 wcsession *WCC = WC;
3907 return ((WCC!=NULL) &&
3908 (!IsEmptyStr(WCC->ugname)) &&
3909 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3912 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3914 wcsession *WCC = WC;
3916 return ((WCC!=NULL) &&
3917 ((WCC->room_flags & QR_PERMANENT) != 0));
3920 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3922 wcsession *WCC = WC;
3924 return ((WCC!=NULL) &&
3925 ((WCC->room_flags & QR_INUSE) != 0));
3928 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3930 wcsession *WCC = WC;
3932 return ((WCC!=NULL) &&
3933 ((WCC->room_flags & QR_PRIVATE) != 0));
3936 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3938 wcsession *WCC = WC;
3940 return ((WCC!=NULL) &&
3941 ((WCC->room_flags & QR_PASSWORDED) != 0));
3944 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3946 wcsession *WCC = WC;
3948 return ((WCC!=NULL) &&
3949 ((WCC->room_flags & QR_GUESSNAME) != 0));
3952 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3954 wcsession *WCC = WC;
3956 return ((WCC!=NULL) &&
3957 ((WCC->room_flags & QR_DIRECTORY) != 0));
3960 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3962 wcsession *WCC = WC;
3964 return ((WCC!=NULL) &&
3965 ((WCC->room_flags & QR_UPLOAD) != 0));
3968 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3970 wcsession *WCC = WC;
3972 return ((WCC!=NULL) &&
3973 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3976 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3978 wcsession *WCC = WC;
3980 return ((WCC!=NULL) &&
3981 ((WCC->room_flags & QR_VISDIR) != 0));
3984 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3986 wcsession *WCC = WC;
3988 return ((WCC!=NULL) &&
3989 ((WCC->room_flags & QR_ANONONLY) != 0));
3992 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3994 wcsession *WCC = WC;
3996 return ((WCC!=NULL) &&
3997 ((WCC->room_flags & QR_ANONOPT) != 0));
4000 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
4002 wcsession *WCC = WC;
4004 return ((WCC!=NULL) &&
4005 ((WCC->room_flags & QR_NETWORK) != 0));
4008 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
4010 wcsession *WCC = WC;
4012 return ((WCC!=NULL) &&
4013 ((WCC->room_flags & QR_PREFONLY) != 0));
4016 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
4018 wcsession *WCC = WC;
4020 return ((WCC!=NULL) &&
4021 ((WCC->room_flags & QR_READONLY) != 0));
4024 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
4026 wcsession *WCC = WC;
4028 return ((WCC!=NULL) &&
4029 ((WCC->room_flags & QR_MAILBOX) != 0));
4033 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
4035 wcsession *WCC = WC;
4037 return ( (WCC!= NULL) &&
4038 ((WCC->axlevel >= 6) ||
4039 (WCC->is_room_aide) ||
4040 (WCC->is_mailbox) ));
4043 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
4045 wcsession *WCC = WC;
4047 if ((WCC == NULL) ||
4048 (TP->Tokens->nParameters < 3) ||
4049 (TP->Tokens->Params[2]->Type != TYPE_STR)||
4050 (TP->Tokens->Params[2]->len < 7))
4053 switch(WCC->wc_view) {
4055 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
4057 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
4058 case VIEW_ADDRESSBOOK:
4059 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
4061 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
4063 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
4065 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
4067 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
4069 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
4071 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
4081 RegisterPreference("roomlistview",
4082 _("Room list view"),
4085 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
4087 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
4089 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
4090 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
4091 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
4092 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4093 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4094 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4095 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4096 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4097 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4098 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4099 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4100 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4101 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4102 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4103 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4104 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4105 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4106 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4107 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4108 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4109 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4110 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4111 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4112 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4113 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4115 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
4116 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4117 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4118 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4119 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4120 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4121 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4122 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4123 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4124 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4125 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4126 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4127 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4128 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4129 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4130 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4132 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4133 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4135 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4136 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4137 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4138 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, NULL, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4139 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);
4145 SessionDestroyModule_ROOMOPS
4148 if (sess->cache_fold != NULL) {
4149 free(sess->cache_fold);
4152 free_march_list(sess);