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) {
477 char with_files[256];
481 * We need to have the information returned by a GOTO server command.
482 * If it isn't supplied, we fake it by issuing our own GOTO.
485 memset(buf, '0', 20);
487 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
488 serv_getln(buf, sizeof buf);
492 /** The browser needs some information for its own use */
493 wprintf("<script type=\"text/javascript\"> \n"
494 " room_is_trash = %d; \n"
500 * If the user happens to select the "make this my start page" link,
501 * we want it to remember the URL as a "/dotskip" one instead of
502 * a "skip" or "gotonext" or something like that.
504 if (WC->this_page == NULL)
505 WC->this_page = NewStrBuf();
506 StrBufPrintf(WC->this_page,
508 ChrPtr(WC->wc_roomname));
510 /** Check for new mail. */
511 WC->new_mail = extract_int(&got[4], 9);
512 WC->wc_view = extract_int(&got[4], 11);
514 /* Is this a directory room and does it contain files and how many? */
515 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
518 serv_getln(buf2, sizeof buf2);
519 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
521 snprintf (with_files, sizeof with_files,
522 "; <a href=\"do_template?template=files\"> %d %s </a>",
524 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
527 strcpy (with_files, "");
529 svprintf(HKEY("NUMMSGS"), WCS_STRING,
530 _("%d new of %d messages%s"),
531 extract_int(&got[4], 1),
532 extract_int(&got[4], 2),
535 svcallback("ROOMPIC", embed_room_graphic);
536 svcallback("ROOMINFO", readinfo);
537 svcallback("VIEWOMATIC", embed_view_o_matic);
538 svcallback("SEARCHOMATIC", embed_search_o_matic);
539 svcallback("START", offer_start_page);
541 do_template("roombanner", NULL);
542 /* roombanner contains this for mobile */
543 if (navbar_style != navbar_none && !WC->is_mobile) {
545 wprintf("<div id=\"navbar\"><ul>");
547 if (navbar_style == navbar_default) wprintf(
548 "<li class=\"ungoto\">"
549 "<a href=\"ungoto\">"
550 "<img src=\"static/ungoto2_24x.gif\" alt=\"\">"
551 "<span class=\"navbar_link\">%s</span></A>"
552 "</li>\n", _("Ungoto")
555 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
557 "<li class=\"newmess\">"
558 "<a href=\"readnew\">"
559 "<img src=\"static/newmess2_24x.gif\" alt=\"\">"
560 "<span class=\"navbar_link\">%s</span></A>"
561 "</li>\n", _("Read new messages")
565 if (navbar_style == navbar_default) {
566 switch(WC->wc_view) {
567 case VIEW_ADDRESSBOOK:
569 "<li class=\"viewcontacts\">"
570 "<a href=\"readfwd\">"
571 "<img src=\"static/viewcontacts_24x.gif\" "
573 "<span class=\"navbar_link\">"
575 "</span></a></li>\n", _("View contacts")
580 "<li class=\"staskday\">"
581 "<a href=\"readfwd?calview=day\">"
582 "<img src=\"static/taskday2_24x.gif\" "
584 "<span class=\"navbar_link\">"
586 "</span></a></li>\n", _("Day view")
589 "<li class=\"monthview\">"
590 "<a href=\"readfwd?calview=month\">"
591 "<img src=\"static/monthview2_24x.gif\" "
593 "<span class=\"navbar_link\">"
595 "</span></a></li>\n", _("Month view")
600 "<li class=\"monthview\">"
601 "<a href=\"readfwd?calview=month\">"
602 "<img src=\"static/monthview2_24x.gif\" "
604 "<span class=\"navbar_link\">"
606 "</span></a></li>\n", _("Calendar list")
611 "<li class=\"taskmanag\">"
612 "<a href=\"readfwd\">"
613 "<img src=\"static/taskmanag_24x.gif\" "
615 "<span class=\"navbar_link\">"
617 "</span></a></li>\n", _("View tasks")
622 "<li class=\"viewnotes\">"
623 "<a href=\"readfwd\">"
624 "<img src=\"static/viewnotes_24x.gif\" "
626 "<span class=\"navbar_link\">"
628 "</span></a></li>\n", _("View notes")
633 "<li class=\"readallmess\">"
634 "<a id=\"m_refresh\" href=\"readfwd\">"
635 "<img src=\"static/readallmess3_24x.gif\" "
637 "<span class=\"navbar_link\">"
639 "</span></a></li>\n", _("Refresh message list")
644 "<li class=\"readallmess\">"
645 "<a href=\"readfwd\">"
646 "<img src=\"static/readallmess3_24x.gif\" "
648 "<span class=\"navbar_link\">"
650 "</span></a></li>\n", _("Wiki home")
655 "<li class=\"readallmess\">"
656 "<a href=\"readfwd\">"
657 "<img src=\"static/readallmess3_24x.gif\" "
659 "<span class=\"navbar_link\">"
661 "</span></a></li>\n", _("Read all messages")
667 if (navbar_style == navbar_default) {
668 switch(WC->wc_view) {
669 case VIEW_ADDRESSBOOK:
671 "<li class=\"addnewcontact\">"
672 "<a href=\"display_enter\">"
673 "<img src=\"static/addnewcontact_24x.gif\" "
674 "alt=\"\"><span class=\"navbar_link\">"
676 "</span></a></li>\n", _("Add new contact")
681 wprintf("<li class=\"addevent\"><a href=\"display_enter");
682 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
683 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
684 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
686 "<img src=\"static/addevent_24x.gif\" "
687 "alt=\"\"><span class=\"navbar_link\">"
689 "</span></a></li>\n", _("Add new event")
694 "<li class=\"newmess\">"
695 "<a href=\"display_enter\">"
696 "<img src=\"static/newmess3_24x.gif\" "
697 "alt=\"\"><span class=\"navbar_link\">"
699 "</span></a></li>\n", _("Add new task")
704 "<li class=\"enternewnote\">"
705 "<a href=\"add_new_note\">"
706 "<img src=\"static/enternewnote_24x.gif\" "
707 "alt=\"\"><span class=\"navbar_link\">"
709 "</span></a></li>\n", _("Add new note")
713 safestrncpy(buf, bstr("page"), sizeof buf);
716 "<li class=\"newmess\">"
717 "<a href=\"display_enter?wikipage=%s\">"
718 "<img src=\"static/newmess3_24x.gif\" "
719 "alt=\"\"><span class=\"navbar_link\">"
721 "</span></a></li>\n", buf, _("Edit this page")
726 "<li class=\"newmess\">"
727 "<a href=\"display_enter\">"
728 "<img src=\"static/newmess3_24x.gif\" "
729 "alt=\"\"><span class=\"navbar_link\">"
731 "</span></a></li>\n", _("Write mail")
734 "<li class=\"newmess\">"
735 "<a href=\"javascript:deleteAllSelectedMessages();\">"
736 "<img src=\"static/delete.gif\" "
737 "alt=\"\"><span class=\"navbar_link\">"
739 "</span></a></li>\n", _("Delete")
744 "<li class=\"newmess\">"
745 "<a href=\"display_enter\">"
746 "<img src=\"static/newmess3_24x.gif\" "
747 "alt=\"\"><span class=\"navbar_link\">"
749 "</span></a></li>\n", _("Enter a message")
755 if (navbar_style == navbar_default) wprintf(
756 "<li class=\"skipthisroom\">"
759 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\">"
760 "<span class=\"navbar_link\">%s</span></a>"
762 _("Leave all messages marked as unread, go to next room with unread messages"),
766 if (navbar_style == navbar_default) wprintf(
767 "<li class=\"markngo\">"
768 "<a href=\"gotonext\" "
770 "<img src=\"static/markngo_24x.gif\" alt=\"\">"
771 "<span class=\"navbar_link\">%s</span></a>"
773 _("Mark all messages as read, go to next room with unread messages"),
777 wprintf("</ul></div>\n");
784 * back end routine to take the session to a new room
786 long gotoroom(const StrBuf *gname)
789 static long ls = (-1L);
792 /* store ungoto information */
793 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
796 /** move to the new room */
797 serv_printf("GOTO %s", ChrPtr(gname));
798 StrBuf_ServGetln(Buf);
799 if (GetServerStatus(Buf, &err) != 2) {
800 serv_puts("GOTO _BASEROOM_");
801 StrBuf_ServGetln(Buf);
803 * well, we know that this is the fallback case,
804 * but we're interested that the first command
805 * didn't work out in first place.
807 if (GetServerStatus(Buf, NULL) != 2) {
813 if (WC->wc_roomname == NULL)
814 WC->wc_roomname = NewStrBuf();
816 FlushStrBuf(WC->wc_roomname);
818 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
819 StrBufCutLeft(WC->wc_roomname, 4);
820 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
821 /* highest_msg_read = extract_int(&buf[4],6);
822 maxmsgnum = extract_int(&buf[4],5);
824 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
825 ls = StrBufExtract_long(Buf, 6, '|');
826 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
827 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
828 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
829 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
830 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
833 WC->is_room_aide = WC->is_aide;
835 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
837 remove_march(WC->wc_roomname);
838 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
847 * \brief Locate the room on the march list which we most want to go to.
849 * is measured given a "weight" of preference based on various factors.
850 * \param desired_floor the room number on the citadel server
851 * \return the roomname
853 char *pop_march(int desired_floor)
855 static char TheRoom[128];
857 int TheOrder = 32767;
860 struct march *mptr = NULL;
862 strcpy(TheRoom, "_BASEROOM_");
863 if (WC->march == NULL)
866 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
868 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
869 weight = weight + 10000;
870 if (mptr->march_floor == desired_floor)
871 weight = weight + 5000;
873 weight = weight + ((128 - (mptr->march_floor)) * 128);
874 weight = weight + (128 - (mptr->march_order));
876 if (weight > TheWeight) {
878 strcpy(TheRoom, mptr->march_name);
879 TheFloor = mptr->march_floor;
880 TheOrder = mptr->march_order;
889 * Goto next room having unread messages.
891 * We want to skip over rooms that the user has already been to, and take the
892 * user back to the lobby when done. The room we end up in is placed in
893 * newroom - which is set to 0 (the lobby) initially.
894 * We start the search in the current room rather than the beginning to prevent
895 * two or more concurrent users from dragging each other back to the same room.
900 struct march *mptr = NULL;
901 struct march *mptr2 = NULL;
907 * First check to see if the march-mode list is already allocated.
908 * If it is, pop the first room off the list and go there.
911 if (WC->march == NULL) {
913 serv_getln(buf, sizeof buf);
915 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
916 if (IsEmptyStr(buf)) {
919 if (ELoop % 100 == 0)
924 extract_token(room_name, buf, 0, '|', sizeof room_name);
925 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
926 mptr = (struct march *) malloc(sizeof(struct march));
928 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
929 mptr->march_floor = extract_int(buf, 2);
930 mptr->march_order = extract_int(buf, 3);
931 if (WC->march == NULL)
940 * add _BASEROOM_ to the end of the march list, so the user will end up
941 * in the system base room (usually the Lobby>) at the end of the loop
943 mptr = (struct march *) malloc(sizeof(struct march));
945 mptr->march_order = 0;
946 mptr->march_floor = 0;
947 strcpy(mptr->march_name, "_BASEROOM_");
948 if (WC->march == NULL) {
952 while (mptr2->next != NULL)
957 * ...and remove the room we're currently in, so a <G>oto doesn't make us
958 * walk around in circles
960 remove_march(WC->wc_roomname);
962 if (WC->march != NULL) {
963 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
965 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
969 smart_goto(next_room);
970 FreeStrBuf(&next_room);
977 void smart_goto(const StrBuf *next_room) {
985 * mark all messages in current room as having been read
987 void slrp_highest(void)
991 serv_puts("SLRP HIGHEST");
992 serv_getln(buf, sizeof buf);
997 * un-goto the previous room
1003 if (!strcmp(WC->ugname, "")) {
1004 smart_goto(WC->wc_roomname);
1007 serv_printf("GOTO %s", WC->ugname);
1009 StrBuf_ServGetln(Buf);
1010 if (GetServerStatus(Buf, NULL) != 2) {
1011 smart_goto(WC->wc_roomname);
1015 if (WC->uglsn >= 0L) {
1016 serv_printf("SLRP %ld", WC->uglsn);
1017 StrBuf_ServGetln(Buf);
1020 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1021 strcpy(WC->ugname, "");
1026 typedef struct __room_states {
1041 * Set/clear/read the "self-service list subscribe" flag for a room
1043 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1044 * returns the new value.
1047 int self_service(int newval) {
1048 int current_value = 0;
1054 int flags, floor, order, view, flags2;
1057 serv_getln(buf, sizeof buf);
1058 if (buf[0] != '2') return(0);
1060 extract_token(name, &buf[4], 0, '|', sizeof name);
1061 extract_token(password, &buf[4], 1, '|', sizeof password);
1062 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1063 flags = extract_int(&buf[4], 3);
1064 floor = extract_int(&buf[4], 4);
1065 order = extract_int(&buf[4], 5);
1066 view = extract_int(&buf[4], 6);
1067 flags2 = extract_int(&buf[4], 7);
1069 if (flags2 & QR2_SELFLIST) {
1077 flags2 = flags2 | QR2_SELFLIST;
1079 else if (newval == 0) {
1080 flags2 = flags2 & ~QR2_SELFLIST;
1083 return(current_value);
1086 if (newval != current_value) {
1087 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1088 name, password, dirname, flags,
1089 floor, order, view, flags2);
1090 serv_getln(buf, sizeof buf);
1097 int is_selflist(room_states *RoomFlags)
1099 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1102 int is_publiclist(room_states *RoomFlags)
1104 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1107 int is_moderatedlist(room_states *RoomFlags)
1109 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1113 * Set/clear/read the "self-service list subscribe" flag for a room
1115 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1116 * returns the new value.
1119 int get_roomflags(room_states *RoomOps)
1124 serv_getln(buf, sizeof buf);
1125 if (buf[0] != '2') return(0);
1127 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1128 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1129 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1130 RoomOps->flags = extract_int(&buf[4], 3);
1131 RoomOps->floor = extract_int(&buf[4], 4);
1132 RoomOps->order = extract_int(&buf[4], 5);
1133 RoomOps->view = extract_int(&buf[4], 6);
1134 RoomOps->flags2 = extract_int(&buf[4], 7);
1138 int set_roomflags(room_states *RoomOps)
1142 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1151 serv_getln(buf, sizeof buf);
1161 * display the form for editing a room
1163 void display_editroom(void)
1169 char remote_room[128];
1172 char er_password[10];
1173 char er_dirname[15];
1174 char er_roomaide[26];
1181 char *not_shared_with;
1184 int floorpolicy = 0;
1186 char pop3_host[128];
1191 if (IsEmptyStr(tab)) tab = "admin";
1194 load_floorlist(Buf);
1196 output_headers(1, 1, 1, 0, 0, 0);
1198 wprintf("<div class=\"fix_scrollbar_bug\">");
1200 wprintf("<br />\n");
1202 /* print the tabbed dialog */
1203 wprintf("<div align=\"center\">");
1204 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""
1205 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1208 wprintf("<td class=\"");
1209 if (!strcmp(tab, "admin")) {
1210 wprintf(" tab_cell_label\">");
1211 wprintf(_("Administration"));
1214 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1215 wprintf(_("Administration"));
1219 wprintf("<td> </td>\n");
1221 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1223 wprintf("<td class=\"");
1224 if (!strcmp(tab, "config")) {
1225 wprintf(" tab_cell_label\">");
1226 wprintf(_("Configuration"));
1229 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1230 wprintf(_("Configuration"));
1234 wprintf("<td> </td>\n");
1236 wprintf("<td class=\"");
1237 if (!strcmp(tab, "expire")) {
1238 wprintf(" tab_cell_label\">");
1239 wprintf(_("Message expire policy"));
1242 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1243 wprintf(_("Message expire policy"));
1247 wprintf("<td> </td>\n");
1249 wprintf("<td class=\"");
1250 if (!strcmp(tab, "access")) {
1251 wprintf(" tab_cell_label\">");
1252 wprintf(_("Access controls"));
1255 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1256 wprintf(_("Access controls"));
1260 wprintf("<td> </td>\n");
1262 wprintf("<td class=\"");
1263 if (!strcmp(tab, "sharing")) {
1264 wprintf(" tab_cell_label\">");
1265 wprintf(_("Sharing"));
1268 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1269 wprintf(_("Sharing"));
1273 wprintf("<td> </td>\n");
1275 wprintf("<td class=\"");
1276 if (!strcmp(tab, "listserv")) {
1277 wprintf(" tab_cell_label\">");
1278 wprintf(_("Mailing list service"));
1281 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1282 wprintf(_("Mailing list service"));
1286 wprintf("<td> </td>\n");
1290 wprintf("<td class=\"");
1291 if (!strcmp(tab, "feeds")) {
1292 wprintf(" tab_cell_label\">");
1293 wprintf(_("Remote retrieval"));
1296 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1297 wprintf(_("Remote retrieval"));
1301 wprintf("<td> </td>\n");
1303 wprintf("</tr></table>\n");
1304 wprintf("</div>\n");
1305 /* end tabbed dialog */
1307 wprintf("<script type=\"text/javascript\">"
1308 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1312 /* begin content of whatever tab is open now */
1314 if (!strcmp(tab, "admin")) {
1315 wprintf("<div class=\"tabcontent\">");
1317 "<li><a href=\"delete_room\" "
1318 "onClick=\"return confirm('");
1319 wprintf(_("Are you sure you want to delete this room?"));
1320 wprintf("');\">\n");
1321 wprintf(_("Delete this room"));
1323 "<li><a href=\"display_editroompic\">\n");
1324 wprintf(_("Set or change the icon for this room's banner"));
1326 "<li><a href=\"display_editinfo\">\n");
1327 wprintf(_("Edit this room's Info file"));
1333 if (!strcmp(tab, "config")) {
1334 wprintf("<div class=\"tabcontent\">");
1336 serv_getln(buf, sizeof buf);
1338 if (!strncmp(buf, "550", 3)) {
1339 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1340 _("Higher access is required to access this function.")
1343 else if (buf[0] != '2') {
1344 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1347 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1348 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1349 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1350 er_flags = extract_int(&buf[4], 3);
1351 er_floor = extract_int(&buf[4], 4);
1352 er_flags2 = extract_int(&buf[4], 7);
1354 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1355 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1357 wprintf("<ul><li>");
1358 wprintf(_("Name of room: "));
1359 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1365 wprintf(_("Resides on floor: "));
1366 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1367 if (er_flags & QR_MAILBOX)
1368 wprintf("disabled >\n");
1369 for (i = 0; i < 128; ++i)
1370 if (!IsEmptyStr(floorlist[i])) {
1371 wprintf("<OPTION ");
1373 wprintf("SELECTED ");
1374 wprintf("VALUE=\"%d\">", i);
1375 escputs(floorlist[i]);
1376 wprintf("</OPTION>\n");
1378 wprintf("</select>\n");
1381 wprintf(_("Type of room:"));
1384 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1385 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1386 wprintf("CHECKED ");
1387 wprintf("OnChange=\""
1388 " if (this.form.type[0].checked == true) { "
1389 " this.form.er_floor.disabled = false; "
1392 wprintf(_("Public (automatically appears to everyone)"));
1395 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1396 if ((er_flags & QR_PRIVATE) &&
1397 (er_flags & QR_GUESSNAME))
1398 wprintf("CHECKED ");
1399 wprintf(" OnChange=\""
1400 " if (this.form.type[1].checked == true) { "
1401 " this.form.er_floor.disabled = false; "
1404 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1406 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1407 if ((er_flags & QR_PRIVATE) &&
1408 (er_flags & QR_PASSWORDED))
1409 wprintf("CHECKED ");
1410 wprintf(" OnChange=\""
1411 " if (this.form.type[2].checked == true) { "
1412 " this.form.er_floor.disabled = false; "
1415 wprintf(_("Private - require password: "));
1416 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1419 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1420 if ((er_flags & QR_PRIVATE)
1421 && ((er_flags & QR_GUESSNAME) == 0)
1422 && ((er_flags & QR_PASSWORDED) == 0))
1423 wprintf("CHECKED ");
1424 wprintf(" OnChange=\""
1425 " if (this.form.type[3].checked == true) { "
1426 " this.form.er_floor.disabled = false; "
1429 wprintf(_("Private - invitation only"));
1431 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1432 if (er_flags & QR_MAILBOX)
1433 wprintf("CHECKED ");
1434 wprintf (" OnChange=\""
1435 " if (this.form.type[4].checked == true) { "
1436 " this.form.er_floor.disabled = true; "
1439 wprintf(_("Personal (mailbox for you only)"));
1441 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1443 wprintf(_("If private, cause current users to forget room"));
1445 wprintf("\n</ul>\n");
1447 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1448 if (er_flags & QR_PREFONLY)
1449 wprintf("CHECKED ");
1451 wprintf(_("Preferred users only"));
1453 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1454 if (er_flags & QR_READONLY)
1455 wprintf("CHECKED ");
1457 wprintf(_("Read-only room"));
1459 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1460 if (er_flags2 & QR2_COLLABDEL)
1461 wprintf("CHECKED ");
1463 wprintf(_("All users allowed to post may also delete messages"));
1465 /** directory stuff */
1466 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1467 if (er_flags & QR_DIRECTORY)
1468 wprintf("CHECKED ");
1470 wprintf(_("File directory room"));
1472 wprintf("\n<ul><li>");
1473 wprintf(_("Directory name: "));
1474 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1477 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1478 if (er_flags & QR_UPLOAD)
1479 wprintf("CHECKED ");
1481 wprintf(_("Uploading allowed"));
1483 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1484 if (er_flags & QR_DOWNLOAD)
1485 wprintf("CHECKED ");
1487 wprintf(_("Downloading allowed"));
1489 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1490 if (er_flags & QR_VISDIR)
1491 wprintf("CHECKED ");
1493 wprintf(_("Visible directory"));
1496 /** end of directory stuff */
1498 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1499 if (er_flags & QR_NETWORK)
1500 wprintf("CHECKED ");
1502 wprintf(_("Network shared room"));
1504 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1505 if (er_flags & QR_PERMANENT)
1506 wprintf("CHECKED ");
1508 wprintf(_("Permanent (does not auto-purge)"));
1510 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1511 if (er_flags2 & QR2_SUBJECTREQ)
1512 wprintf("CHECKED ");
1514 wprintf(_("Subject Required (Force users to specify a message subject)"));
1516 /** start of anon options */
1519 wprintf(_("Anonymous messages"));
1522 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1523 if (((er_flags & QR_ANONONLY) == 0)
1524 && ((er_flags & QR_ANONOPT) == 0))
1525 wprintf("CHECKED ");
1527 wprintf(_("No anonymous messages"));
1529 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1530 if (er_flags & QR_ANONONLY)
1531 wprintf("CHECKED ");
1533 wprintf(_("All messages are anonymous"));
1535 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1536 if (er_flags & QR_ANONOPT)
1537 wprintf("CHECKED ");
1539 wprintf(_("Prompt user when entering messages"));
1542 /* end of anon options */
1545 wprintf(_("Room aide: "));
1547 serv_getln(buf, sizeof buf);
1548 if (buf[0] != '2') {
1549 wprintf("<em>%s</em>\n", &buf[4]);
1551 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1552 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1555 wprintf("</ul><CENTER>\n");
1556 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1557 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1559 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1569 /* Sharing the room with other Citadel nodes... */
1570 if (!strcmp(tab, "sharing")) {
1571 wprintf("<div class=\"tabcontent\">");
1573 shared_with = strdup("");
1574 not_shared_with = strdup("");
1576 /** Learn the current configuration */
1577 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1578 serv_getln(buf, sizeof buf);
1579 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1580 extract_token(node, buf, 0, '|', sizeof node);
1581 not_shared_with = realloc(not_shared_with,
1582 strlen(not_shared_with) + 32);
1583 strcat(not_shared_with, node);
1584 strcat(not_shared_with, "\n");
1588 serv_getln(buf, sizeof buf);
1589 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1590 extract_token(cmd, buf, 0, '|', sizeof cmd);
1591 extract_token(node, buf, 1, '|', sizeof node);
1592 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1593 if (!strcasecmp(cmd, "ignet_push_share")) {
1594 shared_with = realloc(shared_with,
1595 strlen(shared_with) + 32);
1596 strcat(shared_with, node);
1597 if (!IsEmptyStr(remote_room)) {
1598 strcat(shared_with, "|");
1599 strcat(shared_with, remote_room);
1601 strcat(shared_with, "\n");
1605 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1606 extract_token(buf, shared_with, i, '\n', sizeof buf);
1607 extract_token(node, buf, 0, '|', sizeof node);
1608 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1609 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1610 if (!strcasecmp(node, cmd)) {
1611 remove_token(not_shared_with, j, '\n');
1616 /* Display the stuff */
1617 wprintf("<CENTER><br />"
1618 "<table border=1 cellpadding=5><tr>"
1620 wprintf(_("Shared with"));
1621 wprintf("</I></B></td>"
1623 wprintf(_("Not shared with"));
1624 wprintf("</I></B></td></tr>\n"
1625 "<tr><td VALIGN=TOP>\n");
1627 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1628 wprintf(_("Remote node name"));
1629 wprintf("</td><td>");
1630 wprintf(_("Remote room name"));
1631 wprintf("</td><td>");
1632 wprintf(_("Actions"));
1633 wprintf("</td></tr>\n");
1635 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1636 extract_token(buf, shared_with, i, '\n', sizeof buf);
1637 extract_token(node, buf, 0, '|', sizeof node);
1638 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1639 if (!IsEmptyStr(node)) {
1640 wprintf("<form method=\"POST\" action=\"netedit\">");
1641 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1642 wprintf("<tr><td>%s</td>\n", node);
1645 if (!IsEmptyStr(remote_room)) {
1646 escputs(remote_room);
1652 wprintf("<input type=\"hidden\" NAME=\"line\" "
1653 "VALUE=\"ignet_push_share|");
1655 if (!IsEmptyStr(remote_room)) {
1657 urlescputs(remote_room);
1660 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1661 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1662 wprintf("<input type=\"submit\" "
1663 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1664 wprintf("</td></tr></form>\n");
1668 wprintf("</table>\n");
1669 wprintf("</td><td VALIGN=TOP>\n");
1670 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1671 wprintf(_("Remote node name"));
1672 wprintf("</td><td>");
1673 wprintf(_("Remote room name"));
1674 wprintf("</td><td>");
1675 wprintf(_("Actions"));
1676 wprintf("</td></tr>\n");
1678 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1679 extract_token(node, not_shared_with, i, '\n', sizeof node);
1680 if (!IsEmptyStr(node)) {
1681 wprintf("<form method=\"POST\" action=\"netedit\">");
1682 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1683 wprintf("<tr><td>");
1686 "<input type=\"INPUT\" "
1690 wprintf("<input type=\"hidden\" "
1692 "VALUE=\"ignet_push_share|");
1695 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1696 "VALUE=\"sharing\">\n");
1697 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1698 "VALUE=\"add\">\n");
1699 wprintf("<input type=\"submit\" "
1700 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1701 wprintf("</td></tr></form>\n");
1705 wprintf("</table>\n");
1706 wprintf("</td></tr>"
1707 "</table></CENTER><br />\n"
1708 "<I><B>%s</B><ul><li>", _("Notes:"));
1709 wprintf(_("When sharing a room, "
1710 "it must be shared from both ends. Adding a node to "
1711 "the 'shared' list sends messages out, but in order to"
1712 " receive messages, the other nodes must be configured"
1713 " to send messages out to your system as well. "
1714 "<li>If the remote room name is blank, it is assumed "
1715 "that the room name is identical on the remote node."
1716 "<li>If the remote room name is different, the remote "
1717 "node must also configure the name of the room here."
1724 /* Mailing list management */
1725 if (!strcmp(tab, "listserv")) {
1726 room_states RoomFlags;
1727 wprintf("<div class=\"tabcontent\">");
1729 wprintf("<br /><center>"
1730 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1731 "<tr><td VALIGN=TOP>");
1733 wprintf(_("<i>The contents of this room are being "
1734 "mailed <b>as individual messages</b> "
1735 "to the following list recipients:"
1736 "</i><br /><br />\n"));
1739 serv_getln(buf, sizeof buf);
1740 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1741 extract_token(cmd, buf, 0, '|', sizeof cmd);
1742 if (!strcasecmp(cmd, "listrecp")) {
1743 extract_token(recp, buf, 1, '|', sizeof recp);
1746 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1749 wprintf(_("(remove)"));
1750 wprintf("</A><br />");
1753 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1754 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1755 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1756 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1757 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1758 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1759 wprintf("</form>\n");
1761 wprintf("</td><td VALIGN=TOP>\n");
1763 wprintf(_("<i>The contents of this room are being "
1764 "mailed <b>in digest form</b> "
1765 "to the following list recipients:"
1766 "</i><br /><br />\n"));
1769 serv_getln(buf, sizeof buf);
1770 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1771 extract_token(cmd, buf, 0, '|', sizeof cmd);
1772 if (!strcasecmp(cmd, "digestrecp")) {
1773 extract_token(recp, buf, 1, '|', sizeof recp);
1776 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1780 wprintf(_("(remove)"));
1781 wprintf("</A><br />");
1784 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1785 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1786 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1787 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1788 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1789 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1790 wprintf("</form>\n");
1792 wprintf("</td></tr></table>\n");
1794 /** Pop open an address book -- begin **/
1795 wprintf("<div align=right>"
1796 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1798 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1803 _("Add recipients from Contacts or other address books"),
1804 _("Add recipients from Contacts or other address books")
1806 /* Pop open an address book -- end **/
1808 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1810 get_roomflags (&RoomFlags);
1812 /* Self Service subscription? */
1813 wprintf("<table><tr><td>\n");
1814 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1815 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1816 " <tr><td colspan=\"2\">\n",
1817 (is_selflist(&RoomFlags))?"checked":"");
1818 wprintf(_("The URL for subscribe/unsubscribe is: "));
1819 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1820 (is_https ? "https" : "http"),
1821 ChrPtr(WC->http_host));
1822 /* Public posting? */
1823 wprintf("<tr><td>");
1824 wprintf(_("Allow non-subscribers to mail to this room."));
1825 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1826 (is_publiclist(&RoomFlags))?"checked":"");
1828 /* Moderated List? */
1829 wprintf("<tr><td>");
1830 wprintf(_("Room post publication needs Aide permission."));
1831 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1832 (is_moderatedlist(&RoomFlags))?"checked":"");
1835 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1836 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1837 wprintf("</table></form>");
1840 wprintf("</CENTER>\n");
1845 /* Configuration of The Dreaded Auto-Purger */
1846 if (!strcmp(tab, "expire")) {
1847 wprintf("<div class=\"tabcontent\">");
1849 serv_puts("GPEX room");
1850 serv_getln(buf, sizeof buf);
1851 if (!strncmp(buf, "550", 3)) {
1852 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1853 _("Higher access is required to access this function.")
1856 else if (buf[0] != '2') {
1857 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1860 roompolicy = extract_int(&buf[4], 0);
1861 roomvalue = extract_int(&buf[4], 1);
1863 serv_puts("GPEX floor");
1864 serv_getln(buf, sizeof buf);
1865 if (buf[0] == '2') {
1866 floorpolicy = extract_int(&buf[4], 0);
1867 floorvalue = extract_int(&buf[4], 1);
1870 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1871 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1872 wprintf("<table border=0 cellspacing=5>\n");
1873 wprintf("<tr><td>");
1874 wprintf(_("Message expire policy for this room"));
1876 escputs(ChrPtr(WC->wc_roomname));
1877 wprintf(")</td><td>");
1878 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1879 ((roompolicy == 0) ? "CHECKED" : "") );
1880 wprintf(_("Use the default policy for this floor"));
1881 wprintf("<br />\n");
1882 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1883 ((roompolicy == 1) ? "CHECKED" : "") );
1884 wprintf(_("Never automatically expire messages"));
1885 wprintf("<br />\n");
1886 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1887 ((roompolicy == 2) ? "CHECKED" : "") );
1888 wprintf(_("Expire by message count"));
1889 wprintf("<br />\n");
1890 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1891 ((roompolicy == 3) ? "CHECKED" : "") );
1892 wprintf(_("Expire by message age"));
1894 wprintf(_("Number of messages or days: "));
1895 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1896 wprintf("</td></tr>\n");
1898 if (WC->axlevel >= 6) {
1899 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1900 wprintf("<tr><td>");
1901 wprintf(_("Message expire policy for this floor"));
1903 escputs(floorlist[WC->wc_floor]);
1904 wprintf(")</td><td>");
1905 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1906 ((floorpolicy == 0) ? "CHECKED" : "") );
1907 wprintf(_("Use the system default"));
1908 wprintf("<br />\n");
1909 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1910 ((floorpolicy == 1) ? "CHECKED" : "") );
1911 wprintf(_("Never automatically expire messages"));
1912 wprintf("<br />\n");
1913 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1914 ((floorpolicy == 2) ? "CHECKED" : "") );
1915 wprintf(_("Expire by message count"));
1916 wprintf("<br />\n");
1917 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1918 ((floorpolicy == 3) ? "CHECKED" : "") );
1919 wprintf(_("Expire by message age"));
1921 wprintf(_("Number of messages or days: "));
1922 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1926 wprintf("<CENTER>\n");
1927 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1928 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1930 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1931 wprintf("</CENTER></td><tr>\n");
1933 wprintf("</table>\n"
1934 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1942 /* Access controls */
1943 if (!strcmp(tab, "access")) {
1944 wprintf("<div class=\"tabcontent\">");
1949 /* Fetch messages from remote locations */
1950 if (!strcmp(tab, "feeds")) {
1951 wprintf("<div class=\"tabcontent\">");
1954 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1955 wprintf("</i><br />\n");
1957 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1958 "<tr class=\"even\"><th>");
1959 wprintf(_("Remote host"));
1960 wprintf("</th><th>");
1961 wprintf(_("User name"));
1962 wprintf("</th><th>");
1963 wprintf(_("Password"));
1964 wprintf("</th><th>");
1965 wprintf(_("Keep messages on server?"));
1966 wprintf("</th><th>");
1967 wprintf(_("Interval"));
1968 wprintf("</th><th> </th></tr>");
1971 serv_getln(buf, sizeof buf);
1973 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1974 extract_token(cmd, buf, 0, '|', sizeof cmd);
1975 if (!strcasecmp(cmd, "pop3client")) {
1976 safestrncpy(recp, &buf[11], sizeof recp);
1979 wprintf("<tr class=\"%s\">",
1980 (bg ? "even" : "odd")
1984 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1989 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1993 wprintf("<td>*****</td>"); /* Don't show the password */
1995 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1997 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1999 wprintf("<td class=\"button_link\">");
2000 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
2003 wprintf(_("(remove)"));
2004 wprintf("</a></td>");
2010 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2012 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2013 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
2014 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2016 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
2019 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
2022 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2025 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2028 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2031 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2032 wprintf("</td></tr>");
2033 wprintf("</form></table>\n");
2038 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2039 wprintf("</i><br />\n");
2041 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2042 "<tr class=\"even\"><th>");
2043 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2044 wprintf(_("Feed URL"));
2045 wprintf("</th><th>");
2046 wprintf("</th></tr>");
2049 serv_getln(buf, sizeof buf);
2051 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2052 extract_token(cmd, buf, 0, '|', sizeof cmd);
2053 if (!strcasecmp(cmd, "rssclient")) {
2054 safestrncpy(recp, &buf[10], sizeof recp);
2057 wprintf("<tr class=\"%s\">",
2058 (bg ? "even" : "odd")
2062 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2066 wprintf("<td class=\"button_link\">");
2067 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
2070 wprintf(_("(remove)"));
2071 wprintf("</a></td>");
2077 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2079 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2080 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2081 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2083 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2084 "maxlength=\"256\" name=\"line_pop3host\">\n");
2087 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2088 wprintf("</td></tr>");
2089 wprintf("</form></table>\n");
2095 /* end content of whatever tab is open now */
2096 wprintf("</div>\n");
2098 address_book_popup();
2104 * Toggle self-service list subscription
2106 void toggle_self_service(void) {
2107 room_states RoomFlags;
2109 get_roomflags (&RoomFlags);
2111 if (yesbstr("QR2_SelfList"))
2112 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2114 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2116 if (yesbstr("QR2_SMTP_PUBLIC"))
2117 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2119 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2121 if (yesbstr("QR2_Moderated"))
2122 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2124 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2125 if (yesbstr("QR2_SubsOnly"))
2126 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2128 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2130 set_roomflags (&RoomFlags);
2138 * save new parameters for a room
2145 StrBuf *er_password;
2147 StrBuf *er_roomaide;
2150 int er_listingorder;
2156 if (!havebstr("ok_button")) {
2157 strcpy(WC->ImportantMessage,
2158 _("Cancelled. Changes were not saved."));
2164 StrBuf_ServGetln(Buf);
2165 if (GetServerStatus(Buf, NULL) != 2) {
2166 StrBufCutLeft(Buf, 4);
2167 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2173 er_name = NewStrBuf();
2174 er_password = NewStrBuf();
2175 er_dirname = NewStrBuf();
2176 er_roomaide = NewStrBuf();
2178 StrBufCutLeft(Buf, 4);
2179 StrBufExtract_token(er_name, Buf, 0, '|');
2180 StrBufExtract_token(er_password, Buf, 1, '|');
2181 StrBufExtract_token(er_dirname, Buf, 2, '|');
2182 er_flags = StrBufExtract_int(Buf, 3, '|');
2183 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2184 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2185 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2187 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2188 if (StrLength(er_roomaide) == 0) {
2190 StrBuf_ServGetln(Buf);
2191 if (GetServerStatus(Buf, NULL) != 2) {
2192 FlushStrBuf(er_roomaide);
2194 StrBufCutLeft(Buf, 4);
2195 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2198 Ptr = sbstr("er_name");
2199 if (StrLength(Ptr) > 0) {
2200 FlushStrBuf(er_name);
2201 StrBufAppendBuf(er_name, Ptr, 0);
2204 Ptr = sbstr("er_password");
2205 if (StrLength(Ptr) > 0) {
2206 FlushStrBuf(er_password);
2207 StrBufAppendBuf(er_password, Ptr, 0);
2211 Ptr = sbstr("er_dirname");
2212 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2213 FlushStrBuf(er_dirname);
2214 StrBufAppendBuf(er_dirname, Ptr, 0);
2218 Ptr = sbstr("type");
2219 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2221 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2222 er_flags |= (QR_PRIVATE);
2224 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2225 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2227 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2228 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2230 if (!strcmp(ChrPtr(Ptr), "personal")) {
2231 er_flags |= QR_MAILBOX;
2233 er_flags &= ~QR_MAILBOX;
2236 if (yesbstr("prefonly")) {
2237 er_flags |= QR_PREFONLY;
2239 er_flags &= ~QR_PREFONLY;
2242 if (yesbstr("readonly")) {
2243 er_flags |= QR_READONLY;
2245 er_flags &= ~QR_READONLY;
2249 if (yesbstr("collabdel")) {
2250 er_flags2 |= QR2_COLLABDEL;
2252 er_flags2 &= ~QR2_COLLABDEL;
2255 if (yesbstr("permanent")) {
2256 er_flags |= QR_PERMANENT;
2258 er_flags &= ~QR_PERMANENT;
2261 if (yesbstr("subjectreq")) {
2262 er_flags2 |= QR2_SUBJECTREQ;
2264 er_flags2 &= ~QR2_SUBJECTREQ;
2267 if (yesbstr("network")) {
2268 er_flags |= QR_NETWORK;
2270 er_flags &= ~QR_NETWORK;
2273 if (yesbstr("directory")) {
2274 er_flags |= QR_DIRECTORY;
2276 er_flags &= ~QR_DIRECTORY;
2279 if (yesbstr("ulallowed")) {
2280 er_flags |= QR_UPLOAD;
2282 er_flags &= ~QR_UPLOAD;
2285 if (yesbstr("dlallowed")) {
2286 er_flags |= QR_DOWNLOAD;
2288 er_flags &= ~QR_DOWNLOAD;
2291 if (yesbstr("visdir")) {
2292 er_flags |= QR_VISDIR;
2294 er_flags &= ~QR_VISDIR;
2297 Ptr = sbstr("anon");
2299 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2300 if (!strcmp(ChrPtr(Ptr), "anononly"))
2301 er_flags |= QR_ANONONLY;
2302 if (!strcmp(ChrPtr(Ptr), "anon2"))
2303 er_flags |= QR_ANONOPT;
2305 bump = yesbstr("bump");
2307 er_floor = ibstr("er_floor");
2309 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2311 ChrPtr(er_password),
2320 StrBuf_ServGetln(Buf);
2321 if (GetServerStatus(Buf, NULL) != 2) {
2322 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2325 FreeStrBuf(&er_name);
2326 FreeStrBuf(&er_password);
2327 FreeStrBuf(&er_dirname);
2328 FreeStrBuf(&er_roomaide);
2333 if (StrLength(er_roomaide) > 0) {
2334 serv_printf("SETA %s", ChrPtr(er_roomaide));
2335 StrBuf_ServGetln(Buf);
2336 if (GetServerStatus(Buf, NULL) != 2) {
2337 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2338 display_main_menu();
2340 FreeStrBuf(&er_name);
2341 FreeStrBuf(&er_password);
2342 FreeStrBuf(&er_dirname);
2343 FreeStrBuf(&er_roomaide);
2348 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2351 FreeStrBuf(&er_name);
2352 FreeStrBuf(&er_password);
2353 FreeStrBuf(&er_dirname);
2354 FreeStrBuf(&er_roomaide);
2360 * Display form for Invite, Kick, and show Who Knows a room
2362 void do_invt_kick(void) {
2363 char buf[SIZ], room[SIZ], username[SIZ];
2366 serv_getln(buf, sizeof buf);
2368 if (buf[0] != '2') {
2372 extract_token(room, &buf[4], 0, '|', sizeof room);
2374 strcpy(username, bstr("username"));
2376 if (havebstr("kick_button")) {
2377 sprintf(buf, "KICK %s", username);
2379 serv_getln(buf, sizeof buf);
2381 if (buf[0] != '2') {
2382 strcpy(WC->ImportantMessage, &buf[4]);
2384 sprintf(WC->ImportantMessage,
2385 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2390 if (havebstr("invite_button")) {
2391 sprintf(buf, "INVT %s", username);
2393 serv_getln(buf, sizeof buf);
2395 if (buf[0] != '2') {
2396 strcpy(WC->ImportantMessage, &buf[4]);
2398 sprintf(WC->ImportantMessage,
2399 _("<B><I>User %s invited to room %s.</I></B>\n"),
2410 * Display form for Invite, Kick, and show Who Knows a room
2412 void display_whok(void)
2414 char buf[SIZ], room[SIZ], username[SIZ];
2417 serv_getln(buf, sizeof buf);
2419 if (buf[0] != '2') {
2423 extract_token(room, &buf[4], 0, '|', sizeof room);
2426 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2427 wprintf(_("The users listed below have access to this room. "
2428 "To remove a user from the access list, select the user "
2429 "name from the list and click 'Kick'."));
2430 wprintf("<br /><br />");
2432 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2433 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2434 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2435 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2437 serv_getln(buf, sizeof buf);
2438 if (buf[0] == '1') {
2439 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2440 extract_token(username, buf, 0, '|', sizeof username);
2441 wprintf("<OPTION>");
2446 wprintf("</select><br />\n");
2448 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2449 wprintf("</form></CENTER>\n");
2451 wprintf("</td><td>");
2452 wprintf(_("To grant another user access to this room, enter the "
2453 "user name in the box below and click 'Invite'."));
2454 wprintf("<br /><br />");
2456 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2457 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2458 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2459 wprintf(_("Invite:"));
2461 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2462 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2463 "<input type=\"submit\" value=\"%s\">"
2464 "</form></CENTER>\n", _("Invite"));
2465 /* Pop open an address book -- begin **/
2467 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2469 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2472 _("Users"), _("Users")
2474 /* Pop open an address book -- end **/
2476 wprintf("</td></tr></table>\n");
2477 address_book_popup();
2484 * display the form for entering a new room
2486 void display_entroom(void)
2493 serv_puts("CRE8 0");
2494 serv_getln(buf, sizeof buf);
2496 if (buf[0] != '2') {
2497 strcpy(WC->ImportantMessage, &buf[4]);
2498 display_main_menu();
2503 output_headers(1, 1, 1, 0, 0, 0);
2505 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2506 do_template("beginbox", NULL);
2508 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2509 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2511 wprintf("<table class=\"altern\"> ");
2513 wprintf("<tr class=\"even\"><td>");
2514 wprintf(_("Name of room: "));
2515 wprintf("</td><td>");
2516 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2517 wprintf("</td></tr>");
2519 wprintf("<tr class=\"odd\"><td>");
2520 wprintf(_("Resides on floor: "));
2521 wprintf("</td><td>");
2522 load_floorlist(Buf);
2523 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2524 for (i = 0; i < 128; ++i)
2525 if (!IsEmptyStr(floorlist[i])) {
2526 wprintf("<option ");
2527 wprintf("value=\"%d\">", i);
2528 escputs(floorlist[i]);
2529 wprintf("</option>\n");
2531 wprintf("</select>\n");
2532 wprintf("</td></tr>");
2535 * Our clever little snippet of JavaScript automatically selects
2536 * a public room if the view is set to Bulletin Board or wiki, and
2537 * it selects a mailbox room otherwise. The user can override this,
2538 * of course. We also disable the floor selector for mailboxes.
2540 wprintf("<tr class=\"even\"><td>");
2541 wprintf(_("Default view for room: "));
2542 wprintf("</td><td>");
2543 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2544 " if ( (this.form.er_view.value == 0) "
2545 " || (this.form.er_view.value == 6) ) { "
2546 " this.form.type[0].checked=true; "
2547 " this.form.er_floor.disabled = false; "
2550 " this.form.type[4].checked=true; "
2551 " this.form.er_floor.disabled = true; "
2554 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2555 if (is_view_allowed_as_default(i)) {
2556 wprintf("<option %s value=\"%d\">",
2557 ((i == 0) ? "selected" : ""), i );
2558 escputs(viewdefs[i]);
2559 wprintf("</option>\n");
2562 wprintf("</select>\n");
2563 wprintf("</td></tr>");
2565 wprintf("<tr class=\"even\"><td>");
2566 wprintf(_("Type of room:"));
2567 wprintf("</td><td>");
2568 wprintf("<ul class=\"adminlist\">\n");
2570 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2571 wprintf("CHECKED OnChange=\""
2572 " if (this.form.type[0].checked == true) { "
2573 " this.form.er_floor.disabled = false; "
2576 wprintf(_("Public (automatically appears to everyone)"));
2579 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2580 " if (this.form.type[1].checked == true) { "
2581 " this.form.er_floor.disabled = false; "
2584 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2587 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2588 " if (this.form.type[2].checked == true) { "
2589 " this.form.er_floor.disabled = false; "
2592 wprintf(_("Private - require password: "));
2593 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2596 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2597 " if (this.form.type[3].checked == true) { "
2598 " this.form.er_floor.disabled = false; "
2601 wprintf(_("Private - invitation only"));
2604 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2606 " if (this.form.type[4].checked == true) { "
2607 " this.form.er_floor.disabled = true; "
2610 wprintf(_("Personal (mailbox for you only)"));
2613 wprintf("\n</ul>\n");
2614 wprintf("</td></tr></table>\n");
2616 wprintf("<div class=\"buttons\">\n");
2617 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2619 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2620 wprintf("</div>\n");
2621 wprintf("</form>\n<hr />");
2622 serv_printf("MESG roomaccess");
2623 serv_getln(buf, sizeof buf);
2624 if (buf[0] == '1') {
2628 do_template("endbox", NULL);
2638 * support function for entroom() -- sets the default view
2640 void er_set_default_view(int newview) {
2653 serv_getln(buf, sizeof buf);
2654 if (buf[0] != '2') return;
2656 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2657 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2658 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2659 rm_bits1 = extract_int(&buf[4], 3);
2660 rm_floor = extract_int(&buf[4], 4);
2661 rm_listorder = extract_int(&buf[4], 5);
2662 rm_bits2 = extract_int(&buf[4], 7);
2664 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2665 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2666 rm_listorder, newview, rm_bits2
2668 serv_getln(buf, sizeof buf);
2679 const StrBuf *er_name;
2680 const StrBuf *er_type;
2681 const StrBuf *er_password;
2686 if (!havebstr("ok_button")) {
2687 strcpy(WC->ImportantMessage,
2688 _("Cancelled. No new room was created."));
2689 display_main_menu();
2692 er_name = sbstr("er_name");
2693 er_type = sbstr("type");
2694 er_password = sbstr("er_password");
2695 er_floor = ibstr("er_floor");
2696 er_view = ibstr("er_view");
2699 if (!strcmp(ChrPtr(er_type), "hidden"))
2701 else if (!strcmp(ChrPtr(er_type), "passworded"))
2703 else if (!strcmp(ChrPtr(er_type), "invonly"))
2705 else if (!strcmp(ChrPtr(er_type), "personal"))
2708 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2711 ChrPtr(er_password),
2716 serv_getln(buf, sizeof buf);
2717 if (buf[0] != '2') {
2718 strcpy(WC->ImportantMessage, &buf[4]);
2719 display_main_menu();
2722 /** TODO: Room created, now udate the left hand icon bar for this user */
2723 burn_folder_cache(0); /* burn the old folder cache */
2727 do_change_view(er_view); /* Now go there */
2732 * \brief display the screen to enter a private room
2734 void display_private(char *rname, int req_pass)
2736 WCTemplputParams SubTP;
2738 output_headers(1, 1, 1, 0, 0, 0);
2740 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2741 memset(&SubTP, 0, sizeof(WCTemplputParams));
2742 SubTP.Filter.ContextType = CTX_STRBUF;
2743 SubTP.Context = Buf;
2744 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2749 wprintf(_("If you know the name of a hidden (guess-name) or "
2750 "passworded room, you can enter that room by typing "
2751 "its name below. Once you gain access to a private "
2752 "room, it will appear in your regular room listings "
2753 "so you don't have to keep returning here."));
2756 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2757 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2759 wprintf("<table class=\"altern\"> "
2760 "<tr class=\"even\"><td>");
2761 wprintf(_("Enter room name:"));
2763 "<input type=\"text\" name=\"gr_name\" "
2764 "value=\"%s\" maxlength=\"128\">\n", rname);
2767 wprintf("</td></tr><tr class=\"odd\"><td>");
2768 wprintf(_("Enter room password:"));
2769 wprintf("</td><td>");
2770 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2772 wprintf("</td></tr></table>\n");
2774 wprintf("<div class=\"buttons\">\n");
2775 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2777 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2781 wprintf("</div></form>\n");
2783 do_template("endbox", NULL);
2789 * \brief goto a private room
2791 void goto_private(void)
2796 if (!havebstr("ok_button")) {
2797 display_main_menu();
2800 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2801 serv_printf("GOTO %s|%s",
2804 serv_getln(buf, sizeof buf);
2806 if (buf[0] == '2') {
2807 smart_goto(sbstr("gr_name"));
2810 if (!strncmp(buf, "540", 3)) {
2811 display_private(bstr("gr_name"), 1);
2814 output_headers(1, 1, 1, 0, 0, 0);
2815 wprintf("%s\n", &buf[4]);
2822 * \brief display the screen to zap a room
2824 void display_zap(void)
2826 output_headers(1, 1, 2, 0, 0, 0);
2828 wprintf("<div id=\"banner\">\n");
2830 wprintf(_("Zap (forget/unsubscribe) the current room"));
2832 wprintf("</div>\n");
2834 wprintf("<div id=\"content\" class=\"service\">\n");
2836 wprintf(_("If you select this option, <em>%s</em> will "
2837 "disappear from your room list. Is this what you wish "
2838 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2840 wprintf("<form method=\"POST\" action=\"zap\">\n");
2841 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2842 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2844 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2845 wprintf("</form>\n");
2856 StrBuf *final_destination;
2859 * If the forget-room routine fails for any reason, we fall back
2860 * to the current room; otherwise, we go to the Lobby
2862 final_destination = NewStrBufDup(WC->wc_roomname);
2864 if (havebstr("ok_button")) {
2865 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2866 serv_getln(buf, sizeof buf);
2867 if (buf[0] == '2') {
2869 serv_getln(buf, sizeof buf);
2870 if (buf[0] == '2') {
2871 FlushStrBuf(final_destination);
2872 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2876 smart_goto(final_destination);
2877 FreeStrBuf(&final_destination);
2883 * \brief Delete the current room
2885 void delete_room(void)
2890 serv_puts("KILL 1");
2891 serv_getln(buf, sizeof buf);
2892 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2893 if (buf[0] != '2') {
2894 strcpy(WC->ImportantMessage, &buf[4]);
2895 display_main_menu();
2900 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2909 * \brief Perform changes to a room's network configuration
2911 void netedit(void) {
2920 /*/ TODO: do line dynamic! */
2921 if (havebstr("line_pop3host")) {
2922 strcpy(line, bstr("prefix"));
2923 strcat(line, bstr("line_pop3host"));
2925 strcat(line, bstr("line_pop3user"));
2927 strcat(line, bstr("line_pop3pass"));
2929 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2931 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2932 strcat(line, bstr("suffix"));
2934 else if (havebstr("line")) {
2935 strcpy(line, bstr("prefix"));
2936 strcat(line, bstr("line"));
2937 strcat(line, bstr("suffix"));
2952 serv_getln(buf, sizeof buf);
2953 if (buf[0] != '1') {
2959 /** This loop works for add *or* remove. Spiffy, eh? */
2960 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2961 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2962 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2963 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2964 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2965 if ( (strcasecmp(cmpa0, cmpb0))
2966 || (strcasecmp(cmpa1, cmpb1)) ) {
2967 fprintf(fp, "%s\n", buf);
2973 serv_getln(buf, sizeof buf);
2974 if (buf[0] != '4') {
2980 while (fgets(buf, sizeof buf, fp) != NULL) {
2981 buf[strlen(buf)-1] = 0;
2985 if (havebstr("add_button")) {
2986 num_addrs = num_tokens(bstr("line"), ',');
2987 if (num_addrs < 2) {
2988 /* just adding one node or address */
2992 /* adding multiple addresses separated by commas */
2993 for (i=0; i<num_addrs; ++i) {
2994 strcpy(line, bstr("prefix"));
2995 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2998 strcat(line, bstr("suffix"));
3012 * \brief Convert a room name to a folder-ish-looking name.
3013 * \param folder the folderish name
3014 * \param room the room name
3015 * \param floor the floor name
3016 * \param is_mailbox is it a mailbox?
3018 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
3023 * For mailboxes, just do it straight...
3026 sprintf(folder, "My folders|%s", room);
3030 * Otherwise, prefix the floor name as a "public folders" moniker
3033 if (floor > MAX_FLOORS) {
3035 sprintf(folder, "%%%%%%|%s", room);
3038 sprintf(folder, "%s|%s", floorlist[floor], room);
3043 * Replace "\" characters with "|" for pseudo-folder-delimiting
3045 len = strlen (folder);
3046 for (i=0; i<len; ++i) {
3047 if (folder[i] == '\\') folder[i] = '|';
3055 * \brief Back end for change_view()
3056 * \param newview set newview???
3058 void do_change_view(int newview) {
3061 serv_printf("VIEW %d", newview);
3062 serv_getln(buf, sizeof buf);
3063 WC->wc_view = newview;
3064 smart_goto(WC->wc_roomname);
3070 * \brief Change the view for this room
3072 void change_view(void) {
3075 view = lbstr("view");
3076 do_change_view(view);
3081 * \brief One big expanded tree list view --- like a folder list
3082 * \param fold the folder to view
3083 * \param max_folders how many folders???
3084 * \param num_floors hom many floors???
3086 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3090 int has_subfolders = 0;
3093 parents = malloc(max_folders * sizeof(int));
3095 /** BEGIN TREE MENU */
3096 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3098 /** include NanoTree */
3099 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3101 /** initialize NanoTree */
3102 wprintf("<script type=\"text/javascript\"> \n"
3103 " showRootNode = false; \n"
3104 " sortNodes = false; \n"
3105 " dragable = false; \n"
3107 " function standardClick(treeNode) { \n"
3110 " var closedGif = 'static/folder_closed.gif'; \n"
3111 " var openGif = 'static/folder_open.gif'; \n"
3113 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3117 for (i=0; i<max_folders; ++i) {
3120 if ((i+1) < max_folders) {
3122 len = strlen(fold[i].name);
3123 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3124 && (fold[i+1].name[len] == '|') ) {
3129 levels = num_tokens(fold[i].name, '|');
3130 parents[levels] = i;
3132 wprintf("var node%d = new TreeNode(%d, '", i, i);
3134 if (fold[i].selectable) {
3135 wprintf("<a href=\"dotgoto?room=");
3136 urlescputs(fold[i].room);
3141 wprintf("<span class=\"roomlist_floor\">");
3143 else if (fold[i].hasnewmsgs) {
3144 wprintf("<span class=\"roomlist_new\">");
3147 wprintf("<span class=\"roomlist_old\">");
3149 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3154 if (has_subfolders) {
3155 wprintf("new Array(closedGif, openGif)");
3157 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3158 wprintf("'static/viewcontacts_16x.gif'");
3160 else if (fold[i].view == VIEW_CALENDAR) {
3161 wprintf("'static/calarea_16x.gif'");
3163 else if (fold[i].view == VIEW_CALBRIEF) {
3164 wprintf("'static/calarea_16x.gif'");
3166 else if (fold[i].view == VIEW_TASKS) {
3167 wprintf("'static/taskmanag_16x.gif'");
3169 else if (fold[i].view == VIEW_NOTES) {
3170 wprintf("'static/storenotes_16x.gif'");
3172 else if (fold[i].view == VIEW_MAILBOX) {
3173 wprintf("'static/privatemess_16x.gif'");
3176 wprintf("'static/chatrooms_16x.gif'");
3179 urlescputs(fold[i].name);
3183 wprintf("rootNode.addChild(node%d);\n", i);
3186 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3190 wprintf("container = document.getElementById('roomlist_div'); \n"
3196 /** END TREE MENU */
3200 * \brief Boxes and rooms and lists ... oh my!
3201 * \param fold the folder to view
3202 * \param max_folders how many folders???
3203 * \param num_floors hom many floors???
3205 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3207 char floor_name[256];
3208 char old_floor_name[256];
3209 int levels, oldlevels;
3212 static int columns = 3;
3213 int boxes_per_column = 0;
3214 int current_column = 0;
3217 strcpy(floor_name, "");
3218 strcpy(old_floor_name, "");
3221 while (nf % columns != 0) ++nf;
3222 boxes_per_column = (nf / columns);
3223 if (boxes_per_column < 1) boxes_per_column = 1;
3225 /** Outer table (for columnization) */
3226 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3227 "<tr><td valign=top>");
3231 for (i=0; i<max_folders; ++i) {
3233 levels = num_tokens(fold[i].name, '|');
3234 extract_token(floor_name, fold[i].name, 0,
3235 '|', sizeof floor_name);
3237 if ( (strcasecmp(floor_name, old_floor_name))
3238 && (!IsEmptyStr(old_floor_name)) ) {
3240 do_template("endbox", NULL);
3244 if ((num_boxes % boxes_per_column) == 0) {
3246 if (current_column < columns) {
3247 wprintf("</td><td valign=top>\n");
3251 strcpy(old_floor_name, floor_name);
3255 WCTemplputParams SubTP;
3257 Buf = NewStrBufPlain(floor_name, -1);
3258 memset(&SubTP, 0, sizeof(WCTemplputParams));
3259 SubTP.Filter.ContextType = CTX_STRBUF;
3260 SubTP.Context = Buf;
3261 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3270 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3271 if (fold[i].selectable) {
3272 wprintf("<a href=\"dotgoto?room=");
3273 urlescputs(fold[i].room);
3279 if (fold[i].hasnewmsgs) {
3280 wprintf("<span class=\"roomlist_new\">");
3283 wprintf("<span class=\"roomlist_old\">");
3285 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3288 if (fold[i].selectable) {
3294 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3295 wprintf(" (INBOX)");
3297 wprintf("<br />\n");
3300 /** End the final inner box */
3301 do_template("endbox", NULL);
3303 wprintf("</td></tr></table>\n");
3307 * \brief print a floor div???
3308 * \param which_floordiv name of the floordiv???
3310 void set_floordiv_expanded(void) {
3311 wcsession *WCC = WC;
3314 FloorDiv = NewStrBuf();
3315 StrBufAppendBuf(FloorDiv, WCC->UrlFragment2, 0);
3316 set_preference("floordiv_expanded", FloorDiv, 1);
3317 WCC->floordiv_expanded = FloorDiv;
3321 * \brief view the iconbar
3322 * \param fold the folder to view
3323 * \param max_folders how many folders???
3324 * \param num_floors hom many floors???
3326 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3328 char floor_name[256];
3329 char old_floor_name[256];
3330 char floordivtitle[256];
3331 char floordiv_id[32];
3332 int levels, oldlevels;
3336 strcpy(floor_name, "");
3337 strcpy(old_floor_name, "");
3341 for (i=0; i<max_folders; ++i) {
3343 levels = num_tokens(fold[i].name, '|');
3344 extract_token(floor_name, fold[i].name, 0,
3345 '|', sizeof floor_name);
3347 if ( (strcasecmp(floor_name, old_floor_name))
3348 && (!IsEmptyStr(old_floor_name)) ) {
3349 /** End inner box */
3351 wprintf("</div>\n"); /** floordiv */
3353 strcpy(old_floor_name, floor_name);
3357 stresc(floordivtitle, 256, floor_name, 0, 0);
3358 sprintf(floordiv_id, "floordiv%d", i);
3359 wprintf("<span class=\"ib_roomlist_floor\" "
3360 "onClick=\"expand_floor('%s')\">"
3361 "%s</span><br>\n", floordiv_id, floordivtitle);
3362 wprintf("<div id=\"%s\" style=\"display:%s\">",
3364 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3371 wprintf("<div id=\"roomdiv%d\">", i);
3373 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3375 /** choose the icon */
3376 if (fold[i].view == VIEW_ADDRESSBOOK) {
3377 icon = "viewcontacts_16x.gif" ;
3379 else if (fold[i].view == VIEW_CALENDAR) {
3380 icon = "calarea_16x.gif" ;
3382 else if (fold[i].view == VIEW_CALBRIEF) {
3383 icon = "calarea_16x.gif" ;
3385 else if (fold[i].view == VIEW_TASKS) {
3386 icon = "taskmanag_16x.gif" ;
3388 else if (fold[i].view == VIEW_NOTES) {
3389 icon = "storenotes_16x.gif" ;
3391 else if (fold[i].view == VIEW_MAILBOX) {
3392 icon = "privatemess_16x.gif" ;
3395 icon = "chatrooms_16x.gif" ;
3398 if (fold[i].selectable) {
3399 wprintf("<a href=\"dotgoto?room=");
3400 urlescputs(fold[i].room);
3402 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3407 if (fold[i].hasnewmsgs) {
3408 wprintf("<span class=\"ib_roomlist_new\">");
3411 wprintf("<span class=\"ib_roomlist_old\">");
3413 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3415 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3416 wprintf(" (INBOX)");
3419 if (fold[i].selectable) {
3426 wprintf("</div>\n"); /** roomdiv */
3429 wprintf("</div>\n"); /** floordiv */
3437 * \brief Burn the cached folder list.
3438 * \param age How old the cahce needs to be before we burn it.
3441 void burn_folder_cache(time_t age)
3443 /** If our cached folder list is very old, burn it. */
3444 if (WC->cache_fold != NULL) {
3445 if ((time(NULL) - WC->cache_timestamp) > age) {
3446 free(WC->cache_fold);
3447 WC->cache_fold = NULL;
3456 * \brief Show the room list.
3457 * (only should get called by
3458 * knrooms() because that's where output_headers() is called from)
3459 * \param viewpref the view preferences???
3462 void list_all_rooms_by_floor(const char *viewpref) {
3466 struct folder *fold = NULL;
3468 int max_folders = 0;
3469 int alloc_folders = 0;
3473 int ShowEmptyFloors;
3476 int num_floors = 1; /** add an extra one for private folders */
3479 /** If our cached folder list is very old, burn it. */
3480 burn_folder_cache(300);
3482 /** Can we do the iconbar roomlist from cache? */
3483 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3484 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3489 /** Grab the floor table so we know how to build the list... */
3490 load_floorlist(Buf);
3492 /** Start with the mailboxes */
3495 fold = malloc(sizeof(struct folder));
3496 memset(fold, 0, sizeof(struct folder));
3497 strcpy(fold[0].name, "My folders");
3498 fold[0].is_mailbox = 1;
3500 /** Then add floors */
3502 serv_getln(buf, sizeof buf);
3503 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3504 if (max_folders >= alloc_folders) {
3505 alloc_folders = max_folders + 100;
3506 fold = realloc(fold,
3507 alloc_folders * sizeof(struct folder));
3509 memset(&fold[max_folders], 0, sizeof(struct folder));
3510 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3511 extract_token(buf3, buf, 0, '|', SIZ);
3512 fold[max_folders].floor = atol (buf3);
3517 for (i=0; i<num_floors; i++)
3518 if (IDMax < fold[i].floor)
3519 IDMax = fold[i].floor;
3520 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3521 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3522 for (i=0; i<num_floors; i++)
3523 floor_mapping[fold[i].floor]=i;
3525 /** refresh the messages index for this room */
3526 /* TODO serv_puts("GOTO ");
3527 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3528 /** Now add rooms */
3530 serv_getln(buf, sizeof buf);
3531 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3532 if (max_folders >= alloc_folders) {
3533 alloc_folders = max_folders + 100;
3534 fold = realloc(fold,
3535 alloc_folders * sizeof(struct folder));
3537 memset(&fold[max_folders], 0, sizeof(struct folder));
3538 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3539 ra_flags = extract_int(buf, 5);
3540 flags = extract_int(buf, 1);
3541 fold[max_folders].floor = extract_int(buf, 2);
3542 fold[max_folders].hasnewmsgs =
3543 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3544 if (flags & QR_MAILBOX) {
3545 fold[max_folders].is_mailbox = 1;
3547 fold[max_folders].view = extract_int(buf, 6);
3548 room_to_folder(fold[max_folders].name,
3549 fold[max_folders].room,
3550 fold[max_folders].floor,
3551 fold[max_folders].is_mailbox);
3552 fold[max_folders].selectable = 1;
3553 /* Increase the room count for the associtaed floor */
3554 if (fold[max_folders].is_mailbox) {
3555 fold[0].num_rooms++;
3558 i = floor_mapping[fold[max_folders].floor];
3559 fold[i].num_rooms++;
3565 * Remove any floors that don't have rooms
3567 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3568 if (ShowEmptyFloors)
3570 for (i=0; i<num_floors; i++)
3572 if (fold[i].num_rooms == 0) {
3573 for (j=i; j<max_folders; j++) {
3574 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3583 /** Bubble-sort the folder list */
3584 for (i=0; i<max_folders; ++i) {
3585 for (j=0; j<(max_folders-1)-i; ++j) {
3586 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3587 swap = strcasecmp(fold[j].name, fold[j+1].name);
3590 if ( (fold[j+1].is_mailbox)
3591 && (!fold[j].is_mailbox)) {
3599 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3600 memcpy(&fold[j], &fold[j+1],
3601 sizeof(struct folder));
3602 memcpy(&fold[j+1], &ftmp,
3603 sizeof(struct folder));
3609 if (!strcasecmp(viewpref, "folders")) {
3610 do_folder_view(fold, max_folders, num_floors);
3612 else if (!strcasecmp(viewpref, "hackish_view")) {
3613 for (i=0; i<max_folders; ++i) {
3614 escputs(fold[i].name);
3615 wprintf("<br />\n");
3618 else if (!strcasecmp(viewpref, "iconbar")) {
3619 do_iconbar_view(fold, max_folders, num_floors);
3622 do_rooms_view(fold, max_folders, num_floors);
3625 /* Don't free the folder list ... cache it for future use! */
3626 if (WC->cache_fold != NULL) {
3627 free(WC->cache_fold);
3629 WC->cache_fold = fold;
3630 WC->cache_max_folders = max_folders;
3631 WC->cache_num_floors = num_floors;
3632 WC->cache_timestamp = time(NULL);
3633 free(floor_mapping);
3638 * \brief Do either a known rooms list or a folders list, depending on the
3643 StrBuf *ListView = NULL;
3645 output_headers(1, 1, 2, 0, 0, 0);
3647 /** Determine whether the user is trying to change views */
3648 if (havebstr("view")) {
3649 ListView = NewStrBufPlain(bstr("view"), -1);
3650 set_preference("roomlistview", ListView, 1);
3652 /** Sanitize the input so its safe */
3653 if(!get_preference("roomlistview", &ListView) ||
3654 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3655 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3657 if (ListView == NULL) {
3658 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3659 set_preference("roomlistview", ListView, 0);
3662 StrBufPrintf(ListView, "rooms");
3668 wprintf("<div id=\"banner\">\n");
3669 wprintf("<div class=\"room_banner\" id=\"room_banner\">");
3671 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3672 wprintf(_("Room list"));
3674 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3675 wprintf(_("Folder list"));
3677 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3678 wprintf(_("Room list"));
3680 wprintf("</h1></div>\n");
3682 /** offer the ability to switch views */
3683 wprintf("<div id=\"actiondiv\">");
3684 wprintf("<ul class=\"room_actions\">\n");
3685 wprintf("<li class=\"start_page\">");
3686 offer_start_page(NULL, &NoCtx);
3688 wprintf("<li><form name=\"roomlistomatic\">\n"
3689 "<select name=\"newview\" size=\"1\" "
3690 "OnChange=\"location.href=roomlistomatic.newview.options"
3691 "[selectedIndex].value\">\n");
3693 wprintf("<option %s value=\"knrooms&view=rooms\">"
3696 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3699 wprintf("<option %s value=\"knrooms&view=folders\">"
3700 "View as folder list"
3702 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3705 wprintf("</select>");
3706 wprintf("</form></li>");
3707 wprintf("</ul></div></div>\n");
3709 wprintf("<div id=\"content\" class=\"service\">\n");
3711 /** Display the room list in the user's preferred format */
3712 list_all_rooms_by_floor(ChrPtr(ListView));
3719 * \brief Set the message expire policy for this room and/or floor
3721 void set_room_policy(void) {
3724 if (!havebstr("ok_button")) {
3725 strcpy(WC->ImportantMessage,
3726 _("Cancelled. Changes were not saved."));
3731 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3732 serv_getln(buf, sizeof buf);
3733 strcpy(WC->ImportantMessage, &buf[4]);
3735 if (WC->axlevel >= 6) {
3736 strcat(WC->ImportantMessage, "<br />\n");
3737 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3738 serv_getln(buf, sizeof buf);
3739 strcat(WC->ImportantMessage, &buf[4]);
3745 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3746 /* todo: check context */
3752 floors = NewHash(1, NULL);
3754 serv_puts("LFLR"); /* get floors */
3755 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
3756 if (ChrPtr(Buf)[0] == '1') while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3758 const char *floorNum = NULL;
3759 floor = NewHash(1, NULL);
3760 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3762 StrBufExtract_token(Buf2, Buf, a, '|');
3764 floorNum = ChrPtr(Buf2); /* hmm, should we copy Buf2 first? */
3766 Put(floor, FPKEY(a), Buf2, NULL);
3768 Put(floors, HKEY(floorNum), floor, NULL);
3774 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3777 HashList *floor = (HashList *)(TP->Context);
3779 GetHash(floor, TKEY(0), &value);
3780 val = (StrBuf *)value;
3781 StrECMAEscAppend(TemplBuffer, val, 0);
3783 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP)
3786 return GetRoomListHash(Target, TP);
3788 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
3790 /* TODO: Check context */
3797 rooms = NewHash(1, NULL);
3798 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3799 if (ChrPtr(buf)[0] == '1') while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3801 const char *rmName = NULL;
3802 room = NewHash(1, NULL);
3803 for(i=0; i<ROOM_PARAM_LEN; i++) {
3805 StrBufExtract_token(buf2, buf, i, '|');
3807 rmName = ChrPtr(buf2);
3809 Put(room, RPKEY(i), buf2, NULL);
3811 Put(rooms, rmName, strlen(rmName), room, NULL);
3813 SortByHashKey(rooms, 1);
3814 /*SortByPayload(rooms, SortRoomsByListOrder); */
3818 /** Unused function that orders rooms by the listorder flag */
3819 int SortRoomsByListOrder(const void *room1, const void *room2)
3823 HashList *r1 = (HashList *)GetSearchPayload(room1);
3824 HashList *r2 = (HashList *)GetSearchPayload(room2);
3825 StrBuf *listOrderBuf1;
3826 StrBuf *listOrderBuf2;
3828 GetHash(r1, RPKEY(3), (void *)&listOrderBuf1);
3829 GetHash(r2, RPKEY(3), (void *)&listOrderBuf2);
3830 l1 = atoi(ChrPtr(listOrderBuf1));
3831 l2 = atoi(ChrPtr(listOrderBuf2));
3832 if (l1 < l2) return -1;
3833 else if (l1 > l2) return +1;
3836 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3840 HashList *room = (HashList *)(TP->Context);
3842 GetHash(room, TKEY(0), &value);
3843 val = (StrBuf *)value;
3844 StrECMAEscAppend(TemplBuffer, val, 0);
3846 void jsonRoomFlr(void) {
3847 /* Send as our own (application/json) content type */
3848 hprintf("HTTP/1.1 200 OK\r\n");
3849 hprintf("Content-type: application/json; charset=utf-8\r\n");
3850 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
3851 hprintf("Connection: close\r\n");
3852 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3854 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3857 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3859 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3862 void _gotonext(void) { slrp_highest(); gotonext(); }
3863 void dotskip(void) {smart_goto(sbstr("room"));}
3864 void _display_private(void) { display_private("", 0); }
3865 void dotgoto(void) {
3866 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3869 smart_goto(sbstr("room"));
3872 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3874 wprintf("<div id=\"banner\">\n");
3875 embed_room_banner(NULL, navbar_default);
3876 wprintf("</div>\n");
3880 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3882 wcsession *WCC = WC;
3885 (!IsEmptyStr(WCC->ugname)))
3886 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3890 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3892 wcsession *WCC = WC;
3894 return ((WCC!=NULL) &&
3895 (!IsEmptyStr(WCC->ugname)) &&
3896 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3899 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3901 wcsession *WCC = WC;
3903 return ((WCC!=NULL) &&
3904 ((WCC->room_flags & QR_PERMANENT) != 0));
3907 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3909 wcsession *WCC = WC;
3911 return ((WCC!=NULL) &&
3912 ((WCC->room_flags & QR_INUSE) != 0));
3915 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3917 wcsession *WCC = WC;
3919 return ((WCC!=NULL) &&
3920 ((WCC->room_flags & QR_PRIVATE) != 0));
3923 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3925 wcsession *WCC = WC;
3927 return ((WCC!=NULL) &&
3928 ((WCC->room_flags & QR_PASSWORDED) != 0));
3931 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3933 wcsession *WCC = WC;
3935 return ((WCC!=NULL) &&
3936 ((WCC->room_flags & QR_GUESSNAME) != 0));
3939 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3941 wcsession *WCC = WC;
3943 return ((WCC!=NULL) &&
3944 ((WCC->room_flags & QR_DIRECTORY) != 0));
3947 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3949 wcsession *WCC = WC;
3951 return ((WCC!=NULL) &&
3952 ((WCC->room_flags & QR_UPLOAD) != 0));
3955 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3957 wcsession *WCC = WC;
3959 return ((WCC!=NULL) &&
3960 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3963 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3965 wcsession *WCC = WC;
3967 return ((WCC!=NULL) &&
3968 ((WCC->room_flags & QR_VISDIR) != 0));
3971 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3973 wcsession *WCC = WC;
3975 return ((WCC!=NULL) &&
3976 ((WCC->room_flags & QR_ANONONLY) != 0));
3979 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3981 wcsession *WCC = WC;
3983 return ((WCC!=NULL) &&
3984 ((WCC->room_flags & QR_ANONOPT) != 0));
3987 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
3989 wcsession *WCC = WC;
3991 return ((WCC!=NULL) &&
3992 ((WCC->room_flags & QR_NETWORK) != 0));
3995 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
3997 wcsession *WCC = WC;
3999 return ((WCC!=NULL) &&
4000 ((WCC->room_flags & QR_PREFONLY) != 0));
4003 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
4005 wcsession *WCC = WC;
4007 return ((WCC!=NULL) &&
4008 ((WCC->room_flags & QR_READONLY) != 0));
4011 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
4013 wcsession *WCC = WC;
4015 return ((WCC!=NULL) &&
4016 ((WCC->room_flags & QR_MAILBOX) != 0));
4020 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
4022 wcsession *WCC = WC;
4024 return ( (WCC!= NULL) &&
4025 ((WCC->axlevel >= 6) ||
4026 (WCC->is_room_aide) ||
4027 (WCC->is_mailbox) ));
4030 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
4032 wcsession *WCC = WC;
4034 if ((WCC == NULL) ||
4035 (TP->Tokens->nParameters < 3) ||
4036 (TP->Tokens->Params[2]->Type != TYPE_STR)||
4037 (TP->Tokens->Params[2]->len < 7))
4040 switch(WCC->wc_view) {
4042 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
4044 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
4045 case VIEW_ADDRESSBOOK:
4046 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
4048 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
4050 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
4052 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
4054 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
4056 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
4058 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
4068 RegisterPreference("roomlistview",
4069 _("Room list view"),
4072 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
4074 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
4076 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
4077 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
4078 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
4079 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4080 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4081 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4082 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4083 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4084 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4085 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4086 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4087 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4088 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4089 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4090 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4091 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4092 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4093 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4094 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4095 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4096 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4097 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4098 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4099 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4100 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4102 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
4103 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4104 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4105 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4106 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4107 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4108 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4109 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4110 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4111 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4112 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4113 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4114 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4115 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4116 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4117 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4119 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4120 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4122 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4123 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4124 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4125 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, NULL, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4126 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);