3 * Lots of different room-related operations.
10 char floorlist[MAX_FLOORS][SIZ]; /* list of our floor names */
12 char *viewdefs[9]; /* the different kinds of available views */
14 /* See GetFloorListHash and GetRoomListHash for info on these.
15 * Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys.
18 #define FLOOR_PARAM_LEN 3
19 const ConstStr FLOOR_PARAM_NAMES[] = {{HKEY("ID")},
23 #define ROOM_PARAM_LEN 8
24 const ConstStr ROOM_PARAM_NAMES[] = {{HKEY("NAME")},
31 {HKEY("LASTCHANGE")}};
34 void display_whok(void);
37 * Initialize the viewdefs with localized strings
39 void initialize_viewdefs(void) {
40 viewdefs[0] = _("Bulletin Board");
41 viewdefs[1] = _("Mail Folder");
42 viewdefs[2] = _("Address Book");
43 viewdefs[3] = _("Calendar");
44 viewdefs[4] = _("Task List");
45 viewdefs[5] = _("Notes List");
46 viewdefs[6] = _("Wiki");
47 viewdefs[7] = _("Calendar List");
48 viewdefs[8] = _("Journal");
52 * Determine which views are allowed as the default for creating a new room.
54 int is_view_allowed_as_default(int which_view)
57 case VIEW_BBS: return(1);
58 case VIEW_MAILBOX: return(1);
59 case VIEW_ADDRESSBOOK: return(1);
60 case VIEW_CALENDAR: return(1);
61 case VIEW_TASKS: return(1);
62 case VIEW_NOTES: return(1);
65 case VIEW_WIKI: return(1);
66 #else /* TECH_PREVIEW */
67 case VIEW_WIKI: return(0); /* because it isn't finished yet */
68 #endif /* TECH_PREVIEW */
70 case VIEW_CALBRIEF: return(0);
71 case VIEW_JOURNAL: return(0);
72 default: return(0); /* should never get here */
78 * load the list of floors
80 void load_floorlist(StrBuf *Buf)
85 for (a = 0; a < MAX_FLOORS; ++a)
89 StrBuf_ServGetln(Buf);
90 if (GetServerStatus(Buf, NULL) != 1) {
91 strcpy(floorlist[0], "Main Floor");
94 while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
95 if ( (StrLength(Buf)==3) &&
96 !strcmp(ChrPtr(Buf), "000")) {
100 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
106 * Free a session's march list
108 void free_march_list(wcsession *wcf)
112 while (wcf->march != NULL) {
113 mptr = wcf->march->next;
123 * remove a room from the march list
125 void remove_march(const StrBuf *aaa)
127 struct march *mptr, *mptr2;
129 if (WC->march == NULL)
132 if (!strcasecmp(WC->march->march_name, ChrPtr(aaa))) {
133 mptr = WC->march->next;
139 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
140 if (!strcasecmp(mptr->march_name, ChrPtr(aaa))) {
141 mptr2->next = mptr->next;
154 * display rooms in tree structure
156 void room_tree_list(struct roomlisting *rp)
165 room_tree_list(rp->lnext);
167 strcpy(rmname, rp->rlname);
170 wprintf("<a href=\"dotgoto?room=");
174 escputs1(rmname, 1, 1);
175 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
177 else if (f & QR_DIRECTORY)
179 else if (f & QR_NETWORK)
183 wprintf("</a><tt> </tt>\n");
185 room_tree_list(rp->rnext);
191 * Room ordering stuff (compare first by floor, then by order)
193 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
195 if ((r1 == NULL) && (r2 == NULL))
201 if (r1->rlfloor < r2->rlfloor)
203 if (r1->rlfloor > r2->rlfloor)
205 if (r1->rlorder < r2->rlorder)
207 if (r1->rlorder > r2->rlorder)
214 * Common code for all room listings
216 void listrms(char *variety)
221 struct roomlisting *rl = NULL;
222 struct roomlisting *rp;
223 struct roomlisting *rs;
225 /* Ask the server for a room list */
227 serv_getln(buf, sizeof buf);
233 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
235 rp = malloc(sizeof(struct roomlisting));
236 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
237 rp->rlflags = extract_int(buf, 1);
238 rp->rlfloor = extract_int(buf, 2);
239 rp->rlorder = extract_int(buf, 3);
248 if (rordercmp(rp, rs) < 0) {
249 if (rs->lnext == NULL) {
256 if (rs->rnext == NULL) {
269 * If no rooms were listed, print an nbsp to make the cell
270 * borders show up anyway.
272 if (num_rooms == 0) wprintf(" ");
277 * list all forgotten rooms
279 void zapped_list(void)
281 WCTemplputParams SubTP;
284 output_headers(1, 1, 1, 0, 0, 0);
285 memset(&SubTP, 0, sizeof(WCTemplputParams));
286 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
287 SubTP.Filter.ContextType = CTX_STRBUF;
289 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
295 wprintf("<br /><br />\n");
296 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
297 do_template("endbox", NULL);
303 * read this room's info file (set v to 1 for verbose mode)
305 void readinfo(StrBuf *Target, WCTemplputParams *TP)
310 int fullinfo_len = 0;
313 serv_getln(buf, sizeof buf);
316 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
317 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
318 strcpy(&fullinfo[fullinfo_len], buf);
319 fullinfo_len += strlen(buf);
323 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
324 strcpy(&briefinfo[50], "...");
326 wprintf("<div class=\"infos\" "
327 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
331 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
332 wprintf("<img class=\"close_infos\" "
333 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
334 "src=\"static/closewindow.gif\" alt=\"%s\" width=\"16\" height=\"16\">",
349 * Display room banner icon.
350 * The server doesn't actually need the room name, but we supply it in
351 * order to keep the browser from using a cached icon from another room.
353 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
357 serv_puts("OIMG _roompic_");
358 serv_getln(buf, sizeof buf);
360 wprintf("<img height=\"64px\" src=\"image?name=_roompic_&room=");
361 urlescputs(ChrPtr(WC->wc_roomname));
364 serv_getln(buf, sizeof buf);
366 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
367 wprintf("<img class=\"roompic\" alt=\"\" src=\""
368 "static/viewcontacts_48x.gif"
372 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
373 wprintf("<img class=\"roompic\" alt=\"\" src=\""
374 "static/calarea_48x.gif"
375 "\" width=\"48\" height=\"48\">"
378 else if (WC->wc_view == VIEW_TASKS) {
379 wprintf("<img class=\"roompic\" alt=\"\" src=\""
380 "static/taskmanag_48x.gif"
381 "\" width=\"48\" height=\"48\">"
384 else if (WC->wc_view == VIEW_NOTES) {
385 wprintf("<img class=\"roompic\" alt=\"\" src=\""
386 "static/storenotes_48x.gif"
387 "\" width=\"48\" height=\"48\">"
390 else if (WC->wc_view == VIEW_MAILBOX) {
391 wprintf("<img class=\"roompic\" alt=\"\" src=\""
392 "static/privatemess_48x.gif"
393 "\" width=\"48\" height=\"48\">"
397 wprintf("<img class=\"roompic\" alt=\"\" src=\""
398 "static/chatrooms_48x.gif"
399 "\" width=\"48\" height=\"48\">"
408 * Display the current view and offer an option to change it
410 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
414 wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
415 wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
416 wprintf("<label for=\"view_name\">");
417 wprintf(_("View as:"));
419 "<select name=\"newview\" size=\"1\" "
420 "id=\"view_name\" class=\"selectbox\" "
421 "OnChange=\"location.href=viewomatic.newview.options"
422 "[selectedIndex].value\">\n");
424 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
426 * Only offer the views that make sense, given the default
427 * view for the room. For example, don't offer a Calendar
428 * view in a non-Calendar room.
432 || (i == WC->wc_default_view) /* default */
433 || ( (i == 0) && (WC->wc_default_view == 1) ) /* mail or bulletin */
434 || ( (i == 1) && (WC->wc_default_view == 0) ) /* mail or bulletin */
435 /* || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */
438 wprintf("<option %s value=\"changeview?view=%d\">",
439 ((i == WC->wc_view) ? "selected" : ""),
441 escputs(viewdefs[i]);
442 wprintf("</option>\n");
445 wprintf("</select></div></form>\n");
450 * Display a search box
452 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
454 wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
455 wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
456 wprintf("<label for=\"srchquery\">");
457 wprintf(_("Search: "));
458 wprintf("</label><input ");
459 wprintf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
460 wprintf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
462 wprintf("</div></form>\n");
467 * Embed the room banner
469 * got The information returned from a GOTO server command
470 * navbar_style Determines which navigation buttons to display
474 void embed_room_banner(char *got, int navbar_style) {
478 char with_files[256];
482 * We need to have the information returned by a GOTO server command.
483 * If it isn't supplied, we fake it by issuing our own GOTO.
486 memset(buf, '0', 20);
488 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
489 serv_getln(buf, sizeof buf);
493 /* The browser needs some information for its own use */
494 wprintf("<script type=\"text/javascript\"> \n"
495 " room_is_trash = %d; \n"
501 * If the user happens to select the "make this my start page" link,
502 * we want it to remember the URL as a "/dotskip" one instead of
503 * a "skip" or "gotonext" or something like that.
505 if (WCC->Hdr->this_page == NULL) {
506 WCC->Hdr->this_page = NewStrBuf();
508 StrBufPrintf(WCC->Hdr->this_page,
510 ChrPtr(WC->wc_roomname)
513 /* Check for new mail. */
514 WC->new_mail = extract_int(&got[4], 9);
515 WC->wc_view = extract_int(&got[4], 11);
517 /* Is this a directory room and does it contain files and how many? */
518 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
521 serv_getln(buf2, sizeof buf2);
522 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
524 snprintf (with_files, sizeof with_files,
525 "; <a href=\"do_template?template=files\"> %d %s </a>",
527 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
530 strcpy (with_files, "");
532 svprintf(HKEY("NUMMSGS"), WCS_STRING,
533 _("%d new of %d messages%s"),
534 extract_int(&got[4], 1),
535 extract_int(&got[4], 2),
538 svcallback("ROOMPIC", embed_room_graphic);
539 svcallback("ROOMINFO", readinfo);
540 svcallback("VIEWOMATIC", embed_view_o_matic);
541 svcallback("SEARCHOMATIC", embed_search_o_matic);
542 svcallback("START", offer_start_page);
544 do_template("roombanner", NULL);
545 /* roombanner contains this for mobile */
546 if (navbar_style != navbar_none && !WC->is_mobile) {
548 wprintf("<div id=\"navbar\"><ul>");
550 if (navbar_style == navbar_default) wprintf(
551 "<li class=\"ungoto\">"
552 "<a href=\"ungoto\">"
553 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
554 "<span class=\"navbar_link\">%s</span></A>"
555 "</li>\n", _("Ungoto")
558 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
560 "<li class=\"newmess\">"
561 "<a href=\"readnew\">"
562 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
563 "<span class=\"navbar_link\">%s</span></A>"
564 "</li>\n", _("Read new messages")
568 if (navbar_style == navbar_default) {
569 switch(WC->wc_view) {
570 case VIEW_ADDRESSBOOK:
572 "<li class=\"viewcontacts\">"
573 "<a href=\"readfwd\">"
574 "<img src=\"static/viewcontacts_24x.gif\" "
575 "alt=\"\" width=\"24\" height=\"24\">"
576 "<span class=\"navbar_link\">"
578 "</span></a></li>\n", _("View contacts")
583 "<li class=\"staskday\">"
584 "<a href=\"readfwd?calview=day\">"
585 "<img src=\"static/taskday2_24x.gif\" "
586 "alt=\"\" width=\"24\" height=\"24\">"
587 "<span class=\"navbar_link\">"
589 "</span></a></li>\n", _("Day view")
592 "<li class=\"monthview\">"
593 "<a href=\"readfwd?calview=month\">"
594 "<img src=\"static/monthview2_24x.gif\" "
595 "alt=\"\" width=\"24\" height=\"24\">"
596 "<span class=\"navbar_link\">"
598 "</span></a></li>\n", _("Month view")
603 "<li class=\"monthview\">"
604 "<a href=\"readfwd?calview=month\">"
605 "<img src=\"static/monthview2_24x.gif\" "
606 "alt=\"\" width=\"24\" height=\"24\">"
607 "<span class=\"navbar_link\">"
609 "</span></a></li>\n", _("Calendar list")
614 "<li class=\"taskmanag\">"
615 "<a href=\"readfwd\">"
616 "<img src=\"static/taskmanag_24x.gif\" "
617 "alt=\"\" width=\"24\" height=\"24\">"
618 "<span class=\"navbar_link\">"
620 "</span></a></li>\n", _("View tasks")
625 "<li class=\"viewnotes\">"
626 "<a href=\"readfwd\">"
627 "<img src=\"static/viewnotes_24x.gif\" "
628 "alt=\"\" width=\"24\" height=\"24\">"
629 "<span class=\"navbar_link\">"
631 "</span></a></li>\n", _("View notes")
636 "<li class=\"readallmess\">"
637 "<a id=\"m_refresh\" href=\"readfwd\">"
638 "<img src=\"static/readallmess3_24x.gif\" "
639 "alt=\"\" width=\"24\" height=\"24\">"
640 "<span class=\"navbar_link\">"
642 "</span></a></li>\n", _("Refresh message list")
647 "<li class=\"readallmess\">"
648 "<a href=\"readfwd\">"
649 "<img src=\"static/readallmess3_24x.gif\" "
650 "alt=\"\" width=\"24\" height=\"24\">"
651 "<span class=\"navbar_link\">"
653 "</span></a></li>\n", _("Wiki home")
658 "<li class=\"readallmess\">"
659 "<a href=\"readfwd\">"
660 "<img src=\"static/readallmess3_24x.gif\" "
661 "alt=\"\" width=\"24\" height=\"24\">"
662 "<span class=\"navbar_link\">"
664 "</span></a></li>\n", _("Read all messages")
670 if (navbar_style == navbar_default) {
671 switch(WC->wc_view) {
672 case VIEW_ADDRESSBOOK:
674 "<li class=\"addnewcontact\">"
675 "<a href=\"display_enter\">"
676 "<img src=\"static/addnewcontact_24x.gif\" "
677 "alt=\"\" width=\"24\" height=\"24\">"
678 "<span class=\"navbar_link\">"
680 "</span></a></li>\n", _("Add new contact")
685 wprintf("<li class=\"addevent\"><a href=\"display_enter");
686 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
687 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
688 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
690 "<img src=\"static/addevent_24x.gif\" "
691 "alt=\"\" width=\"24\" height=\"24\">"
692 "<span class=\"navbar_link\">"
694 "</span></a></li>\n", _("Add new event")
699 "<li class=\"newmess\">"
700 "<a href=\"display_enter\">"
701 "<img src=\"static/newmess3_24x.gif\" "
702 "alt=\"\" width=\"24\" height=\"24\">"
703 "<span class=\"navbar_link\">"
705 "</span></a></li>\n", _("Add new task")
710 "<li class=\"enternewnote\">"
711 "<a href=\"add_new_note\">"
712 "<img src=\"static/enternewnote_24x.gif\" "
713 "alt=\"\" width=\"24\" height=\"24\">"
714 "<span class=\"navbar_link\">"
716 "</span></a></li>\n", _("Add new note")
720 safestrncpy(buf, bstr("page"), sizeof buf);
723 "<li class=\"newmess\">"
724 "<a href=\"display_enter?wikipage=%s\">"
725 "<img src=\"static/newmess3_24x.gif\" "
726 "alt=\"\" width=\"24\" height=\"24\">"
727 "<span class=\"navbar_link\">"
729 "</span></a></li>\n", buf, _("Edit this page")
734 "<li class=\"newmess\">"
735 "<a href=\"display_enter\">"
736 "<img src=\"static/newmess3_24x.gif\" "
737 "alt=\"\" width=\"24\" height=\"24\">"
738 "<span class=\"navbar_link\">"
740 "</span></a></li>\n", _("Write mail")
743 "<li class=\"newmess\">"
744 "<a href=\"javascript:deleteAllSelectedMessages();\">"
745 "<img src=\"static/delete.gif\" "
746 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
748 "</span></a></li>\n", _("Delete")
753 "<li class=\"newmess\">"
754 "<a href=\"display_enter\">"
755 "<img src=\"static/newmess3_24x.gif\" "
756 "alt=\"\" width=\"24\" height=\"24\">"
757 "<span class=\"navbar_link\">"
759 "</span></a></li>\n", _("Enter a message")
765 if (navbar_style == navbar_default) wprintf(
766 "<li class=\"skipthisroom\">"
769 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
770 "width=\"24\" height=\"24\">"
771 "<span class=\"navbar_link\">%s</span></a>"
773 _("Leave all messages marked as unread, go to next room with unread messages"),
777 if (navbar_style == navbar_default) wprintf(
778 "<li class=\"markngo\">"
779 "<a href=\"gotonext\" "
781 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
782 "width=\"24\" height=\"24\">"
783 "<span class=\"navbar_link\">%s</span></a>"
785 _("Mark all messages as read, go to next room with unread messages"),
789 wprintf("</ul></div>\n");
796 * back end routine to take the session to a new room
798 long gotoroom(const StrBuf *gname)
801 static long ls = (-1L);
804 lprintf(9, "%s:%d gotoroom(%s)\n", __FILE__, __LINE__, ChrPtr(gname));
806 /* store ungoto information */
807 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
811 /* move to the new room */
812 serv_printf("GOTO %s", ChrPtr(gname));
813 StrBuf_ServGetln(Buf);
814 lprintf(9, "%s:%d server reply: %s\n", __FILE__, __LINE__, ChrPtr(Buf));
815 if (GetServerStatus(Buf, &err) != 2) {
816 serv_puts("GOTO _BASEROOM_");
817 StrBuf_ServGetln(Buf);
819 * well, we know that this is the fallback case,
820 * but we're interested that the first command
821 * didn't work out in first place.
823 if (GetServerStatus(Buf, NULL) != 2) {
829 if (WC->wc_roomname == NULL)
830 WC->wc_roomname = NewStrBuf();
832 FlushStrBuf(WC->wc_roomname);
834 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
835 lprintf(9, "%s:%d extracted room name: %s\n", __FILE__, __LINE__, ChrPtr(WC->wc_roomname));
836 StrBufCutLeft(WC->wc_roomname, 4);
837 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
838 /* highest_msg_read = extract_int(&buf[4],6);
839 maxmsgnum = extract_int(&buf[4],5);
841 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
842 ls = StrBufExtract_long(Buf, 6, '|');
843 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
844 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
845 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
846 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
847 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
850 WC->is_room_aide = WC->is_aide;
852 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
854 remove_march(WC->wc_roomname);
855 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
864 * \brief Locate the room on the march list which we most want to go to.
866 * is measured given a "weight" of preference based on various factors.
867 * \param desired_floor the room number on the citadel server
868 * \return the roomname
870 char *pop_march(int desired_floor)
872 static char TheRoom[128];
874 int TheOrder = 32767;
877 struct march *mptr = NULL;
879 strcpy(TheRoom, "_BASEROOM_");
880 if (WC->march == NULL)
883 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
885 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
886 weight = weight + 10000;
887 if (mptr->march_floor == desired_floor)
888 weight = weight + 5000;
890 weight = weight + ((128 - (mptr->march_floor)) * 128);
891 weight = weight + (128 - (mptr->march_order));
893 if (weight > TheWeight) {
895 strcpy(TheRoom, mptr->march_name);
896 TheFloor = mptr->march_floor;
897 TheOrder = mptr->march_order;
906 * Goto next room having unread messages.
908 * We want to skip over rooms that the user has already been to, and take the
909 * user back to the lobby when done. The room we end up in is placed in
910 * newroom - which is set to 0 (the lobby) initially.
911 * We start the search in the current room rather than the beginning to prevent
912 * two or more concurrent users from dragging each other back to the same room.
917 struct march *mptr = NULL;
918 struct march *mptr2 = NULL;
924 * First check to see if the march-mode list is already allocated.
925 * If it is, pop the first room off the list and go there.
928 if (WC->march == NULL) {
930 serv_getln(buf, sizeof buf);
932 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
933 if (IsEmptyStr(buf)) {
936 if (ELoop % 100 == 0)
941 extract_token(room_name, buf, 0, '|', sizeof room_name);
942 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
943 mptr = (struct march *) malloc(sizeof(struct march));
945 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
946 mptr->march_floor = extract_int(buf, 2);
947 mptr->march_order = extract_int(buf, 3);
948 if (WC->march == NULL)
957 * add _BASEROOM_ to the end of the march list, so the user will end up
958 * in the system base room (usually the Lobby>) at the end of the loop
960 mptr = (struct march *) malloc(sizeof(struct march));
962 mptr->march_order = 0;
963 mptr->march_floor = 0;
964 strcpy(mptr->march_name, "_BASEROOM_");
965 if (WC->march == NULL) {
969 while (mptr2->next != NULL)
974 * ...and remove the room we're currently in, so a <G>oto doesn't make us
975 * walk around in circles
977 remove_march(WC->wc_roomname);
979 if (WC->march != NULL) {
980 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
982 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
986 smart_goto(next_room);
987 FreeStrBuf(&next_room);
994 void smart_goto(const StrBuf *next_room) {
995 lprintf(9, "%s:%d smart_goto(%s)\n", __FILE__, __LINE__, ChrPtr(next_room));
1003 * mark all messages in current room as having been read
1005 void slrp_highest(void)
1009 serv_puts("SLRP HIGHEST");
1010 serv_getln(buf, sizeof buf);
1015 * un-goto the previous room
1021 if (!strcmp(WC->ugname, "")) {
1022 smart_goto(WC->wc_roomname);
1025 serv_printf("GOTO %s", WC->ugname);
1027 StrBuf_ServGetln(Buf);
1028 if (GetServerStatus(Buf, NULL) != 2) {
1029 smart_goto(WC->wc_roomname);
1033 if (WC->uglsn >= 0L) {
1034 serv_printf("SLRP %ld", WC->uglsn);
1035 StrBuf_ServGetln(Buf);
1038 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1039 strcpy(WC->ugname, "");
1044 typedef struct __room_states {
1059 * Set/clear/read the "self-service list subscribe" flag for a room
1061 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1062 * returns the new value.
1065 int self_service(int newval) {
1066 int current_value = 0;
1072 int flags, floor, order, view, flags2;
1075 serv_getln(buf, sizeof buf);
1076 if (buf[0] != '2') return(0);
1078 extract_token(name, &buf[4], 0, '|', sizeof name);
1079 extract_token(password, &buf[4], 1, '|', sizeof password);
1080 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1081 flags = extract_int(&buf[4], 3);
1082 floor = extract_int(&buf[4], 4);
1083 order = extract_int(&buf[4], 5);
1084 view = extract_int(&buf[4], 6);
1085 flags2 = extract_int(&buf[4], 7);
1087 if (flags2 & QR2_SELFLIST) {
1095 flags2 = flags2 | QR2_SELFLIST;
1097 else if (newval == 0) {
1098 flags2 = flags2 & ~QR2_SELFLIST;
1101 return(current_value);
1104 if (newval != current_value) {
1105 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1106 name, password, dirname, flags,
1107 floor, order, view, flags2);
1108 serv_getln(buf, sizeof buf);
1115 int is_selflist(room_states *RoomFlags)
1117 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1120 int is_publiclist(room_states *RoomFlags)
1122 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1125 int is_moderatedlist(room_states *RoomFlags)
1127 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1131 * Set/clear/read the "self-service list subscribe" flag for a room
1133 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1134 * returns the new value.
1137 int get_roomflags(room_states *RoomOps)
1142 serv_getln(buf, sizeof buf);
1143 if (buf[0] != '2') return(0);
1145 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1146 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1147 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1148 RoomOps->flags = extract_int(&buf[4], 3);
1149 RoomOps->floor = extract_int(&buf[4], 4);
1150 RoomOps->order = extract_int(&buf[4], 5);
1151 RoomOps->view = extract_int(&buf[4], 6);
1152 RoomOps->flags2 = extract_int(&buf[4], 7);
1156 int set_roomflags(room_states *RoomOps)
1160 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1169 serv_getln(buf, sizeof buf);
1179 * display the form for editing a room
1181 void display_editroom(void)
1187 char remote_room[128];
1190 char er_password[10];
1191 char er_dirname[15];
1192 char er_roomaide[26];
1199 char *not_shared_with;
1202 int floorpolicy = 0;
1204 char pop3_host[128];
1209 if (IsEmptyStr(tab)) tab = "admin";
1212 load_floorlist(Buf);
1214 output_headers(1, 1, 1, 0, 0, 0);
1216 wprintf("<div class=\"fix_scrollbar_bug\">");
1218 wprintf("<br />\n");
1220 /* print the tabbed dialog */
1221 wprintf("<div align=\"center\">");
1222 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
1223 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1226 wprintf("<td class=\"");
1227 if (!strcmp(tab, "admin")) {
1228 wprintf(" tab_cell_label\">");
1229 wprintf(_("Administration"));
1232 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1233 wprintf(_("Administration"));
1237 wprintf("<td> </td>\n");
1239 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1241 wprintf("<td class=\"");
1242 if (!strcmp(tab, "config")) {
1243 wprintf(" tab_cell_label\">");
1244 wprintf(_("Configuration"));
1247 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1248 wprintf(_("Configuration"));
1252 wprintf("<td> </td>\n");
1254 wprintf("<td class=\"");
1255 if (!strcmp(tab, "expire")) {
1256 wprintf(" tab_cell_label\">");
1257 wprintf(_("Message expire policy"));
1260 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1261 wprintf(_("Message expire policy"));
1265 wprintf("<td> </td>\n");
1267 wprintf("<td class=\"");
1268 if (!strcmp(tab, "access")) {
1269 wprintf(" tab_cell_label\">");
1270 wprintf(_("Access controls"));
1273 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1274 wprintf(_("Access controls"));
1278 wprintf("<td> </td>\n");
1280 wprintf("<td class=\"");
1281 if (!strcmp(tab, "sharing")) {
1282 wprintf(" tab_cell_label\">");
1283 wprintf(_("Sharing"));
1286 wprintf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1287 wprintf(_("Sharing"));
1291 wprintf("<td> </td>\n");
1293 wprintf("<td class=\"");
1294 if (!strcmp(tab, "listserv")) {
1295 wprintf(" tab_cell_label\">");
1296 wprintf(_("Mailing list service"));
1299 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1300 wprintf(_("Mailing list service"));
1304 wprintf("<td> </td>\n");
1308 wprintf("<td class=\"");
1309 if (!strcmp(tab, "feeds")) {
1310 wprintf(" tab_cell_label\">");
1311 wprintf(_("Remote retrieval"));
1314 wprintf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1315 wprintf(_("Remote retrieval"));
1319 wprintf("<td> </td>\n");
1321 wprintf("</tr></table>\n");
1322 wprintf("</div>\n");
1323 /* end tabbed dialog */
1325 wprintf("<script type=\"text/javascript\">"
1326 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1330 /* begin content of whatever tab is open now */
1332 if (!strcmp(tab, "admin")) {
1333 wprintf("<div class=\"tabcontent\">");
1335 "<li><a href=\"delete_room\" "
1336 "onClick=\"return confirm('");
1337 wprintf(_("Are you sure you want to delete this room?"));
1338 wprintf("');\">\n");
1339 wprintf(_("Delete this room"));
1341 "<li><a href=\"display_editroompic\">\n");
1342 wprintf(_("Set or change the icon for this room's banner"));
1344 "<li><a href=\"display_editinfo\">\n");
1345 wprintf(_("Edit this room's Info file"));
1351 if (!strcmp(tab, "config")) {
1352 wprintf("<div class=\"tabcontent\">");
1354 serv_getln(buf, sizeof buf);
1356 if (!strncmp(buf, "550", 3)) {
1357 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1358 _("Higher access is required to access this function.")
1361 else if (buf[0] != '2') {
1362 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1365 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1366 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1367 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1368 er_flags = extract_int(&buf[4], 3);
1369 er_floor = extract_int(&buf[4], 4);
1370 er_flags2 = extract_int(&buf[4], 7);
1372 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1373 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1375 wprintf("<ul><li>");
1376 wprintf(_("Name of room: "));
1377 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1383 wprintf(_("Resides on floor: "));
1384 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1385 if (er_flags & QR_MAILBOX)
1386 wprintf("disabled >\n");
1387 for (i = 0; i < 128; ++i)
1388 if (!IsEmptyStr(floorlist[i])) {
1389 wprintf("<OPTION ");
1391 wprintf("SELECTED ");
1392 wprintf("VALUE=\"%d\">", i);
1393 escputs(floorlist[i]);
1394 wprintf("</OPTION>\n");
1396 wprintf("</select>\n");
1399 wprintf(_("Type of room:"));
1402 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1403 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1404 wprintf("CHECKED ");
1405 wprintf("OnChange=\""
1406 " if (this.form.type[0].checked == true) { "
1407 " this.form.er_floor.disabled = false; "
1410 wprintf(_("Public (automatically appears to everyone)"));
1413 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1414 if ((er_flags & QR_PRIVATE) &&
1415 (er_flags & QR_GUESSNAME))
1416 wprintf("CHECKED ");
1417 wprintf(" OnChange=\""
1418 " if (this.form.type[1].checked == true) { "
1419 " this.form.er_floor.disabled = false; "
1422 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1424 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1425 if ((er_flags & QR_PRIVATE) &&
1426 (er_flags & QR_PASSWORDED))
1427 wprintf("CHECKED ");
1428 wprintf(" OnChange=\""
1429 " if (this.form.type[2].checked == true) { "
1430 " this.form.er_floor.disabled = false; "
1433 wprintf(_("Private - require password: "));
1434 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1437 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1438 if ((er_flags & QR_PRIVATE)
1439 && ((er_flags & QR_GUESSNAME) == 0)
1440 && ((er_flags & QR_PASSWORDED) == 0))
1441 wprintf("CHECKED ");
1442 wprintf(" OnChange=\""
1443 " if (this.form.type[3].checked == true) { "
1444 " this.form.er_floor.disabled = false; "
1447 wprintf(_("Private - invitation only"));
1449 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1450 if (er_flags & QR_MAILBOX)
1451 wprintf("CHECKED ");
1452 wprintf (" OnChange=\""
1453 " if (this.form.type[4].checked == true) { "
1454 " this.form.er_floor.disabled = true; "
1457 wprintf(_("Personal (mailbox for you only)"));
1459 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1461 wprintf(_("If private, cause current users to forget room"));
1463 wprintf("\n</ul>\n");
1465 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1466 if (er_flags & QR_PREFONLY)
1467 wprintf("CHECKED ");
1469 wprintf(_("Preferred users only"));
1471 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1472 if (er_flags & QR_READONLY)
1473 wprintf("CHECKED ");
1475 wprintf(_("Read-only room"));
1477 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1478 if (er_flags2 & QR2_COLLABDEL)
1479 wprintf("CHECKED ");
1481 wprintf(_("All users allowed to post may also delete messages"));
1483 /** directory stuff */
1484 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1485 if (er_flags & QR_DIRECTORY)
1486 wprintf("CHECKED ");
1488 wprintf(_("File directory room"));
1490 wprintf("\n<ul><li>");
1491 wprintf(_("Directory name: "));
1492 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1495 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1496 if (er_flags & QR_UPLOAD)
1497 wprintf("CHECKED ");
1499 wprintf(_("Uploading allowed"));
1501 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1502 if (er_flags & QR_DOWNLOAD)
1503 wprintf("CHECKED ");
1505 wprintf(_("Downloading allowed"));
1507 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1508 if (er_flags & QR_VISDIR)
1509 wprintf("CHECKED ");
1511 wprintf(_("Visible directory"));
1514 /** end of directory stuff */
1516 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1517 if (er_flags & QR_NETWORK)
1518 wprintf("CHECKED ");
1520 wprintf(_("Network shared room"));
1522 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1523 if (er_flags & QR_PERMANENT)
1524 wprintf("CHECKED ");
1526 wprintf(_("Permanent (does not auto-purge)"));
1528 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1529 if (er_flags2 & QR2_SUBJECTREQ)
1530 wprintf("CHECKED ");
1532 wprintf(_("Subject Required (Force users to specify a message subject)"));
1534 /** start of anon options */
1537 wprintf(_("Anonymous messages"));
1540 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1541 if (((er_flags & QR_ANONONLY) == 0)
1542 && ((er_flags & QR_ANONOPT) == 0))
1543 wprintf("CHECKED ");
1545 wprintf(_("No anonymous messages"));
1547 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1548 if (er_flags & QR_ANONONLY)
1549 wprintf("CHECKED ");
1551 wprintf(_("All messages are anonymous"));
1553 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1554 if (er_flags & QR_ANONOPT)
1555 wprintf("CHECKED ");
1557 wprintf(_("Prompt user when entering messages"));
1560 /* end of anon options */
1563 wprintf(_("Room aide: "));
1565 serv_getln(buf, sizeof buf);
1566 if (buf[0] != '2') {
1567 wprintf("<em>%s</em>\n", &buf[4]);
1569 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1570 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1573 wprintf("</ul><CENTER>\n");
1574 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1575 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1577 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1587 /* Sharing the room with other Citadel nodes... */
1588 if (!strcmp(tab, "sharing")) {
1589 wprintf("<div class=\"tabcontent\">");
1591 shared_with = strdup("");
1592 not_shared_with = strdup("");
1594 /** Learn the current configuration */
1595 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1596 serv_getln(buf, sizeof buf);
1597 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1598 extract_token(node, buf, 0, '|', sizeof node);
1599 not_shared_with = realloc(not_shared_with,
1600 strlen(not_shared_with) + 32);
1601 strcat(not_shared_with, node);
1602 strcat(not_shared_with, "\n");
1606 serv_getln(buf, sizeof buf);
1607 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1608 extract_token(cmd, buf, 0, '|', sizeof cmd);
1609 extract_token(node, buf, 1, '|', sizeof node);
1610 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1611 if (!strcasecmp(cmd, "ignet_push_share")) {
1612 shared_with = realloc(shared_with,
1613 strlen(shared_with) + 32);
1614 strcat(shared_with, node);
1615 if (!IsEmptyStr(remote_room)) {
1616 strcat(shared_with, "|");
1617 strcat(shared_with, remote_room);
1619 strcat(shared_with, "\n");
1623 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1624 extract_token(buf, shared_with, i, '\n', sizeof buf);
1625 extract_token(node, buf, 0, '|', sizeof node);
1626 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1627 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1628 if (!strcasecmp(node, cmd)) {
1629 remove_token(not_shared_with, j, '\n');
1634 /* Display the stuff */
1635 wprintf("<CENTER><br />"
1636 "<table border=1 cellpadding=5><tr>"
1638 wprintf(_("Shared with"));
1639 wprintf("</I></B></td>"
1641 wprintf(_("Not shared with"));
1642 wprintf("</I></B></td></tr>\n"
1643 "<tr><td VALIGN=TOP>\n");
1645 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1646 wprintf(_("Remote node name"));
1647 wprintf("</td><td>");
1648 wprintf(_("Remote room name"));
1649 wprintf("</td><td>");
1650 wprintf(_("Actions"));
1651 wprintf("</td></tr>\n");
1653 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1654 extract_token(buf, shared_with, i, '\n', sizeof buf);
1655 extract_token(node, buf, 0, '|', sizeof node);
1656 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1657 if (!IsEmptyStr(node)) {
1658 wprintf("<form method=\"POST\" action=\"netedit\">");
1659 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1660 wprintf("<tr><td>%s</td>\n", node);
1663 if (!IsEmptyStr(remote_room)) {
1664 escputs(remote_room);
1670 wprintf("<input type=\"hidden\" NAME=\"line\" "
1671 "VALUE=\"ignet_push_share|");
1673 if (!IsEmptyStr(remote_room)) {
1675 urlescputs(remote_room);
1678 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1679 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1680 wprintf("<input type=\"submit\" "
1681 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1682 wprintf("</td></tr></form>\n");
1686 wprintf("</table>\n");
1687 wprintf("</td><td VALIGN=TOP>\n");
1688 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1689 wprintf(_("Remote node name"));
1690 wprintf("</td><td>");
1691 wprintf(_("Remote room name"));
1692 wprintf("</td><td>");
1693 wprintf(_("Actions"));
1694 wprintf("</td></tr>\n");
1696 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1697 extract_token(node, not_shared_with, i, '\n', sizeof node);
1698 if (!IsEmptyStr(node)) {
1699 wprintf("<form method=\"POST\" action=\"netedit\">");
1700 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1701 wprintf("<tr><td>");
1704 "<input type=\"INPUT\" "
1708 wprintf("<input type=\"hidden\" "
1710 "VALUE=\"ignet_push_share|");
1713 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1714 "VALUE=\"sharing\">\n");
1715 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1716 "VALUE=\"add\">\n");
1717 wprintf("<input type=\"submit\" "
1718 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1719 wprintf("</td></tr></form>\n");
1723 wprintf("</table>\n");
1724 wprintf("</td></tr>"
1725 "</table></CENTER><br />\n"
1726 "<I><B>%s</B><ul><li>", _("Notes:"));
1727 wprintf(_("When sharing a room, "
1728 "it must be shared from both ends. Adding a node to "
1729 "the 'shared' list sends messages out, but in order to"
1730 " receive messages, the other nodes must be configured"
1731 " to send messages out to your system as well. "
1732 "<li>If the remote room name is blank, it is assumed "
1733 "that the room name is identical on the remote node."
1734 "<li>If the remote room name is different, the remote "
1735 "node must also configure the name of the room here."
1742 /* Mailing list management */
1743 if (!strcmp(tab, "listserv")) {
1744 room_states RoomFlags;
1745 wprintf("<div class=\"tabcontent\">");
1747 wprintf("<br /><center>"
1748 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1749 "<tr><td VALIGN=TOP>");
1751 wprintf(_("<i>The contents of this room are being "
1752 "mailed <b>as individual messages</b> "
1753 "to the following list recipients:"
1754 "</i><br /><br />\n"));
1757 serv_getln(buf, sizeof buf);
1758 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1759 extract_token(cmd, buf, 0, '|', sizeof cmd);
1760 if (!strcasecmp(cmd, "listrecp")) {
1761 extract_token(recp, buf, 1, '|', sizeof recp);
1764 wprintf(" <a href=\"netedit?cmd=remove&tab=listserv&line=listrecp|");
1767 wprintf(_("(remove)"));
1768 wprintf("</A><br />");
1771 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1772 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1773 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1774 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1775 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1776 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1777 wprintf("</form>\n");
1779 wprintf("</td><td VALIGN=TOP>\n");
1781 wprintf(_("<i>The contents of this room are being "
1782 "mailed <b>in digest form</b> "
1783 "to the following list recipients:"
1784 "</i><br /><br />\n"));
1787 serv_getln(buf, sizeof buf);
1788 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1789 extract_token(cmd, buf, 0, '|', sizeof cmd);
1790 if (!strcasecmp(cmd, "digestrecp")) {
1791 extract_token(recp, buf, 1, '|', sizeof recp);
1794 wprintf(" <a href=\"netedit?cmd=remove&tab=listserv&line="
1798 wprintf(_("(remove)"));
1799 wprintf("</A><br />");
1802 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1803 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1804 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1805 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1806 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1807 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1808 wprintf("</form>\n");
1810 wprintf("</td></tr></table>\n");
1812 /** Pop open an address book -- begin **/
1813 wprintf("<div align=right>"
1814 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1816 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1821 _("Add recipients from Contacts or other address books"),
1822 _("Add recipients from Contacts or other address books")
1824 /* Pop open an address book -- end **/
1826 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1828 get_roomflags (&RoomFlags);
1830 /* Self Service subscription? */
1831 wprintf("<table><tr><td>\n");
1832 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1833 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1834 " <tr><td colspan=\"2\">\n",
1835 (is_selflist(&RoomFlags))?"checked":"");
1836 wprintf(_("The URL for subscribe/unsubscribe is: "));
1837 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1838 (is_https ? "https" : "http"),
1839 ChrPtr(WC->Hdr->HR.http_host));
1840 /* Public posting? */
1841 wprintf("<tr><td>");
1842 wprintf(_("Allow non-subscribers to mail to this room."));
1843 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1844 (is_publiclist(&RoomFlags))?"checked":"");
1846 /* Moderated List? */
1847 wprintf("<tr><td>");
1848 wprintf(_("Room post publication needs Aide permission."));
1849 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1850 (is_moderatedlist(&RoomFlags))?"checked":"");
1853 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1854 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1855 wprintf("</table></form>");
1858 wprintf("</CENTER>\n");
1863 /* Configuration of The Dreaded Auto-Purger */
1864 if (!strcmp(tab, "expire")) {
1865 wprintf("<div class=\"tabcontent\">");
1867 serv_puts("GPEX room");
1868 serv_getln(buf, sizeof buf);
1869 if (!strncmp(buf, "550", 3)) {
1870 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1871 _("Higher access is required to access this function.")
1874 else if (buf[0] != '2') {
1875 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1878 roompolicy = extract_int(&buf[4], 0);
1879 roomvalue = extract_int(&buf[4], 1);
1881 serv_puts("GPEX floor");
1882 serv_getln(buf, sizeof buf);
1883 if (buf[0] == '2') {
1884 floorpolicy = extract_int(&buf[4], 0);
1885 floorvalue = extract_int(&buf[4], 1);
1888 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1889 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1890 wprintf("<table border=0 cellspacing=5>\n");
1891 wprintf("<tr><td>");
1892 wprintf(_("Message expire policy for this room"));
1894 escputs(ChrPtr(WC->wc_roomname));
1895 wprintf(")</td><td>");
1896 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1897 ((roompolicy == 0) ? "CHECKED" : "") );
1898 wprintf(_("Use the default policy for this floor"));
1899 wprintf("<br />\n");
1900 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1901 ((roompolicy == 1) ? "CHECKED" : "") );
1902 wprintf(_("Never automatically expire messages"));
1903 wprintf("<br />\n");
1904 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1905 ((roompolicy == 2) ? "CHECKED" : "") );
1906 wprintf(_("Expire by message count"));
1907 wprintf("<br />\n");
1908 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1909 ((roompolicy == 3) ? "CHECKED" : "") );
1910 wprintf(_("Expire by message age"));
1912 wprintf(_("Number of messages or days: "));
1913 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1914 wprintf("</td></tr>\n");
1916 if (WC->axlevel >= 6) {
1917 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1918 wprintf("<tr><td>");
1919 wprintf(_("Message expire policy for this floor"));
1921 escputs(floorlist[WC->wc_floor]);
1922 wprintf(")</td><td>");
1923 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1924 ((floorpolicy == 0) ? "CHECKED" : "") );
1925 wprintf(_("Use the system default"));
1926 wprintf("<br />\n");
1927 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1928 ((floorpolicy == 1) ? "CHECKED" : "") );
1929 wprintf(_("Never automatically expire messages"));
1930 wprintf("<br />\n");
1931 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1932 ((floorpolicy == 2) ? "CHECKED" : "") );
1933 wprintf(_("Expire by message count"));
1934 wprintf("<br />\n");
1935 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1936 ((floorpolicy == 3) ? "CHECKED" : "") );
1937 wprintf(_("Expire by message age"));
1939 wprintf(_("Number of messages or days: "));
1940 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1944 wprintf("<CENTER>\n");
1945 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1946 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1948 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1949 wprintf("</CENTER></td><tr>\n");
1951 wprintf("</table>\n"
1952 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1960 /* Access controls */
1961 if (!strcmp(tab, "access")) {
1962 wprintf("<div class=\"tabcontent\">");
1967 /* Fetch messages from remote locations */
1968 if (!strcmp(tab, "feeds")) {
1969 wprintf("<div class=\"tabcontent\">");
1972 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1973 wprintf("</i><br />\n");
1975 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1976 "<tr class=\"even\"><th>");
1977 wprintf(_("Remote host"));
1978 wprintf("</th><th>");
1979 wprintf(_("User name"));
1980 wprintf("</th><th>");
1981 wprintf(_("Password"));
1982 wprintf("</th><th>");
1983 wprintf(_("Keep messages on server?"));
1984 wprintf("</th><th>");
1985 wprintf(_("Interval"));
1986 wprintf("</th><th> </th></tr>");
1989 serv_getln(buf, sizeof buf);
1991 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1992 extract_token(cmd, buf, 0, '|', sizeof cmd);
1993 if (!strcasecmp(cmd, "pop3client")) {
1994 safestrncpy(recp, &buf[11], sizeof recp);
1997 wprintf("<tr class=\"%s\">",
1998 (bg ? "even" : "odd")
2002 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2007 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
2011 wprintf("<td>*****</td>"); /* Don't show the password */
2013 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
2015 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
2017 wprintf("<td class=\"button_link\">");
2018 wprintf(" <a href=\"netedit?cmd=remove&tab=feeds&line=pop3client|");
2021 wprintf(_("(remove)"));
2022 wprintf("</a></td>");
2028 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2030 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2031 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
2032 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2034 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
2037 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
2040 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2043 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2046 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2049 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2050 wprintf("</td></tr>");
2051 wprintf("</form></table>\n");
2056 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2057 wprintf("</i><br />\n");
2059 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2060 "<tr class=\"even\"><th>");
2061 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2062 wprintf(_("Feed URL"));
2063 wprintf("</th><th>");
2064 wprintf("</th></tr>");
2067 serv_getln(buf, sizeof buf);
2069 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2070 extract_token(cmd, buf, 0, '|', sizeof cmd);
2071 if (!strcasecmp(cmd, "rssclient")) {
2072 safestrncpy(recp, &buf[10], sizeof recp);
2075 wprintf("<tr class=\"%s\">",
2076 (bg ? "even" : "odd")
2080 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2084 wprintf("<td class=\"button_link\">");
2085 wprintf(" <a href=\"netedit?cmd=remove&tab=feeds&line=rssclient|");
2088 wprintf(_("(remove)"));
2089 wprintf("</a></td>");
2095 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2097 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2098 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2099 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2101 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2102 "maxlength=\"256\" name=\"line_pop3host\">\n");
2105 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2106 wprintf("</td></tr>");
2107 wprintf("</form></table>\n");
2113 /* end content of whatever tab is open now */
2114 wprintf("</div>\n");
2116 address_book_popup();
2122 * Toggle self-service list subscription
2124 void toggle_self_service(void) {
2125 room_states RoomFlags;
2127 get_roomflags (&RoomFlags);
2129 if (yesbstr("QR2_SelfList"))
2130 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2132 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2134 if (yesbstr("QR2_SMTP_PUBLIC"))
2135 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2137 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2139 if (yesbstr("QR2_Moderated"))
2140 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2142 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2143 if (yesbstr("QR2_SubsOnly"))
2144 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2146 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2148 set_roomflags (&RoomFlags);
2156 * save new parameters for a room
2163 StrBuf *er_password;
2165 StrBuf *er_roomaide;
2168 int er_listingorder;
2174 if (!havebstr("ok_button")) {
2175 strcpy(WC->ImportantMessage,
2176 _("Cancelled. Changes were not saved."));
2182 StrBuf_ServGetln(Buf);
2183 if (GetServerStatus(Buf, NULL) != 2) {
2184 StrBufCutLeft(Buf, 4);
2185 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2191 er_name = NewStrBuf();
2192 er_password = NewStrBuf();
2193 er_dirname = NewStrBuf();
2194 er_roomaide = NewStrBuf();
2196 StrBufCutLeft(Buf, 4);
2197 StrBufExtract_token(er_name, Buf, 0, '|');
2198 StrBufExtract_token(er_password, Buf, 1, '|');
2199 StrBufExtract_token(er_dirname, Buf, 2, '|');
2200 er_flags = StrBufExtract_int(Buf, 3, '|');
2201 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2202 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2203 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2205 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2206 if (StrLength(er_roomaide) == 0) {
2208 StrBuf_ServGetln(Buf);
2209 if (GetServerStatus(Buf, NULL) != 2) {
2210 FlushStrBuf(er_roomaide);
2212 StrBufCutLeft(Buf, 4);
2213 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2216 Ptr = sbstr("er_name");
2217 if (StrLength(Ptr) > 0) {
2218 FlushStrBuf(er_name);
2219 StrBufAppendBuf(er_name, Ptr, 0);
2222 Ptr = sbstr("er_password");
2223 if (StrLength(Ptr) > 0) {
2224 FlushStrBuf(er_password);
2225 StrBufAppendBuf(er_password, Ptr, 0);
2229 Ptr = sbstr("er_dirname");
2230 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2231 FlushStrBuf(er_dirname);
2232 StrBufAppendBuf(er_dirname, Ptr, 0);
2236 Ptr = sbstr("type");
2237 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2239 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2240 er_flags |= (QR_PRIVATE);
2242 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2243 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2245 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2246 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2248 if (!strcmp(ChrPtr(Ptr), "personal")) {
2249 er_flags |= QR_MAILBOX;
2251 er_flags &= ~QR_MAILBOX;
2254 if (yesbstr("prefonly")) {
2255 er_flags |= QR_PREFONLY;
2257 er_flags &= ~QR_PREFONLY;
2260 if (yesbstr("readonly")) {
2261 er_flags |= QR_READONLY;
2263 er_flags &= ~QR_READONLY;
2267 if (yesbstr("collabdel")) {
2268 er_flags2 |= QR2_COLLABDEL;
2270 er_flags2 &= ~QR2_COLLABDEL;
2273 if (yesbstr("permanent")) {
2274 er_flags |= QR_PERMANENT;
2276 er_flags &= ~QR_PERMANENT;
2279 if (yesbstr("subjectreq")) {
2280 er_flags2 |= QR2_SUBJECTREQ;
2282 er_flags2 &= ~QR2_SUBJECTREQ;
2285 if (yesbstr("network")) {
2286 er_flags |= QR_NETWORK;
2288 er_flags &= ~QR_NETWORK;
2291 if (yesbstr("directory")) {
2292 er_flags |= QR_DIRECTORY;
2294 er_flags &= ~QR_DIRECTORY;
2297 if (yesbstr("ulallowed")) {
2298 er_flags |= QR_UPLOAD;
2300 er_flags &= ~QR_UPLOAD;
2303 if (yesbstr("dlallowed")) {
2304 er_flags |= QR_DOWNLOAD;
2306 er_flags &= ~QR_DOWNLOAD;
2309 if (yesbstr("visdir")) {
2310 er_flags |= QR_VISDIR;
2312 er_flags &= ~QR_VISDIR;
2315 Ptr = sbstr("anon");
2317 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2318 if (!strcmp(ChrPtr(Ptr), "anononly"))
2319 er_flags |= QR_ANONONLY;
2320 if (!strcmp(ChrPtr(Ptr), "anon2"))
2321 er_flags |= QR_ANONOPT;
2323 bump = yesbstr("bump");
2325 er_floor = ibstr("er_floor");
2327 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2329 ChrPtr(er_password),
2338 StrBuf_ServGetln(Buf);
2339 if (GetServerStatus(Buf, NULL) != 2) {
2340 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2343 FreeStrBuf(&er_name);
2344 FreeStrBuf(&er_password);
2345 FreeStrBuf(&er_dirname);
2346 FreeStrBuf(&er_roomaide);
2351 if (StrLength(er_roomaide) > 0) {
2352 serv_printf("SETA %s", ChrPtr(er_roomaide));
2353 StrBuf_ServGetln(Buf);
2354 if (GetServerStatus(Buf, NULL) != 2) {
2355 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2356 display_main_menu();
2358 FreeStrBuf(&er_name);
2359 FreeStrBuf(&er_password);
2360 FreeStrBuf(&er_dirname);
2361 FreeStrBuf(&er_roomaide);
2366 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2369 FreeStrBuf(&er_name);
2370 FreeStrBuf(&er_password);
2371 FreeStrBuf(&er_dirname);
2372 FreeStrBuf(&er_roomaide);
2378 * Display form for Invite, Kick, and show Who Knows a room
2380 void do_invt_kick(void) {
2381 char buf[SIZ], room[SIZ], username[SIZ];
2384 serv_getln(buf, sizeof buf);
2386 if (buf[0] != '2') {
2390 extract_token(room, &buf[4], 0, '|', sizeof room);
2392 strcpy(username, bstr("username"));
2394 if (havebstr("kick_button")) {
2395 sprintf(buf, "KICK %s", username);
2397 serv_getln(buf, sizeof buf);
2399 if (buf[0] != '2') {
2400 strcpy(WC->ImportantMessage, &buf[4]);
2402 sprintf(WC->ImportantMessage,
2403 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2408 if (havebstr("invite_button")) {
2409 sprintf(buf, "INVT %s", username);
2411 serv_getln(buf, sizeof buf);
2413 if (buf[0] != '2') {
2414 strcpy(WC->ImportantMessage, &buf[4]);
2416 sprintf(WC->ImportantMessage,
2417 _("<B><I>User %s invited to room %s.</I></B>\n"),
2428 * Display form for Invite, Kick, and show Who Knows a room
2430 void display_whok(void)
2432 char buf[SIZ], room[SIZ], username[SIZ];
2435 serv_getln(buf, sizeof buf);
2437 if (buf[0] != '2') {
2441 extract_token(room, &buf[4], 0, '|', sizeof room);
2444 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2445 wprintf(_("The users listed below have access to this room. "
2446 "To remove a user from the access list, select the user "
2447 "name from the list and click 'Kick'."));
2448 wprintf("<br /><br />");
2450 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2451 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2452 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2453 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2455 serv_getln(buf, sizeof buf);
2456 if (buf[0] == '1') {
2457 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2458 extract_token(username, buf, 0, '|', sizeof username);
2459 wprintf("<OPTION>");
2464 wprintf("</select><br />\n");
2466 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2467 wprintf("</form></CENTER>\n");
2469 wprintf("</td><td>");
2470 wprintf(_("To grant another user access to this room, enter the "
2471 "user name in the box below and click 'Invite'."));
2472 wprintf("<br /><br />");
2474 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2475 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2476 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2477 wprintf(_("Invite:"));
2479 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2480 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2481 "<input type=\"submit\" value=\"%s\">"
2482 "</form></CENTER>\n", _("Invite"));
2483 /* Pop open an address book -- begin **/
2485 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2487 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2490 _("Users"), _("Users")
2492 /* Pop open an address book -- end **/
2494 wprintf("</td></tr></table>\n");
2495 address_book_popup();
2502 * display the form for entering a new room
2504 void display_entroom(void)
2511 serv_puts("CRE8 0");
2512 serv_getln(buf, sizeof buf);
2514 if (buf[0] != '2') {
2515 strcpy(WC->ImportantMessage, &buf[4]);
2516 display_main_menu();
2521 output_headers(1, 1, 1, 0, 0, 0);
2523 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2524 do_template("beginbox", NULL);
2526 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2527 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2529 wprintf("<table class=\"altern\"> ");
2531 wprintf("<tr class=\"even\"><td>");
2532 wprintf(_("Name of room: "));
2533 wprintf("</td><td>");
2534 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2535 wprintf("</td></tr>");
2537 wprintf("<tr class=\"odd\"><td>");
2538 wprintf(_("Resides on floor: "));
2539 wprintf("</td><td>");
2540 load_floorlist(Buf);
2541 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2542 for (i = 0; i < 128; ++i)
2543 if (!IsEmptyStr(floorlist[i])) {
2544 wprintf("<option ");
2545 wprintf("value=\"%d\">", i);
2546 escputs(floorlist[i]);
2547 wprintf("</option>\n");
2549 wprintf("</select>\n");
2550 wprintf("</td></tr>");
2553 * Our clever little snippet of JavaScript automatically selects
2554 * a public room if the view is set to Bulletin Board or wiki, and
2555 * it selects a mailbox room otherwise. The user can override this,
2556 * of course. We also disable the floor selector for mailboxes.
2558 wprintf("<tr class=\"even\"><td>");
2559 wprintf(_("Default view for room: "));
2560 wprintf("</td><td>");
2561 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2562 " if ( (this.form.er_view.value == 0) "
2563 " || (this.form.er_view.value == 6) ) { "
2564 " this.form.type[0].checked=true; "
2565 " this.form.er_floor.disabled = false; "
2568 " this.form.type[4].checked=true; "
2569 " this.form.er_floor.disabled = true; "
2572 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2573 if (is_view_allowed_as_default(i)) {
2574 wprintf("<option %s value=\"%d\">",
2575 ((i == 0) ? "selected" : ""), i );
2576 escputs(viewdefs[i]);
2577 wprintf("</option>\n");
2580 wprintf("</select>\n");
2581 wprintf("</td></tr>");
2583 wprintf("<tr class=\"even\"><td>");
2584 wprintf(_("Type of room:"));
2585 wprintf("</td><td>");
2586 wprintf("<ul class=\"adminlist\">\n");
2588 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2589 wprintf("CHECKED OnChange=\""
2590 " if (this.form.type[0].checked == true) { "
2591 " this.form.er_floor.disabled = false; "
2594 wprintf(_("Public (automatically appears to everyone)"));
2597 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2598 " if (this.form.type[1].checked == true) { "
2599 " this.form.er_floor.disabled = false; "
2602 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2605 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2606 " if (this.form.type[2].checked == true) { "
2607 " this.form.er_floor.disabled = false; "
2610 wprintf(_("Private - require password: "));
2611 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2614 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2615 " if (this.form.type[3].checked == true) { "
2616 " this.form.er_floor.disabled = false; "
2619 wprintf(_("Private - invitation only"));
2622 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2624 " if (this.form.type[4].checked == true) { "
2625 " this.form.er_floor.disabled = true; "
2628 wprintf(_("Personal (mailbox for you only)"));
2631 wprintf("\n</ul>\n");
2632 wprintf("</td></tr></table>\n");
2634 wprintf("<div class=\"buttons\">\n");
2635 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2637 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2638 wprintf("</div>\n");
2639 wprintf("</form>\n<hr />");
2640 serv_printf("MESG roomaccess");
2641 serv_getln(buf, sizeof buf);
2642 if (buf[0] == '1') {
2646 do_template("endbox", NULL);
2656 * support function for entroom() -- sets the default view
2658 void er_set_default_view(int newview) {
2671 serv_getln(buf, sizeof buf);
2672 if (buf[0] != '2') return;
2674 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2675 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2676 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2677 rm_bits1 = extract_int(&buf[4], 3);
2678 rm_floor = extract_int(&buf[4], 4);
2679 rm_listorder = extract_int(&buf[4], 5);
2680 rm_bits2 = extract_int(&buf[4], 7);
2682 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2683 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2684 rm_listorder, newview, rm_bits2
2686 serv_getln(buf, sizeof buf);
2697 const StrBuf *er_name;
2698 const StrBuf *er_type;
2699 const StrBuf *er_password;
2704 if (!havebstr("ok_button")) {
2705 strcpy(WC->ImportantMessage,
2706 _("Cancelled. No new room was created."));
2707 display_main_menu();
2710 er_name = sbstr("er_name");
2711 er_type = sbstr("type");
2712 er_password = sbstr("er_password");
2713 er_floor = ibstr("er_floor");
2714 er_view = ibstr("er_view");
2717 if (!strcmp(ChrPtr(er_type), "hidden"))
2719 else if (!strcmp(ChrPtr(er_type), "passworded"))
2721 else if (!strcmp(ChrPtr(er_type), "invonly"))
2723 else if (!strcmp(ChrPtr(er_type), "personal"))
2726 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2729 ChrPtr(er_password),
2734 serv_getln(buf, sizeof buf);
2735 if (buf[0] != '2') {
2736 strcpy(WC->ImportantMessage, &buf[4]);
2737 display_main_menu();
2740 /** TODO: Room created, now udate the left hand icon bar for this user */
2741 burn_folder_cache(0); /* burn the old folder cache */
2745 do_change_view(er_view); /* Now go there */
2750 * \brief display the screen to enter a private room
2752 void display_private(char *rname, int req_pass)
2754 WCTemplputParams SubTP;
2756 output_headers(1, 1, 1, 0, 0, 0);
2758 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2759 memset(&SubTP, 0, sizeof(WCTemplputParams));
2760 SubTP.Filter.ContextType = CTX_STRBUF;
2761 SubTP.Context = Buf;
2762 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2767 wprintf(_("If you know the name of a hidden (guess-name) or "
2768 "passworded room, you can enter that room by typing "
2769 "its name below. Once you gain access to a private "
2770 "room, it will appear in your regular room listings "
2771 "so you don't have to keep returning here."));
2774 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2775 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2777 wprintf("<table class=\"altern\"> "
2778 "<tr class=\"even\"><td>");
2779 wprintf(_("Enter room name:"));
2781 "<input type=\"text\" name=\"gr_name\" "
2782 "value=\"%s\" maxlength=\"128\">\n", rname);
2785 wprintf("</td></tr><tr class=\"odd\"><td>");
2786 wprintf(_("Enter room password:"));
2787 wprintf("</td><td>");
2788 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2790 wprintf("</td></tr></table>\n");
2792 wprintf("<div class=\"buttons\">\n");
2793 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2795 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2799 wprintf("</div></form>\n");
2801 do_template("endbox", NULL);
2807 * \brief goto a private room
2809 void goto_private(void)
2814 if (!havebstr("ok_button")) {
2815 display_main_menu();
2818 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2819 serv_printf("GOTO %s|%s",
2822 serv_getln(buf, sizeof buf);
2824 if (buf[0] == '2') {
2825 smart_goto(sbstr("gr_name"));
2828 if (!strncmp(buf, "540", 3)) {
2829 display_private(bstr("gr_name"), 1);
2832 output_headers(1, 1, 1, 0, 0, 0);
2833 wprintf("%s\n", &buf[4]);
2840 * \brief display the screen to zap a room
2842 void display_zap(void)
2844 output_headers(1, 1, 2, 0, 0, 0);
2846 wprintf("<div id=\"banner\">\n");
2848 wprintf(_("Zap (forget/unsubscribe) the current room"));
2850 wprintf("</div>\n");
2852 wprintf("<div id=\"content\" class=\"service\">\n");
2854 wprintf(_("If you select this option, <em>%s</em> will "
2855 "disappear from your room list. Is this what you wish "
2856 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2858 wprintf("<form method=\"POST\" action=\"zap\">\n");
2859 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2860 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2862 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2863 wprintf("</form>\n");
2874 StrBuf *final_destination;
2877 * If the forget-room routine fails for any reason, we fall back
2878 * to the current room; otherwise, we go to the Lobby
2880 final_destination = NewStrBufDup(WC->wc_roomname);
2882 if (havebstr("ok_button")) {
2883 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2884 serv_getln(buf, sizeof buf);
2885 if (buf[0] == '2') {
2887 serv_getln(buf, sizeof buf);
2888 if (buf[0] == '2') {
2889 FlushStrBuf(final_destination);
2890 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2894 smart_goto(final_destination);
2895 FreeStrBuf(&final_destination);
2901 * \brief Delete the current room
2903 void delete_room(void)
2908 serv_puts("KILL 1");
2909 serv_getln(buf, sizeof buf);
2910 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2911 if (buf[0] != '2') {
2912 strcpy(WC->ImportantMessage, &buf[4]);
2913 display_main_menu();
2918 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2927 * \brief Perform changes to a room's network configuration
2929 void netedit(void) {
2938 /*/ TODO: do line dynamic! */
2939 if (havebstr("line_pop3host")) {
2940 strcpy(line, bstr("prefix"));
2941 strcat(line, bstr("line_pop3host"));
2943 strcat(line, bstr("line_pop3user"));
2945 strcat(line, bstr("line_pop3pass"));
2947 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2949 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2950 strcat(line, bstr("suffix"));
2952 else if (havebstr("line")) {
2953 strcpy(line, bstr("prefix"));
2954 strcat(line, bstr("line"));
2955 strcat(line, bstr("suffix"));
2970 serv_getln(buf, sizeof buf);
2971 if (buf[0] != '1') {
2977 /** This loop works for add *or* remove. Spiffy, eh? */
2978 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2979 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2980 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2981 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2982 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2983 if ( (strcasecmp(cmpa0, cmpb0))
2984 || (strcasecmp(cmpa1, cmpb1)) ) {
2985 fprintf(fp, "%s\n", buf);
2991 serv_getln(buf, sizeof buf);
2992 if (buf[0] != '4') {
2998 while (fgets(buf, sizeof buf, fp) != NULL) {
2999 buf[strlen(buf)-1] = 0;
3003 if (havebstr("add_button")) {
3004 num_addrs = num_tokens(bstr("line"), ',');
3005 if (num_addrs < 2) {
3006 /* just adding one node or address */
3010 /* adding multiple addresses separated by commas */
3011 for (i=0; i<num_addrs; ++i) {
3012 strcpy(line, bstr("prefix"));
3013 extract_token(buf, bstr("line"), i, ',', sizeof buf);
3016 strcat(line, bstr("suffix"));
3030 * \brief Convert a room name to a folder-ish-looking name.
3031 * \param folder the folderish name
3032 * \param room the room name
3033 * \param floor the floor name
3034 * \param is_mailbox is it a mailbox?
3036 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
3041 * For mailboxes, just do it straight...
3044 sprintf(folder, "My folders|%s", room);
3048 * Otherwise, prefix the floor name as a "public folders" moniker
3051 if (floor > MAX_FLOORS) {
3053 sprintf(folder, "%%%%%%|%s", room);
3056 sprintf(folder, "%s|%s", floorlist[floor], room);
3061 * Replace "\" characters with "|" for pseudo-folder-delimiting
3063 len = strlen (folder);
3064 for (i=0; i<len; ++i) {
3065 if (folder[i] == '\\') folder[i] = '|';
3073 * \brief Back end for change_view()
3074 * \param newview set newview???
3076 void do_change_view(int newview) {
3079 serv_printf("VIEW %d", newview);
3080 serv_getln(buf, sizeof buf);
3081 WC->wc_view = newview;
3082 smart_goto(WC->wc_roomname);
3088 * \brief Change the view for this room
3090 void change_view(void) {
3093 view = lbstr("view");
3094 do_change_view(view);
3099 * \brief One big expanded tree list view --- like a folder list
3100 * \param fold the folder to view
3101 * \param max_folders how many folders???
3102 * \param num_floors hom many floors???
3104 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3108 int has_subfolders = 0;
3111 parents = malloc(max_folders * sizeof(int));
3113 /** BEGIN TREE MENU */
3114 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3116 /** include NanoTree */
3117 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3119 /** initialize NanoTree */
3120 wprintf("<script type=\"text/javascript\"> \n"
3121 " showRootNode = false; \n"
3122 " sortNodes = false; \n"
3123 " dragable = false; \n"
3125 " function standardClick(treeNode) { \n"
3128 " var closedGif = 'static/folder_closed.gif'; \n"
3129 " var openGif = 'static/folder_open.gif'; \n"
3131 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3135 for (i=0; i<max_folders; ++i) {
3138 if ((i+1) < max_folders) {
3140 len = strlen(fold[i].name);
3141 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3142 && (fold[i+1].name[len] == '|') ) {
3147 levels = num_tokens(fold[i].name, '|');
3148 parents[levels] = i;
3150 wprintf("var node%d = new TreeNode(%d, '", i, i);
3152 if (fold[i].selectable) {
3153 wprintf("<a href=\"dotgoto?room=");
3154 urlescputs(fold[i].room);
3159 wprintf("<span class=\"roomlist_floor\">");
3161 else if (fold[i].hasnewmsgs) {
3162 wprintf("<span class=\"roomlist_new\">");
3165 wprintf("<span class=\"roomlist_old\">");
3167 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3172 if (has_subfolders) {
3173 wprintf("new Array(closedGif, openGif)");
3175 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3176 wprintf("'static/viewcontacts_16x.gif'");
3178 else if (fold[i].view == VIEW_CALENDAR) {
3179 wprintf("'static/calarea_16x.gif'");
3181 else if (fold[i].view == VIEW_CALBRIEF) {
3182 wprintf("'static/calarea_16x.gif'");
3184 else if (fold[i].view == VIEW_TASKS) {
3185 wprintf("'static/taskmanag_16x.gif'");
3187 else if (fold[i].view == VIEW_NOTES) {
3188 wprintf("'static/storenotes_16x.gif'");
3190 else if (fold[i].view == VIEW_MAILBOX) {
3191 wprintf("'static/privatemess_16x.gif'");
3194 wprintf("'static/chatrooms_16x.gif'");
3197 urlescputs(fold[i].name);
3201 wprintf("rootNode.addChild(node%d);\n", i);
3204 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3208 wprintf("container = document.getElementById('roomlist_div'); \n"
3214 /** END TREE MENU */
3218 * \brief Boxes and rooms and lists ... oh my!
3219 * \param fold the folder to view
3220 * \param max_folders how many folders???
3221 * \param num_floors hom many floors???
3223 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3225 char floor_name[256];
3226 char old_floor_name[256];
3227 int levels, oldlevels;
3230 static int columns = 3;
3231 int boxes_per_column = 0;
3232 int current_column = 0;
3235 strcpy(floor_name, "");
3236 strcpy(old_floor_name, "");
3239 while (nf % columns != 0) ++nf;
3240 boxes_per_column = (nf / columns);
3241 if (boxes_per_column < 1) boxes_per_column = 1;
3243 /** Outer table (for columnization) */
3244 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3245 "<tr><td valign=top>");
3249 for (i=0; i<max_folders; ++i) {
3251 levels = num_tokens(fold[i].name, '|');
3252 extract_token(floor_name, fold[i].name, 0,
3253 '|', sizeof floor_name);
3255 if ( (strcasecmp(floor_name, old_floor_name))
3256 && (!IsEmptyStr(old_floor_name)) ) {
3258 do_template("endbox", NULL);
3262 if ((num_boxes % boxes_per_column) == 0) {
3264 if (current_column < columns) {
3265 wprintf("</td><td valign=top>\n");
3269 strcpy(old_floor_name, floor_name);
3273 WCTemplputParams SubTP;
3275 Buf = NewStrBufPlain(floor_name, -1);
3276 memset(&SubTP, 0, sizeof(WCTemplputParams));
3277 SubTP.Filter.ContextType = CTX_STRBUF;
3278 SubTP.Context = Buf;
3279 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3288 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3289 if (fold[i].selectable) {
3290 wprintf("<a href=\"dotgoto?room=");
3291 urlescputs(fold[i].room);
3297 if (fold[i].hasnewmsgs) {
3298 wprintf("<span class=\"roomlist_new\">");
3301 wprintf("<span class=\"roomlist_old\">");
3303 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3306 if (fold[i].selectable) {
3312 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3313 wprintf(" (INBOX)");
3315 wprintf("<br />\n");
3318 /** End the final inner box */
3319 do_template("endbox", NULL);
3321 wprintf("</td></tr></table>\n");
3325 * \brief print a floor div???
3326 * \param which_floordiv name of the floordiv???
3328 void set_floordiv_expanded(void) {
3329 wcsession *WCC = WC;
3332 FloorDiv = NewStrBuf();
3333 StrBufExtract_token(FloorDiv, WCC->Hdr->HR.ReqLine, 0, '/');
3334 set_preference("floordiv_expanded", FloorDiv, 1);
3335 WCC->floordiv_expanded = FloorDiv;
3339 * \brief view the iconbar
3340 * \param fold the folder to view
3341 * \param max_folders how many folders???
3342 * \param num_floors hom many floors???
3344 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3346 char floor_name[256];
3347 char old_floor_name[256];
3348 char floordivtitle[256];
3349 char floordiv_id[32];
3350 int levels, oldlevels;
3354 strcpy(floor_name, "");
3355 strcpy(old_floor_name, "");
3359 for (i=0; i<max_folders; ++i) {
3361 levels = num_tokens(fold[i].name, '|');
3362 extract_token(floor_name, fold[i].name, 0,
3363 '|', sizeof floor_name);
3365 if ( (strcasecmp(floor_name, old_floor_name))
3366 && (!IsEmptyStr(old_floor_name)) ) {
3367 /** End inner box */
3369 wprintf("</div>\n"); /** floordiv */
3371 strcpy(old_floor_name, floor_name);
3375 stresc(floordivtitle, 256, floor_name, 0, 0);
3376 sprintf(floordiv_id, "floordiv%d", i);
3377 wprintf("<span class=\"ib_roomlist_floor\" "
3378 "onClick=\"expand_floor('%s')\">"
3379 "%s</span><br>\n", floordiv_id, floordivtitle);
3380 wprintf("<div id=\"%s\" style=\"display:%s\">",
3382 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3389 wprintf("<div id=\"roomdiv%d\">", i);
3391 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3393 /** choose the icon */
3394 if (fold[i].view == VIEW_ADDRESSBOOK) {
3395 icon = "viewcontacts_16x.gif" ;
3397 else if (fold[i].view == VIEW_CALENDAR) {
3398 icon = "calarea_16x.gif" ;
3400 else if (fold[i].view == VIEW_CALBRIEF) {
3401 icon = "calarea_16x.gif" ;
3403 else if (fold[i].view == VIEW_TASKS) {
3404 icon = "taskmanag_16x.gif" ;
3406 else if (fold[i].view == VIEW_NOTES) {
3407 icon = "storenotes_16x.gif" ;
3409 else if (fold[i].view == VIEW_MAILBOX) {
3410 icon = "privatemess_16x.gif" ;
3413 icon = "chatrooms_16x.gif" ;
3416 if (fold[i].selectable) {
3417 wprintf("<a href=\"dotgoto?room=");
3418 urlescputs(fold[i].room);
3420 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3425 if (fold[i].hasnewmsgs) {
3426 wprintf("<span class=\"ib_roomlist_new\">");
3429 wprintf("<span class=\"ib_roomlist_old\">");
3431 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3433 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3434 wprintf(" (INBOX)");
3437 if (fold[i].selectable) {
3444 wprintf("</div>\n"); /** roomdiv */
3447 wprintf("</div>\n"); /** floordiv */
3455 * \brief Burn the cached folder list.
3456 * \param age How old the cahce needs to be before we burn it.
3459 void burn_folder_cache(time_t age)
3461 /** If our cached folder list is very old, burn it. */
3462 if (WC->cache_fold != NULL) {
3463 if ((time(NULL) - WC->cache_timestamp) > age) {
3464 free(WC->cache_fold);
3465 WC->cache_fold = NULL;
3474 * \brief Show the room list.
3475 * (only should get called by
3476 * knrooms() because that's where output_headers() is called from)
3477 * \param viewpref the view preferences???
3480 void list_all_rooms_by_floor(const char *viewpref) {
3484 struct folder *fold = NULL;
3486 int max_folders = 0;
3487 int alloc_folders = 0;
3491 int ShowEmptyFloors;
3494 int num_floors = 1; /** add an extra one for private folders */
3497 /** If our cached folder list is very old, burn it. */
3498 burn_folder_cache(300);
3500 /** Can we do the iconbar roomlist from cache? */
3501 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3502 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3507 /** Grab the floor table so we know how to build the list... */
3508 load_floorlist(Buf);
3510 /** Start with the mailboxes */
3513 fold = malloc(sizeof(struct folder));
3514 memset(fold, 0, sizeof(struct folder));
3515 strcpy(fold[0].name, "My folders");
3516 fold[0].is_mailbox = 1;
3518 /** Then add floors */
3520 serv_getln(buf, sizeof buf);
3521 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3522 if (max_folders >= alloc_folders) {
3523 alloc_folders = max_folders + 100;
3524 fold = realloc(fold,
3525 alloc_folders * sizeof(struct folder));
3527 memset(&fold[max_folders], 0, sizeof(struct folder));
3528 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3529 extract_token(buf3, buf, 0, '|', SIZ);
3530 fold[max_folders].floor = atol (buf3);
3535 for (i=0; i<num_floors; i++)
3536 if (IDMax < fold[i].floor)
3537 IDMax = fold[i].floor;
3538 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3539 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3540 for (i=0; i<num_floors; i++)
3541 floor_mapping[fold[i].floor]=i;
3543 /** refresh the messages index for this room */
3544 /* TODO serv_puts("GOTO ");
3545 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3546 /** Now add rooms */
3548 serv_getln(buf, sizeof buf);
3549 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3550 if (max_folders >= alloc_folders) {
3551 alloc_folders = max_folders + 100;
3552 fold = realloc(fold,
3553 alloc_folders * sizeof(struct folder));
3555 memset(&fold[max_folders], 0, sizeof(struct folder));
3556 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3557 ra_flags = extract_int(buf, 5);
3558 flags = extract_int(buf, 1);
3559 fold[max_folders].floor = extract_int(buf, 2);
3560 fold[max_folders].hasnewmsgs =
3561 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3562 if (flags & QR_MAILBOX) {
3563 fold[max_folders].is_mailbox = 1;
3565 fold[max_folders].view = extract_int(buf, 6);
3566 room_to_folder(fold[max_folders].name,
3567 fold[max_folders].room,
3568 fold[max_folders].floor,
3569 fold[max_folders].is_mailbox);
3570 fold[max_folders].selectable = 1;
3571 /* Increase the room count for the associtaed floor */
3572 if (fold[max_folders].is_mailbox) {
3573 fold[0].num_rooms++;
3576 i = floor_mapping[fold[max_folders].floor];
3577 fold[i].num_rooms++;
3583 * Remove any floors that don't have rooms
3585 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3586 if (ShowEmptyFloors)
3588 for (i=0; i<num_floors; i++)
3590 if (fold[i].num_rooms == 0) {
3591 for (j=i; j<max_folders; j++) {
3592 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3601 /** Bubble-sort the folder list */
3602 for (i=0; i<max_folders; ++i) {
3603 for (j=0; j<(max_folders-1)-i; ++j) {
3604 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3605 swap = strcasecmp(fold[j].name, fold[j+1].name);
3608 if ( (fold[j+1].is_mailbox)
3609 && (!fold[j].is_mailbox)) {
3617 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3618 memcpy(&fold[j], &fold[j+1],
3619 sizeof(struct folder));
3620 memcpy(&fold[j+1], &ftmp,
3621 sizeof(struct folder));
3627 if (!strcasecmp(viewpref, "folders")) {
3628 do_folder_view(fold, max_folders, num_floors);
3630 else if (!strcasecmp(viewpref, "hackish_view")) {
3631 for (i=0; i<max_folders; ++i) {
3632 escputs(fold[i].name);
3633 wprintf("<br />\n");
3636 else if (!strcasecmp(viewpref, "iconbar")) {
3637 do_iconbar_view(fold, max_folders, num_floors);
3640 do_rooms_view(fold, max_folders, num_floors);
3643 /* Don't free the folder list ... cache it for future use! */
3644 if (WC->cache_fold != NULL) {
3645 free(WC->cache_fold);
3647 WC->cache_fold = fold;
3648 WC->cache_max_folders = max_folders;
3649 WC->cache_num_floors = num_floors;
3650 WC->cache_timestamp = time(NULL);
3651 free(floor_mapping);
3656 * \brief Do either a known rooms list or a folders list, depending on the
3661 StrBuf *ListView = NULL;
3663 output_headers(1, 1, 2, 0, 0, 0);
3665 /** Determine whether the user is trying to change views */
3666 if (havebstr("view")) {
3667 ListView = NewStrBufPlain(bstr("view"), -1);
3668 set_preference("roomlistview", ListView, 1);
3670 /** Sanitize the input so its safe */
3671 if(!get_preference("roomlistview", &ListView) ||
3672 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3673 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3675 if (ListView == NULL) {
3676 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3677 set_preference("roomlistview", ListView, 0);
3680 StrBufPrintf(ListView, "rooms");
3686 wprintf("<div id=\"banner\">\n");
3687 wprintf("<div class=\"room_banner\" id=\"room_banner\">");
3689 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3690 wprintf(_("Room list"));
3692 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3693 wprintf(_("Folder list"));
3695 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3696 wprintf(_("Room list"));
3698 wprintf("</h1></div>\n");
3700 /** offer the ability to switch views */
3701 wprintf("<div id=\"actiondiv\">");
3702 wprintf("<ul class=\"room_actions\">\n");
3703 wprintf("<li class=\"start_page\">");
3704 offer_start_page(NULL, &NoCtx);
3706 wprintf("<li><form name=\"roomlistomatic\">\n"
3707 "<select name=\"newview\" size=\"1\" "
3708 "OnChange=\"location.href=roomlistomatic.newview.options"
3709 "[selectedIndex].value\">\n");
3711 wprintf("<option %s value=\"knrooms?view=rooms\">"
3714 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3717 wprintf("<option %s value=\"knrooms?view=folders\">"
3718 "View as folder list"
3720 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3723 wprintf("</select>");
3724 wprintf("</form></li>");
3725 wprintf("</ul></div></div>\n");
3727 wprintf("<div id=\"content\" class=\"service\">\n");
3729 /** Display the room list in the user's preferred format */
3730 list_all_rooms_by_floor(ChrPtr(ListView));
3737 * \brief Set the message expire policy for this room and/or floor
3739 void set_room_policy(void) {
3742 if (!havebstr("ok_button")) {
3743 strcpy(WC->ImportantMessage,
3744 _("Cancelled. Changes were not saved."));
3749 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3750 serv_getln(buf, sizeof buf);
3751 strcpy(WC->ImportantMessage, &buf[4]);
3753 if (WC->axlevel >= 6) {
3754 strcat(WC->ImportantMessage, "<br />\n");
3755 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3756 serv_getln(buf, sizeof buf);
3757 strcat(WC->ImportantMessage, &buf[4]);
3763 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3764 /* todo: check context */
3770 floors = NewHash(1, NULL);
3772 serv_puts("LFLR"); /* get floors */
3773 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
3774 if (GetServerStatus(Buf, NULL) == 1)
3775 while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3777 const StrBuf *floorNum = NULL;
3778 floor = NewHash(1, NULL);
3779 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3781 StrBufExtract_token(Buf2, Buf, a, '|');
3783 floorNum = Buf2; /* hmm, should we copy Buf2 first? */
3786 Put(floor, CKEY(FLOOR_PARAM_NAMES[a]), Buf2, HFreeStrBuf);
3788 Put(floors, SKEY(floorNum), floor, HDeleteHash);
3794 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3797 HashList *floor = (HashList *)(TP->Context);
3799 GetHash(floor, TKEY(0), &value);
3800 val = (StrBuf *)value;
3801 StrECMAEscAppend(TemplBuffer, val, 0);
3803 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP)
3806 return GetRoomListHash(Target, TP);
3808 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
3810 /* TODO: Check context */
3817 rooms = NewHash(1, NULL);
3818 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3819 if (GetServerStatus(buf, NULL) == 1)
3820 while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3822 StrBuf *rmName = NULL;
3823 room = NewHash(1, NULL);
3824 for(i=0; i<ROOM_PARAM_LEN; i++) {
3826 StrBufExtract_token(buf2, buf, i, '|');
3830 Put(room, CKEY(ROOM_PARAM_NAMES[i]), buf2, HFreeStrBuf);
3832 Put(rooms, SKEY(rmName), room, HDeleteHash);
3834 SortByHashKey(rooms, 1);
3835 /*SortByPayload(rooms, SortRoomsByListOrder); */
3839 /** Unused function that orders rooms by the listorder flag */
3840 int SortRoomsByListOrder(const void *room1, const void *room2)
3844 HashList *r1 = (HashList *)GetSearchPayload(room1);
3845 HashList *r2 = (HashList *)GetSearchPayload(room2);
3846 StrBuf *listOrderBuf1;
3847 StrBuf *listOrderBuf2;
3849 GetHash(r1, CKEY(ROOM_PARAM_NAMES[3]), (void *)&listOrderBuf1);
3850 GetHash(r2, CKEY(ROOM_PARAM_NAMES[3]), (void *)&listOrderBuf2);
3851 l1 = atoi(ChrPtr(listOrderBuf1));
3852 l2 = atoi(ChrPtr(listOrderBuf2));
3853 if (l1 < l2) return -1;
3854 else if (l1 > l2) return +1;
3857 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3861 HashList *room = (HashList *)(TP->Context);
3863 GetHash(room, TKEY(0), &value);
3864 val = (StrBuf *)value;
3865 StrECMAEscAppend(TemplBuffer, val, 0);
3867 void jsonRoomFlr(void)
3869 /* Send as our own (application/json) content type */
3870 hprintf("HTTP/1.1 200 OK\r\n");
3871 hprintf("Content-type: application/json; charset=utf-8\r\n");
3872 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
3873 hprintf("Connection: close\r\n");
3874 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3876 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3880 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3882 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3885 void _gotonext(void) {
3890 void dotskip(void) {
3891 lprintf(9, "%s:%d dotskip?room=%s\n", __FILE__, __LINE__, ChrPtr(sbstr("room")));
3892 smart_goto(sbstr("room"));
3895 void _display_private(void) {
3896 display_private("", 0);
3899 void dotgoto(void) {
3900 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3903 smart_goto(sbstr("room"));
3906 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3908 wprintf("<div id=\"banner\">\n");
3909 embed_room_banner(NULL, navbar_default);
3910 wprintf("</div>\n");
3914 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3916 wcsession *WCC = WC;
3919 (!IsEmptyStr(WCC->ugname)))
3920 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3924 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3926 wcsession *WCC = WC;
3928 return ((WCC!=NULL) &&
3929 (!IsEmptyStr(WCC->ugname)) &&
3930 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3933 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3935 wcsession *WCC = WC;
3937 return ((WCC!=NULL) &&
3938 ((WCC->room_flags & QR_PERMANENT) != 0));
3941 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3943 wcsession *WCC = WC;
3945 return ((WCC!=NULL) &&
3946 ((WCC->room_flags & QR_INUSE) != 0));
3949 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3951 wcsession *WCC = WC;
3953 return ((WCC!=NULL) &&
3954 ((WCC->room_flags & QR_PRIVATE) != 0));
3957 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3959 wcsession *WCC = WC;
3961 return ((WCC!=NULL) &&
3962 ((WCC->room_flags & QR_PASSWORDED) != 0));
3965 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3967 wcsession *WCC = WC;
3969 return ((WCC!=NULL) &&
3970 ((WCC->room_flags & QR_GUESSNAME) != 0));
3973 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3975 wcsession *WCC = WC;
3977 return ((WCC!=NULL) &&
3978 ((WCC->room_flags & QR_DIRECTORY) != 0));
3981 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3983 wcsession *WCC = WC;
3985 return ((WCC!=NULL) &&
3986 ((WCC->room_flags & QR_UPLOAD) != 0));
3989 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3991 wcsession *WCC = WC;
3993 return ((WCC!=NULL) &&
3994 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3997 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3999 wcsession *WCC = WC;
4001 return ((WCC!=NULL) &&
4002 ((WCC->room_flags & QR_VISDIR) != 0));
4005 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
4007 wcsession *WCC = WC;
4009 return ((WCC!=NULL) &&
4010 ((WCC->room_flags & QR_ANONONLY) != 0));
4013 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
4015 wcsession *WCC = WC;
4017 return ((WCC!=NULL) &&
4018 ((WCC->room_flags & QR_ANONOPT) != 0));
4021 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
4023 wcsession *WCC = WC;
4025 return ((WCC!=NULL) &&
4026 ((WCC->room_flags & QR_NETWORK) != 0));
4029 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
4031 wcsession *WCC = WC;
4033 return ((WCC!=NULL) &&
4034 ((WCC->room_flags & QR_PREFONLY) != 0));
4037 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
4039 wcsession *WCC = WC;
4041 return ((WCC!=NULL) &&
4042 ((WCC->room_flags & QR_READONLY) != 0));
4045 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
4047 wcsession *WCC = WC;
4049 return ((WCC!=NULL) &&
4050 ((WCC->room_flags & QR_MAILBOX) != 0));
4054 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
4056 wcsession *WCC = WC;
4058 return ( (WCC!= NULL) &&
4059 ((WCC->axlevel >= 6) ||
4060 (WCC->is_room_aide) ||
4061 (WCC->is_mailbox) ));
4064 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
4066 wcsession *WCC = WC;
4068 if ((WCC == NULL) ||
4069 (TP->Tokens->nParameters < 3) ||
4070 (TP->Tokens->Params[2]->Type != TYPE_STR)||
4071 (TP->Tokens->Params[2]->len < 7))
4074 switch(WCC->wc_view) {
4076 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
4078 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
4079 case VIEW_ADDRESSBOOK:
4080 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
4082 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
4084 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
4086 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
4088 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
4090 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
4092 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
4102 RegisterPreference("roomlistview",
4103 _("Room list view"),
4106 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
4108 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
4110 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
4111 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
4112 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
4113 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4114 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4115 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4116 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4117 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4118 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4119 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4120 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4121 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4122 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4123 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4124 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4125 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4126 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4127 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4128 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4129 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4130 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4131 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4132 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4133 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4134 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4136 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
4137 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4138 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4139 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4140 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4141 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4142 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4143 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4144 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4145 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4146 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4147 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4148 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4149 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4150 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4151 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4153 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4154 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4156 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4157 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4158 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4159 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, DeleteHash, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4160 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);
4166 SessionDestroyModule_ROOMOPS
4169 if (sess->cache_fold != NULL) {
4170 free(sess->cache_fold);
4173 free_march_list(sess);