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(void)
80 for (a = 0; a < MAX_FLOORS; ++a)
84 serv_getln(buf, sizeof buf);
86 strcpy(floorlist[0], "Main Floor");
89 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
90 extract_token(floorlist[extract_int(buf, 0)], buf, 1, '|', sizeof floorlist[0]);
96 * Free a session's march list
98 void free_march_list(wcsession *wcf)
102 while (wcf->march != NULL) {
103 mptr = wcf->march->next;
113 * remove a room from the march list
115 void remove_march(const StrBuf *aaa)
117 struct march *mptr, *mptr2;
119 if (WC->march == NULL)
122 if (!strcasecmp(WC->march->march_name, ChrPtr(aaa))) {
123 mptr = WC->march->next;
129 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
130 if (!strcasecmp(mptr->march_name, ChrPtr(aaa))) {
131 mptr2->next = mptr->next;
144 * display rooms in tree structure
146 void room_tree_list(struct roomlisting *rp)
155 room_tree_list(rp->lnext);
157 strcpy(rmname, rp->rlname);
160 wprintf("<a href=\"dotgoto&room=");
164 escputs1(rmname, 1, 1);
165 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
167 else if (f & QR_DIRECTORY)
169 else if (f & QR_NETWORK)
173 wprintf("</a><tt> </tt>\n");
175 room_tree_list(rp->rnext);
181 * \brief Room ordering stuff (compare first by floor, then by order)
182 * \param r1 first roomlist to compare
183 * \param r2 second roomlist co compare
184 * \return are they the same???
186 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
188 if ((r1 == NULL) && (r2 == NULL))
194 if (r1->rlfloor < r2->rlfloor)
196 if (r1->rlfloor > r2->rlfloor)
198 if (r1->rlorder < r2->rlorder)
200 if (r1->rlorder > r2->rlorder)
207 * \brief Common code for all room listings
208 * \param variety what???
210 void listrms(char *variety)
215 struct roomlisting *rl = NULL;
216 struct roomlisting *rp;
217 struct roomlisting *rs;
219 /** Ask the server for a room list */
221 serv_getln(buf, sizeof buf);
227 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
229 rp = malloc(sizeof(struct roomlisting));
230 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
231 rp->rlflags = extract_int(buf, 1);
232 rp->rlfloor = extract_int(buf, 2);
233 rp->rlorder = extract_int(buf, 3);
242 if (rordercmp(rp, rs) < 0) {
243 if (rs->lnext == NULL) {
250 if (rs->rnext == NULL) {
263 * If no rooms were listed, print an nbsp to make the cell
264 * borders show up anyway.
266 if (num_rooms == 0) wprintf(" ");
271 * \brief list all forgotten rooms
273 void zapped_list(void)
275 WCTemplputParams SubTP;
278 output_headers(1, 1, 1, 0, 0, 0);
279 memset(&SubTP, 0, sizeof(WCTemplputParams));
280 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
281 SubTP.Filter.ContextType = CTX_STRBUF;
283 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
289 wprintf("<br /><br />\n");
290 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
291 do_template("endbox", NULL);
297 * \brief read this room's info file (set v to 1 for verbose mode)
299 void readinfo(StrBuf *Target, WCTemplputParams *TP)
304 int fullinfo_len = 0;
307 serv_getln(buf, sizeof buf);
310 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
311 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
312 strcpy(&fullinfo[fullinfo_len], buf);
313 fullinfo_len += strlen(buf);
317 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
318 strcpy(&briefinfo[50], "...");
320 wprintf("<div class=\"infos\" "
321 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
324 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
325 wprintf("<img class=\"close_infos\" "
326 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
327 "src=\"static/closewindow.gif\" alt=\"%s\">",
342 * \brief Display room banner icon.
343 * The server doesn't actually
344 * need the room name, but we supply it in order to
345 * keep the browser from using a cached icon from
348 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
352 serv_puts("OIMG _roompic_");
353 serv_getln(buf, sizeof buf);
355 wprintf("<img height=\"64px\" src=\"image&name=_roompic_&room=");
356 urlescputs(ChrPtr(WC->wc_roomname));
359 serv_getln(buf, sizeof buf);
361 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
362 wprintf("<img class=\"roompic\" alt=\"\" src=\""
363 "static/viewcontacts_48x.gif"
367 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
368 wprintf("<img class=\"roompic\" alt=\"\" src=\""
369 "static/calarea_48x.gif"
373 else if (WC->wc_view == VIEW_TASKS) {
374 wprintf("<img class=\"roompic\" alt=\"\" src=\""
375 "static/taskmanag_48x.gif"
379 else if (WC->wc_view == VIEW_NOTES) {
380 wprintf("<img class=\"roompic\" alt=\"\" src=\""
381 "static/storenotes_48x.gif"
385 else if (WC->wc_view == VIEW_MAILBOX) {
386 wprintf("<img class=\"roompic\" alt=\"\" src=\""
387 "static/privatemess_48x.gif"
392 wprintf("<img class=\"roompic\" alt=\"\" src=\""
393 "static/chatrooms_48x.gif"
403 * \brief Display the current view and offer an option to change it
405 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
409 wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
410 wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
411 wprintf("<label for=\"view_name\">");
412 wprintf(_("View as:"));
414 "<select name=\"newview\" size=\"1\" "
415 "id=\"view_name\" class=\"selectbox\" "
416 "OnChange=\"location.href=viewomatic.newview.options"
417 "[selectedIndex].value\">\n");
419 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
421 * Only offer the views that make sense, given the default
422 * view for the room. For example, don't offer a Calendar
423 * view in a non-Calendar room.
427 || (i == WC->wc_default_view) /**< default */
428 || ( (i == 0) && (WC->wc_default_view == 1) ) /**< mail or bulletin */
429 || ( (i == 1) && (WC->wc_default_view == 0) ) /**< mail or bulletin */
430 /** || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */
433 wprintf("<option %s value=\"changeview?view=%d\">",
434 ((i == WC->wc_view) ? "selected" : ""),
436 escputs(viewdefs[i]);
437 wprintf("</option>\n");
440 wprintf("</select></div></form>\n");
445 * \brief Display a search box
447 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
449 wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
450 wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
451 wprintf("<label for=\"srchquery\">");
452 wprintf(_("Search: "));
453 wprintf("</label><input ");
454 wprintf("%s", serv_info.serv_fulltext_enabled ? "" : "disabled ");
455 wprintf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
457 wprintf("</div></form>\n");
462 * \brief Embed the room banner
464 * \param got The information returned from a GOTO server command
465 * \param navbar_style Determines which navigation buttons to display
469 void embed_room_banner(char *got, int navbar_style) {
472 char with_files[256];
476 * We need to have the information returned by a GOTO server command.
477 * If it isn't supplied, we fake it by issuing our own GOTO.
480 memset(buf, '0', 20);
482 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
483 serv_getln(buf, sizeof buf);
487 /** The browser needs some information for its own use */
488 wprintf("<script type=\"text/javascript\"> \n"
489 " room_is_trash = %d; \n"
495 * If the user happens to select the "make this my start page" link,
496 * we want it to remember the URL as a "/dotskip" one instead of
497 * a "skip" or "gotonext" or something like that.
499 FreeStrBuf(&WC->this_page);
500 StrBufPrintf(WC->this_page,
502 ChrPtr(WC->wc_roomname));
504 /** Check for new mail. */
505 WC->new_mail = extract_int(&got[4], 9);
506 WC->wc_view = extract_int(&got[4], 11);
508 /* Is this a directory room and does it contain files and how many? */
509 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
512 serv_getln(buf2, sizeof buf2);
513 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
515 snprintf (with_files, sizeof with_files,
516 "; <a href=\"do_template?template=files\"> %d %s </a>",
518 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
521 strcpy (with_files, "");
523 svprintf(HKEY("NUMMSGS"), WCS_STRING,
524 _("%d new of %d messages%s"),
525 extract_int(&got[4], 1),
526 extract_int(&got[4], 2),
529 svcallback("ROOMPIC", embed_room_graphic);
530 svcallback("ROOMINFO", readinfo);
531 svcallback("VIEWOMATIC", embed_view_o_matic);
532 svcallback("SEARCHOMATIC", embed_search_o_matic);
533 svcallback("START", offer_start_page);
535 do_template("roombanner", NULL);
536 /* roombanner contains this for mobile */
537 if (navbar_style != navbar_none && !WC->is_mobile) {
539 wprintf("<div id=\"navbar\"><ul>");
541 if (navbar_style == navbar_default) wprintf(
542 "<li class=\"ungoto\">"
543 "<a href=\"ungoto\">"
544 "<img src=\"static/ungoto2_24x.gif\" alt=\"\">"
545 "<span class=\"navbar_link\">%s</span></A>"
546 "</li>\n", _("Ungoto")
549 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
551 "<li class=\"newmess\">"
552 "<a href=\"readnew\">"
553 "<img src=\"static/newmess2_24x.gif\" alt=\"\">"
554 "<span class=\"navbar_link\">%s</span></A>"
555 "</li>\n", _("Read new messages")
559 if (navbar_style == navbar_default) {
560 switch(WC->wc_view) {
561 case VIEW_ADDRESSBOOK:
563 "<li class=\"viewcontacts\">"
564 "<a href=\"readfwd\">"
565 "<img src=\"static/viewcontacts_24x.gif\" "
567 "<span class=\"navbar_link\">"
569 "</span></a></li>\n", _("View contacts")
574 "<li class=\"staskday\">"
575 "<a href=\"readfwd?calview=day\">"
576 "<img src=\"static/taskday2_24x.gif\" "
578 "<span class=\"navbar_link\">"
580 "</span></a></li>\n", _("Day view")
583 "<li class=\"monthview\">"
584 "<a href=\"readfwd?calview=month\">"
585 "<img src=\"static/monthview2_24x.gif\" "
587 "<span class=\"navbar_link\">"
589 "</span></a></li>\n", _("Month view")
594 "<li class=\"monthview\">"
595 "<a href=\"readfwd?calview=month\">"
596 "<img src=\"static/monthview2_24x.gif\" "
598 "<span class=\"navbar_link\">"
600 "</span></a></li>\n", _("Calendar list")
605 "<li class=\"taskmanag\">"
606 "<a href=\"readfwd\">"
607 "<img src=\"static/taskmanag_24x.gif\" "
609 "<span class=\"navbar_link\">"
611 "</span></a></li>\n", _("View tasks")
616 "<li class=\"viewnotes\">"
617 "<a href=\"readfwd\">"
618 "<img src=\"static/viewnotes_24x.gif\" "
620 "<span class=\"navbar_link\">"
622 "</span></a></li>\n", _("View notes")
627 "<li class=\"readallmess\">"
628 "<a id=\"m_refresh\" href=\"readfwd\">"
629 "<img src=\"static/readallmess3_24x.gif\" "
631 "<span class=\"navbar_link\">"
633 "</span></a></li>\n", _("Refresh message list")
638 "<li class=\"readallmess\">"
639 "<a href=\"readfwd\">"
640 "<img src=\"static/readallmess3_24x.gif\" "
642 "<span class=\"navbar_link\">"
644 "</span></a></li>\n", _("Wiki home")
649 "<li class=\"readallmess\">"
650 "<a href=\"readfwd\">"
651 "<img src=\"static/readallmess3_24x.gif\" "
653 "<span class=\"navbar_link\">"
655 "</span></a></li>\n", _("Read all messages")
661 if (navbar_style == navbar_default) {
662 switch(WC->wc_view) {
663 case VIEW_ADDRESSBOOK:
665 "<li class=\"addnewcontact\">"
666 "<a href=\"display_enter\">"
667 "<img src=\"static/addnewcontact_24x.gif\" "
668 "alt=\"\"><span class=\"navbar_link\">"
670 "</span></a></li>\n", _("Add new contact")
675 wprintf("<li class=\"addevent\"><a href=\"display_enter");
676 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
677 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
678 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
680 "<img src=\"static/addevent_24x.gif\" "
681 "alt=\"\"><span class=\"navbar_link\">"
683 "</span></a></li>\n", _("Add new event")
688 "<li class=\"newmess\">"
689 "<a href=\"display_enter\">"
690 "<img src=\"static/newmess3_24x.gif\" "
691 "alt=\"\"><span class=\"navbar_link\">"
693 "</span></a></li>\n", _("Add new task")
698 "<li class=\"enternewnote\">"
699 "<a href=\"add_new_note\">"
700 "<img src=\"static/enternewnote_24x.gif\" "
701 "alt=\"\"><span class=\"navbar_link\">"
703 "</span></a></li>\n", _("Add new note")
707 safestrncpy(buf, bstr("page"), sizeof buf);
710 "<li class=\"newmess\">"
711 "<a href=\"display_enter?wikipage=%s\">"
712 "<img src=\"static/newmess3_24x.gif\" "
713 "alt=\"\"><span class=\"navbar_link\">"
715 "</span></a></li>\n", buf, _("Edit this page")
720 "<li class=\"newmess\">"
721 "<a href=\"display_enter\">"
722 "<img src=\"static/newmess3_24x.gif\" "
723 "alt=\"\"><span class=\"navbar_link\">"
725 "</span></a></li>\n", _("Write mail")
730 "<li class=\"newmess\">"
731 "<a href=\"display_enter\">"
732 "<img src=\"static/newmess3_24x.gif\" "
733 "alt=\"\"><span class=\"navbar_link\">"
735 "</span></a></li>\n", _("Enter a message")
741 if (navbar_style == navbar_default) wprintf(
742 "<li class=\"skipthisroom\">"
745 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\">"
746 "<span class=\"navbar_link\">%s</span></a>"
748 _("Leave all messages marked as unread, go to next room with unread messages"),
752 if (navbar_style == navbar_default) wprintf(
753 "<li class=\"markngo\">"
754 "<a href=\"gotonext\" "
756 "<img src=\"static/markngo_24x.gif\" alt=\"\">"
757 "<span class=\"navbar_link\">%s</span></a>"
759 _("Mark all messages as read, go to next room with unread messages"),
763 wprintf("</ul></div>\n");
770 * back end routine to take the session to a new room
772 long gotoroom(const StrBuf *gname)
775 static long ls = (-1L);
778 /* store ungoto information */
779 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
782 /** move to the new room */
783 serv_printf("GOTO %s", ChrPtr(gname));
784 StrBuf_ServGetln(Buf);
785 if (GetServerStatus(Buf, &err) != 2) {
786 serv_puts("GOTO _BASEROOM_");
787 StrBuf_ServGetln(Buf);
788 if (GetServerStatus(Buf, &err) != 2) {
794 if (WC->wc_roomname == NULL)
795 WC->wc_roomname = NewStrBuf();
797 FlushStrBuf(WC->wc_roomname);
799 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
800 StrBufCutLeft(WC->wc_roomname, 4);
801 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
802 /* highest_msg_read = extract_int(&buf[4],6);
803 maxmsgnum = extract_int(&buf[4],5);
805 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
806 ls = StrBufExtract_long(Buf, 6, '|');
807 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
808 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
809 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
810 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
811 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
814 WC->is_room_aide = WC->is_aide;
816 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
818 remove_march(WC->wc_roomname);
819 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
828 * \brief Locate the room on the march list which we most want to go to.
830 * is measured given a "weight" of preference based on various factors.
831 * \param desired_floor the room number on the citadel server
832 * \return the roomname
834 char *pop_march(int desired_floor)
836 static char TheRoom[128];
838 int TheOrder = 32767;
841 struct march *mptr = NULL;
843 strcpy(TheRoom, "_BASEROOM_");
844 if (WC->march == NULL)
847 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
849 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
850 weight = weight + 10000;
851 if (mptr->march_floor == desired_floor)
852 weight = weight + 5000;
854 weight = weight + ((128 - (mptr->march_floor)) * 128);
855 weight = weight + (128 - (mptr->march_order));
857 if (weight > TheWeight) {
859 strcpy(TheRoom, mptr->march_name);
860 TheFloor = mptr->march_floor;
861 TheOrder = mptr->march_order;
870 * Goto next room having unread messages.
872 * We want to skip over rooms that the user has already been to, and take the
873 * user back to the lobby when done. The room we end up in is placed in
874 * newroom - which is set to 0 (the lobby) initially.
875 * We start the search in the current room rather than the beginning to prevent
876 * two or more concurrent users from dragging each other back to the same room.
881 struct march *mptr = NULL;
882 struct march *mptr2 = NULL;
888 * First check to see if the march-mode list is already allocated.
889 * If it is, pop the first room off the list and go there.
892 if (WC->march == NULL) {
894 serv_getln(buf, sizeof buf);
896 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
897 if (IsEmptyStr(buf)) {
900 if (ELoop % 100 == 0)
905 extract_token(room_name, buf, 0, '|', sizeof room_name);
906 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
907 mptr = (struct march *) malloc(sizeof(struct march));
909 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
910 mptr->march_floor = extract_int(buf, 2);
911 mptr->march_order = extract_int(buf, 3);
912 if (WC->march == NULL)
921 * add _BASEROOM_ to the end of the march list, so the user will end up
922 * in the system base room (usually the Lobby>) at the end of the loop
924 mptr = (struct march *) malloc(sizeof(struct march));
926 mptr->march_order = 0;
927 mptr->march_floor = 0;
928 strcpy(mptr->march_name, "_BASEROOM_");
929 if (WC->march == NULL) {
933 while (mptr2->next != NULL)
938 * ...and remove the room we're currently in, so a <G>oto doesn't make us
939 * walk around in circles
941 remove_march(WC->wc_roomname);
943 if (WC->march != NULL) {
944 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
946 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
950 smart_goto(next_room);
951 FreeStrBuf(&next_room);
958 void smart_goto(const StrBuf *next_room) {
966 * mark all messages in current room as having been read
968 void slrp_highest(void)
972 serv_puts("SLRP HIGHEST");
973 serv_getln(buf, sizeof buf);
978 * un-goto the previous room
984 if (!strcmp(WC->ugname, "")) {
985 smart_goto(WC->wc_roomname);
988 serv_printf("GOTO %s", WC->ugname);
990 StrBuf_ServGetln(Buf);
991 if (GetServerStatus(Buf, NULL) != 2) {
992 smart_goto(WC->wc_roomname);
996 if (WC->uglsn >= 0L) {
997 serv_printf("SLRP %ld", WC->uglsn);
998 StrBuf_ServGetln(Buf);
1001 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1002 strcpy(WC->ugname, "");
1007 typedef struct __room_states {
1022 * Set/clear/read the "self-service list subscribe" flag for a room
1024 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1025 * returns the new value.
1028 int self_service(int newval) {
1029 int current_value = 0;
1035 int flags, floor, order, view, flags2;
1038 serv_getln(buf, sizeof buf);
1039 if (buf[0] != '2') return(0);
1041 extract_token(name, &buf[4], 0, '|', sizeof name);
1042 extract_token(password, &buf[4], 1, '|', sizeof password);
1043 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1044 flags = extract_int(&buf[4], 3);
1045 floor = extract_int(&buf[4], 4);
1046 order = extract_int(&buf[4], 5);
1047 view = extract_int(&buf[4], 6);
1048 flags2 = extract_int(&buf[4], 7);
1050 if (flags2 & QR2_SELFLIST) {
1058 flags2 = flags2 | QR2_SELFLIST;
1060 else if (newval == 0) {
1061 flags2 = flags2 & ~QR2_SELFLIST;
1064 return(current_value);
1067 if (newval != current_value) {
1068 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1069 name, password, dirname, flags,
1070 floor, order, view, flags2);
1071 serv_getln(buf, sizeof buf);
1078 int is_selflist(room_states *RoomFlags)
1080 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1083 int is_publiclist(room_states *RoomFlags)
1085 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1088 int is_moderatedlist(room_states *RoomFlags)
1090 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1094 * Set/clear/read the "self-service list subscribe" flag for a room
1096 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1097 * returns the new value.
1100 int get_roomflags(room_states *RoomOps)
1105 serv_getln(buf, sizeof buf);
1106 if (buf[0] != '2') return(0);
1108 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1109 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1110 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1111 RoomOps->flags = extract_int(&buf[4], 3);
1112 RoomOps->floor = extract_int(&buf[4], 4);
1113 RoomOps->order = extract_int(&buf[4], 5);
1114 RoomOps->view = extract_int(&buf[4], 6);
1115 RoomOps->flags2 = extract_int(&buf[4], 7);
1119 int set_roomflags(room_states *RoomOps)
1123 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1132 serv_getln(buf, sizeof buf);
1142 * display the form for editing a room
1144 void display_editroom(void)
1149 char remote_room[128];
1152 char er_password[10];
1153 char er_dirname[15];
1154 char er_roomaide[26];
1161 char *not_shared_with;
1164 int floorpolicy = 0;
1166 char pop3_host[128];
1171 if (IsEmptyStr(tab)) tab = "admin";
1174 output_headers(1, 1, 1, 0, 0, 0);
1176 wprintf("<div class=\"fix_scrollbar_bug\">");
1178 wprintf("<br />\n");
1180 /* print the tabbed dialog */
1181 wprintf("<div align=\"center\">");
1182 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""
1183 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1186 wprintf("<td class=\"");
1187 if (!strcmp(tab, "admin")) {
1188 wprintf(" tab_cell_label\">");
1189 wprintf(_("Administration"));
1192 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1193 wprintf(_("Administration"));
1197 wprintf("<td> </td>\n");
1199 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1201 wprintf("<td class=\"");
1202 if (!strcmp(tab, "config")) {
1203 wprintf(" tab_cell_label\">");
1204 wprintf(_("Configuration"));
1207 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1208 wprintf(_("Configuration"));
1212 wprintf("<td> </td>\n");
1214 wprintf("<td class=\"");
1215 if (!strcmp(tab, "expire")) {
1216 wprintf(" tab_cell_label\">");
1217 wprintf(_("Message expire policy"));
1220 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1221 wprintf(_("Message expire policy"));
1225 wprintf("<td> </td>\n");
1227 wprintf("<td class=\"");
1228 if (!strcmp(tab, "access")) {
1229 wprintf(" tab_cell_label\">");
1230 wprintf(_("Access controls"));
1233 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1234 wprintf(_("Access controls"));
1238 wprintf("<td> </td>\n");
1240 wprintf("<td class=\"");
1241 if (!strcmp(tab, "sharing")) {
1242 wprintf(" tab_cell_label\">");
1243 wprintf(_("Sharing"));
1246 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1247 wprintf(_("Sharing"));
1251 wprintf("<td> </td>\n");
1253 wprintf("<td class=\"");
1254 if (!strcmp(tab, "listserv")) {
1255 wprintf(" tab_cell_label\">");
1256 wprintf(_("Mailing list service"));
1259 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1260 wprintf(_("Mailing list service"));
1264 wprintf("<td> </td>\n");
1268 wprintf("<td class=\"");
1269 if (!strcmp(tab, "feeds")) {
1270 wprintf(" tab_cell_label\">");
1271 wprintf(_("Remote retrieval"));
1274 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1275 wprintf(_("Remote retrieval"));
1279 wprintf("<td> </td>\n");
1281 wprintf("</tr></table>\n");
1282 wprintf("</div>\n");
1283 /* end tabbed dialog */
1285 wprintf("<script type=\"text/javascript\">"
1286 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1290 /* begin content of whatever tab is open now */
1292 if (!strcmp(tab, "admin")) {
1293 wprintf("<div class=\"tabcontent\">");
1295 "<li><a href=\"delete_room\" "
1296 "onClick=\"return confirm('");
1297 wprintf(_("Are you sure you want to delete this room?"));
1298 wprintf("');\">\n");
1299 wprintf(_("Delete this room"));
1301 "<li><a href=\"display_editroompic\">\n");
1302 wprintf(_("Set or change the icon for this room's banner"));
1304 "<li><a href=\"display_editinfo\">\n");
1305 wprintf(_("Edit this room's Info file"));
1311 if (!strcmp(tab, "config")) {
1312 wprintf("<div class=\"tabcontent\">");
1314 serv_getln(buf, sizeof buf);
1316 if (!strncmp(buf, "550", 3)) {
1317 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1318 _("Higher access is required to access this function.")
1321 else if (buf[0] != '2') {
1322 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1325 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1326 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1327 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1328 er_flags = extract_int(&buf[4], 3);
1329 er_floor = extract_int(&buf[4], 4);
1330 er_flags2 = extract_int(&buf[4], 7);
1332 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1333 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1335 wprintf("<ul><li>");
1336 wprintf(_("Name of room: "));
1337 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1343 wprintf(_("Resides on floor: "));
1344 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1345 if (er_flags & QR_MAILBOX)
1346 wprintf("disabled >\n");
1347 for (i = 0; i < 128; ++i)
1348 if (!IsEmptyStr(floorlist[i])) {
1349 wprintf("<OPTION ");
1351 wprintf("SELECTED ");
1352 wprintf("VALUE=\"%d\">", i);
1353 escputs(floorlist[i]);
1354 wprintf("</OPTION>\n");
1356 wprintf("</select>\n");
1359 wprintf(_("Type of room:"));
1362 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1363 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1364 wprintf("CHECKED ");
1365 wprintf("OnChange=\""
1366 " if (this.form.type[0].checked == true) { "
1367 " this.form.er_floor.disabled = false; "
1370 wprintf(_("Public (automatically appears to everyone)"));
1373 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1374 if ((er_flags & QR_PRIVATE) &&
1375 (er_flags & QR_GUESSNAME))
1376 wprintf("CHECKED ");
1377 wprintf(" OnChange=\""
1378 " if (this.form.type[1].checked == true) { "
1379 " this.form.er_floor.disabled = false; "
1382 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1384 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1385 if ((er_flags & QR_PRIVATE) &&
1386 (er_flags & QR_PASSWORDED))
1387 wprintf("CHECKED ");
1388 wprintf(" OnChange=\""
1389 " if (this.form.type[2].checked == true) { "
1390 " this.form.er_floor.disabled = false; "
1393 wprintf(_("Private - require password: "));
1394 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1397 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1398 if ((er_flags & QR_PRIVATE)
1399 && ((er_flags & QR_GUESSNAME) == 0)
1400 && ((er_flags & QR_PASSWORDED) == 0))
1401 wprintf("CHECKED ");
1402 wprintf(" OnChange=\""
1403 " if (this.form.type[3].checked == true) { "
1404 " this.form.er_floor.disabled = false; "
1407 wprintf(_("Private - invitation only"));
1409 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1410 if (er_flags & QR_MAILBOX)
1411 wprintf("CHECKED ");
1412 wprintf (" OnChange=\""
1413 " if (this.form.type[4].checked == true) { "
1414 " this.form.er_floor.disabled = true; "
1417 wprintf(_("Personal (mailbox for you only)"));
1419 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1421 wprintf(_("If private, cause current users to forget room"));
1423 wprintf("\n</ul>\n");
1425 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1426 if (er_flags & QR_PREFONLY)
1427 wprintf("CHECKED ");
1429 wprintf(_("Preferred users only"));
1431 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1432 if (er_flags & QR_READONLY)
1433 wprintf("CHECKED ");
1435 wprintf(_("Read-only room"));
1437 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1438 if (er_flags2 & QR2_COLLABDEL)
1439 wprintf("CHECKED ");
1441 wprintf(_("All users allowed to post may also delete messages"));
1443 /** directory stuff */
1444 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1445 if (er_flags & QR_DIRECTORY)
1446 wprintf("CHECKED ");
1448 wprintf(_("File directory room"));
1450 wprintf("\n<ul><li>");
1451 wprintf(_("Directory name: "));
1452 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1455 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1456 if (er_flags & QR_UPLOAD)
1457 wprintf("CHECKED ");
1459 wprintf(_("Uploading allowed"));
1461 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1462 if (er_flags & QR_DOWNLOAD)
1463 wprintf("CHECKED ");
1465 wprintf(_("Downloading allowed"));
1467 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1468 if (er_flags & QR_VISDIR)
1469 wprintf("CHECKED ");
1471 wprintf(_("Visible directory"));
1474 /** end of directory stuff */
1476 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1477 if (er_flags & QR_NETWORK)
1478 wprintf("CHECKED ");
1480 wprintf(_("Network shared room"));
1482 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1483 if (er_flags & QR_PERMANENT)
1484 wprintf("CHECKED ");
1486 wprintf(_("Permanent (does not auto-purge)"));
1488 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1489 if (er_flags2 & QR2_SUBJECTREQ)
1490 wprintf("CHECKED ");
1492 wprintf(_("Subject Required (Force users to specify a message subject)"));
1494 /** start of anon options */
1497 wprintf(_("Anonymous messages"));
1500 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1501 if (((er_flags & QR_ANONONLY) == 0)
1502 && ((er_flags & QR_ANONOPT) == 0))
1503 wprintf("CHECKED ");
1505 wprintf(_("No anonymous messages"));
1507 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1508 if (er_flags & QR_ANONONLY)
1509 wprintf("CHECKED ");
1511 wprintf(_("All messages are anonymous"));
1513 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1514 if (er_flags & QR_ANONOPT)
1515 wprintf("CHECKED ");
1517 wprintf(_("Prompt user when entering messages"));
1520 /* end of anon options */
1523 wprintf(_("Room aide: "));
1525 serv_getln(buf, sizeof buf);
1526 if (buf[0] != '2') {
1527 wprintf("<em>%s</em>\n", &buf[4]);
1529 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1530 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1533 wprintf("</ul><CENTER>\n");
1534 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1535 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1537 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1547 /* Sharing the room with other Citadel nodes... */
1548 if (!strcmp(tab, "sharing")) {
1549 wprintf("<div class=\"tabcontent\">");
1551 shared_with = strdup("");
1552 not_shared_with = strdup("");
1554 /** Learn the current configuration */
1555 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1556 serv_getln(buf, sizeof buf);
1557 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1558 extract_token(node, buf, 0, '|', sizeof node);
1559 not_shared_with = realloc(not_shared_with,
1560 strlen(not_shared_with) + 32);
1561 strcat(not_shared_with, node);
1562 strcat(not_shared_with, "\n");
1566 serv_getln(buf, sizeof buf);
1567 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1568 extract_token(cmd, buf, 0, '|', sizeof cmd);
1569 extract_token(node, buf, 1, '|', sizeof node);
1570 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1571 if (!strcasecmp(cmd, "ignet_push_share")) {
1572 shared_with = realloc(shared_with,
1573 strlen(shared_with) + 32);
1574 strcat(shared_with, node);
1575 if (!IsEmptyStr(remote_room)) {
1576 strcat(shared_with, "|");
1577 strcat(shared_with, remote_room);
1579 strcat(shared_with, "\n");
1583 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1584 extract_token(buf, shared_with, i, '\n', sizeof buf);
1585 extract_token(node, buf, 0, '|', sizeof node);
1586 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1587 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1588 if (!strcasecmp(node, cmd)) {
1589 remove_token(not_shared_with, j, '\n');
1594 /* Display the stuff */
1595 wprintf("<CENTER><br />"
1596 "<table border=1 cellpadding=5><tr>"
1598 wprintf(_("Shared with"));
1599 wprintf("</I></B></td>"
1601 wprintf(_("Not shared with"));
1602 wprintf("</I></B></td></tr>\n"
1603 "<tr><td VALIGN=TOP>\n");
1605 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1606 wprintf(_("Remote node name"));
1607 wprintf("</td><td>");
1608 wprintf(_("Remote room name"));
1609 wprintf("</td><td>");
1610 wprintf(_("Actions"));
1611 wprintf("</td></tr>\n");
1613 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1614 extract_token(buf, shared_with, i, '\n', sizeof buf);
1615 extract_token(node, buf, 0, '|', sizeof node);
1616 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1617 if (!IsEmptyStr(node)) {
1618 wprintf("<form method=\"POST\" action=\"netedit\">");
1619 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1620 wprintf("<tr><td>%s</td>\n", node);
1623 if (!IsEmptyStr(remote_room)) {
1624 escputs(remote_room);
1630 wprintf("<input type=\"hidden\" NAME=\"line\" "
1631 "VALUE=\"ignet_push_share|");
1633 if (!IsEmptyStr(remote_room)) {
1635 urlescputs(remote_room);
1638 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1639 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1640 wprintf("<input type=\"submit\" "
1641 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1642 wprintf("</td></tr></form>\n");
1646 wprintf("</table>\n");
1647 wprintf("</td><td VALIGN=TOP>\n");
1648 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1649 wprintf(_("Remote node name"));
1650 wprintf("</td><td>");
1651 wprintf(_("Remote room name"));
1652 wprintf("</td><td>");
1653 wprintf(_("Actions"));
1654 wprintf("</td></tr>\n");
1656 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1657 extract_token(node, not_shared_with, i, '\n', sizeof node);
1658 if (!IsEmptyStr(node)) {
1659 wprintf("<form method=\"POST\" action=\"netedit\">");
1660 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1661 wprintf("<tr><td>");
1664 "<input type=\"INPUT\" "
1668 wprintf("<input type=\"hidden\" "
1670 "VALUE=\"ignet_push_share|");
1673 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1674 "VALUE=\"sharing\">\n");
1675 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1676 "VALUE=\"add\">\n");
1677 wprintf("<input type=\"submit\" "
1678 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1679 wprintf("</td></tr></form>\n");
1683 wprintf("</table>\n");
1684 wprintf("</td></tr>"
1685 "</table></CENTER><br />\n"
1686 "<I><B>%s</B><ul><li>", _("Notes:"));
1687 wprintf(_("When sharing a room, "
1688 "it must be shared from both ends. Adding a node to "
1689 "the 'shared' list sends messages out, but in order to"
1690 " receive messages, the other nodes must be configured"
1691 " to send messages out to your system as well. "
1692 "<li>If the remote room name is blank, it is assumed "
1693 "that the room name is identical on the remote node."
1694 "<li>If the remote room name is different, the remote "
1695 "node must also configure the name of the room here."
1702 /* Mailing list management */
1703 if (!strcmp(tab, "listserv")) {
1704 room_states RoomFlags;
1705 wprintf("<div class=\"tabcontent\">");
1707 wprintf("<br /><center>"
1708 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1709 "<tr><td VALIGN=TOP>");
1711 wprintf(_("<i>The contents of this room are being "
1712 "mailed <b>as individual messages</b> "
1713 "to the following list recipients:"
1714 "</i><br /><br />\n"));
1717 serv_getln(buf, sizeof buf);
1718 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1719 extract_token(cmd, buf, 0, '|', sizeof cmd);
1720 if (!strcasecmp(cmd, "listrecp")) {
1721 extract_token(recp, buf, 1, '|', sizeof recp);
1724 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1727 wprintf(_("(remove)"));
1728 wprintf("</A><br />");
1731 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1732 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1733 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1734 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1735 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1736 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1737 wprintf("</form>\n");
1739 wprintf("</td><td VALIGN=TOP>\n");
1741 wprintf(_("<i>The contents of this room are being "
1742 "mailed <b>in digest form</b> "
1743 "to the following list recipients:"
1744 "</i><br /><br />\n"));
1747 serv_getln(buf, sizeof buf);
1748 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1749 extract_token(cmd, buf, 0, '|', sizeof cmd);
1750 if (!strcasecmp(cmd, "digestrecp")) {
1751 extract_token(recp, buf, 1, '|', sizeof recp);
1754 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1758 wprintf(_("(remove)"));
1759 wprintf("</A><br />");
1762 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1763 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1764 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1765 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1766 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1767 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1768 wprintf("</form>\n");
1770 wprintf("</td></tr></table>\n");
1772 /** Pop open an address book -- begin **/
1773 wprintf("<div align=right>"
1774 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1776 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1781 _("Add recipients from Contacts or other address books"),
1782 _("Add recipients from Contacts or other address books")
1784 /* Pop open an address book -- end **/
1786 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1788 get_roomflags (&RoomFlags);
1790 /* Self Service subscription? */
1791 wprintf("<table><tr><td>\n");
1792 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1793 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1794 " <tr><td colspan=\"2\">\n",
1795 (is_selflist(&RoomFlags))?"checked":"");
1796 wprintf(_("The URL for subscribe/unsubscribe is: "));
1797 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1798 (is_https ? "https" : "http"),
1799 ChrPtr(WC->http_host));
1800 /* Public posting? */
1801 wprintf("<tr><td>");
1802 wprintf(_("Allow non-subscribers to mail to this room."));
1803 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1804 (is_publiclist(&RoomFlags))?"checked":"");
1806 /* Moderated List? */
1807 wprintf("<tr><td>");
1808 wprintf(_("Room post publication needs Aide permission."));
1809 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1810 (is_moderatedlist(&RoomFlags))?"checked":"");
1813 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1814 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1815 wprintf("</table></form>");
1818 wprintf("</CENTER>\n");
1823 /* Configuration of The Dreaded Auto-Purger */
1824 if (!strcmp(tab, "expire")) {
1825 wprintf("<div class=\"tabcontent\">");
1827 serv_puts("GPEX room");
1828 serv_getln(buf, sizeof buf);
1829 if (!strncmp(buf, "550", 3)) {
1830 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1831 _("Higher access is required to access this function.")
1834 else if (buf[0] != '2') {
1835 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1838 roompolicy = extract_int(&buf[4], 0);
1839 roomvalue = extract_int(&buf[4], 1);
1841 serv_puts("GPEX floor");
1842 serv_getln(buf, sizeof buf);
1843 if (buf[0] == '2') {
1844 floorpolicy = extract_int(&buf[4], 0);
1845 floorvalue = extract_int(&buf[4], 1);
1848 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1849 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1850 wprintf("<table border=0 cellspacing=5>\n");
1851 wprintf("<tr><td>");
1852 wprintf(_("Message expire policy for this room"));
1854 escputs(ChrPtr(WC->wc_roomname));
1855 wprintf(")</td><td>");
1856 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1857 ((roompolicy == 0) ? "CHECKED" : "") );
1858 wprintf(_("Use the default policy for this floor"));
1859 wprintf("<br />\n");
1860 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1861 ((roompolicy == 1) ? "CHECKED" : "") );
1862 wprintf(_("Never automatically expire messages"));
1863 wprintf("<br />\n");
1864 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1865 ((roompolicy == 2) ? "CHECKED" : "") );
1866 wprintf(_("Expire by message count"));
1867 wprintf("<br />\n");
1868 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1869 ((roompolicy == 3) ? "CHECKED" : "") );
1870 wprintf(_("Expire by message age"));
1872 wprintf(_("Number of messages or days: "));
1873 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1874 wprintf("</td></tr>\n");
1876 if (WC->axlevel >= 6) {
1877 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1878 wprintf("<tr><td>");
1879 wprintf(_("Message expire policy for this floor"));
1881 escputs(floorlist[WC->wc_floor]);
1882 wprintf(")</td><td>");
1883 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1884 ((floorpolicy == 0) ? "CHECKED" : "") );
1885 wprintf(_("Use the system default"));
1886 wprintf("<br />\n");
1887 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1888 ((floorpolicy == 1) ? "CHECKED" : "") );
1889 wprintf(_("Never automatically expire messages"));
1890 wprintf("<br />\n");
1891 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1892 ((floorpolicy == 2) ? "CHECKED" : "") );
1893 wprintf(_("Expire by message count"));
1894 wprintf("<br />\n");
1895 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1896 ((floorpolicy == 3) ? "CHECKED" : "") );
1897 wprintf(_("Expire by message age"));
1899 wprintf(_("Number of messages or days: "));
1900 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1904 wprintf("<CENTER>\n");
1905 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1906 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1908 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1909 wprintf("</CENTER></td><tr>\n");
1911 wprintf("</table>\n"
1912 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1920 /* Access controls */
1921 if (!strcmp(tab, "access")) {
1922 wprintf("<div class=\"tabcontent\">");
1927 /* Fetch messages from remote locations */
1928 if (!strcmp(tab, "feeds")) {
1929 wprintf("<div class=\"tabcontent\">");
1932 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1933 wprintf("</i><br />\n");
1935 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1936 "<tr class=\"even\"><th>");
1937 wprintf(_("Remote host"));
1938 wprintf("</th><th>");
1939 wprintf(_("User name"));
1940 wprintf("</th><th>");
1941 wprintf(_("Password"));
1942 wprintf("</th><th>");
1943 wprintf(_("Keep messages on server?"));
1944 wprintf("</th><th>");
1945 wprintf(_("Interval"));
1946 wprintf("</th><th> </th></tr>");
1949 serv_getln(buf, sizeof buf);
1951 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1952 extract_token(cmd, buf, 0, '|', sizeof cmd);
1953 if (!strcasecmp(cmd, "pop3client")) {
1954 safestrncpy(recp, &buf[11], sizeof recp);
1957 wprintf("<tr class=\"%s\">",
1958 (bg ? "even" : "odd")
1962 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1967 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1971 wprintf("<td>*****</td>"); /* Don't show the password */
1973 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1975 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1977 wprintf("<td class=\"button_link\">");
1978 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
1981 wprintf(_("(remove)"));
1982 wprintf("</a></td>");
1988 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1990 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1991 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1992 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1994 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1997 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
2000 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2003 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2006 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2009 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2010 wprintf("</td></tr>");
2011 wprintf("</form></table>\n");
2016 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2017 wprintf("</i><br />\n");
2019 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2020 "<tr class=\"even\"><th>");
2021 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2022 wprintf(_("Feed URL"));
2023 wprintf("</th><th>");
2024 wprintf("</th></tr>");
2027 serv_getln(buf, sizeof buf);
2029 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2030 extract_token(cmd, buf, 0, '|', sizeof cmd);
2031 if (!strcasecmp(cmd, "rssclient")) {
2032 safestrncpy(recp, &buf[10], sizeof recp);
2035 wprintf("<tr class=\"%s\">",
2036 (bg ? "even" : "odd")
2040 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2044 wprintf("<td class=\"button_link\">");
2045 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
2048 wprintf(_("(remove)"));
2049 wprintf("</a></td>");
2055 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2057 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2058 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2059 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2061 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2062 "maxlength=\"256\" name=\"line_pop3host\">\n");
2065 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2066 wprintf("</td></tr>");
2067 wprintf("</form></table>\n");
2073 /* end content of whatever tab is open now */
2074 wprintf("</div>\n");
2076 address_book_popup();
2082 * Toggle self-service list subscription
2084 void toggle_self_service(void) {
2085 room_states RoomFlags;
2087 get_roomflags (&RoomFlags);
2089 if (yesbstr("QR2_SelfList"))
2090 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2092 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2094 if (yesbstr("QR2_SMTP_PUBLIC"))
2095 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2097 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2099 if (yesbstr("QR2_Moderated"))
2100 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2102 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2103 if (yesbstr("QR2_SubsOnly"))
2104 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2106 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2108 set_roomflags (&RoomFlags);
2116 * save new parameters for a room
2123 StrBuf *er_password;
2125 StrBuf *er_roomaide;
2128 int er_listingorder;
2134 if (!havebstr("ok_button")) {
2135 strcpy(WC->ImportantMessage,
2136 _("Cancelled. Changes were not saved."));
2142 StrBuf_ServGetln(Buf);
2143 if (GetServerStatus(Buf, NULL) != 2) {
2144 StrBufCutLeft(Buf, 4);
2145 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2150 StrBufCutLeft(Buf, 4);
2151 StrBufExtract_token(er_name, Buf, 0, '|');
2152 StrBufExtract_token(er_password, Buf, 1, '|');
2153 StrBufExtract_token(er_dirname, Buf, 2, '|');
2154 er_flags = StrBufExtract_int(Buf, 3, '|');
2155 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2156 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2157 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2159 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2160 if (StrLength(er_roomaide) == 0) {
2162 StrBuf_ServGetln(Buf);
2163 if (GetServerStatus(Buf, NULL) != 2) {
2164 FlushStrBuf(er_roomaide);
2166 StrBufCutLeft(Buf, 4);
2167 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2170 Ptr = sbstr("er_name");
2171 if (StrLength(Ptr) > 0) {
2172 FlushStrBuf(er_name);
2173 StrBufAppendBuf(er_name, Ptr, 0);
2176 Ptr = sbstr("er_password");
2177 if (StrLength(Ptr) > 0) {
2178 FlushStrBuf(er_password);
2179 StrBufAppendBuf(er_password, Ptr, 0);
2183 Ptr = sbstr("er_dirname");
2184 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2185 FlushStrBuf(er_dirname);
2186 StrBufAppendBuf(er_dirname, Ptr, 0);
2190 Ptr = sbstr("type");
2191 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2193 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2194 er_flags |= (QR_PRIVATE);
2196 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2197 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2199 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2200 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2202 if (!strcmp(ChrPtr(Ptr), "personal")) {
2203 er_flags |= QR_MAILBOX;
2205 er_flags &= ~QR_MAILBOX;
2208 if (yesbstr("prefonly")) {
2209 er_flags |= QR_PREFONLY;
2211 er_flags &= ~QR_PREFONLY;
2214 if (yesbstr("readonly")) {
2215 er_flags |= QR_READONLY;
2217 er_flags &= ~QR_READONLY;
2221 if (yesbstr("collabdel")) {
2222 er_flags2 |= QR2_COLLABDEL;
2224 er_flags2 &= ~QR2_COLLABDEL;
2227 if (yesbstr("permanent")) {
2228 er_flags |= QR_PERMANENT;
2230 er_flags &= ~QR_PERMANENT;
2233 if (yesbstr("subjectreq")) {
2234 er_flags2 |= QR2_SUBJECTREQ;
2236 er_flags2 &= ~QR2_SUBJECTREQ;
2239 if (yesbstr("network")) {
2240 er_flags |= QR_NETWORK;
2242 er_flags &= ~QR_NETWORK;
2245 if (yesbstr("directory")) {
2246 er_flags |= QR_DIRECTORY;
2248 er_flags &= ~QR_DIRECTORY;
2251 if (yesbstr("ulallowed")) {
2252 er_flags |= QR_UPLOAD;
2254 er_flags &= ~QR_UPLOAD;
2257 if (yesbstr("dlallowed")) {
2258 er_flags |= QR_DOWNLOAD;
2260 er_flags &= ~QR_DOWNLOAD;
2263 if (yesbstr("visdir")) {
2264 er_flags |= QR_VISDIR;
2266 er_flags &= ~QR_VISDIR;
2269 Ptr = sbstr("anon");
2271 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2272 if (!strcmp(ChrPtr(Ptr), "anononly"))
2273 er_flags |= QR_ANONONLY;
2274 if (!strcmp(ChrPtr(Ptr), "anon2"))
2275 er_flags |= QR_ANONOPT;
2277 bump = yesbstr("bump");
2279 er_floor = ibstr("er_floor");
2281 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2283 ChrPtr(er_password),
2292 StrBuf_ServGetln(Buf);
2293 if (GetServerStatus(Buf, NULL) != 2) {
2294 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2297 FreeStrBuf(&er_name);
2298 FreeStrBuf(&er_password);
2299 FreeStrBuf(&er_dirname);
2300 FreeStrBuf(&er_roomaide);
2305 if (StrLength(er_roomaide) > 0) {
2306 serv_printf("SETA %s", ChrPtr(er_roomaide));
2307 StrBuf_ServGetln(Buf);
2308 if (GetServerStatus(Buf, NULL) != 2) {
2309 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2310 display_main_menu();
2312 FreeStrBuf(&er_name);
2313 FreeStrBuf(&er_password);
2314 FreeStrBuf(&er_dirname);
2315 FreeStrBuf(&er_roomaide);
2320 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2323 FreeStrBuf(&er_name);
2324 FreeStrBuf(&er_password);
2325 FreeStrBuf(&er_dirname);
2326 FreeStrBuf(&er_roomaide);
2332 * Display form for Invite, Kick, and show Who Knows a room
2334 void do_invt_kick(void) {
2335 char buf[SIZ], room[SIZ], username[SIZ];
2338 serv_getln(buf, sizeof buf);
2340 if (buf[0] != '2') {
2344 extract_token(room, &buf[4], 0, '|', sizeof room);
2346 strcpy(username, bstr("username"));
2348 if (havebstr("kick_button")) {
2349 sprintf(buf, "KICK %s", username);
2351 serv_getln(buf, sizeof buf);
2353 if (buf[0] != '2') {
2354 strcpy(WC->ImportantMessage, &buf[4]);
2356 sprintf(WC->ImportantMessage,
2357 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2362 if (havebstr("invite_button")) {
2363 sprintf(buf, "INVT %s", username);
2365 serv_getln(buf, sizeof buf);
2367 if (buf[0] != '2') {
2368 strcpy(WC->ImportantMessage, &buf[4]);
2370 sprintf(WC->ImportantMessage,
2371 _("<B><I>User %s invited to room %s.</I></B>\n"),
2382 * Display form for Invite, Kick, and show Who Knows a room
2384 void display_whok(void)
2386 char buf[SIZ], room[SIZ], username[SIZ];
2389 serv_getln(buf, sizeof buf);
2391 if (buf[0] != '2') {
2395 extract_token(room, &buf[4], 0, '|', sizeof room);
2398 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2399 wprintf(_("The users listed below have access to this room. "
2400 "To remove a user from the access list, select the user "
2401 "name from the list and click 'Kick'."));
2402 wprintf("<br /><br />");
2404 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2405 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2406 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2407 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2409 serv_getln(buf, sizeof buf);
2410 if (buf[0] == '1') {
2411 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2412 extract_token(username, buf, 0, '|', sizeof username);
2413 wprintf("<OPTION>");
2418 wprintf("</select><br />\n");
2420 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2421 wprintf("</form></CENTER>\n");
2423 wprintf("</td><td>");
2424 wprintf(_("To grant another user access to this room, enter the "
2425 "user name in the box below and click 'Invite'."));
2426 wprintf("<br /><br />");
2428 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2429 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2430 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2431 wprintf(_("Invite:"));
2433 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2434 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2435 "<input type=\"submit\" value=\"%s\">"
2436 "</form></CENTER>\n", _("Invite"));
2437 /* Pop open an address book -- begin **/
2439 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2441 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2444 _("Users"), _("Users")
2446 /* Pop open an address book -- end **/
2448 wprintf("</td></tr></table>\n");
2449 address_book_popup();
2456 * display the form for entering a new room
2458 void display_entroom(void)
2463 serv_puts("CRE8 0");
2464 serv_getln(buf, sizeof buf);
2466 if (buf[0] != '2') {
2467 strcpy(WC->ImportantMessage, &buf[4]);
2468 display_main_menu();
2472 output_headers(1, 1, 1, 0, 0, 0);
2474 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2475 do_template("beginbox", NULL);
2477 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2478 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2480 wprintf("<table class=\"altern\"> ");
2482 wprintf("<tr class=\"even\"><td>");
2483 wprintf(_("Name of room: "));
2484 wprintf("</td><td>");
2485 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2486 wprintf("</td></tr>");
2488 wprintf("<tr class=\"odd\"><td>");
2489 wprintf(_("Resides on floor: "));
2490 wprintf("</td><td>");
2492 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2493 for (i = 0; i < 128; ++i)
2494 if (!IsEmptyStr(floorlist[i])) {
2495 wprintf("<option ");
2496 wprintf("value=\"%d\">", i);
2497 escputs(floorlist[i]);
2498 wprintf("</option>\n");
2500 wprintf("</select>\n");
2501 wprintf("</td></tr>");
2504 * Our clever little snippet of JavaScript automatically selects
2505 * a public room if the view is set to Bulletin Board or wiki, and
2506 * it selects a mailbox room otherwise. The user can override this,
2507 * of course. We also disable the floor selector for mailboxes.
2509 wprintf("<tr class=\"even\"><td>");
2510 wprintf(_("Default view for room: "));
2511 wprintf("</td><td>");
2512 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2513 " if ( (this.form.er_view.value == 0) "
2514 " || (this.form.er_view.value == 6) ) { "
2515 " this.form.type[0].checked=true; "
2516 " this.form.er_floor.disabled = false; "
2519 " this.form.type[4].checked=true; "
2520 " this.form.er_floor.disabled = true; "
2523 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2524 if (is_view_allowed_as_default(i)) {
2525 wprintf("<option %s value=\"%d\">",
2526 ((i == 0) ? "selected" : ""), i );
2527 escputs(viewdefs[i]);
2528 wprintf("</option>\n");
2531 wprintf("</select>\n");
2532 wprintf("</td></tr>");
2534 wprintf("<tr class=\"even\"><td>");
2535 wprintf(_("Type of room:"));
2536 wprintf("</td><td>");
2537 wprintf("<ul class=\"adminlist\">\n");
2539 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2540 wprintf("CHECKED OnChange=\""
2541 " if (this.form.type[0].checked == true) { "
2542 " this.form.er_floor.disabled = false; "
2545 wprintf(_("Public (automatically appears to everyone)"));
2548 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2549 " if (this.form.type[1].checked == true) { "
2550 " this.form.er_floor.disabled = false; "
2553 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2556 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2557 " if (this.form.type[2].checked == true) { "
2558 " this.form.er_floor.disabled = false; "
2561 wprintf(_("Private - require password: "));
2562 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2565 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2566 " if (this.form.type[3].checked == true) { "
2567 " this.form.er_floor.disabled = false; "
2570 wprintf(_("Private - invitation only"));
2573 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2575 " if (this.form.type[4].checked == true) { "
2576 " this.form.er_floor.disabled = true; "
2579 wprintf(_("Personal (mailbox for you only)"));
2582 wprintf("\n</ul>\n");
2583 wprintf("</td></tr></table>\n");
2585 wprintf("<div class=\"buttons\">\n");
2586 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2588 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2589 wprintf("</div>\n");
2590 wprintf("</form>\n<hr />");
2591 serv_printf("MESG roomaccess");
2592 serv_getln(buf, sizeof buf);
2593 if (buf[0] == '1') {
2597 do_template("endbox", NULL);
2606 * support function for entroom() -- sets the default view
2608 void er_set_default_view(int newview) {
2621 serv_getln(buf, sizeof buf);
2622 if (buf[0] != '2') return;
2624 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2625 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2626 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2627 rm_bits1 = extract_int(&buf[4], 3);
2628 rm_floor = extract_int(&buf[4], 4);
2629 rm_listorder = extract_int(&buf[4], 5);
2630 rm_bits2 = extract_int(&buf[4], 7);
2632 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2633 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2634 rm_listorder, newview, rm_bits2
2636 serv_getln(buf, sizeof buf);
2647 const StrBuf *er_name;
2648 const StrBuf *er_type;
2649 const StrBuf *er_password;
2654 if (!havebstr("ok_button")) {
2655 strcpy(WC->ImportantMessage,
2656 _("Cancelled. No new room was created."));
2657 display_main_menu();
2660 er_name = sbstr("er_name");
2661 er_type = sbstr("type");
2662 er_password = sbstr("er_password");
2663 er_floor = ibstr("er_floor");
2664 er_view = ibstr("er_view");
2667 if (!strcmp(ChrPtr(er_type), "hidden"))
2669 else if (!strcmp(ChrPtr(er_type), "passworded"))
2671 else if (!strcmp(ChrPtr(er_type), "invonly"))
2673 else if (!strcmp(ChrPtr(er_type), "personal"))
2676 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2679 ChrPtr(er_password),
2684 serv_getln(buf, sizeof buf);
2685 if (buf[0] != '2') {
2686 strcpy(WC->ImportantMessage, &buf[4]);
2687 display_main_menu();
2690 /** TODO: Room created, now udate the left hand icon bar for this user */
2691 burn_folder_cache(0); /* burn the old folder cache */
2695 do_change_view(er_view); /* Now go there */
2700 * \brief display the screen to enter a private room
2702 void display_private(char *rname, int req_pass)
2704 WCTemplputParams SubTP;
2706 output_headers(1, 1, 1, 0, 0, 0);
2708 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2709 memset(&SubTP, 0, sizeof(WCTemplputParams));
2710 SubTP.Filter.ContextType = CTX_STRBUF;
2711 SubTP.Context = Buf;
2712 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2717 wprintf(_("If you know the name of a hidden (guess-name) or "
2718 "passworded room, you can enter that room by typing "
2719 "its name below. Once you gain access to a private "
2720 "room, it will appear in your regular room listings "
2721 "so you don't have to keep returning here."));
2724 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2725 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2727 wprintf("<table class=\"altern\"> "
2728 "<tr class=\"even\"><td>");
2729 wprintf(_("Enter room name:"));
2731 "<input type=\"text\" name=\"gr_name\" "
2732 "value=\"%s\" maxlength=\"128\">\n", rname);
2735 wprintf("</td></tr><tr class=\"odd\"><td>");
2736 wprintf(_("Enter room password:"));
2737 wprintf("</td><td>");
2738 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2740 wprintf("</td></tr></table>\n");
2742 wprintf("<div class=\"buttons\">\n");
2743 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2745 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2749 wprintf("</div></form>\n");
2751 do_template("endbox", NULL);
2757 * \brief goto a private room
2759 void goto_private(void)
2764 if (!havebstr("ok_button")) {
2765 display_main_menu();
2768 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2769 serv_printf("GOTO %s|%s",
2772 serv_getln(buf, sizeof buf);
2774 if (buf[0] == '2') {
2775 smart_goto(sbstr("gr_name"));
2778 if (!strncmp(buf, "540", 3)) {
2779 display_private(bstr("gr_name"), 1);
2782 output_headers(1, 1, 1, 0, 0, 0);
2783 wprintf("%s\n", &buf[4]);
2790 * \brief display the screen to zap a room
2792 void display_zap(void)
2794 output_headers(1, 1, 2, 0, 0, 0);
2796 wprintf("<div id=\"banner\">\n");
2798 wprintf(_("Zap (forget/unsubscribe) the current room"));
2800 wprintf("</div>\n");
2802 wprintf("<div id=\"content\" class=\"service\">\n");
2804 wprintf(_("If you select this option, <em>%s</em> will "
2805 "disappear from your room list. Is this what you wish "
2806 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2808 wprintf("<form method=\"POST\" action=\"zap\">\n");
2809 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2810 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2812 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2813 wprintf("</form>\n");
2824 StrBuf *final_destination;
2827 * If the forget-room routine fails for any reason, we fall back
2828 * to the current room; otherwise, we go to the Lobby
2830 final_destination = NewStrBufDup(WC->wc_roomname);
2832 if (havebstr("ok_button")) {
2833 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2834 serv_getln(buf, sizeof buf);
2835 if (buf[0] == '2') {
2837 serv_getln(buf, sizeof buf);
2838 if (buf[0] == '2') {
2839 FlushStrBuf(final_destination);
2840 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2844 smart_goto(final_destination);
2845 FreeStrBuf(&final_destination);
2851 * \brief Delete the current room
2853 void delete_room(void)
2858 serv_puts("KILL 1");
2859 serv_getln(buf, sizeof buf);
2860 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2861 if (buf[0] != '2') {
2862 strcpy(WC->ImportantMessage, &buf[4]);
2863 display_main_menu();
2868 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2877 * \brief Perform changes to a room's network configuration
2879 void netedit(void) {
2888 /*/ TODO: do line dynamic! */
2889 if (havebstr("line_pop3host")) {
2890 strcpy(line, bstr("prefix"));
2891 strcat(line, bstr("line_pop3host"));
2893 strcat(line, bstr("line_pop3user"));
2895 strcat(line, bstr("line_pop3pass"));
2897 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2899 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2900 strcat(line, bstr("suffix"));
2902 else if (havebstr("line")) {
2903 strcpy(line, bstr("prefix"));
2904 strcat(line, bstr("line"));
2905 strcat(line, bstr("suffix"));
2920 serv_getln(buf, sizeof buf);
2921 if (buf[0] != '1') {
2927 /** This loop works for add *or* remove. Spiffy, eh? */
2928 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2929 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2930 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2931 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2932 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2933 if ( (strcasecmp(cmpa0, cmpb0))
2934 || (strcasecmp(cmpa1, cmpb1)) ) {
2935 fprintf(fp, "%s\n", buf);
2941 serv_getln(buf, sizeof buf);
2942 if (buf[0] != '4') {
2948 while (fgets(buf, sizeof buf, fp) != NULL) {
2949 buf[strlen(buf)-1] = 0;
2953 if (havebstr("add_button")) {
2954 num_addrs = num_tokens(bstr("line"), ',');
2955 if (num_addrs < 2) {
2956 /* just adding one node or address */
2960 /* adding multiple addresses separated by commas */
2961 for (i=0; i<num_addrs; ++i) {
2962 strcpy(line, bstr("prefix"));
2963 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2966 strcat(line, bstr("suffix"));
2980 * \brief Convert a room name to a folder-ish-looking name.
2981 * \param folder the folderish name
2982 * \param room the room name
2983 * \param floor the floor name
2984 * \param is_mailbox is it a mailbox?
2986 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2991 * For mailboxes, just do it straight...
2994 sprintf(folder, "My folders|%s", room);
2998 * Otherwise, prefix the floor name as a "public folders" moniker
3001 if (floor > MAX_FLOORS) {
3003 sprintf(folder, "%%%%%%|%s", room);
3006 sprintf(folder, "%s|%s", floorlist[floor], room);
3011 * Replace "\" characters with "|" for pseudo-folder-delimiting
3013 len = strlen (folder);
3014 for (i=0; i<len; ++i) {
3015 if (folder[i] == '\\') folder[i] = '|';
3023 * \brief Back end for change_view()
3024 * \param newview set newview???
3026 void do_change_view(int newview) {
3029 serv_printf("VIEW %d", newview);
3030 serv_getln(buf, sizeof buf);
3031 WC->wc_view = newview;
3032 smart_goto(WC->wc_roomname);
3038 * \brief Change the view for this room
3040 void change_view(void) {
3043 view = lbstr("view");
3044 do_change_view(view);
3049 * \brief One big expanded tree list view --- like a folder list
3050 * \param fold the folder to view
3051 * \param max_folders how many folders???
3052 * \param num_floors hom many floors???
3054 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3058 int has_subfolders = 0;
3061 parents = malloc(max_folders * sizeof(int));
3063 /** BEGIN TREE MENU */
3064 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3066 /** include NanoTree */
3067 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3069 /** initialize NanoTree */
3070 wprintf("<script type=\"text/javascript\"> \n"
3071 " showRootNode = false; \n"
3072 " sortNodes = false; \n"
3073 " dragable = false; \n"
3075 " function standardClick(treeNode) { \n"
3078 " var closedGif = 'static/folder_closed.gif'; \n"
3079 " var openGif = 'static/folder_open.gif'; \n"
3081 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3085 for (i=0; i<max_folders; ++i) {
3088 if ((i+1) < max_folders) {
3090 len = strlen(fold[i].name);
3091 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3092 && (fold[i+1].name[len] == '|') ) {
3097 levels = num_tokens(fold[i].name, '|');
3098 parents[levels] = i;
3100 wprintf("var node%d = new TreeNode(%d, '", i, i);
3102 if (fold[i].selectable) {
3103 wprintf("<a href=\"dotgoto?room=");
3104 urlescputs(fold[i].room);
3109 wprintf("<span class=\"roomlist_floor\">");
3111 else if (fold[i].hasnewmsgs) {
3112 wprintf("<span class=\"roomlist_new\">");
3115 wprintf("<span class=\"roomlist_old\">");
3117 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3122 if (has_subfolders) {
3123 wprintf("new Array(closedGif, openGif)");
3125 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3126 wprintf("'static/viewcontacts_16x.gif'");
3128 else if (fold[i].view == VIEW_CALENDAR) {
3129 wprintf("'static/calarea_16x.gif'");
3131 else if (fold[i].view == VIEW_CALBRIEF) {
3132 wprintf("'static/calarea_16x.gif'");
3134 else if (fold[i].view == VIEW_TASKS) {
3135 wprintf("'static/taskmanag_16x.gif'");
3137 else if (fold[i].view == VIEW_NOTES) {
3138 wprintf("'static/storenotes_16x.gif'");
3140 else if (fold[i].view == VIEW_MAILBOX) {
3141 wprintf("'static/privatemess_16x.gif'");
3144 wprintf("'static/chatrooms_16x.gif'");
3147 urlescputs(fold[i].name);
3151 wprintf("rootNode.addChild(node%d);\n", i);
3154 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3158 wprintf("container = document.getElementById('roomlist_div'); \n"
3164 /** END TREE MENU */
3168 * \brief Boxes and rooms and lists ... oh my!
3169 * \param fold the folder to view
3170 * \param max_folders how many folders???
3171 * \param num_floors hom many floors???
3173 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3175 char floor_name[256];
3176 char old_floor_name[256];
3177 int levels, oldlevels;
3180 static int columns = 3;
3181 int boxes_per_column = 0;
3182 int current_column = 0;
3185 strcpy(floor_name, "");
3186 strcpy(old_floor_name, "");
3189 while (nf % columns != 0) ++nf;
3190 boxes_per_column = (nf / columns);
3191 if (boxes_per_column < 1) boxes_per_column = 1;
3193 /** Outer table (for columnization) */
3194 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3195 "<tr><td valign=top>");
3199 for (i=0; i<max_folders; ++i) {
3201 levels = num_tokens(fold[i].name, '|');
3202 extract_token(floor_name, fold[i].name, 0,
3203 '|', sizeof floor_name);
3205 if ( (strcasecmp(floor_name, old_floor_name))
3206 && (!IsEmptyStr(old_floor_name)) ) {
3208 do_template("endbox", NULL);
3212 if ((num_boxes % boxes_per_column) == 0) {
3214 if (current_column < columns) {
3215 wprintf("</td><td valign=top>\n");
3219 strcpy(old_floor_name, floor_name);
3223 WCTemplputParams SubTP;
3225 Buf = NewStrBufPlain(floor_name, -1);
3226 memset(&SubTP, 0, sizeof(WCTemplputParams));
3227 SubTP.Filter.ContextType = CTX_STRBUF;
3228 SubTP.Context = Buf;
3229 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3238 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3239 if (fold[i].selectable) {
3240 wprintf("<a href=\"dotgoto?room=");
3241 urlescputs(fold[i].room);
3247 if (fold[i].hasnewmsgs) {
3248 wprintf("<span class=\"roomlist_new\">");
3251 wprintf("<span class=\"roomlist_old\">");
3253 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3256 if (fold[i].selectable) {
3262 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3263 wprintf(" (INBOX)");
3265 wprintf("<br />\n");
3268 /** End the final inner box */
3269 do_template("endbox", NULL);
3271 wprintf("</td></tr></table>\n");
3275 * \brief print a floor div???
3276 * \param which_floordiv name of the floordiv???
3278 void set_floordiv_expanded(void) {
3279 wcsession *WCC = WC;
3282 FloorDiv = NewStrBuf();
3283 StrBufAppendBuf(FloorDiv, WCC->UrlFragment2, 0);
3284 set_preference("floordiv_expanded", FloorDiv, 1);
3285 WCC->floordiv_expanded = FloorDiv;
3289 * \brief view the iconbar
3290 * \param fold the folder to view
3291 * \param max_folders how many folders???
3292 * \param num_floors hom many floors???
3294 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3296 char floor_name[256];
3297 char old_floor_name[256];
3298 char floordivtitle[256];
3299 char floordiv_id[32];
3300 int levels, oldlevels;
3304 strcpy(floor_name, "");
3305 strcpy(old_floor_name, "");
3309 for (i=0; i<max_folders; ++i) {
3311 levels = num_tokens(fold[i].name, '|');
3312 extract_token(floor_name, fold[i].name, 0,
3313 '|', sizeof floor_name);
3315 if ( (strcasecmp(floor_name, old_floor_name))
3316 && (!IsEmptyStr(old_floor_name)) ) {
3317 /** End inner box */
3319 wprintf("</div>\n"); /** floordiv */
3321 strcpy(old_floor_name, floor_name);
3325 stresc(floordivtitle, 256, floor_name, 0, 0);
3326 sprintf(floordiv_id, "floordiv%d", i);
3327 wprintf("<span class=\"ib_roomlist_floor\" "
3328 "onClick=\"expand_floor('%s')\">"
3329 "%s</span><br>\n", floordiv_id, floordivtitle);
3330 wprintf("<div id=\"%s\" style=\"display:%s\">",
3332 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3339 wprintf("<div id=\"roomdiv%d\">", i);
3341 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3343 /** choose the icon */
3344 if (fold[i].view == VIEW_ADDRESSBOOK) {
3345 icon = "viewcontacts_16x.gif" ;
3347 else if (fold[i].view == VIEW_CALENDAR) {
3348 icon = "calarea_16x.gif" ;
3350 else if (fold[i].view == VIEW_CALBRIEF) {
3351 icon = "calarea_16x.gif" ;
3353 else if (fold[i].view == VIEW_TASKS) {
3354 icon = "taskmanag_16x.gif" ;
3356 else if (fold[i].view == VIEW_NOTES) {
3357 icon = "storenotes_16x.gif" ;
3359 else if (fold[i].view == VIEW_MAILBOX) {
3360 icon = "privatemess_16x.gif" ;
3363 icon = "chatrooms_16x.gif" ;
3366 if (fold[i].selectable) {
3367 wprintf("<a href=\"dotgoto?room=");
3368 urlescputs(fold[i].room);
3370 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3375 if (fold[i].hasnewmsgs) {
3376 wprintf("<span class=\"ib_roomlist_new\">");
3379 wprintf("<span class=\"ib_roomlist_old\">");
3381 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3383 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3384 wprintf(" (INBOX)");
3387 if (fold[i].selectable) {
3394 wprintf("</div>\n"); /** roomdiv */
3397 wprintf("</div>\n"); /** floordiv */
3405 * \brief Burn the cached folder list.
3406 * \param age How old the cahce needs to be before we burn it.
3409 void burn_folder_cache(time_t age)
3411 /** If our cached folder list is very old, burn it. */
3412 if (WC->cache_fold != NULL) {
3413 if ((time(NULL) - WC->cache_timestamp) > age) {
3414 free(WC->cache_fold);
3415 WC->cache_fold = NULL;
3424 * \brief Show the room list.
3425 * (only should get called by
3426 * knrooms() because that's where output_headers() is called from)
3427 * \param viewpref the view preferences???
3430 void list_all_rooms_by_floor(const char *viewpref) {
3433 struct folder *fold = NULL;
3435 int max_folders = 0;
3436 int alloc_folders = 0;
3440 int ShowEmptyFloors;
3443 int num_floors = 1; /** add an extra one for private folders */
3446 /** If our cached folder list is very old, burn it. */
3447 burn_folder_cache(300);
3449 /** Can we do the iconbar roomlist from cache? */
3450 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3451 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3455 /** Grab the floor table so we know how to build the list... */
3458 /** Start with the mailboxes */
3461 fold = malloc(sizeof(struct folder));
3462 memset(fold, 0, sizeof(struct folder));
3463 strcpy(fold[0].name, "My folders");
3464 fold[0].is_mailbox = 1;
3466 /** Then add floors */
3468 serv_getln(buf, sizeof buf);
3469 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3470 if (max_folders >= alloc_folders) {
3471 alloc_folders = max_folders + 100;
3472 fold = realloc(fold,
3473 alloc_folders * sizeof(struct folder));
3475 memset(&fold[max_folders], 0, sizeof(struct folder));
3476 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3477 extract_token(buf3, buf, 0, '|', SIZ);
3478 fold[max_folders].floor = atol (buf3);
3483 for (i=0; i<num_floors; i++)
3484 if (IDMax < fold[i].floor)
3485 IDMax = fold[i].floor;
3486 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3487 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3488 for (i=0; i<num_floors; i++)
3489 floor_mapping[fold[i].floor]=i;
3491 /** refresh the messages index for this room */
3492 /* TODO serv_puts("GOTO ");
3493 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3494 /** Now add rooms */
3496 serv_getln(buf, sizeof buf);
3497 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3498 if (max_folders >= alloc_folders) {
3499 alloc_folders = max_folders + 100;
3500 fold = realloc(fold,
3501 alloc_folders * sizeof(struct folder));
3503 memset(&fold[max_folders], 0, sizeof(struct folder));
3504 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3505 ra_flags = extract_int(buf, 5);
3506 flags = extract_int(buf, 1);
3507 fold[max_folders].floor = extract_int(buf, 2);
3508 fold[max_folders].hasnewmsgs =
3509 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3510 if (flags & QR_MAILBOX) {
3511 fold[max_folders].is_mailbox = 1;
3513 fold[max_folders].view = extract_int(buf, 6);
3514 room_to_folder(fold[max_folders].name,
3515 fold[max_folders].room,
3516 fold[max_folders].floor,
3517 fold[max_folders].is_mailbox);
3518 fold[max_folders].selectable = 1;
3519 /* Increase the room count for the associtaed floor */
3520 if (fold[max_folders].is_mailbox) {
3521 fold[0].num_rooms++;
3524 i = floor_mapping[fold[max_folders].floor];
3525 fold[i].num_rooms++;
3531 * Remove any floors that don't have rooms
3533 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3534 if (ShowEmptyFloors)
3536 for (i=0; i<num_floors; i++)
3538 if (fold[i].num_rooms == 0) {
3539 for (j=i; j<max_folders; j++) {
3540 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3549 /** Bubble-sort the folder list */
3550 for (i=0; i<max_folders; ++i) {
3551 for (j=0; j<(max_folders-1)-i; ++j) {
3552 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3553 swap = strcasecmp(fold[j].name, fold[j+1].name);
3556 if ( (fold[j+1].is_mailbox)
3557 && (!fold[j].is_mailbox)) {
3565 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3566 memcpy(&fold[j], &fold[j+1],
3567 sizeof(struct folder));
3568 memcpy(&fold[j+1], &ftmp,
3569 sizeof(struct folder));
3575 if (!strcasecmp(viewpref, "folders")) {
3576 do_folder_view(fold, max_folders, num_floors);
3578 else if (!strcasecmp(viewpref, "hackish_view")) {
3579 for (i=0; i<max_folders; ++i) {
3580 escputs(fold[i].name);
3581 wprintf("<br />\n");
3584 else if (!strcasecmp(viewpref, "iconbar")) {
3585 do_iconbar_view(fold, max_folders, num_floors);
3588 do_rooms_view(fold, max_folders, num_floors);
3591 /* Don't free the folder list ... cache it for future use! */
3592 if (WC->cache_fold != NULL) {
3593 free(WC->cache_fold);
3595 WC->cache_fold = fold;
3596 WC->cache_max_folders = max_folders;
3597 WC->cache_num_floors = num_floors;
3598 WC->cache_timestamp = time(NULL);
3599 free(floor_mapping);
3604 * \brief Do either a known rooms list or a folders list, depending on the
3609 StrBuf *ListView = NULL;
3611 output_headers(1, 1, 2, 0, 0, 0);
3613 /** Determine whether the user is trying to change views */
3614 if (havebstr("view")) {
3615 ListView = NewStrBufPlain(bstr("view"), -1);
3616 set_preference("roomlistview", ListView, 1);
3618 /** Sanitize the input so its safe */
3619 if(!get_preference("roomlistview", &ListView) ||
3620 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3621 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3623 if (ListView == NULL) {
3624 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3625 set_preference("roomlistview", ListView, 0);
3628 StrBufPrintf(ListView, "rooms");
3634 wprintf("<div id=\"banner\">\n");
3635 wprintf("<div class=\"room_banner\">");
3637 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3638 wprintf(_("Room list"));
3640 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3641 wprintf(_("Folder list"));
3643 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3644 wprintf(_("Room list"));
3646 wprintf("</h1></div>\n");
3648 /** offer the ability to switch views */
3649 wprintf("<ul class=\"room_actions\">\n");
3650 wprintf("<li class=\"start_page\">");
3651 offer_start_page(NULL, &NoCtx);
3653 wprintf("<li><form name=\"roomlistomatic\">\n"
3654 "<select name=\"newview\" size=\"1\" "
3655 "OnChange=\"location.href=roomlistomatic.newview.options"
3656 "[selectedIndex].value\">\n");
3658 wprintf("<option %s value=\"knrooms&view=rooms\">"
3661 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3664 wprintf("<option %s value=\"knrooms&view=folders\">"
3665 "View as folder list"
3667 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3670 wprintf("</select>");
3671 wprintf("</form></li>");
3672 wprintf("</ul></div>\n");
3674 wprintf("<div id=\"content\" class=\"service\">\n");
3676 /** Display the room list in the user's preferred format */
3677 list_all_rooms_by_floor(ChrPtr(ListView));
3684 * \brief Set the message expire policy for this room and/or floor
3686 void set_room_policy(void) {
3689 if (!havebstr("ok_button")) {
3690 strcpy(WC->ImportantMessage,
3691 _("Cancelled. Changes were not saved."));
3696 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3697 serv_getln(buf, sizeof buf);
3698 strcpy(WC->ImportantMessage, &buf[4]);
3700 if (WC->axlevel >= 6) {
3701 strcat(WC->ImportantMessage, "<br />\n");
3702 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3703 serv_getln(buf, sizeof buf);
3704 strcat(WC->ImportantMessage, &buf[4]);
3710 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3711 /* todo: check context */
3717 floors = NewHash(1, NULL);
3719 serv_puts("LFLR"); /* get floors */
3720 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
3721 if (ChrPtr(Buf)[0] == '1') while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3723 const char *floorNum;
3724 floor = NewHash(1, NULL);
3725 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3727 StrBufExtract_token(Buf2, Buf, a, '|');
3729 floorNum = ChrPtr(Buf2); /* hmm, should we copy Buf2 first? */
3731 Put(floor, FPKEY(a), Buf2, NULL);
3733 Put(floors, HKEY(floorNum), floor, NULL);
3739 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3742 HashList *floor = (HashList *)(TP->Context);
3744 GetHash(floor, TKEY(0), &value);
3745 val = (StrBuf *)value;
3746 StrECMAEscAppend(TemplBuffer, val, 0);
3748 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP)
3751 return GetRoomListHash(Target, TP);
3753 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
3755 /* TODO: Check context */
3762 rooms = NewHash(1, NULL);
3763 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3764 if (ChrPtr(buf)[0] == '1') while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3767 room = NewHash(1, NULL);
3768 for(i=0; i<ROOM_PARAM_LEN; i++) {
3770 StrBufExtract_token(buf2, buf, i, '|');
3772 rmName = ChrPtr(buf2);
3774 Put(room, RPKEY(i), buf2, NULL);
3776 Put(rooms, rmName, strlen(rmName), room, NULL);
3778 SortByHashKey(rooms, 1);
3779 /*SortByPayload(rooms, SortRoomsByListOrder); */
3783 /** Unused function that orders rooms by the listorder flag */
3784 int SortRoomsByListOrder(const void *room1, const void *room2)
3788 HashList *r1 = (HashList *)GetSearchPayload(room1);
3789 HashList *r2 = (HashList *)GetSearchPayload(room2);
3790 StrBuf *listOrderBuf1;
3791 StrBuf *listOrderBuf2;
3793 GetHash(r1, RPKEY(3), (void *)&listOrderBuf1);
3794 GetHash(r2, RPKEY(3), (void *)&listOrderBuf2);
3795 l1 = atoi(ChrPtr(listOrderBuf1));
3796 l2 = atoi(ChrPtr(listOrderBuf2));
3797 if (l1 < l2) return -1;
3798 else if (l1 > l2) return +1;
3801 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3805 HashList *room = (HashList *)(TP->Context);
3807 GetHash(room, TKEY(0), &value);
3808 val = (StrBuf *)value;
3809 StrECMAEscAppend(TemplBuffer, val, 0);
3811 void jsonRoomFlr(void) {
3812 /* Send as our own (application/json) content type */
3813 hprintf("HTTP/1.1 200 OK\r\n");
3814 hprintf("Content-type: application/json; charset=utf-8\r\n");
3815 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(serv_info.serv_software));
3816 hprintf("Connection: close\r\n");
3817 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3819 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3822 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3824 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3827 void _gotonext(void) { slrp_highest(); gotonext(); }
3828 void dotskip(void) {smart_goto(sbstr("room"));}
3829 void _display_private(void) { display_private("", 0); }
3830 void dotgoto(void) {
3831 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3834 smart_goto(sbstr("room"));
3837 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3839 wprintf("<div id=\"banner\">\n");
3840 embed_room_banner(NULL, navbar_default);
3841 wprintf("</div>\n");
3845 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3847 wcsession *WCC = WC;
3850 (!IsEmptyStr(WCC->ugname)))
3851 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3855 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3857 wcsession *WCC = WC;
3859 return ((WCC!=NULL) &&
3860 (!IsEmptyStr(WCC->ugname)) &&
3861 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3864 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3866 wcsession *WCC = WC;
3868 return ((WCC!=NULL) &&
3869 ((WCC->room_flags & QR_PERMANENT) != 0));
3872 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3874 wcsession *WCC = WC;
3876 return ((WCC!=NULL) &&
3877 ((WCC->room_flags & QR_INUSE) != 0));
3880 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3882 wcsession *WCC = WC;
3884 return ((WCC!=NULL) &&
3885 ((WCC->room_flags & QR_PRIVATE) != 0));
3888 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3890 wcsession *WCC = WC;
3892 return ((WCC!=NULL) &&
3893 ((WCC->room_flags & QR_PASSWORDED) != 0));
3896 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3898 wcsession *WCC = WC;
3900 return ((WCC!=NULL) &&
3901 ((WCC->room_flags & QR_GUESSNAME) != 0));
3904 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3906 wcsession *WCC = WC;
3908 return ((WCC!=NULL) &&
3909 ((WCC->room_flags & QR_DIRECTORY) != 0));
3912 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3914 wcsession *WCC = WC;
3916 return ((WCC!=NULL) &&
3917 ((WCC->room_flags & QR_UPLOAD) != 0));
3920 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3922 wcsession *WCC = WC;
3924 return ((WCC!=NULL) &&
3925 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3928 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3930 wcsession *WCC = WC;
3932 return ((WCC!=NULL) &&
3933 ((WCC->room_flags & QR_VISDIR) != 0));
3936 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3938 wcsession *WCC = WC;
3940 return ((WCC!=NULL) &&
3941 ((WCC->room_flags & QR_ANONONLY) != 0));
3944 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3946 wcsession *WCC = WC;
3948 return ((WCC!=NULL) &&
3949 ((WCC->room_flags & QR_ANONOPT) != 0));
3952 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
3954 wcsession *WCC = WC;
3956 return ((WCC!=NULL) &&
3957 ((WCC->room_flags & QR_NETWORK) != 0));
3960 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
3962 wcsession *WCC = WC;
3964 return ((WCC!=NULL) &&
3965 ((WCC->room_flags & QR_PREFONLY) != 0));
3968 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
3970 wcsession *WCC = WC;
3972 return ((WCC!=NULL) &&
3973 ((WCC->room_flags & QR_READONLY) != 0));
3976 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
3978 wcsession *WCC = WC;
3980 return ((WCC!=NULL) &&
3981 ((WCC->room_flags & QR_MAILBOX) != 0));
3985 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3987 wcsession *WCC = WC;
3989 return ( (WCC!= NULL) &&
3990 ((WCC->axlevel >= 6) ||
3991 (WCC->is_room_aide) ||
3992 (WCC->is_mailbox) ));
3999 RegisterPreference(HKEY("roomlistview"),
4000 _("Room list view"),
4003 RegisterPreference(HKEY("emptyfloors"), _("Show empty floors"), PRF_YESNO, NULL);
4005 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
4007 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
4008 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
4009 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
4010 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4011 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4012 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4013 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4014 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4015 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4016 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4017 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4018 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4019 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4020 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4021 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4022 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4023 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4024 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4025 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4026 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4027 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4028 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4029 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4030 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4031 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4033 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4034 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4035 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4036 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4037 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4038 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4039 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4040 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4041 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4042 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4043 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4044 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4045 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4046 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4047 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4049 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4050 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4052 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4053 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4054 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4055 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, NULL, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4056 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);