3 * Lots of different room-related operations.
9 char floorlist[MAX_FLOORS][SIZ]; /**< list of our floor names */
11 char *viewdefs[9]; /**< the different kinds of available views */
13 /** See GetFloorListHash and GetRoomListHash for info on these. Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys. */
14 const char FLOOR_PARAM_NAMES[(FLOOR_PARAM_LEN + 1)][15] = {"ID",
17 const char ROOM_PARAM_NAMES[(ROOM_PARAM_LEN + 1)][20] = {"NAME",
25 /* Because avoiding strlen at run time is a Good Thing(TM) */
26 const int FLOOR_PARAM_NAMELEN[(FLOOR_PARAM_LEN +1)] = {2, 4, 5};
27 const int ROOM_PARAM_NAMELEN[(ROOM_PARAM_LEN +1)] = {4, 4, 5, 9, 3, 7, 7, 8};
29 void display_whok(void);
32 * Initialize the viewdefs with localized strings
34 void initialize_viewdefs(void) {
35 viewdefs[0] = _("Bulletin Board");
36 viewdefs[1] = _("Mail Folder");
37 viewdefs[2] = _("Address Book");
38 viewdefs[3] = _("Calendar");
39 viewdefs[4] = _("Task List");
40 viewdefs[5] = _("Notes List");
41 viewdefs[6] = _("Wiki");
42 viewdefs[7] = _("Calendar List");
43 viewdefs[8] = _("Journal");
47 * Determine which views are allowed as the default for creating a new room.
49 int is_view_allowed_as_default(int which_view)
52 case VIEW_BBS: return(1);
53 case VIEW_MAILBOX: return(1);
54 case VIEW_ADDRESSBOOK: return(1);
55 case VIEW_CALENDAR: return(1);
56 case VIEW_TASKS: return(1);
57 case VIEW_NOTES: return(1);
60 case VIEW_WIKI: return(1);
61 #else /* TECH_PREVIEW */
62 case VIEW_WIKI: return(0); /* because it isn't finished yet */
63 #endif /* TECH_PREVIEW */
65 case VIEW_CALBRIEF: return(0);
66 case VIEW_JOURNAL: return(0);
67 default: return(0); /* should never get here */
73 * load the list of floors
75 void load_floorlist(StrBuf *Buf)
80 for (a = 0; a < MAX_FLOORS; ++a)
84 StrBuf_ServGetln(Buf);
85 if (GetServerStatus(Buf, NULL) != 1) {
86 strcpy(floorlist[0], "Main Floor");
89 while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
90 if ( (StrLength(Buf)==3) &&
91 !strcmp(ChrPtr(Buf), "000")) {
95 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
101 * Free a session's march list
103 void free_march_list(wcsession *wcf)
107 while (wcf->march != NULL) {
108 mptr = wcf->march->next;
118 * remove a room from the march list
120 void remove_march(const StrBuf *aaa)
122 struct march *mptr, *mptr2;
124 if (WC->march == NULL)
127 if (!strcasecmp(WC->march->march_name, ChrPtr(aaa))) {
128 mptr = WC->march->next;
134 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
135 if (!strcasecmp(mptr->march_name, ChrPtr(aaa))) {
136 mptr2->next = mptr->next;
149 * display rooms in tree structure
151 void room_tree_list(struct roomlisting *rp)
160 room_tree_list(rp->lnext);
162 strcpy(rmname, rp->rlname);
165 wprintf("<a href=\"dotgoto&room=");
169 escputs1(rmname, 1, 1);
170 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
172 else if (f & QR_DIRECTORY)
174 else if (f & QR_NETWORK)
178 wprintf("</a><tt> </tt>\n");
180 room_tree_list(rp->rnext);
186 * \brief Room ordering stuff (compare first by floor, then by order)
187 * \param r1 first roomlist to compare
188 * \param r2 second roomlist co compare
189 * \return are they the same???
191 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
193 if ((r1 == NULL) && (r2 == NULL))
199 if (r1->rlfloor < r2->rlfloor)
201 if (r1->rlfloor > r2->rlfloor)
203 if (r1->rlorder < r2->rlorder)
205 if (r1->rlorder > r2->rlorder)
212 * \brief Common code for all room listings
213 * \param variety what???
215 void listrms(char *variety)
220 struct roomlisting *rl = NULL;
221 struct roomlisting *rp;
222 struct roomlisting *rs;
224 /** Ask the server for a room list */
226 serv_getln(buf, sizeof buf);
232 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
234 rp = malloc(sizeof(struct roomlisting));
235 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
236 rp->rlflags = extract_int(buf, 1);
237 rp->rlfloor = extract_int(buf, 2);
238 rp->rlorder = extract_int(buf, 3);
247 if (rordercmp(rp, rs) < 0) {
248 if (rs->lnext == NULL) {
255 if (rs->rnext == NULL) {
268 * If no rooms were listed, print an nbsp to make the cell
269 * borders show up anyway.
271 if (num_rooms == 0) wprintf(" ");
276 * \brief list all forgotten rooms
278 void zapped_list(void)
280 WCTemplputParams SubTP;
283 output_headers(1, 1, 1, 0, 0, 0);
284 memset(&SubTP, 0, sizeof(WCTemplputParams));
285 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
286 SubTP.Filter.ContextType = CTX_STRBUF;
288 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
294 wprintf("<br /><br />\n");
295 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
296 do_template("endbox", NULL);
302 * \brief read this room's info file (set v to 1 for verbose mode)
304 void readinfo(StrBuf *Target, WCTemplputParams *TP)
309 int fullinfo_len = 0;
312 serv_getln(buf, sizeof buf);
315 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
316 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
317 strcpy(&fullinfo[fullinfo_len], buf);
318 fullinfo_len += strlen(buf);
322 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
323 strcpy(&briefinfo[50], "...");
325 wprintf("<div class=\"infos\" "
326 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
329 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
330 wprintf("<img class=\"close_infos\" "
331 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
332 "src=\"static/closewindow.gif\" alt=\"%s\">",
347 * \brief Display room banner icon.
348 * The server doesn't actually
349 * need the room name, but we supply it in order to
350 * keep the browser from using a cached icon from
353 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
357 serv_puts("OIMG _roompic_");
358 serv_getln(buf, sizeof buf);
360 wprintf("<img height=\"64px\" src=\"image&name=_roompic_&room=");
361 urlescputs(ChrPtr(WC->wc_roomname));
364 serv_getln(buf, sizeof buf);
366 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
367 wprintf("<img class=\"roompic\" alt=\"\" src=\""
368 "static/viewcontacts_48x.gif"
372 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
373 wprintf("<img class=\"roompic\" alt=\"\" src=\""
374 "static/calarea_48x.gif"
378 else if (WC->wc_view == VIEW_TASKS) {
379 wprintf("<img class=\"roompic\" alt=\"\" src=\""
380 "static/taskmanag_48x.gif"
384 else if (WC->wc_view == VIEW_NOTES) {
385 wprintf("<img class=\"roompic\" alt=\"\" src=\""
386 "static/storenotes_48x.gif"
390 else if (WC->wc_view == VIEW_MAILBOX) {
391 wprintf("<img class=\"roompic\" alt=\"\" src=\""
392 "static/privatemess_48x.gif"
397 wprintf("<img class=\"roompic\" alt=\"\" src=\""
398 "static/chatrooms_48x.gif"
408 * \brief Display the current view and offer an option to change it
410 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
414 wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
415 wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
416 wprintf("<label for=\"view_name\">");
417 wprintf(_("View as:"));
419 "<select name=\"newview\" size=\"1\" "
420 "id=\"view_name\" class=\"selectbox\" "
421 "OnChange=\"location.href=viewomatic.newview.options"
422 "[selectedIndex].value\">\n");
424 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
426 * Only offer the views that make sense, given the default
427 * view for the room. For example, don't offer a Calendar
428 * view in a non-Calendar room.
432 || (i == WC->wc_default_view) /**< default */
433 || ( (i == 0) && (WC->wc_default_view == 1) ) /**< mail or bulletin */
434 || ( (i == 1) && (WC->wc_default_view == 0) ) /**< mail or bulletin */
435 /** || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */
438 wprintf("<option %s value=\"changeview?view=%d\">",
439 ((i == WC->wc_view) ? "selected" : ""),
441 escputs(viewdefs[i]);
442 wprintf("</option>\n");
445 wprintf("</select></div></form>\n");
450 * \brief Display a search box
452 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
454 wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
455 wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
456 wprintf("<label for=\"srchquery\">");
457 wprintf(_("Search: "));
458 wprintf("</label><input ");
459 wprintf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
460 wprintf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
462 wprintf("</div></form>\n");
467 * \brief Embed the room banner
469 * \param got The information returned from a GOTO server command
470 * \param navbar_style Determines which navigation buttons to display
474 void embed_room_banner(char *got, int navbar_style) {
478 char with_files[256];
482 * We need to have the information returned by a GOTO server command.
483 * If it isn't supplied, we fake it by issuing our own GOTO.
486 memset(buf, '0', 20);
488 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
489 serv_getln(buf, sizeof buf);
493 /** The browser needs some information for its own use */
494 wprintf("<script type=\"text/javascript\"> \n"
495 " room_is_trash = %d; \n"
501 * If the user happens to select the "make this my start page" link,
502 * we want it to remember the URL as a "/dotskip" one instead of
503 * a "skip" or "gotonext" or something like that.
505 if (WCC->Hdr->this_page == NULL)
506 WCC->Hdr->this_page = NewStrBuf();
507 StrBufPrintf(WCC->Hdr->this_page,
509 ChrPtr(WC->wc_roomname));
511 /** Check for new mail. */
512 WC->new_mail = extract_int(&got[4], 9);
513 WC->wc_view = extract_int(&got[4], 11);
515 /* Is this a directory room and does it contain files and how many? */
516 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
519 serv_getln(buf2, sizeof buf2);
520 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
522 snprintf (with_files, sizeof with_files,
523 "; <a href=\"do_template?template=files\"> %d %s </a>",
525 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
528 strcpy (with_files, "");
530 svprintf(HKEY("NUMMSGS"), WCS_STRING,
531 _("%d new of %d messages%s"),
532 extract_int(&got[4], 1),
533 extract_int(&got[4], 2),
536 svcallback("ROOMPIC", embed_room_graphic);
537 svcallback("ROOMINFO", readinfo);
538 svcallback("VIEWOMATIC", embed_view_o_matic);
539 svcallback("SEARCHOMATIC", embed_search_o_matic);
540 svcallback("START", offer_start_page);
542 do_template("roombanner", NULL);
543 /* roombanner contains this for mobile */
544 if (navbar_style != navbar_none && !WC->is_mobile) {
546 wprintf("<div id=\"navbar\"><ul>");
548 if (navbar_style == navbar_default) wprintf(
549 "<li class=\"ungoto\">"
550 "<a href=\"ungoto\">"
551 "<img src=\"static/ungoto2_24x.gif\" alt=\"\">"
552 "<span class=\"navbar_link\">%s</span></A>"
553 "</li>\n", _("Ungoto")
556 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
558 "<li class=\"newmess\">"
559 "<a href=\"readnew\">"
560 "<img src=\"static/newmess2_24x.gif\" alt=\"\">"
561 "<span class=\"navbar_link\">%s</span></A>"
562 "</li>\n", _("Read new messages")
566 if (navbar_style == navbar_default) {
567 switch(WC->wc_view) {
568 case VIEW_ADDRESSBOOK:
570 "<li class=\"viewcontacts\">"
571 "<a href=\"readfwd\">"
572 "<img src=\"static/viewcontacts_24x.gif\" "
574 "<span class=\"navbar_link\">"
576 "</span></a></li>\n", _("View contacts")
581 "<li class=\"staskday\">"
582 "<a href=\"readfwd?calview=day\">"
583 "<img src=\"static/taskday2_24x.gif\" "
585 "<span class=\"navbar_link\">"
587 "</span></a></li>\n", _("Day view")
590 "<li class=\"monthview\">"
591 "<a href=\"readfwd?calview=month\">"
592 "<img src=\"static/monthview2_24x.gif\" "
594 "<span class=\"navbar_link\">"
596 "</span></a></li>\n", _("Month view")
601 "<li class=\"monthview\">"
602 "<a href=\"readfwd?calview=month\">"
603 "<img src=\"static/monthview2_24x.gif\" "
605 "<span class=\"navbar_link\">"
607 "</span></a></li>\n", _("Calendar list")
612 "<li class=\"taskmanag\">"
613 "<a href=\"readfwd\">"
614 "<img src=\"static/taskmanag_24x.gif\" "
616 "<span class=\"navbar_link\">"
618 "</span></a></li>\n", _("View tasks")
623 "<li class=\"viewnotes\">"
624 "<a href=\"readfwd\">"
625 "<img src=\"static/viewnotes_24x.gif\" "
627 "<span class=\"navbar_link\">"
629 "</span></a></li>\n", _("View notes")
634 "<li class=\"readallmess\">"
635 "<a id=\"m_refresh\" href=\"readfwd\">"
636 "<img src=\"static/readallmess3_24x.gif\" "
638 "<span class=\"navbar_link\">"
640 "</span></a></li>\n", _("Refresh message list")
645 "<li class=\"readallmess\">"
646 "<a href=\"readfwd\">"
647 "<img src=\"static/readallmess3_24x.gif\" "
649 "<span class=\"navbar_link\">"
651 "</span></a></li>\n", _("Wiki home")
656 "<li class=\"readallmess\">"
657 "<a href=\"readfwd?startmsg=20&maxmsgs=20&is_summary=0&SortBy=date&SortOrder=2\">"
658 "<img src=\"static/readallmess3_24x.gif\" "
660 "<span class=\"navbar_link\">"
662 "</span></a></li>\n", _("Read all messages")
668 if (navbar_style == navbar_default) {
669 switch(WC->wc_view) {
670 case VIEW_ADDRESSBOOK:
672 "<li class=\"addnewcontact\">"
673 "<a href=\"display_enter\">"
674 "<img src=\"static/addnewcontact_24x.gif\" "
675 "alt=\"\"><span class=\"navbar_link\">"
677 "</span></a></li>\n", _("Add new contact")
682 wprintf("<li class=\"addevent\"><a href=\"display_enter");
683 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
684 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
685 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
687 "<img src=\"static/addevent_24x.gif\" "
688 "alt=\"\"><span class=\"navbar_link\">"
690 "</span></a></li>\n", _("Add new event")
695 "<li class=\"newmess\">"
696 "<a href=\"display_enter\">"
697 "<img src=\"static/newmess3_24x.gif\" "
698 "alt=\"\"><span class=\"navbar_link\">"
700 "</span></a></li>\n", _("Add new task")
705 "<li class=\"enternewnote\">"
706 "<a href=\"add_new_note\">"
707 "<img src=\"static/enternewnote_24x.gif\" "
708 "alt=\"\"><span class=\"navbar_link\">"
710 "</span></a></li>\n", _("Add new note")
714 safestrncpy(buf, bstr("page"), sizeof buf);
717 "<li class=\"newmess\">"
718 "<a href=\"display_enter?wikipage=%s\">"
719 "<img src=\"static/newmess3_24x.gif\" "
720 "alt=\"\"><span class=\"navbar_link\">"
722 "</span></a></li>\n", buf, _("Edit this page")
727 "<li class=\"newmess\">"
728 "<a href=\"display_enter\">"
729 "<img src=\"static/newmess3_24x.gif\" "
730 "alt=\"\"><span class=\"navbar_link\">"
732 "</span></a></li>\n", _("Write mail")
735 "<li class=\"newmess\">"
736 "<a href=\"javascript:deleteAllSelectedMessages();\">"
737 "<img src=\"static/delete.gif\" "
738 "alt=\"\"><span class=\"navbar_link\">"
740 "</span></a></li>\n", _("Delete")
745 "<li class=\"newmess\">"
746 "<a href=\"display_enter\">"
747 "<img src=\"static/newmess3_24x.gif\" "
748 "alt=\"\"><span class=\"navbar_link\">"
750 "</span></a></li>\n", _("Enter a message")
756 if (navbar_style == navbar_default) wprintf(
757 "<li class=\"skipthisroom\">"
760 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\">"
761 "<span class=\"navbar_link\">%s</span></a>"
763 _("Leave all messages marked as unread, go to next room with unread messages"),
767 if (navbar_style == navbar_default) wprintf(
768 "<li class=\"markngo\">"
769 "<a href=\"gotonext\" "
771 "<img src=\"static/markngo_24x.gif\" alt=\"\">"
772 "<span class=\"navbar_link\">%s</span></a>"
774 _("Mark all messages as read, go to next room with unread messages"),
778 wprintf("</ul></div>\n");
785 * back end routine to take the session to a new room
787 long gotoroom(const StrBuf *gname)
790 static long ls = (-1L);
793 /* store ungoto information */
794 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
797 /** move to the new room */
798 serv_printf("GOTO %s", ChrPtr(gname));
799 StrBuf_ServGetln(Buf);
800 if (GetServerStatus(Buf, &err) != 2) {
801 serv_puts("GOTO _BASEROOM_");
802 StrBuf_ServGetln(Buf);
804 * well, we know that this is the fallback case,
805 * but we're interested that the first command
806 * didn't work out in first place.
808 if (GetServerStatus(Buf, NULL) != 2) {
814 if (WC->wc_roomname == NULL)
815 WC->wc_roomname = NewStrBuf();
817 FlushStrBuf(WC->wc_roomname);
819 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
820 StrBufCutLeft(WC->wc_roomname, 4);
821 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
822 /* highest_msg_read = extract_int(&buf[4],6);
823 maxmsgnum = extract_int(&buf[4],5);
825 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
826 ls = StrBufExtract_long(Buf, 6, '|');
827 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
828 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
829 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
830 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
831 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
834 WC->is_room_aide = WC->is_aide;
836 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
838 remove_march(WC->wc_roomname);
839 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
848 * \brief Locate the room on the march list which we most want to go to.
850 * is measured given a "weight" of preference based on various factors.
851 * \param desired_floor the room number on the citadel server
852 * \return the roomname
854 char *pop_march(int desired_floor)
856 static char TheRoom[128];
858 int TheOrder = 32767;
861 struct march *mptr = NULL;
863 strcpy(TheRoom, "_BASEROOM_");
864 if (WC->march == NULL)
867 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
869 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
870 weight = weight + 10000;
871 if (mptr->march_floor == desired_floor)
872 weight = weight + 5000;
874 weight = weight + ((128 - (mptr->march_floor)) * 128);
875 weight = weight + (128 - (mptr->march_order));
877 if (weight > TheWeight) {
879 strcpy(TheRoom, mptr->march_name);
880 TheFloor = mptr->march_floor;
881 TheOrder = mptr->march_order;
890 * Goto next room having unread messages.
892 * We want to skip over rooms that the user has already been to, and take the
893 * user back to the lobby when done. The room we end up in is placed in
894 * newroom - which is set to 0 (the lobby) initially.
895 * We start the search in the current room rather than the beginning to prevent
896 * two or more concurrent users from dragging each other back to the same room.
901 struct march *mptr = NULL;
902 struct march *mptr2 = NULL;
908 * First check to see if the march-mode list is already allocated.
909 * If it is, pop the first room off the list and go there.
912 if (WC->march == NULL) {
914 serv_getln(buf, sizeof buf);
916 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
917 if (IsEmptyStr(buf)) {
920 if (ELoop % 100 == 0)
925 extract_token(room_name, buf, 0, '|', sizeof room_name);
926 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
927 mptr = (struct march *) malloc(sizeof(struct march));
929 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
930 mptr->march_floor = extract_int(buf, 2);
931 mptr->march_order = extract_int(buf, 3);
932 if (WC->march == NULL)
941 * add _BASEROOM_ to the end of the march list, so the user will end up
942 * in the system base room (usually the Lobby>) at the end of the loop
944 mptr = (struct march *) malloc(sizeof(struct march));
946 mptr->march_order = 0;
947 mptr->march_floor = 0;
948 strcpy(mptr->march_name, "_BASEROOM_");
949 if (WC->march == NULL) {
953 while (mptr2->next != NULL)
958 * ...and remove the room we're currently in, so a <G>oto doesn't make us
959 * walk around in circles
961 remove_march(WC->wc_roomname);
963 if (WC->march != NULL) {
964 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
966 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
970 smart_goto(next_room);
971 FreeStrBuf(&next_room);
978 void smart_goto(const StrBuf *next_room) {
986 * mark all messages in current room as having been read
988 void slrp_highest(void)
992 serv_puts("SLRP HIGHEST");
993 serv_getln(buf, sizeof buf);
998 * un-goto the previous room
1004 if (!strcmp(WC->ugname, "")) {
1005 smart_goto(WC->wc_roomname);
1008 serv_printf("GOTO %s", WC->ugname);
1010 StrBuf_ServGetln(Buf);
1011 if (GetServerStatus(Buf, NULL) != 2) {
1012 smart_goto(WC->wc_roomname);
1016 if (WC->uglsn >= 0L) {
1017 serv_printf("SLRP %ld", WC->uglsn);
1018 StrBuf_ServGetln(Buf);
1021 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1022 strcpy(WC->ugname, "");
1027 typedef struct __room_states {
1042 * Set/clear/read the "self-service list subscribe" flag for a room
1044 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1045 * returns the new value.
1048 int self_service(int newval) {
1049 int current_value = 0;
1055 int flags, floor, order, view, flags2;
1058 serv_getln(buf, sizeof buf);
1059 if (buf[0] != '2') return(0);
1061 extract_token(name, &buf[4], 0, '|', sizeof name);
1062 extract_token(password, &buf[4], 1, '|', sizeof password);
1063 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1064 flags = extract_int(&buf[4], 3);
1065 floor = extract_int(&buf[4], 4);
1066 order = extract_int(&buf[4], 5);
1067 view = extract_int(&buf[4], 6);
1068 flags2 = extract_int(&buf[4], 7);
1070 if (flags2 & QR2_SELFLIST) {
1078 flags2 = flags2 | QR2_SELFLIST;
1080 else if (newval == 0) {
1081 flags2 = flags2 & ~QR2_SELFLIST;
1084 return(current_value);
1087 if (newval != current_value) {
1088 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1089 name, password, dirname, flags,
1090 floor, order, view, flags2);
1091 serv_getln(buf, sizeof buf);
1098 int is_selflist(room_states *RoomFlags)
1100 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1103 int is_publiclist(room_states *RoomFlags)
1105 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1108 int is_moderatedlist(room_states *RoomFlags)
1110 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1114 * Set/clear/read the "self-service list subscribe" flag for a room
1116 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1117 * returns the new value.
1120 int get_roomflags(room_states *RoomOps)
1125 serv_getln(buf, sizeof buf);
1126 if (buf[0] != '2') return(0);
1128 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1129 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1130 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1131 RoomOps->flags = extract_int(&buf[4], 3);
1132 RoomOps->floor = extract_int(&buf[4], 4);
1133 RoomOps->order = extract_int(&buf[4], 5);
1134 RoomOps->view = extract_int(&buf[4], 6);
1135 RoomOps->flags2 = extract_int(&buf[4], 7);
1139 int set_roomflags(room_states *RoomOps)
1143 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1152 serv_getln(buf, sizeof buf);
1162 * display the form for editing a room
1164 void display_editroom(void)
1170 char remote_room[128];
1173 char er_password[10];
1174 char er_dirname[15];
1175 char er_roomaide[26];
1182 char *not_shared_with;
1185 int floorpolicy = 0;
1187 char pop3_host[128];
1192 if (IsEmptyStr(tab)) tab = "admin";
1195 load_floorlist(Buf);
1197 output_headers(1, 1, 1, 0, 0, 0);
1199 wprintf("<div class=\"fix_scrollbar_bug\">");
1201 wprintf("<br />\n");
1203 /* print the tabbed dialog */
1204 wprintf("<div align=\"center\">");
1205 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""
1206 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1209 wprintf("<td class=\"");
1210 if (!strcmp(tab, "admin")) {
1211 wprintf(" tab_cell_label\">");
1212 wprintf(_("Administration"));
1215 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1216 wprintf(_("Administration"));
1220 wprintf("<td> </td>\n");
1222 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1224 wprintf("<td class=\"");
1225 if (!strcmp(tab, "config")) {
1226 wprintf(" tab_cell_label\">");
1227 wprintf(_("Configuration"));
1230 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1231 wprintf(_("Configuration"));
1235 wprintf("<td> </td>\n");
1237 wprintf("<td class=\"");
1238 if (!strcmp(tab, "expire")) {
1239 wprintf(" tab_cell_label\">");
1240 wprintf(_("Message expire policy"));
1243 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1244 wprintf(_("Message expire policy"));
1248 wprintf("<td> </td>\n");
1250 wprintf("<td class=\"");
1251 if (!strcmp(tab, "access")) {
1252 wprintf(" tab_cell_label\">");
1253 wprintf(_("Access controls"));
1256 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1257 wprintf(_("Access controls"));
1261 wprintf("<td> </td>\n");
1263 wprintf("<td class=\"");
1264 if (!strcmp(tab, "sharing")) {
1265 wprintf(" tab_cell_label\">");
1266 wprintf(_("Sharing"));
1269 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1270 wprintf(_("Sharing"));
1274 wprintf("<td> </td>\n");
1276 wprintf("<td class=\"");
1277 if (!strcmp(tab, "listserv")) {
1278 wprintf(" tab_cell_label\">");
1279 wprintf(_("Mailing list service"));
1282 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1283 wprintf(_("Mailing list service"));
1287 wprintf("<td> </td>\n");
1291 wprintf("<td class=\"");
1292 if (!strcmp(tab, "feeds")) {
1293 wprintf(" tab_cell_label\">");
1294 wprintf(_("Remote retrieval"));
1297 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1298 wprintf(_("Remote retrieval"));
1302 wprintf("<td> </td>\n");
1304 wprintf("</tr></table>\n");
1305 wprintf("</div>\n");
1306 /* end tabbed dialog */
1308 wprintf("<script type=\"text/javascript\">"
1309 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1313 /* begin content of whatever tab is open now */
1315 if (!strcmp(tab, "admin")) {
1316 wprintf("<div class=\"tabcontent\">");
1318 "<li><a href=\"delete_room\" "
1319 "onClick=\"return confirm('");
1320 wprintf(_("Are you sure you want to delete this room?"));
1321 wprintf("');\">\n");
1322 wprintf(_("Delete this room"));
1324 "<li><a href=\"display_editroompic\">\n");
1325 wprintf(_("Set or change the icon for this room's banner"));
1327 "<li><a href=\"display_editinfo\">\n");
1328 wprintf(_("Edit this room's Info file"));
1334 if (!strcmp(tab, "config")) {
1335 wprintf("<div class=\"tabcontent\">");
1337 serv_getln(buf, sizeof buf);
1339 if (!strncmp(buf, "550", 3)) {
1340 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1341 _("Higher access is required to access this function.")
1344 else if (buf[0] != '2') {
1345 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1348 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1349 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1350 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1351 er_flags = extract_int(&buf[4], 3);
1352 er_floor = extract_int(&buf[4], 4);
1353 er_flags2 = extract_int(&buf[4], 7);
1355 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1356 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1358 wprintf("<ul><li>");
1359 wprintf(_("Name of room: "));
1360 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1366 wprintf(_("Resides on floor: "));
1367 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1368 if (er_flags & QR_MAILBOX)
1369 wprintf("disabled >\n");
1370 for (i = 0; i < 128; ++i)
1371 if (!IsEmptyStr(floorlist[i])) {
1372 wprintf("<OPTION ");
1374 wprintf("SELECTED ");
1375 wprintf("VALUE=\"%d\">", i);
1376 escputs(floorlist[i]);
1377 wprintf("</OPTION>\n");
1379 wprintf("</select>\n");
1382 wprintf(_("Type of room:"));
1385 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1386 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1387 wprintf("CHECKED ");
1388 wprintf("OnChange=\""
1389 " if (this.form.type[0].checked == true) { "
1390 " this.form.er_floor.disabled = false; "
1393 wprintf(_("Public (automatically appears to everyone)"));
1396 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1397 if ((er_flags & QR_PRIVATE) &&
1398 (er_flags & QR_GUESSNAME))
1399 wprintf("CHECKED ");
1400 wprintf(" OnChange=\""
1401 " if (this.form.type[1].checked == true) { "
1402 " this.form.er_floor.disabled = false; "
1405 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1407 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1408 if ((er_flags & QR_PRIVATE) &&
1409 (er_flags & QR_PASSWORDED))
1410 wprintf("CHECKED ");
1411 wprintf(" OnChange=\""
1412 " if (this.form.type[2].checked == true) { "
1413 " this.form.er_floor.disabled = false; "
1416 wprintf(_("Private - require password: "));
1417 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1420 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1421 if ((er_flags & QR_PRIVATE)
1422 && ((er_flags & QR_GUESSNAME) == 0)
1423 && ((er_flags & QR_PASSWORDED) == 0))
1424 wprintf("CHECKED ");
1425 wprintf(" OnChange=\""
1426 " if (this.form.type[3].checked == true) { "
1427 " this.form.er_floor.disabled = false; "
1430 wprintf(_("Private - invitation only"));
1432 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1433 if (er_flags & QR_MAILBOX)
1434 wprintf("CHECKED ");
1435 wprintf (" OnChange=\""
1436 " if (this.form.type[4].checked == true) { "
1437 " this.form.er_floor.disabled = true; "
1440 wprintf(_("Personal (mailbox for you only)"));
1442 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1444 wprintf(_("If private, cause current users to forget room"));
1446 wprintf("\n</ul>\n");
1448 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1449 if (er_flags & QR_PREFONLY)
1450 wprintf("CHECKED ");
1452 wprintf(_("Preferred users only"));
1454 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1455 if (er_flags & QR_READONLY)
1456 wprintf("CHECKED ");
1458 wprintf(_("Read-only room"));
1460 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1461 if (er_flags2 & QR2_COLLABDEL)
1462 wprintf("CHECKED ");
1464 wprintf(_("All users allowed to post may also delete messages"));
1466 /** directory stuff */
1467 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1468 if (er_flags & QR_DIRECTORY)
1469 wprintf("CHECKED ");
1471 wprintf(_("File directory room"));
1473 wprintf("\n<ul><li>");
1474 wprintf(_("Directory name: "));
1475 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1478 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1479 if (er_flags & QR_UPLOAD)
1480 wprintf("CHECKED ");
1482 wprintf(_("Uploading allowed"));
1484 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1485 if (er_flags & QR_DOWNLOAD)
1486 wprintf("CHECKED ");
1488 wprintf(_("Downloading allowed"));
1490 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1491 if (er_flags & QR_VISDIR)
1492 wprintf("CHECKED ");
1494 wprintf(_("Visible directory"));
1497 /** end of directory stuff */
1499 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1500 if (er_flags & QR_NETWORK)
1501 wprintf("CHECKED ");
1503 wprintf(_("Network shared room"));
1505 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1506 if (er_flags & QR_PERMANENT)
1507 wprintf("CHECKED ");
1509 wprintf(_("Permanent (does not auto-purge)"));
1511 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1512 if (er_flags2 & QR2_SUBJECTREQ)
1513 wprintf("CHECKED ");
1515 wprintf(_("Subject Required (Force users to specify a message subject)"));
1517 /** start of anon options */
1520 wprintf(_("Anonymous messages"));
1523 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1524 if (((er_flags & QR_ANONONLY) == 0)
1525 && ((er_flags & QR_ANONOPT) == 0))
1526 wprintf("CHECKED ");
1528 wprintf(_("No anonymous messages"));
1530 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1531 if (er_flags & QR_ANONONLY)
1532 wprintf("CHECKED ");
1534 wprintf(_("All messages are anonymous"));
1536 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1537 if (er_flags & QR_ANONOPT)
1538 wprintf("CHECKED ");
1540 wprintf(_("Prompt user when entering messages"));
1543 /* end of anon options */
1546 wprintf(_("Room aide: "));
1548 serv_getln(buf, sizeof buf);
1549 if (buf[0] != '2') {
1550 wprintf("<em>%s</em>\n", &buf[4]);
1552 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1553 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1556 wprintf("</ul><CENTER>\n");
1557 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1558 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1560 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1570 /* Sharing the room with other Citadel nodes... */
1571 if (!strcmp(tab, "sharing")) {
1572 wprintf("<div class=\"tabcontent\">");
1574 shared_with = strdup("");
1575 not_shared_with = strdup("");
1577 /** Learn the current configuration */
1578 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1579 serv_getln(buf, sizeof buf);
1580 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1581 extract_token(node, buf, 0, '|', sizeof node);
1582 not_shared_with = realloc(not_shared_with,
1583 strlen(not_shared_with) + 32);
1584 strcat(not_shared_with, node);
1585 strcat(not_shared_with, "\n");
1589 serv_getln(buf, sizeof buf);
1590 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1591 extract_token(cmd, buf, 0, '|', sizeof cmd);
1592 extract_token(node, buf, 1, '|', sizeof node);
1593 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1594 if (!strcasecmp(cmd, "ignet_push_share")) {
1595 shared_with = realloc(shared_with,
1596 strlen(shared_with) + 32);
1597 strcat(shared_with, node);
1598 if (!IsEmptyStr(remote_room)) {
1599 strcat(shared_with, "|");
1600 strcat(shared_with, remote_room);
1602 strcat(shared_with, "\n");
1606 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1607 extract_token(buf, shared_with, i, '\n', sizeof buf);
1608 extract_token(node, buf, 0, '|', sizeof node);
1609 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1610 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1611 if (!strcasecmp(node, cmd)) {
1612 remove_token(not_shared_with, j, '\n');
1617 /* Display the stuff */
1618 wprintf("<CENTER><br />"
1619 "<table border=1 cellpadding=5><tr>"
1621 wprintf(_("Shared with"));
1622 wprintf("</I></B></td>"
1624 wprintf(_("Not shared with"));
1625 wprintf("</I></B></td></tr>\n"
1626 "<tr><td VALIGN=TOP>\n");
1628 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1629 wprintf(_("Remote node name"));
1630 wprintf("</td><td>");
1631 wprintf(_("Remote room name"));
1632 wprintf("</td><td>");
1633 wprintf(_("Actions"));
1634 wprintf("</td></tr>\n");
1636 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1637 extract_token(buf, shared_with, i, '\n', sizeof buf);
1638 extract_token(node, buf, 0, '|', sizeof node);
1639 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1640 if (!IsEmptyStr(node)) {
1641 wprintf("<form method=\"POST\" action=\"netedit\">");
1642 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1643 wprintf("<tr><td>%s</td>\n", node);
1646 if (!IsEmptyStr(remote_room)) {
1647 escputs(remote_room);
1653 wprintf("<input type=\"hidden\" NAME=\"line\" "
1654 "VALUE=\"ignet_push_share|");
1656 if (!IsEmptyStr(remote_room)) {
1658 urlescputs(remote_room);
1661 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1662 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1663 wprintf("<input type=\"submit\" "
1664 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1665 wprintf("</td></tr></form>\n");
1669 wprintf("</table>\n");
1670 wprintf("</td><td VALIGN=TOP>\n");
1671 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1672 wprintf(_("Remote node name"));
1673 wprintf("</td><td>");
1674 wprintf(_("Remote room name"));
1675 wprintf("</td><td>");
1676 wprintf(_("Actions"));
1677 wprintf("</td></tr>\n");
1679 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1680 extract_token(node, not_shared_with, i, '\n', sizeof node);
1681 if (!IsEmptyStr(node)) {
1682 wprintf("<form method=\"POST\" action=\"netedit\">");
1683 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1684 wprintf("<tr><td>");
1687 "<input type=\"INPUT\" "
1691 wprintf("<input type=\"hidden\" "
1693 "VALUE=\"ignet_push_share|");
1696 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1697 "VALUE=\"sharing\">\n");
1698 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1699 "VALUE=\"add\">\n");
1700 wprintf("<input type=\"submit\" "
1701 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1702 wprintf("</td></tr></form>\n");
1706 wprintf("</table>\n");
1707 wprintf("</td></tr>"
1708 "</table></CENTER><br />\n"
1709 "<I><B>%s</B><ul><li>", _("Notes:"));
1710 wprintf(_("When sharing a room, "
1711 "it must be shared from both ends. Adding a node to "
1712 "the 'shared' list sends messages out, but in order to"
1713 " receive messages, the other nodes must be configured"
1714 " to send messages out to your system as well. "
1715 "<li>If the remote room name is blank, it is assumed "
1716 "that the room name is identical on the remote node."
1717 "<li>If the remote room name is different, the remote "
1718 "node must also configure the name of the room here."
1725 /* Mailing list management */
1726 if (!strcmp(tab, "listserv")) {
1727 room_states RoomFlags;
1728 wprintf("<div class=\"tabcontent\">");
1730 wprintf("<br /><center>"
1731 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1732 "<tr><td VALIGN=TOP>");
1734 wprintf(_("<i>The contents of this room are being "
1735 "mailed <b>as individual messages</b> "
1736 "to the following list recipients:"
1737 "</i><br /><br />\n"));
1740 serv_getln(buf, sizeof buf);
1741 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1742 extract_token(cmd, buf, 0, '|', sizeof cmd);
1743 if (!strcasecmp(cmd, "listrecp")) {
1744 extract_token(recp, buf, 1, '|', sizeof recp);
1747 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1750 wprintf(_("(remove)"));
1751 wprintf("</A><br />");
1754 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1755 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1756 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1757 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1758 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1759 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1760 wprintf("</form>\n");
1762 wprintf("</td><td VALIGN=TOP>\n");
1764 wprintf(_("<i>The contents of this room are being "
1765 "mailed <b>in digest form</b> "
1766 "to the following list recipients:"
1767 "</i><br /><br />\n"));
1770 serv_getln(buf, sizeof buf);
1771 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1772 extract_token(cmd, buf, 0, '|', sizeof cmd);
1773 if (!strcasecmp(cmd, "digestrecp")) {
1774 extract_token(recp, buf, 1, '|', sizeof recp);
1777 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1781 wprintf(_("(remove)"));
1782 wprintf("</A><br />");
1785 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1786 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1787 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1788 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1789 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1790 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1791 wprintf("</form>\n");
1793 wprintf("</td></tr></table>\n");
1795 /** Pop open an address book -- begin **/
1796 wprintf("<div align=right>"
1797 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1799 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1804 _("Add recipients from Contacts or other address books"),
1805 _("Add recipients from Contacts or other address books")
1807 /* Pop open an address book -- end **/
1809 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1811 get_roomflags (&RoomFlags);
1813 /* Self Service subscription? */
1814 wprintf("<table><tr><td>\n");
1815 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1816 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1817 " <tr><td colspan=\"2\">\n",
1818 (is_selflist(&RoomFlags))?"checked":"");
1819 wprintf(_("The URL for subscribe/unsubscribe is: "));
1820 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1821 (is_https ? "https" : "http"),
1822 ChrPtr(WC->Hdr->http_host));
1823 /* Public posting? */
1824 wprintf("<tr><td>");
1825 wprintf(_("Allow non-subscribers to mail to this room."));
1826 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1827 (is_publiclist(&RoomFlags))?"checked":"");
1829 /* Moderated List? */
1830 wprintf("<tr><td>");
1831 wprintf(_("Room post publication needs Aide permission."));
1832 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1833 (is_moderatedlist(&RoomFlags))?"checked":"");
1836 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1837 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1838 wprintf("</table></form>");
1841 wprintf("</CENTER>\n");
1846 /* Configuration of The Dreaded Auto-Purger */
1847 if (!strcmp(tab, "expire")) {
1848 wprintf("<div class=\"tabcontent\">");
1850 serv_puts("GPEX room");
1851 serv_getln(buf, sizeof buf);
1852 if (!strncmp(buf, "550", 3)) {
1853 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1854 _("Higher access is required to access this function.")
1857 else if (buf[0] != '2') {
1858 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1861 roompolicy = extract_int(&buf[4], 0);
1862 roomvalue = extract_int(&buf[4], 1);
1864 serv_puts("GPEX floor");
1865 serv_getln(buf, sizeof buf);
1866 if (buf[0] == '2') {
1867 floorpolicy = extract_int(&buf[4], 0);
1868 floorvalue = extract_int(&buf[4], 1);
1871 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1872 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1873 wprintf("<table border=0 cellspacing=5>\n");
1874 wprintf("<tr><td>");
1875 wprintf(_("Message expire policy for this room"));
1877 escputs(ChrPtr(WC->wc_roomname));
1878 wprintf(")</td><td>");
1879 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1880 ((roompolicy == 0) ? "CHECKED" : "") );
1881 wprintf(_("Use the default policy for this floor"));
1882 wprintf("<br />\n");
1883 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1884 ((roompolicy == 1) ? "CHECKED" : "") );
1885 wprintf(_("Never automatically expire messages"));
1886 wprintf("<br />\n");
1887 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1888 ((roompolicy == 2) ? "CHECKED" : "") );
1889 wprintf(_("Expire by message count"));
1890 wprintf("<br />\n");
1891 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1892 ((roompolicy == 3) ? "CHECKED" : "") );
1893 wprintf(_("Expire by message age"));
1895 wprintf(_("Number of messages or days: "));
1896 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1897 wprintf("</td></tr>\n");
1899 if (WC->axlevel >= 6) {
1900 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1901 wprintf("<tr><td>");
1902 wprintf(_("Message expire policy for this floor"));
1904 escputs(floorlist[WC->wc_floor]);
1905 wprintf(")</td><td>");
1906 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1907 ((floorpolicy == 0) ? "CHECKED" : "") );
1908 wprintf(_("Use the system default"));
1909 wprintf("<br />\n");
1910 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1911 ((floorpolicy == 1) ? "CHECKED" : "") );
1912 wprintf(_("Never automatically expire messages"));
1913 wprintf("<br />\n");
1914 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1915 ((floorpolicy == 2) ? "CHECKED" : "") );
1916 wprintf(_("Expire by message count"));
1917 wprintf("<br />\n");
1918 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1919 ((floorpolicy == 3) ? "CHECKED" : "") );
1920 wprintf(_("Expire by message age"));
1922 wprintf(_("Number of messages or days: "));
1923 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1927 wprintf("<CENTER>\n");
1928 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1929 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1931 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1932 wprintf("</CENTER></td><tr>\n");
1934 wprintf("</table>\n"
1935 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1943 /* Access controls */
1944 if (!strcmp(tab, "access")) {
1945 wprintf("<div class=\"tabcontent\">");
1950 /* Fetch messages from remote locations */
1951 if (!strcmp(tab, "feeds")) {
1952 wprintf("<div class=\"tabcontent\">");
1955 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1956 wprintf("</i><br />\n");
1958 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1959 "<tr class=\"even\"><th>");
1960 wprintf(_("Remote host"));
1961 wprintf("</th><th>");
1962 wprintf(_("User name"));
1963 wprintf("</th><th>");
1964 wprintf(_("Password"));
1965 wprintf("</th><th>");
1966 wprintf(_("Keep messages on server?"));
1967 wprintf("</th><th>");
1968 wprintf(_("Interval"));
1969 wprintf("</th><th> </th></tr>");
1972 serv_getln(buf, sizeof buf);
1974 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1975 extract_token(cmd, buf, 0, '|', sizeof cmd);
1976 if (!strcasecmp(cmd, "pop3client")) {
1977 safestrncpy(recp, &buf[11], sizeof recp);
1980 wprintf("<tr class=\"%s\">",
1981 (bg ? "even" : "odd")
1985 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1990 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1994 wprintf("<td>*****</td>"); /* Don't show the password */
1996 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1998 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
2000 wprintf("<td class=\"button_link\">");
2001 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
2004 wprintf(_("(remove)"));
2005 wprintf("</a></td>");
2011 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2013 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2014 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
2015 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2017 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
2020 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
2023 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2026 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2029 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2032 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2033 wprintf("</td></tr>");
2034 wprintf("</form></table>\n");
2039 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2040 wprintf("</i><br />\n");
2042 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2043 "<tr class=\"even\"><th>");
2044 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2045 wprintf(_("Feed URL"));
2046 wprintf("</th><th>");
2047 wprintf("</th></tr>");
2050 serv_getln(buf, sizeof buf);
2052 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2053 extract_token(cmd, buf, 0, '|', sizeof cmd);
2054 if (!strcasecmp(cmd, "rssclient")) {
2055 safestrncpy(recp, &buf[10], sizeof recp);
2058 wprintf("<tr class=\"%s\">",
2059 (bg ? "even" : "odd")
2063 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2067 wprintf("<td class=\"button_link\">");
2068 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
2071 wprintf(_("(remove)"));
2072 wprintf("</a></td>");
2078 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2080 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2081 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2082 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2084 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2085 "maxlength=\"256\" name=\"line_pop3host\">\n");
2088 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2089 wprintf("</td></tr>");
2090 wprintf("</form></table>\n");
2096 /* end content of whatever tab is open now */
2097 wprintf("</div>\n");
2099 address_book_popup();
2105 * Toggle self-service list subscription
2107 void toggle_self_service(void) {
2108 room_states RoomFlags;
2110 get_roomflags (&RoomFlags);
2112 if (yesbstr("QR2_SelfList"))
2113 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2115 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2117 if (yesbstr("QR2_SMTP_PUBLIC"))
2118 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2120 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2122 if (yesbstr("QR2_Moderated"))
2123 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2125 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2126 if (yesbstr("QR2_SubsOnly"))
2127 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2129 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2131 set_roomflags (&RoomFlags);
2139 * save new parameters for a room
2146 StrBuf *er_password;
2148 StrBuf *er_roomaide;
2151 int er_listingorder;
2157 if (!havebstr("ok_button")) {
2158 strcpy(WC->ImportantMessage,
2159 _("Cancelled. Changes were not saved."));
2165 StrBuf_ServGetln(Buf);
2166 if (GetServerStatus(Buf, NULL) != 2) {
2167 StrBufCutLeft(Buf, 4);
2168 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2174 er_name = NewStrBuf();
2175 er_password = NewStrBuf();
2176 er_dirname = NewStrBuf();
2177 er_roomaide = NewStrBuf();
2179 StrBufCutLeft(Buf, 4);
2180 StrBufExtract_token(er_name, Buf, 0, '|');
2181 StrBufExtract_token(er_password, Buf, 1, '|');
2182 StrBufExtract_token(er_dirname, Buf, 2, '|');
2183 er_flags = StrBufExtract_int(Buf, 3, '|');
2184 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2185 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2186 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2188 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2189 if (StrLength(er_roomaide) == 0) {
2191 StrBuf_ServGetln(Buf);
2192 if (GetServerStatus(Buf, NULL) != 2) {
2193 FlushStrBuf(er_roomaide);
2195 StrBufCutLeft(Buf, 4);
2196 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2199 Ptr = sbstr("er_name");
2200 if (StrLength(Ptr) > 0) {
2201 FlushStrBuf(er_name);
2202 StrBufAppendBuf(er_name, Ptr, 0);
2205 Ptr = sbstr("er_password");
2206 if (StrLength(Ptr) > 0) {
2207 FlushStrBuf(er_password);
2208 StrBufAppendBuf(er_password, Ptr, 0);
2212 Ptr = sbstr("er_dirname");
2213 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2214 FlushStrBuf(er_dirname);
2215 StrBufAppendBuf(er_dirname, Ptr, 0);
2219 Ptr = sbstr("type");
2220 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2222 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2223 er_flags |= (QR_PRIVATE);
2225 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2226 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2228 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2229 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2231 if (!strcmp(ChrPtr(Ptr), "personal")) {
2232 er_flags |= QR_MAILBOX;
2234 er_flags &= ~QR_MAILBOX;
2237 if (yesbstr("prefonly")) {
2238 er_flags |= QR_PREFONLY;
2240 er_flags &= ~QR_PREFONLY;
2243 if (yesbstr("readonly")) {
2244 er_flags |= QR_READONLY;
2246 er_flags &= ~QR_READONLY;
2250 if (yesbstr("collabdel")) {
2251 er_flags2 |= QR2_COLLABDEL;
2253 er_flags2 &= ~QR2_COLLABDEL;
2256 if (yesbstr("permanent")) {
2257 er_flags |= QR_PERMANENT;
2259 er_flags &= ~QR_PERMANENT;
2262 if (yesbstr("subjectreq")) {
2263 er_flags2 |= QR2_SUBJECTREQ;
2265 er_flags2 &= ~QR2_SUBJECTREQ;
2268 if (yesbstr("network")) {
2269 er_flags |= QR_NETWORK;
2271 er_flags &= ~QR_NETWORK;
2274 if (yesbstr("directory")) {
2275 er_flags |= QR_DIRECTORY;
2277 er_flags &= ~QR_DIRECTORY;
2280 if (yesbstr("ulallowed")) {
2281 er_flags |= QR_UPLOAD;
2283 er_flags &= ~QR_UPLOAD;
2286 if (yesbstr("dlallowed")) {
2287 er_flags |= QR_DOWNLOAD;
2289 er_flags &= ~QR_DOWNLOAD;
2292 if (yesbstr("visdir")) {
2293 er_flags |= QR_VISDIR;
2295 er_flags &= ~QR_VISDIR;
2298 Ptr = sbstr("anon");
2300 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2301 if (!strcmp(ChrPtr(Ptr), "anononly"))
2302 er_flags |= QR_ANONONLY;
2303 if (!strcmp(ChrPtr(Ptr), "anon2"))
2304 er_flags |= QR_ANONOPT;
2306 bump = yesbstr("bump");
2308 er_floor = ibstr("er_floor");
2310 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2312 ChrPtr(er_password),
2321 StrBuf_ServGetln(Buf);
2322 if (GetServerStatus(Buf, NULL) != 2) {
2323 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2326 FreeStrBuf(&er_name);
2327 FreeStrBuf(&er_password);
2328 FreeStrBuf(&er_dirname);
2329 FreeStrBuf(&er_roomaide);
2334 if (StrLength(er_roomaide) > 0) {
2335 serv_printf("SETA %s", ChrPtr(er_roomaide));
2336 StrBuf_ServGetln(Buf);
2337 if (GetServerStatus(Buf, NULL) != 2) {
2338 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2339 display_main_menu();
2341 FreeStrBuf(&er_name);
2342 FreeStrBuf(&er_password);
2343 FreeStrBuf(&er_dirname);
2344 FreeStrBuf(&er_roomaide);
2349 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2352 FreeStrBuf(&er_name);
2353 FreeStrBuf(&er_password);
2354 FreeStrBuf(&er_dirname);
2355 FreeStrBuf(&er_roomaide);
2361 * Display form for Invite, Kick, and show Who Knows a room
2363 void do_invt_kick(void) {
2364 char buf[SIZ], room[SIZ], username[SIZ];
2367 serv_getln(buf, sizeof buf);
2369 if (buf[0] != '2') {
2373 extract_token(room, &buf[4], 0, '|', sizeof room);
2375 strcpy(username, bstr("username"));
2377 if (havebstr("kick_button")) {
2378 sprintf(buf, "KICK %s", username);
2380 serv_getln(buf, sizeof buf);
2382 if (buf[0] != '2') {
2383 strcpy(WC->ImportantMessage, &buf[4]);
2385 sprintf(WC->ImportantMessage,
2386 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2391 if (havebstr("invite_button")) {
2392 sprintf(buf, "INVT %s", username);
2394 serv_getln(buf, sizeof buf);
2396 if (buf[0] != '2') {
2397 strcpy(WC->ImportantMessage, &buf[4]);
2399 sprintf(WC->ImportantMessage,
2400 _("<B><I>User %s invited to room %s.</I></B>\n"),
2411 * Display form for Invite, Kick, and show Who Knows a room
2413 void display_whok(void)
2415 char buf[SIZ], room[SIZ], username[SIZ];
2418 serv_getln(buf, sizeof buf);
2420 if (buf[0] != '2') {
2424 extract_token(room, &buf[4], 0, '|', sizeof room);
2427 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2428 wprintf(_("The users listed below have access to this room. "
2429 "To remove a user from the access list, select the user "
2430 "name from the list and click 'Kick'."));
2431 wprintf("<br /><br />");
2433 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2434 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2435 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2436 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2438 serv_getln(buf, sizeof buf);
2439 if (buf[0] == '1') {
2440 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2441 extract_token(username, buf, 0, '|', sizeof username);
2442 wprintf("<OPTION>");
2447 wprintf("</select><br />\n");
2449 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2450 wprintf("</form></CENTER>\n");
2452 wprintf("</td><td>");
2453 wprintf(_("To grant another user access to this room, enter the "
2454 "user name in the box below and click 'Invite'."));
2455 wprintf("<br /><br />");
2457 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2458 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2459 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2460 wprintf(_("Invite:"));
2462 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2463 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2464 "<input type=\"submit\" value=\"%s\">"
2465 "</form></CENTER>\n", _("Invite"));
2466 /* Pop open an address book -- begin **/
2468 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2470 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2473 _("Users"), _("Users")
2475 /* Pop open an address book -- end **/
2477 wprintf("</td></tr></table>\n");
2478 address_book_popup();
2485 * display the form for entering a new room
2487 void display_entroom(void)
2494 serv_puts("CRE8 0");
2495 serv_getln(buf, sizeof buf);
2497 if (buf[0] != '2') {
2498 strcpy(WC->ImportantMessage, &buf[4]);
2499 display_main_menu();
2504 output_headers(1, 1, 1, 0, 0, 0);
2506 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2507 do_template("beginbox", NULL);
2509 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2510 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2512 wprintf("<table class=\"altern\"> ");
2514 wprintf("<tr class=\"even\"><td>");
2515 wprintf(_("Name of room: "));
2516 wprintf("</td><td>");
2517 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2518 wprintf("</td></tr>");
2520 wprintf("<tr class=\"odd\"><td>");
2521 wprintf(_("Resides on floor: "));
2522 wprintf("</td><td>");
2523 load_floorlist(Buf);
2524 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2525 for (i = 0; i < 128; ++i)
2526 if (!IsEmptyStr(floorlist[i])) {
2527 wprintf("<option ");
2528 wprintf("value=\"%d\">", i);
2529 escputs(floorlist[i]);
2530 wprintf("</option>\n");
2532 wprintf("</select>\n");
2533 wprintf("</td></tr>");
2536 * Our clever little snippet of JavaScript automatically selects
2537 * a public room if the view is set to Bulletin Board or wiki, and
2538 * it selects a mailbox room otherwise. The user can override this,
2539 * of course. We also disable the floor selector for mailboxes.
2541 wprintf("<tr class=\"even\"><td>");
2542 wprintf(_("Default view for room: "));
2543 wprintf("</td><td>");
2544 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2545 " if ( (this.form.er_view.value == 0) "
2546 " || (this.form.er_view.value == 6) ) { "
2547 " this.form.type[0].checked=true; "
2548 " this.form.er_floor.disabled = false; "
2551 " this.form.type[4].checked=true; "
2552 " this.form.er_floor.disabled = true; "
2555 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2556 if (is_view_allowed_as_default(i)) {
2557 wprintf("<option %s value=\"%d\">",
2558 ((i == 0) ? "selected" : ""), i );
2559 escputs(viewdefs[i]);
2560 wprintf("</option>\n");
2563 wprintf("</select>\n");
2564 wprintf("</td></tr>");
2566 wprintf("<tr class=\"even\"><td>");
2567 wprintf(_("Type of room:"));
2568 wprintf("</td><td>");
2569 wprintf("<ul class=\"adminlist\">\n");
2571 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2572 wprintf("CHECKED OnChange=\""
2573 " if (this.form.type[0].checked == true) { "
2574 " this.form.er_floor.disabled = false; "
2577 wprintf(_("Public (automatically appears to everyone)"));
2580 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2581 " if (this.form.type[1].checked == true) { "
2582 " this.form.er_floor.disabled = false; "
2585 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2588 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2589 " if (this.form.type[2].checked == true) { "
2590 " this.form.er_floor.disabled = false; "
2593 wprintf(_("Private - require password: "));
2594 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2597 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2598 " if (this.form.type[3].checked == true) { "
2599 " this.form.er_floor.disabled = false; "
2602 wprintf(_("Private - invitation only"));
2605 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2607 " if (this.form.type[4].checked == true) { "
2608 " this.form.er_floor.disabled = true; "
2611 wprintf(_("Personal (mailbox for you only)"));
2614 wprintf("\n</ul>\n");
2615 wprintf("</td></tr></table>\n");
2617 wprintf("<div class=\"buttons\">\n");
2618 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2620 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2621 wprintf("</div>\n");
2622 wprintf("</form>\n<hr />");
2623 serv_printf("MESG roomaccess");
2624 serv_getln(buf, sizeof buf);
2625 if (buf[0] == '1') {
2629 do_template("endbox", NULL);
2639 * support function for entroom() -- sets the default view
2641 void er_set_default_view(int newview) {
2654 serv_getln(buf, sizeof buf);
2655 if (buf[0] != '2') return;
2657 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2658 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2659 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2660 rm_bits1 = extract_int(&buf[4], 3);
2661 rm_floor = extract_int(&buf[4], 4);
2662 rm_listorder = extract_int(&buf[4], 5);
2663 rm_bits2 = extract_int(&buf[4], 7);
2665 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2666 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2667 rm_listorder, newview, rm_bits2
2669 serv_getln(buf, sizeof buf);
2680 const StrBuf *er_name;
2681 const StrBuf *er_type;
2682 const StrBuf *er_password;
2687 if (!havebstr("ok_button")) {
2688 strcpy(WC->ImportantMessage,
2689 _("Cancelled. No new room was created."));
2690 display_main_menu();
2693 er_name = sbstr("er_name");
2694 er_type = sbstr("type");
2695 er_password = sbstr("er_password");
2696 er_floor = ibstr("er_floor");
2697 er_view = ibstr("er_view");
2700 if (!strcmp(ChrPtr(er_type), "hidden"))
2702 else if (!strcmp(ChrPtr(er_type), "passworded"))
2704 else if (!strcmp(ChrPtr(er_type), "invonly"))
2706 else if (!strcmp(ChrPtr(er_type), "personal"))
2709 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2712 ChrPtr(er_password),
2717 serv_getln(buf, sizeof buf);
2718 if (buf[0] != '2') {
2719 strcpy(WC->ImportantMessage, &buf[4]);
2720 display_main_menu();
2723 /** TODO: Room created, now udate the left hand icon bar for this user */
2724 burn_folder_cache(0); /* burn the old folder cache */
2728 do_change_view(er_view); /* Now go there */
2733 * \brief display the screen to enter a private room
2735 void display_private(char *rname, int req_pass)
2737 WCTemplputParams SubTP;
2739 output_headers(1, 1, 1, 0, 0, 0);
2741 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2742 memset(&SubTP, 0, sizeof(WCTemplputParams));
2743 SubTP.Filter.ContextType = CTX_STRBUF;
2744 SubTP.Context = Buf;
2745 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2750 wprintf(_("If you know the name of a hidden (guess-name) or "
2751 "passworded room, you can enter that room by typing "
2752 "its name below. Once you gain access to a private "
2753 "room, it will appear in your regular room listings "
2754 "so you don't have to keep returning here."));
2757 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2758 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2760 wprintf("<table class=\"altern\"> "
2761 "<tr class=\"even\"><td>");
2762 wprintf(_("Enter room name:"));
2764 "<input type=\"text\" name=\"gr_name\" "
2765 "value=\"%s\" maxlength=\"128\">\n", rname);
2768 wprintf("</td></tr><tr class=\"odd\"><td>");
2769 wprintf(_("Enter room password:"));
2770 wprintf("</td><td>");
2771 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2773 wprintf("</td></tr></table>\n");
2775 wprintf("<div class=\"buttons\">\n");
2776 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2778 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2782 wprintf("</div></form>\n");
2784 do_template("endbox", NULL);
2790 * \brief goto a private room
2792 void goto_private(void)
2797 if (!havebstr("ok_button")) {
2798 display_main_menu();
2801 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2802 serv_printf("GOTO %s|%s",
2805 serv_getln(buf, sizeof buf);
2807 if (buf[0] == '2') {
2808 smart_goto(sbstr("gr_name"));
2811 if (!strncmp(buf, "540", 3)) {
2812 display_private(bstr("gr_name"), 1);
2815 output_headers(1, 1, 1, 0, 0, 0);
2816 wprintf("%s\n", &buf[4]);
2823 * \brief display the screen to zap a room
2825 void display_zap(void)
2827 output_headers(1, 1, 2, 0, 0, 0);
2829 wprintf("<div id=\"banner\">\n");
2831 wprintf(_("Zap (forget/unsubscribe) the current room"));
2833 wprintf("</div>\n");
2835 wprintf("<div id=\"content\" class=\"service\">\n");
2837 wprintf(_("If you select this option, <em>%s</em> will "
2838 "disappear from your room list. Is this what you wish "
2839 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2841 wprintf("<form method=\"POST\" action=\"zap\">\n");
2842 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2843 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2845 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2846 wprintf("</form>\n");
2857 StrBuf *final_destination;
2860 * If the forget-room routine fails for any reason, we fall back
2861 * to the current room; otherwise, we go to the Lobby
2863 final_destination = NewStrBufDup(WC->wc_roomname);
2865 if (havebstr("ok_button")) {
2866 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2867 serv_getln(buf, sizeof buf);
2868 if (buf[0] == '2') {
2870 serv_getln(buf, sizeof buf);
2871 if (buf[0] == '2') {
2872 FlushStrBuf(final_destination);
2873 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2877 smart_goto(final_destination);
2878 FreeStrBuf(&final_destination);
2884 * \brief Delete the current room
2886 void delete_room(void)
2891 serv_puts("KILL 1");
2892 serv_getln(buf, sizeof buf);
2893 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2894 if (buf[0] != '2') {
2895 strcpy(WC->ImportantMessage, &buf[4]);
2896 display_main_menu();
2901 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2910 * \brief Perform changes to a room's network configuration
2912 void netedit(void) {
2921 /*/ TODO: do line dynamic! */
2922 if (havebstr("line_pop3host")) {
2923 strcpy(line, bstr("prefix"));
2924 strcat(line, bstr("line_pop3host"));
2926 strcat(line, bstr("line_pop3user"));
2928 strcat(line, bstr("line_pop3pass"));
2930 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2932 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2933 strcat(line, bstr("suffix"));
2935 else if (havebstr("line")) {
2936 strcpy(line, bstr("prefix"));
2937 strcat(line, bstr("line"));
2938 strcat(line, bstr("suffix"));
2953 serv_getln(buf, sizeof buf);
2954 if (buf[0] != '1') {
2960 /** This loop works for add *or* remove. Spiffy, eh? */
2961 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2962 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2963 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2964 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2965 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2966 if ( (strcasecmp(cmpa0, cmpb0))
2967 || (strcasecmp(cmpa1, cmpb1)) ) {
2968 fprintf(fp, "%s\n", buf);
2974 serv_getln(buf, sizeof buf);
2975 if (buf[0] != '4') {
2981 while (fgets(buf, sizeof buf, fp) != NULL) {
2982 buf[strlen(buf)-1] = 0;
2986 if (havebstr("add_button")) {
2987 num_addrs = num_tokens(bstr("line"), ',');
2988 if (num_addrs < 2) {
2989 /* just adding one node or address */
2993 /* adding multiple addresses separated by commas */
2994 for (i=0; i<num_addrs; ++i) {
2995 strcpy(line, bstr("prefix"));
2996 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2999 strcat(line, bstr("suffix"));
3013 * \brief Convert a room name to a folder-ish-looking name.
3014 * \param folder the folderish name
3015 * \param room the room name
3016 * \param floor the floor name
3017 * \param is_mailbox is it a mailbox?
3019 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
3024 * For mailboxes, just do it straight...
3027 sprintf(folder, "My folders|%s", room);
3031 * Otherwise, prefix the floor name as a "public folders" moniker
3034 if (floor > MAX_FLOORS) {
3036 sprintf(folder, "%%%%%%|%s", room);
3039 sprintf(folder, "%s|%s", floorlist[floor], room);
3044 * Replace "\" characters with "|" for pseudo-folder-delimiting
3046 len = strlen (folder);
3047 for (i=0; i<len; ++i) {
3048 if (folder[i] == '\\') folder[i] = '|';
3056 * \brief Back end for change_view()
3057 * \param newview set newview???
3059 void do_change_view(int newview) {
3062 serv_printf("VIEW %d", newview);
3063 serv_getln(buf, sizeof buf);
3064 WC->wc_view = newview;
3065 smart_goto(WC->wc_roomname);
3071 * \brief Change the view for this room
3073 void change_view(void) {
3076 view = lbstr("view");
3077 do_change_view(view);
3082 * \brief One big expanded tree list view --- like a folder list
3083 * \param fold the folder to view
3084 * \param max_folders how many folders???
3085 * \param num_floors hom many floors???
3087 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3091 int has_subfolders = 0;
3094 parents = malloc(max_folders * sizeof(int));
3096 /** BEGIN TREE MENU */
3097 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3099 /** include NanoTree */
3100 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3102 /** initialize NanoTree */
3103 wprintf("<script type=\"text/javascript\"> \n"
3104 " showRootNode = false; \n"
3105 " sortNodes = false; \n"
3106 " dragable = false; \n"
3108 " function standardClick(treeNode) { \n"
3111 " var closedGif = 'static/folder_closed.gif'; \n"
3112 " var openGif = 'static/folder_open.gif'; \n"
3114 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3118 for (i=0; i<max_folders; ++i) {
3121 if ((i+1) < max_folders) {
3123 len = strlen(fold[i].name);
3124 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3125 && (fold[i+1].name[len] == '|') ) {
3130 levels = num_tokens(fold[i].name, '|');
3131 parents[levels] = i;
3133 wprintf("var node%d = new TreeNode(%d, '", i, i);
3135 if (fold[i].selectable) {
3136 wprintf("<a href=\"dotgoto?room=");
3137 urlescputs(fold[i].room);
3142 wprintf("<span class=\"roomlist_floor\">");
3144 else if (fold[i].hasnewmsgs) {
3145 wprintf("<span class=\"roomlist_new\">");
3148 wprintf("<span class=\"roomlist_old\">");
3150 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3155 if (has_subfolders) {
3156 wprintf("new Array(closedGif, openGif)");
3158 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3159 wprintf("'static/viewcontacts_16x.gif'");
3161 else if (fold[i].view == VIEW_CALENDAR) {
3162 wprintf("'static/calarea_16x.gif'");
3164 else if (fold[i].view == VIEW_CALBRIEF) {
3165 wprintf("'static/calarea_16x.gif'");
3167 else if (fold[i].view == VIEW_TASKS) {
3168 wprintf("'static/taskmanag_16x.gif'");
3170 else if (fold[i].view == VIEW_NOTES) {
3171 wprintf("'static/storenotes_16x.gif'");
3173 else if (fold[i].view == VIEW_MAILBOX) {
3174 wprintf("'static/privatemess_16x.gif'");
3177 wprintf("'static/chatrooms_16x.gif'");
3180 urlescputs(fold[i].name);
3184 wprintf("rootNode.addChild(node%d);\n", i);
3187 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3191 wprintf("container = document.getElementById('roomlist_div'); \n"
3197 /** END TREE MENU */
3201 * \brief Boxes and rooms and lists ... oh my!
3202 * \param fold the folder to view
3203 * \param max_folders how many folders???
3204 * \param num_floors hom many floors???
3206 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3208 char floor_name[256];
3209 char old_floor_name[256];
3210 int levels, oldlevels;
3213 static int columns = 3;
3214 int boxes_per_column = 0;
3215 int current_column = 0;
3218 strcpy(floor_name, "");
3219 strcpy(old_floor_name, "");
3222 while (nf % columns != 0) ++nf;
3223 boxes_per_column = (nf / columns);
3224 if (boxes_per_column < 1) boxes_per_column = 1;
3226 /** Outer table (for columnization) */
3227 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3228 "<tr><td valign=top>");
3232 for (i=0; i<max_folders; ++i) {
3234 levels = num_tokens(fold[i].name, '|');
3235 extract_token(floor_name, fold[i].name, 0,
3236 '|', sizeof floor_name);
3238 if ( (strcasecmp(floor_name, old_floor_name))
3239 && (!IsEmptyStr(old_floor_name)) ) {
3241 do_template("endbox", NULL);
3245 if ((num_boxes % boxes_per_column) == 0) {
3247 if (current_column < columns) {
3248 wprintf("</td><td valign=top>\n");
3252 strcpy(old_floor_name, floor_name);
3256 WCTemplputParams SubTP;
3258 Buf = NewStrBufPlain(floor_name, -1);
3259 memset(&SubTP, 0, sizeof(WCTemplputParams));
3260 SubTP.Filter.ContextType = CTX_STRBUF;
3261 SubTP.Context = Buf;
3262 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3271 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3272 if (fold[i].selectable) {
3273 wprintf("<a href=\"dotgoto?room=");
3274 urlescputs(fold[i].room);
3280 if (fold[i].hasnewmsgs) {
3281 wprintf("<span class=\"roomlist_new\">");
3284 wprintf("<span class=\"roomlist_old\">");
3286 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3289 if (fold[i].selectable) {
3295 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3296 wprintf(" (INBOX)");
3298 wprintf("<br />\n");
3301 /** End the final inner box */
3302 do_template("endbox", NULL);
3304 wprintf("</td></tr></table>\n");
3308 * \brief print a floor div???
3309 * \param which_floordiv name of the floordiv???
3311 void set_floordiv_expanded(void) {
3312 wcsession *WCC = WC;
3315 FloorDiv = NewStrBuf();
3316 StrBufExtract_token(FloorDiv, WCC->Hdr->ReqLine, 0, '/');
3317 set_preference("floordiv_expanded", FloorDiv, 1);
3318 WCC->floordiv_expanded = FloorDiv;
3322 * \brief view the iconbar
3323 * \param fold the folder to view
3324 * \param max_folders how many folders???
3325 * \param num_floors hom many floors???
3327 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3329 char floor_name[256];
3330 char old_floor_name[256];
3331 char floordivtitle[256];
3332 char floordiv_id[32];
3333 int levels, oldlevels;
3337 strcpy(floor_name, "");
3338 strcpy(old_floor_name, "");
3342 for (i=0; i<max_folders; ++i) {
3344 levels = num_tokens(fold[i].name, '|');
3345 extract_token(floor_name, fold[i].name, 0,
3346 '|', sizeof floor_name);
3348 if ( (strcasecmp(floor_name, old_floor_name))
3349 && (!IsEmptyStr(old_floor_name)) ) {
3350 /** End inner box */
3352 wprintf("</div>\n"); /** floordiv */
3354 strcpy(old_floor_name, floor_name);
3358 stresc(floordivtitle, 256, floor_name, 0, 0);
3359 sprintf(floordiv_id, "floordiv%d", i);
3360 wprintf("<span class=\"ib_roomlist_floor\" "
3361 "onClick=\"expand_floor('%s')\">"
3362 "%s</span><br>\n", floordiv_id, floordivtitle);
3363 wprintf("<div id=\"%s\" style=\"display:%s\">",
3365 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3372 wprintf("<div id=\"roomdiv%d\">", i);
3374 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3376 /** choose the icon */
3377 if (fold[i].view == VIEW_ADDRESSBOOK) {
3378 icon = "viewcontacts_16x.gif" ;
3380 else if (fold[i].view == VIEW_CALENDAR) {
3381 icon = "calarea_16x.gif" ;
3383 else if (fold[i].view == VIEW_CALBRIEF) {
3384 icon = "calarea_16x.gif" ;
3386 else if (fold[i].view == VIEW_TASKS) {
3387 icon = "taskmanag_16x.gif" ;
3389 else if (fold[i].view == VIEW_NOTES) {
3390 icon = "storenotes_16x.gif" ;
3392 else if (fold[i].view == VIEW_MAILBOX) {
3393 icon = "privatemess_16x.gif" ;
3396 icon = "chatrooms_16x.gif" ;
3399 if (fold[i].selectable) {
3400 wprintf("<a href=\"dotgoto?room=");
3401 urlescputs(fold[i].room);
3403 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3408 if (fold[i].hasnewmsgs) {
3409 wprintf("<span class=\"ib_roomlist_new\">");
3412 wprintf("<span class=\"ib_roomlist_old\">");
3414 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3416 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3417 wprintf(" (INBOX)");
3420 if (fold[i].selectable) {
3427 wprintf("</div>\n"); /** roomdiv */
3430 wprintf("</div>\n"); /** floordiv */
3438 * \brief Burn the cached folder list.
3439 * \param age How old the cahce needs to be before we burn it.
3442 void burn_folder_cache(time_t age)
3444 /** If our cached folder list is very old, burn it. */
3445 if (WC->cache_fold != NULL) {
3446 if ((time(NULL) - WC->cache_timestamp) > age) {
3447 free(WC->cache_fold);
3448 WC->cache_fold = NULL;
3457 * \brief Show the room list.
3458 * (only should get called by
3459 * knrooms() because that's where output_headers() is called from)
3460 * \param viewpref the view preferences???
3463 void list_all_rooms_by_floor(const char *viewpref) {
3467 struct folder *fold = NULL;
3469 int max_folders = 0;
3470 int alloc_folders = 0;
3474 int ShowEmptyFloors;
3477 int num_floors = 1; /** add an extra one for private folders */
3480 /** If our cached folder list is very old, burn it. */
3481 burn_folder_cache(300);
3483 /** Can we do the iconbar roomlist from cache? */
3484 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3485 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3490 /** Grab the floor table so we know how to build the list... */
3491 load_floorlist(Buf);
3493 /** Start with the mailboxes */
3496 fold = malloc(sizeof(struct folder));
3497 memset(fold, 0, sizeof(struct folder));
3498 strcpy(fold[0].name, "My folders");
3499 fold[0].is_mailbox = 1;
3501 /** Then add floors */
3503 serv_getln(buf, sizeof buf);
3504 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3505 if (max_folders >= alloc_folders) {
3506 alloc_folders = max_folders + 100;
3507 fold = realloc(fold,
3508 alloc_folders * sizeof(struct folder));
3510 memset(&fold[max_folders], 0, sizeof(struct folder));
3511 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3512 extract_token(buf3, buf, 0, '|', SIZ);
3513 fold[max_folders].floor = atol (buf3);
3518 for (i=0; i<num_floors; i++)
3519 if (IDMax < fold[i].floor)
3520 IDMax = fold[i].floor;
3521 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3522 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3523 for (i=0; i<num_floors; i++)
3524 floor_mapping[fold[i].floor]=i;
3526 /** refresh the messages index for this room */
3527 /* TODO serv_puts("GOTO ");
3528 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3529 /** Now add rooms */
3531 serv_getln(buf, sizeof buf);
3532 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3533 if (max_folders >= alloc_folders) {
3534 alloc_folders = max_folders + 100;
3535 fold = realloc(fold,
3536 alloc_folders * sizeof(struct folder));
3538 memset(&fold[max_folders], 0, sizeof(struct folder));
3539 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3540 ra_flags = extract_int(buf, 5);
3541 flags = extract_int(buf, 1);
3542 fold[max_folders].floor = extract_int(buf, 2);
3543 fold[max_folders].hasnewmsgs =
3544 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3545 if (flags & QR_MAILBOX) {
3546 fold[max_folders].is_mailbox = 1;
3548 fold[max_folders].view = extract_int(buf, 6);
3549 room_to_folder(fold[max_folders].name,
3550 fold[max_folders].room,
3551 fold[max_folders].floor,
3552 fold[max_folders].is_mailbox);
3553 fold[max_folders].selectable = 1;
3554 /* Increase the room count for the associtaed floor */
3555 if (fold[max_folders].is_mailbox) {
3556 fold[0].num_rooms++;
3559 i = floor_mapping[fold[max_folders].floor];
3560 fold[i].num_rooms++;
3566 * Remove any floors that don't have rooms
3568 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3569 if (ShowEmptyFloors)
3571 for (i=0; i<num_floors; i++)
3573 if (fold[i].num_rooms == 0) {
3574 for (j=i; j<max_folders; j++) {
3575 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3584 /** Bubble-sort the folder list */
3585 for (i=0; i<max_folders; ++i) {
3586 for (j=0; j<(max_folders-1)-i; ++j) {
3587 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3588 swap = strcasecmp(fold[j].name, fold[j+1].name);
3591 if ( (fold[j+1].is_mailbox)
3592 && (!fold[j].is_mailbox)) {
3600 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3601 memcpy(&fold[j], &fold[j+1],
3602 sizeof(struct folder));
3603 memcpy(&fold[j+1], &ftmp,
3604 sizeof(struct folder));
3610 if (!strcasecmp(viewpref, "folders")) {
3611 do_folder_view(fold, max_folders, num_floors);
3613 else if (!strcasecmp(viewpref, "hackish_view")) {
3614 for (i=0; i<max_folders; ++i) {
3615 escputs(fold[i].name);
3616 wprintf("<br />\n");
3619 else if (!strcasecmp(viewpref, "iconbar")) {
3620 do_iconbar_view(fold, max_folders, num_floors);
3623 do_rooms_view(fold, max_folders, num_floors);
3626 /* Don't free the folder list ... cache it for future use! */
3627 if (WC->cache_fold != NULL) {
3628 free(WC->cache_fold);
3630 WC->cache_fold = fold;
3631 WC->cache_max_folders = max_folders;
3632 WC->cache_num_floors = num_floors;
3633 WC->cache_timestamp = time(NULL);
3634 free(floor_mapping);
3639 * \brief Do either a known rooms list or a folders list, depending on the
3644 StrBuf *ListView = NULL;
3646 output_headers(1, 1, 2, 0, 0, 0);
3648 /** Determine whether the user is trying to change views */
3649 if (havebstr("view")) {
3650 ListView = NewStrBufPlain(bstr("view"), -1);
3651 set_preference("roomlistview", ListView, 1);
3653 /** Sanitize the input so its safe */
3654 if(!get_preference("roomlistview", &ListView) ||
3655 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3656 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3658 if (ListView == NULL) {
3659 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3660 set_preference("roomlistview", ListView, 0);
3663 StrBufPrintf(ListView, "rooms");
3669 wprintf("<div id=\"banner\">\n");
3670 wprintf("<div class=\"room_banner\" id=\"room_banner\">");
3672 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3673 wprintf(_("Room list"));
3675 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3676 wprintf(_("Folder list"));
3678 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3679 wprintf(_("Room list"));
3681 wprintf("</h1></div>\n");
3683 /** offer the ability to switch views */
3684 wprintf("<div id=\"actiondiv\">");
3685 wprintf("<ul class=\"room_actions\">\n");
3686 wprintf("<li class=\"start_page\">");
3687 offer_start_page(NULL, &NoCtx);
3689 wprintf("<li><form name=\"roomlistomatic\">\n"
3690 "<select name=\"newview\" size=\"1\" "
3691 "OnChange=\"location.href=roomlistomatic.newview.options"
3692 "[selectedIndex].value\">\n");
3694 wprintf("<option %s value=\"knrooms&view=rooms\">"
3697 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3700 wprintf("<option %s value=\"knrooms&view=folders\">"
3701 "View as folder list"
3703 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3706 wprintf("</select>");
3707 wprintf("</form></li>");
3708 wprintf("</ul></div></div>\n");
3710 wprintf("<div id=\"content\" class=\"service\">\n");
3712 /** Display the room list in the user's preferred format */
3713 list_all_rooms_by_floor(ChrPtr(ListView));
3720 * \brief Set the message expire policy for this room and/or floor
3722 void set_room_policy(void) {
3725 if (!havebstr("ok_button")) {
3726 strcpy(WC->ImportantMessage,
3727 _("Cancelled. Changes were not saved."));
3732 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3733 serv_getln(buf, sizeof buf);
3734 strcpy(WC->ImportantMessage, &buf[4]);
3736 if (WC->axlevel >= 6) {
3737 strcat(WC->ImportantMessage, "<br />\n");
3738 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3739 serv_getln(buf, sizeof buf);
3740 strcat(WC->ImportantMessage, &buf[4]);
3746 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3747 /* todo: check context */
3753 floors = NewHash(1, NULL);
3755 serv_puts("LFLR"); /* get floors */
3756 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
3757 if (ChrPtr(Buf)[0] == '1') while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3759 const char *floorNum = NULL;
3760 floor = NewHash(1, NULL);
3761 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3763 StrBufExtract_token(Buf2, Buf, a, '|');
3765 floorNum = ChrPtr(Buf2); /* hmm, should we copy Buf2 first? */
3767 Put(floor, FPKEY(a), Buf2, NULL);
3769 Put(floors, HKEY(floorNum), floor, NULL);
3775 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3778 HashList *floor = (HashList *)(TP->Context);
3780 GetHash(floor, TKEY(0), &value);
3781 val = (StrBuf *)value;
3782 StrECMAEscAppend(TemplBuffer, val, 0);
3784 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP)
3787 return GetRoomListHash(Target, TP);
3789 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
3791 /* TODO: Check context */
3798 rooms = NewHash(1, NULL);
3799 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3800 if (ChrPtr(buf)[0] == '1') while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3802 const char *rmName = NULL;
3803 room = NewHash(1, NULL);
3804 for(i=0; i<ROOM_PARAM_LEN; i++) {
3806 StrBufExtract_token(buf2, buf, i, '|');
3808 rmName = ChrPtr(buf2);
3810 Put(room, RPKEY(i), buf2, NULL);
3812 Put(rooms, rmName, strlen(rmName), room, NULL);
3814 SortByHashKey(rooms, 1);
3815 /*SortByPayload(rooms, SortRoomsByListOrder); */
3819 /** Unused function that orders rooms by the listorder flag */
3820 int SortRoomsByListOrder(const void *room1, const void *room2)
3824 HashList *r1 = (HashList *)GetSearchPayload(room1);
3825 HashList *r2 = (HashList *)GetSearchPayload(room2);
3826 StrBuf *listOrderBuf1;
3827 StrBuf *listOrderBuf2;
3829 GetHash(r1, RPKEY(3), (void *)&listOrderBuf1);
3830 GetHash(r2, RPKEY(3), (void *)&listOrderBuf2);
3831 l1 = atoi(ChrPtr(listOrderBuf1));
3832 l2 = atoi(ChrPtr(listOrderBuf2));
3833 if (l1 < l2) return -1;
3834 else if (l1 > l2) return +1;
3837 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3841 HashList *room = (HashList *)(TP->Context);
3843 GetHash(room, TKEY(0), &value);
3844 val = (StrBuf *)value;
3845 StrECMAEscAppend(TemplBuffer, val, 0);
3847 void jsonRoomFlr(void) {
3848 /* Send as our own (application/json) content type */
3849 hprintf("HTTP/1.1 200 OK\r\n");
3850 hprintf("Content-type: application/json; charset=utf-8\r\n");
3851 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
3852 hprintf("Connection: close\r\n");
3853 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3855 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3858 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3860 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3863 void _gotonext(void) { slrp_highest(); gotonext(); }
3864 void dotskip(void) {smart_goto(sbstr("room"));}
3865 void _display_private(void) { display_private("", 0); }
3866 void dotgoto(void) {
3867 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3870 smart_goto(sbstr("room"));
3873 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3875 wprintf("<div id=\"banner\">\n");
3876 embed_room_banner(NULL, navbar_default);
3877 wprintf("</div>\n");
3881 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3883 wcsession *WCC = WC;
3886 (!IsEmptyStr(WCC->ugname)))
3887 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3891 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3893 wcsession *WCC = WC;
3895 return ((WCC!=NULL) &&
3896 (!IsEmptyStr(WCC->ugname)) &&
3897 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3900 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3902 wcsession *WCC = WC;
3904 return ((WCC!=NULL) &&
3905 ((WCC->room_flags & QR_PERMANENT) != 0));
3908 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3910 wcsession *WCC = WC;
3912 return ((WCC!=NULL) &&
3913 ((WCC->room_flags & QR_INUSE) != 0));
3916 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3918 wcsession *WCC = WC;
3920 return ((WCC!=NULL) &&
3921 ((WCC->room_flags & QR_PRIVATE) != 0));
3924 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3926 wcsession *WCC = WC;
3928 return ((WCC!=NULL) &&
3929 ((WCC->room_flags & QR_PASSWORDED) != 0));
3932 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3934 wcsession *WCC = WC;
3936 return ((WCC!=NULL) &&
3937 ((WCC->room_flags & QR_GUESSNAME) != 0));
3940 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3942 wcsession *WCC = WC;
3944 return ((WCC!=NULL) &&
3945 ((WCC->room_flags & QR_DIRECTORY) != 0));
3948 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3950 wcsession *WCC = WC;
3952 return ((WCC!=NULL) &&
3953 ((WCC->room_flags & QR_UPLOAD) != 0));
3956 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3958 wcsession *WCC = WC;
3960 return ((WCC!=NULL) &&
3961 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3964 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3966 wcsession *WCC = WC;
3968 return ((WCC!=NULL) &&
3969 ((WCC->room_flags & QR_VISDIR) != 0));
3972 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3974 wcsession *WCC = WC;
3976 return ((WCC!=NULL) &&
3977 ((WCC->room_flags & QR_ANONONLY) != 0));
3980 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3982 wcsession *WCC = WC;
3984 return ((WCC!=NULL) &&
3985 ((WCC->room_flags & QR_ANONOPT) != 0));
3988 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
3990 wcsession *WCC = WC;
3992 return ((WCC!=NULL) &&
3993 ((WCC->room_flags & QR_NETWORK) != 0));
3996 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
3998 wcsession *WCC = WC;
4000 return ((WCC!=NULL) &&
4001 ((WCC->room_flags & QR_PREFONLY) != 0));
4004 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
4006 wcsession *WCC = WC;
4008 return ((WCC!=NULL) &&
4009 ((WCC->room_flags & QR_READONLY) != 0));
4012 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
4014 wcsession *WCC = WC;
4016 return ((WCC!=NULL) &&
4017 ((WCC->room_flags & QR_MAILBOX) != 0));
4021 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
4023 wcsession *WCC = WC;
4025 return ( (WCC!= NULL) &&
4026 ((WCC->axlevel >= 6) ||
4027 (WCC->is_room_aide) ||
4028 (WCC->is_mailbox) ));
4031 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
4033 wcsession *WCC = WC;
4035 if ((WCC == NULL) ||
4036 (TP->Tokens->nParameters < 3) ||
4037 (TP->Tokens->Params[2]->Type != TYPE_STR)||
4038 (TP->Tokens->Params[2]->len < 7))
4041 switch(WCC->wc_view) {
4043 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
4045 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
4046 case VIEW_ADDRESSBOOK:
4047 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
4049 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
4051 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
4053 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
4055 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
4057 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
4059 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
4069 RegisterPreference("roomlistview",
4070 _("Room list view"),
4073 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
4075 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
4077 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
4078 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
4079 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
4080 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4081 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4082 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4083 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4084 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4085 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4086 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4087 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4088 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4089 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4090 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4091 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4092 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4093 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4094 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4095 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4096 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4097 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4098 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4099 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4100 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4101 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4103 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
4104 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4105 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4106 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4107 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4108 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4109 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4110 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4111 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4112 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4113 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4114 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4115 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4116 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4117 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4118 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4120 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4121 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4123 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4124 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4125 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4126 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, NULL, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4127 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);
4133 SessionDestroyModule_ROOMOPS
4136 if (sess->cache_fold != NULL) {
4137 free(sess->cache_fold);
4140 free_march_list(sess);