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.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=\"search_name\">");
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\" "
456 "id=\"search_name\" class=\"inputbox\">\n"
458 wprintf("</div></form>\n");
463 * \brief Embed the room banner
465 * \param got The information returned from a GOTO server command
466 * \param navbar_style Determines which navigation buttons to display
470 void embed_room_banner(char *got, int navbar_style) {
473 char with_files[256];
477 * We need to have the information returned by a GOTO server command.
478 * If it isn't supplied, we fake it by issuing our own GOTO.
481 memset(buf, '0', 20);
483 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
484 serv_getln(buf, sizeof buf);
488 /** The browser needs some information for its own use */
489 wprintf("<script type=\"text/javascript\"> \n"
490 " room_is_trash = %d; \n"
496 * If the user happens to select the "make this my start page" link,
497 * we want it to remember the URL as a "/dotskip" one instead of
498 * a "skip" or "gotonext" or something like that.
500 snprintf(WC->this_page, sizeof(WC->this_page), "dotskip&room=%s",
501 ChrPtr(WC->wc_roomname));
503 /** Check for new mail. */
504 WC->new_mail = extract_int(&got[4], 9);
505 WC->wc_view = extract_int(&got[4], 11);
507 /* Is this a directory room and does it contain files and how many? */
508 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
511 serv_getln(buf2, sizeof buf2);
512 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
514 snprintf (with_files, sizeof with_files,
515 "; <a href=\"do_template?template=files\"> %d %s </a>",
517 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
520 strcpy (with_files, "");
522 svprintf(HKEY("NUMMSGS"), WCS_STRING,
523 _("%d new of %d messages%s"),
524 extract_int(&got[4], 1),
525 extract_int(&got[4], 2),
528 svcallback("ROOMPIC", embed_room_graphic);
529 svcallback("ROOMINFO", readinfo);
530 svcallback("VIEWOMATIC", embed_view_o_matic);
531 svcallback("SEARCHOMATIC", embed_search_o_matic);
532 svcallback("START", offer_start_page);
534 do_template("roombanner", NULL);
535 /* roombanner contains this for mobile */
536 if (navbar_style != navbar_none && !WC->is_mobile) {
538 wprintf("<div id=\"navbar\"><ul>");
540 if (navbar_style == navbar_default) wprintf(
541 "<li class=\"ungoto\">"
542 "<a href=\"ungoto\">"
543 "<img src=\"static/ungoto2_24x.gif\" alt=\"\">"
544 "<span class=\"navbar_link\">%s</span></A>"
545 "</li>\n", _("Ungoto")
548 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
550 "<li class=\"newmess\">"
551 "<a href=\"readnew\">"
552 "<img src=\"static/newmess2_24x.gif\" alt=\"\">"
553 "<span class=\"navbar_link\">%s</span></A>"
554 "</li>\n", _("Read new messages")
558 if (navbar_style == navbar_default) {
559 switch(WC->wc_view) {
560 case VIEW_ADDRESSBOOK:
562 "<li class=\"viewcontacts\">"
563 "<a href=\"readfwd\">"
564 "<img src=\"static/viewcontacts_24x.gif\" "
566 "<span class=\"navbar_link\">"
568 "</span></a></li>\n", _("View contacts")
573 "<li class=\"staskday\">"
574 "<a href=\"readfwd?calview=day\">"
575 "<img src=\"static/taskday2_24x.gif\" "
577 "<span class=\"navbar_link\">"
579 "</span></a></li>\n", _("Day view")
582 "<li class=\"monthview\">"
583 "<a href=\"readfwd?calview=month\">"
584 "<img src=\"static/monthview2_24x.gif\" "
586 "<span class=\"navbar_link\">"
588 "</span></a></li>\n", _("Month view")
593 "<li class=\"monthview\">"
594 "<a href=\"readfwd?calview=month\">"
595 "<img src=\"static/monthview2_24x.gif\" "
597 "<span class=\"navbar_link\">"
599 "</span></a></li>\n", _("Calendar list")
604 "<li class=\"taskmanag\">"
605 "<a href=\"readfwd\">"
606 "<img src=\"static/taskmanag_24x.gif\" "
608 "<span class=\"navbar_link\">"
610 "</span></a></li>\n", _("View tasks")
615 "<li class=\"viewnotes\">"
616 "<a href=\"readfwd\">"
617 "<img src=\"static/viewnotes_24x.gif\" "
619 "<span class=\"navbar_link\">"
621 "</span></a></li>\n", _("View notes")
626 "<li class=\"readallmess\">"
627 "<a id=\"m_refresh\" href=\"readfwd\">"
628 "<img src=\"static/readallmess3_24x.gif\" "
630 "<span class=\"navbar_link\">"
632 "</span></a></li>\n", _("Refresh message list")
637 "<li class=\"readallmess\">"
638 "<a href=\"readfwd\">"
639 "<img src=\"static/readallmess3_24x.gif\" "
641 "<span class=\"navbar_link\">"
643 "</span></a></li>\n", _("Wiki home")
648 "<li class=\"readallmess\">"
649 "<a href=\"readfwd\">"
650 "<img src=\"static/readallmess3_24x.gif\" "
652 "<span class=\"navbar_link\">"
654 "</span></a></li>\n", _("Read all messages")
660 if (navbar_style == navbar_default) {
661 switch(WC->wc_view) {
662 case VIEW_ADDRESSBOOK:
664 "<li class=\"addnewcontact\">"
665 "<a href=\"display_enter\">"
666 "<img src=\"static/addnewcontact_24x.gif\" "
667 "alt=\"\"><span class=\"navbar_link\">"
669 "</span></a></li>\n", _("Add new contact")
674 wprintf("<li class=\"addevent\"><a href=\"display_enter");
675 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
676 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
677 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
679 "<img src=\"static/addevent_24x.gif\" "
680 "alt=\"\"><span class=\"navbar_link\">"
682 "</span></a></li>\n", _("Add new event")
687 "<li class=\"newmess\">"
688 "<a href=\"display_enter\">"
689 "<img src=\"static/newmess3_24x.gif\" "
690 "alt=\"\"><span class=\"navbar_link\">"
692 "</span></a></li>\n", _("Add new task")
697 "<li class=\"enternewnote\">"
698 "<a href=\"add_new_note\">"
699 "<img src=\"static/enternewnote_24x.gif\" "
700 "alt=\"\"><span class=\"navbar_link\">"
702 "</span></a></li>\n", _("Add new note")
706 safestrncpy(buf, bstr("page"), sizeof buf);
709 "<li class=\"newmess\">"
710 "<a href=\"display_enter?wikipage=%s\">"
711 "<img src=\"static/newmess3_24x.gif\" "
712 "alt=\"\"><span class=\"navbar_link\">"
714 "</span></a></li>\n", buf, _("Edit this page")
719 "<li class=\"newmess\">"
720 "<a href=\"display_enter\">"
721 "<img src=\"static/newmess3_24x.gif\" "
722 "alt=\"\"><span class=\"navbar_link\">"
724 "</span></a></li>\n", _("Write mail")
729 "<li class=\"newmess\">"
730 "<a href=\"display_enter\">"
731 "<img src=\"static/newmess3_24x.gif\" "
732 "alt=\"\"><span class=\"navbar_link\">"
734 "</span></a></li>\n", _("Enter a message")
740 if (navbar_style == navbar_default) wprintf(
741 "<li class=\"skipthisroom\">"
744 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\">"
745 "<span class=\"navbar_link\">%s</span></a>"
747 _("Leave all messages marked as unread, go to next room with unread messages"),
751 if (navbar_style == navbar_default) wprintf(
752 "<li class=\"markngo\">"
753 "<a href=\"gotonext\" "
755 "<img src=\"static/markngo_24x.gif\" alt=\"\">"
756 "<span class=\"navbar_link\">%s</span></a>"
758 _("Mark all messages as read, go to next room with unread messages"),
762 wprintf("</ul></div>\n");
769 * back end routine to take the session to a new room
771 long gotoroom(const StrBuf *gname)
774 static long ls = (-1L);
777 /* store ungoto information */
778 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
781 /** move to the new room */
782 serv_printf("GOTO %s", ChrPtr(gname));
783 StrBuf_ServGetln(Buf);
784 if (GetServerStatus(Buf, &err) != 2) {
785 serv_puts("GOTO _BASEROOM_");
786 StrBuf_ServGetln(Buf);
787 if (GetServerStatus(Buf, &err) != 2) {
793 if (WC->wc_roomname == NULL)
794 WC->wc_roomname = NewStrBuf();
796 FlushStrBuf(WC->wc_roomname);
798 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
799 StrBufCutLeft(WC->wc_roomname, 4);
800 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
801 /* highest_msg_read = extract_int(&buf[4],6);
802 maxmsgnum = extract_int(&buf[4],5);
804 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
805 ls = StrBufExtract_long(Buf, 6, '|');
806 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
807 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
808 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
809 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
810 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
813 WC->is_room_aide = WC->is_aide;
815 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
817 remove_march(WC->wc_roomname);
818 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
827 * \brief Locate the room on the march list which we most want to go to.
829 * is measured given a "weight" of preference based on various factors.
830 * \param desired_floor the room number on the citadel server
831 * \return the roomname
833 char *pop_march(int desired_floor)
835 static char TheRoom[128];
837 int TheOrder = 32767;
840 struct march *mptr = NULL;
842 strcpy(TheRoom, "_BASEROOM_");
843 if (WC->march == NULL)
846 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
848 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
849 weight = weight + 10000;
850 if (mptr->march_floor == desired_floor)
851 weight = weight + 5000;
853 weight = weight + ((128 - (mptr->march_floor)) * 128);
854 weight = weight + (128 - (mptr->march_order));
856 if (weight > TheWeight) {
858 strcpy(TheRoom, mptr->march_name);
859 TheFloor = mptr->march_floor;
860 TheOrder = mptr->march_order;
869 * Goto next room having unread messages.
871 * We want to skip over rooms that the user has already been to, and take the
872 * user back to the lobby when done. The room we end up in is placed in
873 * newroom - which is set to 0 (the lobby) initially.
874 * We start the search in the current room rather than the beginning to prevent
875 * two or more concurrent users from dragging each other back to the same room.
880 struct march *mptr = NULL;
881 struct march *mptr2 = NULL;
887 * First check to see if the march-mode list is already allocated.
888 * If it is, pop the first room off the list and go there.
891 if (WC->march == NULL) {
893 serv_getln(buf, sizeof buf);
895 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
896 if (IsEmptyStr(buf)) {
899 if (ELoop % 100 == 0)
904 extract_token(room_name, buf, 0, '|', sizeof room_name);
905 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
906 mptr = (struct march *) malloc(sizeof(struct march));
908 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
909 mptr->march_floor = extract_int(buf, 2);
910 mptr->march_order = extract_int(buf, 3);
911 if (WC->march == NULL)
920 * add _BASEROOM_ to the end of the march list, so the user will end up
921 * in the system base room (usually the Lobby>) at the end of the loop
923 mptr = (struct march *) malloc(sizeof(struct march));
925 mptr->march_order = 0;
926 mptr->march_floor = 0;
927 strcpy(mptr->march_name, "_BASEROOM_");
928 if (WC->march == NULL) {
932 while (mptr2->next != NULL)
937 * ...and remove the room we're currently in, so a <G>oto doesn't make us
938 * walk around in circles
940 remove_march(WC->wc_roomname);
942 if (WC->march != NULL) {
943 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
945 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
949 smart_goto(next_room);
950 FreeStrBuf(&next_room);
957 void smart_goto(const StrBuf *next_room) {
965 * mark all messages in current room as having been read
967 void slrp_highest(void)
971 serv_puts("SLRP HIGHEST");
972 serv_getln(buf, sizeof buf);
977 * un-goto the previous room
983 if (!strcmp(WC->ugname, "")) {
984 smart_goto(WC->wc_roomname);
987 serv_printf("GOTO %s", WC->ugname);
989 StrBuf_ServGetln(Buf);
990 if (GetServerStatus(Buf, NULL) != 2) {
991 smart_goto(WC->wc_roomname);
995 if (WC->uglsn >= 0L) {
996 serv_printf("SLRP %ld", WC->uglsn);
997 StrBuf_ServGetln(Buf);
1000 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1001 strcpy(WC->ugname, "");
1006 typedef struct __room_states {
1021 * Set/clear/read the "self-service list subscribe" flag for a room
1023 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1024 * returns the new value.
1027 int self_service(int newval) {
1028 int current_value = 0;
1034 int flags, floor, order, view, flags2;
1037 serv_getln(buf, sizeof buf);
1038 if (buf[0] != '2') return(0);
1040 extract_token(name, &buf[4], 0, '|', sizeof name);
1041 extract_token(password, &buf[4], 1, '|', sizeof password);
1042 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1043 flags = extract_int(&buf[4], 3);
1044 floor = extract_int(&buf[4], 4);
1045 order = extract_int(&buf[4], 5);
1046 view = extract_int(&buf[4], 6);
1047 flags2 = extract_int(&buf[4], 7);
1049 if (flags2 & QR2_SELFLIST) {
1057 flags2 = flags2 | QR2_SELFLIST;
1059 else if (newval == 0) {
1060 flags2 = flags2 & ~QR2_SELFLIST;
1063 return(current_value);
1066 if (newval != current_value) {
1067 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1068 name, password, dirname, flags,
1069 floor, order, view, flags2);
1070 serv_getln(buf, sizeof buf);
1077 int is_selflist(room_states *RoomFlags)
1079 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1082 int is_publiclist(room_states *RoomFlags)
1084 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1087 int is_moderatedlist(room_states *RoomFlags)
1089 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1093 * Set/clear/read the "self-service list subscribe" flag for a room
1095 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1096 * returns the new value.
1099 int get_roomflags(room_states *RoomOps)
1104 serv_getln(buf, sizeof buf);
1105 if (buf[0] != '2') return(0);
1107 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1108 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1109 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1110 RoomOps->flags = extract_int(&buf[4], 3);
1111 RoomOps->floor = extract_int(&buf[4], 4);
1112 RoomOps->order = extract_int(&buf[4], 5);
1113 RoomOps->view = extract_int(&buf[4], 6);
1114 RoomOps->flags2 = extract_int(&buf[4], 7);
1118 int set_roomflags(room_states *RoomOps)
1122 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1131 serv_getln(buf, sizeof buf);
1141 * display the form for editing a room
1143 void display_editroom(void)
1148 char remote_room[128];
1151 char er_password[10];
1152 char er_dirname[15];
1153 char er_roomaide[26];
1160 char *not_shared_with;
1163 int floorpolicy = 0;
1165 char pop3_host[128];
1170 if (IsEmptyStr(tab)) tab = "admin";
1173 output_headers(1, 1, 1, 0, 0, 0);
1175 wprintf("<div class=\"fix_scrollbar_bug\">");
1177 wprintf("<br />\n");
1179 /* print the tabbed dialog */
1180 wprintf("<div align=\"center\">");
1181 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""
1182 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1185 wprintf("<td class=\"");
1186 if (!strcmp(tab, "admin")) {
1187 wprintf(" tab_cell_label\">");
1188 wprintf(_("Administration"));
1191 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1192 wprintf(_("Administration"));
1196 wprintf("<td> </td>\n");
1198 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1200 wprintf("<td class=\"");
1201 if (!strcmp(tab, "config")) {
1202 wprintf(" tab_cell_label\">");
1203 wprintf(_("Configuration"));
1206 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1207 wprintf(_("Configuration"));
1211 wprintf("<td> </td>\n");
1213 wprintf("<td class=\"");
1214 if (!strcmp(tab, "expire")) {
1215 wprintf(" tab_cell_label\">");
1216 wprintf(_("Message expire policy"));
1219 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1220 wprintf(_("Message expire policy"));
1224 wprintf("<td> </td>\n");
1226 wprintf("<td class=\"");
1227 if (!strcmp(tab, "access")) {
1228 wprintf(" tab_cell_label\">");
1229 wprintf(_("Access controls"));
1232 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1233 wprintf(_("Access controls"));
1237 wprintf("<td> </td>\n");
1239 wprintf("<td class=\"");
1240 if (!strcmp(tab, "sharing")) {
1241 wprintf(" tab_cell_label\">");
1242 wprintf(_("Sharing"));
1245 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1246 wprintf(_("Sharing"));
1250 wprintf("<td> </td>\n");
1252 wprintf("<td class=\"");
1253 if (!strcmp(tab, "listserv")) {
1254 wprintf(" tab_cell_label\">");
1255 wprintf(_("Mailing list service"));
1258 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1259 wprintf(_("Mailing list service"));
1263 wprintf("<td> </td>\n");
1267 wprintf("<td class=\"");
1268 if (!strcmp(tab, "feeds")) {
1269 wprintf(" tab_cell_label\">");
1270 wprintf(_("Remote retrieval"));
1273 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1274 wprintf(_("Remote retrieval"));
1278 wprintf("<td> </td>\n");
1280 wprintf("</tr></table>\n");
1281 wprintf("</div>\n");
1282 /* end tabbed dialog */
1284 wprintf("<script type=\"text/javascript\">"
1285 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1289 /* begin content of whatever tab is open now */
1291 if (!strcmp(tab, "admin")) {
1292 wprintf("<div class=\"tabcontent\">");
1294 "<li><a href=\"delete_room\" "
1295 "onClick=\"return confirm('");
1296 wprintf(_("Are you sure you want to delete this room?"));
1297 wprintf("');\">\n");
1298 wprintf(_("Delete this room"));
1300 "<li><a href=\"display_editroompic\">\n");
1301 wprintf(_("Set or change the icon for this room's banner"));
1303 "<li><a href=\"display_editinfo\">\n");
1304 wprintf(_("Edit this room's Info file"));
1310 if (!strcmp(tab, "config")) {
1311 wprintf("<div class=\"tabcontent\">");
1313 serv_getln(buf, sizeof buf);
1315 if (!strncmp(buf, "550", 3)) {
1316 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1317 _("Higher access is required to access this function.")
1320 else if (buf[0] != '2') {
1321 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1324 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1325 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1326 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1327 er_flags = extract_int(&buf[4], 3);
1328 er_floor = extract_int(&buf[4], 4);
1329 er_flags2 = extract_int(&buf[4], 7);
1331 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1332 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1334 wprintf("<ul><li>");
1335 wprintf(_("Name of room: "));
1336 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1342 wprintf(_("Resides on floor: "));
1343 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1344 if (er_flags & QR_MAILBOX)
1345 wprintf("disabled >\n");
1346 for (i = 0; i < 128; ++i)
1347 if (!IsEmptyStr(floorlist[i])) {
1348 wprintf("<OPTION ");
1350 wprintf("SELECTED ");
1351 wprintf("VALUE=\"%d\">", i);
1352 escputs(floorlist[i]);
1353 wprintf("</OPTION>\n");
1355 wprintf("</select>\n");
1358 wprintf(_("Type of room:"));
1361 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1362 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1363 wprintf("CHECKED ");
1364 wprintf("OnChange=\""
1365 " if (this.form.type[0].checked == true) { "
1366 " this.form.er_floor.disabled = false; "
1369 wprintf(_("Public (automatically appears to everyone)"));
1372 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1373 if ((er_flags & QR_PRIVATE) &&
1374 (er_flags & QR_GUESSNAME))
1375 wprintf("CHECKED ");
1376 wprintf(" OnChange=\""
1377 " if (this.form.type[1].checked == true) { "
1378 " this.form.er_floor.disabled = false; "
1381 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1383 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1384 if ((er_flags & QR_PRIVATE) &&
1385 (er_flags & QR_PASSWORDED))
1386 wprintf("CHECKED ");
1387 wprintf(" OnChange=\""
1388 " if (this.form.type[2].checked == true) { "
1389 " this.form.er_floor.disabled = false; "
1392 wprintf(_("Private - require password: "));
1393 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1396 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1397 if ((er_flags & QR_PRIVATE)
1398 && ((er_flags & QR_GUESSNAME) == 0)
1399 && ((er_flags & QR_PASSWORDED) == 0))
1400 wprintf("CHECKED ");
1401 wprintf(" OnChange=\""
1402 " if (this.form.type[3].checked == true) { "
1403 " this.form.er_floor.disabled = false; "
1406 wprintf(_("Private - invitation only"));
1408 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1409 if (er_flags & QR_MAILBOX)
1410 wprintf("CHECKED ");
1411 wprintf (" OnChange=\""
1412 " if (this.form.type[4].checked == true) { "
1413 " this.form.er_floor.disabled = true; "
1416 wprintf(_("Personal (mailbox for you only)"));
1418 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1420 wprintf(_("If private, cause current users to forget room"));
1422 wprintf("\n</ul>\n");
1424 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1425 if (er_flags & QR_PREFONLY)
1426 wprintf("CHECKED ");
1428 wprintf(_("Preferred users only"));
1430 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1431 if (er_flags & QR_READONLY)
1432 wprintf("CHECKED ");
1434 wprintf(_("Read-only room"));
1436 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1437 if (er_flags2 & QR2_COLLABDEL)
1438 wprintf("CHECKED ");
1440 wprintf(_("All users allowed to post may also delete messages"));
1442 /** directory stuff */
1443 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1444 if (er_flags & QR_DIRECTORY)
1445 wprintf("CHECKED ");
1447 wprintf(_("File directory room"));
1449 wprintf("\n<ul><li>");
1450 wprintf(_("Directory name: "));
1451 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1454 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1455 if (er_flags & QR_UPLOAD)
1456 wprintf("CHECKED ");
1458 wprintf(_("Uploading allowed"));
1460 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1461 if (er_flags & QR_DOWNLOAD)
1462 wprintf("CHECKED ");
1464 wprintf(_("Downloading allowed"));
1466 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1467 if (er_flags & QR_VISDIR)
1468 wprintf("CHECKED ");
1470 wprintf(_("Visible directory"));
1473 /** end of directory stuff */
1475 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1476 if (er_flags & QR_NETWORK)
1477 wprintf("CHECKED ");
1479 wprintf(_("Network shared room"));
1481 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1482 if (er_flags & QR_PERMANENT)
1483 wprintf("CHECKED ");
1485 wprintf(_("Permanent (does not auto-purge)"));
1487 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1488 if (er_flags2 & QR2_SUBJECTREQ)
1489 wprintf("CHECKED ");
1491 wprintf(_("Subject Required (Force users to specify a message subject)"));
1493 /** start of anon options */
1496 wprintf(_("Anonymous messages"));
1499 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1500 if (((er_flags & QR_ANONONLY) == 0)
1501 && ((er_flags & QR_ANONOPT) == 0))
1502 wprintf("CHECKED ");
1504 wprintf(_("No anonymous messages"));
1506 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1507 if (er_flags & QR_ANONONLY)
1508 wprintf("CHECKED ");
1510 wprintf(_("All messages are anonymous"));
1512 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1513 if (er_flags & QR_ANONOPT)
1514 wprintf("CHECKED ");
1516 wprintf(_("Prompt user when entering messages"));
1519 /* end of anon options */
1522 wprintf(_("Room aide: "));
1524 serv_getln(buf, sizeof buf);
1525 if (buf[0] != '2') {
1526 wprintf("<em>%s</em>\n", &buf[4]);
1528 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1529 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1532 wprintf("</ul><CENTER>\n");
1533 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1534 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1536 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1546 /* Sharing the room with other Citadel nodes... */
1547 if (!strcmp(tab, "sharing")) {
1548 wprintf("<div class=\"tabcontent\">");
1550 shared_with = strdup("");
1551 not_shared_with = strdup("");
1553 /** Learn the current configuration */
1554 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1555 serv_getln(buf, sizeof buf);
1556 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1557 extract_token(node, buf, 0, '|', sizeof node);
1558 not_shared_with = realloc(not_shared_with,
1559 strlen(not_shared_with) + 32);
1560 strcat(not_shared_with, node);
1561 strcat(not_shared_with, "\n");
1565 serv_getln(buf, sizeof buf);
1566 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1567 extract_token(cmd, buf, 0, '|', sizeof cmd);
1568 extract_token(node, buf, 1, '|', sizeof node);
1569 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1570 if (!strcasecmp(cmd, "ignet_push_share")) {
1571 shared_with = realloc(shared_with,
1572 strlen(shared_with) + 32);
1573 strcat(shared_with, node);
1574 if (!IsEmptyStr(remote_room)) {
1575 strcat(shared_with, "|");
1576 strcat(shared_with, remote_room);
1578 strcat(shared_with, "\n");
1582 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1583 extract_token(buf, shared_with, i, '\n', sizeof buf);
1584 extract_token(node, buf, 0, '|', sizeof node);
1585 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1586 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1587 if (!strcasecmp(node, cmd)) {
1588 remove_token(not_shared_with, j, '\n');
1593 /* Display the stuff */
1594 wprintf("<CENTER><br />"
1595 "<table border=1 cellpadding=5><tr>"
1597 wprintf(_("Shared with"));
1598 wprintf("</I></B></td>"
1600 wprintf(_("Not shared with"));
1601 wprintf("</I></B></td></tr>\n"
1602 "<tr><td VALIGN=TOP>\n");
1604 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1605 wprintf(_("Remote node name"));
1606 wprintf("</td><td>");
1607 wprintf(_("Remote room name"));
1608 wprintf("</td><td>");
1609 wprintf(_("Actions"));
1610 wprintf("</td></tr>\n");
1612 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1613 extract_token(buf, shared_with, i, '\n', sizeof buf);
1614 extract_token(node, buf, 0, '|', sizeof node);
1615 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1616 if (!IsEmptyStr(node)) {
1617 wprintf("<form method=\"POST\" action=\"netedit\">");
1618 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1619 wprintf("<tr><td>%s</td>\n", node);
1622 if (!IsEmptyStr(remote_room)) {
1623 escputs(remote_room);
1629 wprintf("<input type=\"hidden\" NAME=\"line\" "
1630 "VALUE=\"ignet_push_share|");
1632 if (!IsEmptyStr(remote_room)) {
1634 urlescputs(remote_room);
1637 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1638 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1639 wprintf("<input type=\"submit\" "
1640 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1641 wprintf("</td></tr></form>\n");
1645 wprintf("</table>\n");
1646 wprintf("</td><td VALIGN=TOP>\n");
1647 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1648 wprintf(_("Remote node name"));
1649 wprintf("</td><td>");
1650 wprintf(_("Remote room name"));
1651 wprintf("</td><td>");
1652 wprintf(_("Actions"));
1653 wprintf("</td></tr>\n");
1655 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1656 extract_token(node, not_shared_with, i, '\n', sizeof node);
1657 if (!IsEmptyStr(node)) {
1658 wprintf("<form method=\"POST\" action=\"netedit\">");
1659 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1660 wprintf("<tr><td>");
1663 "<input type=\"INPUT\" "
1667 wprintf("<input type=\"hidden\" "
1669 "VALUE=\"ignet_push_share|");
1672 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1673 "VALUE=\"sharing\">\n");
1674 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1675 "VALUE=\"add\">\n");
1676 wprintf("<input type=\"submit\" "
1677 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1678 wprintf("</td></tr></form>\n");
1682 wprintf("</table>\n");
1683 wprintf("</td></tr>"
1684 "</table></CENTER><br />\n"
1685 "<I><B>%s</B><ul><li>", _("Notes:"));
1686 wprintf(_("When sharing a room, "
1687 "it must be shared from both ends. Adding a node to "
1688 "the 'shared' list sends messages out, but in order to"
1689 " receive messages, the other nodes must be configured"
1690 " to send messages out to your system as well. "
1691 "<li>If the remote room name is blank, it is assumed "
1692 "that the room name is identical on the remote node."
1693 "<li>If the remote room name is different, the remote "
1694 "node must also configure the name of the room here."
1701 /* Mailing list management */
1702 if (!strcmp(tab, "listserv")) {
1703 room_states RoomFlags;
1704 wprintf("<div class=\"tabcontent\">");
1706 wprintf("<br /><center>"
1707 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1708 "<tr><td VALIGN=TOP>");
1710 wprintf(_("<i>The contents of this room are being "
1711 "mailed <b>as individual messages</b> "
1712 "to the following list recipients:"
1713 "</i><br /><br />\n"));
1716 serv_getln(buf, sizeof buf);
1717 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1718 extract_token(cmd, buf, 0, '|', sizeof cmd);
1719 if (!strcasecmp(cmd, "listrecp")) {
1720 extract_token(recp, buf, 1, '|', sizeof recp);
1723 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1726 wprintf(_("(remove)"));
1727 wprintf("</A><br />");
1730 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1731 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1732 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1733 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1734 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1735 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1736 wprintf("</form>\n");
1738 wprintf("</td><td VALIGN=TOP>\n");
1740 wprintf(_("<i>The contents of this room are being "
1741 "mailed <b>in digest form</b> "
1742 "to the following list recipients:"
1743 "</i><br /><br />\n"));
1746 serv_getln(buf, sizeof buf);
1747 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1748 extract_token(cmd, buf, 0, '|', sizeof cmd);
1749 if (!strcasecmp(cmd, "digestrecp")) {
1750 extract_token(recp, buf, 1, '|', sizeof recp);
1753 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1757 wprintf(_("(remove)"));
1758 wprintf("</A><br />");
1761 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1762 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1763 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1764 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1765 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1766 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1767 wprintf("</form>\n");
1769 wprintf("</td></tr></table>\n");
1771 /** Pop open an address book -- begin **/
1772 wprintf("<div align=right>"
1773 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1775 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1780 _("Add recipients from Contacts or other address books"),
1781 _("Add recipients from Contacts or other address books")
1783 /* Pop open an address book -- end **/
1785 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1787 get_roomflags (&RoomFlags);
1789 /* Self Service subscription? */
1790 wprintf("<table><tr><td>\n");
1791 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1792 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1793 " <tr><td colspan=\"2\">\n",
1794 (is_selflist(&RoomFlags))?"checked":"");
1795 wprintf(_("The URL for subscribe/unsubscribe is: "));
1796 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1797 (is_https ? "https" : "http"),
1799 /* Public posting? */
1800 wprintf("<tr><td>");
1801 wprintf(_("Allow non-subscribers to mail to this room."));
1802 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1803 (is_publiclist(&RoomFlags))?"checked":"");
1805 /* Moderated List? */
1806 wprintf("<tr><td>");
1807 wprintf(_("Room post publication needs Aide permission."));
1808 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1809 (is_moderatedlist(&RoomFlags))?"checked":"");
1812 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1813 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1814 wprintf("</table></form>");
1817 wprintf("</CENTER>\n");
1822 /* Configuration of The Dreaded Auto-Purger */
1823 if (!strcmp(tab, "expire")) {
1824 wprintf("<div class=\"tabcontent\">");
1826 serv_puts("GPEX room");
1827 serv_getln(buf, sizeof buf);
1828 if (!strncmp(buf, "550", 3)) {
1829 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1830 _("Higher access is required to access this function.")
1833 else if (buf[0] != '2') {
1834 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1837 roompolicy = extract_int(&buf[4], 0);
1838 roomvalue = extract_int(&buf[4], 1);
1840 serv_puts("GPEX floor");
1841 serv_getln(buf, sizeof buf);
1842 if (buf[0] == '2') {
1843 floorpolicy = extract_int(&buf[4], 0);
1844 floorvalue = extract_int(&buf[4], 1);
1847 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1848 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1849 wprintf("<table border=0 cellspacing=5>\n");
1850 wprintf("<tr><td>");
1851 wprintf(_("Message expire policy for this room"));
1853 escputs(ChrPtr(WC->wc_roomname));
1854 wprintf(")</td><td>");
1855 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1856 ((roompolicy == 0) ? "CHECKED" : "") );
1857 wprintf(_("Use the default policy for this floor"));
1858 wprintf("<br />\n");
1859 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1860 ((roompolicy == 1) ? "CHECKED" : "") );
1861 wprintf(_("Never automatically expire messages"));
1862 wprintf("<br />\n");
1863 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1864 ((roompolicy == 2) ? "CHECKED" : "") );
1865 wprintf(_("Expire by message count"));
1866 wprintf("<br />\n");
1867 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1868 ((roompolicy == 3) ? "CHECKED" : "") );
1869 wprintf(_("Expire by message age"));
1871 wprintf(_("Number of messages or days: "));
1872 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1873 wprintf("</td></tr>\n");
1875 if (WC->axlevel >= 6) {
1876 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1877 wprintf("<tr><td>");
1878 wprintf(_("Message expire policy for this floor"));
1880 escputs(floorlist[WC->wc_floor]);
1881 wprintf(")</td><td>");
1882 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1883 ((floorpolicy == 0) ? "CHECKED" : "") );
1884 wprintf(_("Use the system default"));
1885 wprintf("<br />\n");
1886 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1887 ((floorpolicy == 1) ? "CHECKED" : "") );
1888 wprintf(_("Never automatically expire messages"));
1889 wprintf("<br />\n");
1890 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1891 ((floorpolicy == 2) ? "CHECKED" : "") );
1892 wprintf(_("Expire by message count"));
1893 wprintf("<br />\n");
1894 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1895 ((floorpolicy == 3) ? "CHECKED" : "") );
1896 wprintf(_("Expire by message age"));
1898 wprintf(_("Number of messages or days: "));
1899 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1903 wprintf("<CENTER>\n");
1904 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1905 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1907 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1908 wprintf("</CENTER></td><tr>\n");
1910 wprintf("</table>\n"
1911 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1919 /* Access controls */
1920 if (!strcmp(tab, "access")) {
1921 wprintf("<div class=\"tabcontent\">");
1926 /* Fetch messages from remote locations */
1927 if (!strcmp(tab, "feeds")) {
1928 wprintf("<div class=\"tabcontent\">");
1931 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1932 wprintf("</i><br />\n");
1934 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1935 "<tr class=\"even\"><th>");
1936 wprintf(_("Remote host"));
1937 wprintf("</th><th>");
1938 wprintf(_("User name"));
1939 wprintf("</th><th>");
1940 wprintf(_("Password"));
1941 wprintf("</th><th>");
1942 wprintf(_("Keep messages on server?"));
1943 wprintf("</th><th>");
1944 wprintf(_("Interval"));
1945 wprintf("</th><th> </th></tr>");
1948 serv_getln(buf, sizeof buf);
1950 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1951 extract_token(cmd, buf, 0, '|', sizeof cmd);
1952 if (!strcasecmp(cmd, "pop3client")) {
1953 safestrncpy(recp, &buf[11], sizeof recp);
1956 wprintf("<tr class=\"%s\">",
1957 (bg ? "even" : "odd")
1961 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1966 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1970 wprintf("<td>*****</td>"); /* Don't show the password */
1972 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1974 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1976 wprintf("<td class=\"button_link\">");
1977 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
1980 wprintf(_("(remove)"));
1981 wprintf("</a></td>");
1987 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1989 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1990 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1991 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1993 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1996 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1999 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2002 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2005 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2008 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2009 wprintf("</td></tr>");
2010 wprintf("</form></table>\n");
2015 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2016 wprintf("</i><br />\n");
2018 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2019 "<tr class=\"even\"><th>");
2020 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2021 wprintf(_("Feed URL"));
2022 wprintf("</th><th>");
2023 wprintf("</th></tr>");
2026 serv_getln(buf, sizeof buf);
2028 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2029 extract_token(cmd, buf, 0, '|', sizeof cmd);
2030 if (!strcasecmp(cmd, "rssclient")) {
2031 safestrncpy(recp, &buf[10], sizeof recp);
2034 wprintf("<tr class=\"%s\">",
2035 (bg ? "even" : "odd")
2039 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2043 wprintf("<td class=\"button_link\">");
2044 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
2047 wprintf(_("(remove)"));
2048 wprintf("</a></td>");
2054 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2056 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2057 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2058 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2060 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2061 "maxlength=\"256\" name=\"line_pop3host\">\n");
2064 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2065 wprintf("</td></tr>");
2066 wprintf("</form></table>\n");
2072 /* end content of whatever tab is open now */
2073 wprintf("</div>\n");
2075 address_book_popup();
2081 * Toggle self-service list subscription
2083 void toggle_self_service(void) {
2084 room_states RoomFlags;
2086 get_roomflags (&RoomFlags);
2088 if (yesbstr("QR2_SelfList"))
2089 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2091 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2093 if (yesbstr("QR2_SMTP_PUBLIC"))
2094 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2096 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2098 if (yesbstr("QR2_Moderated"))
2099 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2101 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2102 if (yesbstr("QR2_SubsOnly"))
2103 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2105 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2107 set_roomflags (&RoomFlags);
2115 * save new parameters for a room
2122 StrBuf *er_password;
2124 StrBuf *er_roomaide;
2127 int er_listingorder;
2133 if (!havebstr("ok_button")) {
2134 strcpy(WC->ImportantMessage,
2135 _("Cancelled. Changes were not saved."));
2141 StrBuf_ServGetln(Buf);
2142 if (GetServerStatus(Buf, NULL) != 2) {
2143 StrBufCutLeft(Buf, 4);
2144 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2149 StrBufCutLeft(Buf, 4);
2150 StrBufExtract_token(er_name, Buf, 0, '|');
2151 StrBufExtract_token(er_password, Buf, 1, '|');
2152 StrBufExtract_token(er_dirname, Buf, 2, '|');
2153 er_flags = StrBufExtract_int(Buf, 3, '|');
2154 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2155 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2156 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2158 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2159 if (StrLength(er_roomaide) == 0) {
2161 StrBuf_ServGetln(Buf);
2162 if (GetServerStatus(Buf, NULL) != 2) {
2163 FlushStrBuf(er_roomaide);
2165 StrBufCutLeft(Buf, 4);
2166 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2169 Ptr = sbstr("er_name");
2170 if (StrLength(Ptr) > 0) {
2171 FlushStrBuf(er_name);
2172 StrBufAppendBuf(er_name, Ptr, 0);
2175 Ptr = sbstr("er_password");
2176 if (StrLength(Ptr) > 0) {
2177 FlushStrBuf(er_password);
2178 StrBufAppendBuf(er_password, Ptr, 0);
2182 Ptr = sbstr("er_dirname");
2183 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2184 FlushStrBuf(er_dirname);
2185 StrBufAppendBuf(er_dirname, Ptr, 0);
2189 Ptr = sbstr("type");
2190 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2192 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2193 er_flags |= (QR_PRIVATE);
2195 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2196 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2198 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2199 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2201 if (!strcmp(ChrPtr(Ptr), "personal")) {
2202 er_flags |= QR_MAILBOX;
2204 er_flags &= ~QR_MAILBOX;
2207 if (yesbstr("prefonly")) {
2208 er_flags |= QR_PREFONLY;
2210 er_flags &= ~QR_PREFONLY;
2213 if (yesbstr("readonly")) {
2214 er_flags |= QR_READONLY;
2216 er_flags &= ~QR_READONLY;
2220 if (yesbstr("collabdel")) {
2221 er_flags2 |= QR2_COLLABDEL;
2223 er_flags2 &= ~QR2_COLLABDEL;
2226 if (yesbstr("permanent")) {
2227 er_flags |= QR_PERMANENT;
2229 er_flags &= ~QR_PERMANENT;
2232 if (yesbstr("subjectreq")) {
2233 er_flags2 |= QR2_SUBJECTREQ;
2235 er_flags2 &= ~QR2_SUBJECTREQ;
2238 if (yesbstr("network")) {
2239 er_flags |= QR_NETWORK;
2241 er_flags &= ~QR_NETWORK;
2244 if (yesbstr("directory")) {
2245 er_flags |= QR_DIRECTORY;
2247 er_flags &= ~QR_DIRECTORY;
2250 if (yesbstr("ulallowed")) {
2251 er_flags |= QR_UPLOAD;
2253 er_flags &= ~QR_UPLOAD;
2256 if (yesbstr("dlallowed")) {
2257 er_flags |= QR_DOWNLOAD;
2259 er_flags &= ~QR_DOWNLOAD;
2262 if (yesbstr("visdir")) {
2263 er_flags |= QR_VISDIR;
2265 er_flags &= ~QR_VISDIR;
2268 Ptr = sbstr("anon");
2270 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2271 if (!strcmp(ChrPtr(Ptr), "anononly"))
2272 er_flags |= QR_ANONONLY;
2273 if (!strcmp(ChrPtr(Ptr), "anon2"))
2274 er_flags |= QR_ANONOPT;
2276 bump = yesbstr("bump");
2278 er_floor = ibstr("er_floor");
2280 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2282 ChrPtr(er_password),
2291 StrBuf_ServGetln(Buf);
2292 if (GetServerStatus(Buf, NULL) != 2) {
2293 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2296 FreeStrBuf(&er_name);
2297 FreeStrBuf(&er_password);
2298 FreeStrBuf(&er_dirname);
2299 FreeStrBuf(&er_roomaide);
2304 if (StrLength(er_roomaide) > 0) {
2305 serv_printf("SETA %s", ChrPtr(er_roomaide));
2306 StrBuf_ServGetln(Buf);
2307 if (GetServerStatus(Buf, NULL) != 2) {
2308 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2309 display_main_menu();
2311 FreeStrBuf(&er_name);
2312 FreeStrBuf(&er_password);
2313 FreeStrBuf(&er_dirname);
2314 FreeStrBuf(&er_roomaide);
2319 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2322 FreeStrBuf(&er_name);
2323 FreeStrBuf(&er_password);
2324 FreeStrBuf(&er_dirname);
2325 FreeStrBuf(&er_roomaide);
2331 * Display form for Invite, Kick, and show Who Knows a room
2333 void do_invt_kick(void) {
2334 char buf[SIZ], room[SIZ], username[SIZ];
2337 serv_getln(buf, sizeof buf);
2339 if (buf[0] != '2') {
2343 extract_token(room, &buf[4], 0, '|', sizeof room);
2345 strcpy(username, bstr("username"));
2347 if (havebstr("kick_button")) {
2348 sprintf(buf, "KICK %s", username);
2350 serv_getln(buf, sizeof buf);
2352 if (buf[0] != '2') {
2353 strcpy(WC->ImportantMessage, &buf[4]);
2355 sprintf(WC->ImportantMessage,
2356 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2361 if (havebstr("invite_button")) {
2362 sprintf(buf, "INVT %s", username);
2364 serv_getln(buf, sizeof buf);
2366 if (buf[0] != '2') {
2367 strcpy(WC->ImportantMessage, &buf[4]);
2369 sprintf(WC->ImportantMessage,
2370 _("<B><I>User %s invited to room %s.</I></B>\n"),
2381 * Display form for Invite, Kick, and show Who Knows a room
2383 void display_whok(void)
2385 char buf[SIZ], room[SIZ], username[SIZ];
2388 serv_getln(buf, sizeof buf);
2390 if (buf[0] != '2') {
2394 extract_token(room, &buf[4], 0, '|', sizeof room);
2397 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2398 wprintf(_("The users listed below have access to this room. "
2399 "To remove a user from the access list, select the user "
2400 "name from the list and click 'Kick'."));
2401 wprintf("<br /><br />");
2403 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2404 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2405 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2406 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2408 serv_getln(buf, sizeof buf);
2409 if (buf[0] == '1') {
2410 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2411 extract_token(username, buf, 0, '|', sizeof username);
2412 wprintf("<OPTION>");
2417 wprintf("</select><br />\n");
2419 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2420 wprintf("</form></CENTER>\n");
2422 wprintf("</td><td>");
2423 wprintf(_("To grant another user access to this room, enter the "
2424 "user name in the box below and click 'Invite'."));
2425 wprintf("<br /><br />");
2427 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2428 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2429 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2430 wprintf(_("Invite:"));
2432 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2433 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2434 "<input type=\"submit\" value=\"%s\">"
2435 "</form></CENTER>\n", _("Invite"));
2436 /* Pop open an address book -- begin **/
2438 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2440 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2443 _("Users"), _("Users")
2445 /* Pop open an address book -- end **/
2447 wprintf("</td></tr></table>\n");
2448 address_book_popup();
2455 * display the form for entering a new room
2457 void display_entroom(void)
2462 serv_puts("CRE8 0");
2463 serv_getln(buf, sizeof buf);
2465 if (buf[0] != '2') {
2466 strcpy(WC->ImportantMessage, &buf[4]);
2467 display_main_menu();
2471 output_headers(1, 1, 1, 0, 0, 0);
2473 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2474 do_template("beginbox", NULL);
2476 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2477 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2479 wprintf("<table class=\"altern\"> ");
2481 wprintf("<tr class=\"even\"><td>");
2482 wprintf(_("Name of room: "));
2483 wprintf("</td><td>");
2484 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2485 wprintf("</td></tr>");
2487 wprintf("<tr class=\"odd\"><td>");
2488 wprintf(_("Resides on floor: "));
2489 wprintf("</td><td>");
2491 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2492 for (i = 0; i < 128; ++i)
2493 if (!IsEmptyStr(floorlist[i])) {
2494 wprintf("<option ");
2495 wprintf("value=\"%d\">", i);
2496 escputs(floorlist[i]);
2497 wprintf("</option>\n");
2499 wprintf("</select>\n");
2500 wprintf("</td></tr>");
2503 * Our clever little snippet of JavaScript automatically selects
2504 * a public room if the view is set to Bulletin Board or wiki, and
2505 * it selects a mailbox room otherwise. The user can override this,
2506 * of course. We also disable the floor selector for mailboxes.
2508 wprintf("<tr class=\"even\"><td>");
2509 wprintf(_("Default view for room: "));
2510 wprintf("</td><td>");
2511 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2512 " if ( (this.form.er_view.value == 0) "
2513 " || (this.form.er_view.value == 6) ) { "
2514 " this.form.type[0].checked=true; "
2515 " this.form.er_floor.disabled = false; "
2518 " this.form.type[4].checked=true; "
2519 " this.form.er_floor.disabled = true; "
2522 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2523 if (is_view_allowed_as_default(i)) {
2524 wprintf("<option %s value=\"%d\">",
2525 ((i == 0) ? "selected" : ""), i );
2526 escputs(viewdefs[i]);
2527 wprintf("</option>\n");
2530 wprintf("</select>\n");
2531 wprintf("</td></tr>");
2533 wprintf("<tr class=\"even\"><td>");
2534 wprintf(_("Type of room:"));
2535 wprintf("</td><td>");
2536 wprintf("<ul class=\"adminlist\">\n");
2538 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2539 wprintf("CHECKED OnChange=\""
2540 " if (this.form.type[0].checked == true) { "
2541 " this.form.er_floor.disabled = false; "
2544 wprintf(_("Public (automatically appears to everyone)"));
2547 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2548 " if (this.form.type[1].checked == true) { "
2549 " this.form.er_floor.disabled = false; "
2552 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2555 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2556 " if (this.form.type[2].checked == true) { "
2557 " this.form.er_floor.disabled = false; "
2560 wprintf(_("Private - require password: "));
2561 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2564 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2565 " if (this.form.type[3].checked == true) { "
2566 " this.form.er_floor.disabled = false; "
2569 wprintf(_("Private - invitation only"));
2572 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2574 " if (this.form.type[4].checked == true) { "
2575 " this.form.er_floor.disabled = true; "
2578 wprintf(_("Personal (mailbox for you only)"));
2581 wprintf("\n</ul>\n");
2582 wprintf("</td></tr></table>\n");
2584 wprintf("<div class=\"buttons\">\n");
2585 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2587 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2588 wprintf("</div>\n");
2589 wprintf("</form>\n<hr />");
2590 serv_printf("MESG roomaccess");
2591 serv_getln(buf, sizeof buf);
2592 if (buf[0] == '1') {
2596 do_template("endbox", NULL);
2605 * support function for entroom() -- sets the default view
2607 void er_set_default_view(int newview) {
2620 serv_getln(buf, sizeof buf);
2621 if (buf[0] != '2') return;
2623 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2624 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2625 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2626 rm_bits1 = extract_int(&buf[4], 3);
2627 rm_floor = extract_int(&buf[4], 4);
2628 rm_listorder = extract_int(&buf[4], 5);
2629 rm_bits2 = extract_int(&buf[4], 7);
2631 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2632 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2633 rm_listorder, newview, rm_bits2
2635 serv_getln(buf, sizeof buf);
2646 const StrBuf *er_name;
2647 const StrBuf *er_type;
2648 const StrBuf *er_password;
2653 if (!havebstr("ok_button")) {
2654 strcpy(WC->ImportantMessage,
2655 _("Cancelled. No new room was created."));
2656 display_main_menu();
2659 er_name = sbstr("er_name");
2660 er_type = sbstr("type");
2661 er_password = sbstr("er_password");
2662 er_floor = ibstr("er_floor");
2663 er_view = ibstr("er_view");
2666 if (!strcmp(ChrPtr(er_type), "hidden"))
2668 else if (!strcmp(ChrPtr(er_type), "passworded"))
2670 else if (!strcmp(ChrPtr(er_type), "invonly"))
2672 else if (!strcmp(ChrPtr(er_type), "personal"))
2675 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2678 ChrPtr(er_password),
2683 serv_getln(buf, sizeof buf);
2684 if (buf[0] != '2') {
2685 strcpy(WC->ImportantMessage, &buf[4]);
2686 display_main_menu();
2689 /** TODO: Room created, now udate the left hand icon bar for this user */
2690 burn_folder_cache(0); /* burn the old folder cache */
2694 do_change_view(er_view); /* Now go there */
2699 * \brief display the screen to enter a private room
2701 void display_private(char *rname, int req_pass)
2703 WCTemplputParams SubTP;
2705 output_headers(1, 1, 1, 0, 0, 0);
2707 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2708 memset(&SubTP, 0, sizeof(WCTemplputParams));
2709 SubTP.ContextType = CTX_STRBUF;
2710 SubTP.Context = Buf;
2711 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2716 wprintf(_("If you know the name of a hidden (guess-name) or "
2717 "passworded room, you can enter that room by typing "
2718 "its name below. Once you gain access to a private "
2719 "room, it will appear in your regular room listings "
2720 "so you don't have to keep returning here."));
2723 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2724 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2726 wprintf("<table class=\"altern\"> "
2727 "<tr class=\"even\"><td>");
2728 wprintf(_("Enter room name:"));
2730 "<input type=\"text\" name=\"gr_name\" "
2731 "value=\"%s\" maxlength=\"128\">\n", rname);
2734 wprintf("</td></tr><tr class=\"odd\"><td>");
2735 wprintf(_("Enter room password:"));
2736 wprintf("</td><td>");
2737 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2739 wprintf("</td></tr></table>\n");
2741 wprintf("<div class=\"buttons\">\n");
2742 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2744 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2748 wprintf("</div></form>\n");
2750 do_template("endbox", NULL);
2756 * \brief goto a private room
2758 void goto_private(void)
2763 if (!havebstr("ok_button")) {
2764 display_main_menu();
2767 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2768 serv_printf("GOTO %s|%s",
2771 serv_getln(buf, sizeof buf);
2773 if (buf[0] == '2') {
2774 smart_goto(sbstr("gr_name"));
2777 if (!strncmp(buf, "540", 3)) {
2778 display_private(bstr("gr_name"), 1);
2781 output_headers(1, 1, 1, 0, 0, 0);
2782 wprintf("%s\n", &buf[4]);
2789 * \brief display the screen to zap a room
2791 void display_zap(void)
2793 output_headers(1, 1, 2, 0, 0, 0);
2795 wprintf("<div id=\"banner\">\n");
2797 wprintf(_("Zap (forget/unsubscribe) the current room"));
2799 wprintf("</div>\n");
2801 wprintf("<div id=\"content\" class=\"service\">\n");
2803 wprintf(_("If you select this option, <em>%s</em> will "
2804 "disappear from your room list. Is this what you wish "
2805 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2807 wprintf("<form method=\"POST\" action=\"zap\">\n");
2808 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2809 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2811 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2812 wprintf("</form>\n");
2823 StrBuf *final_destination;
2826 * If the forget-room routine fails for any reason, we fall back
2827 * to the current room; otherwise, we go to the Lobby
2829 final_destination = NewStrBufDup(WC->wc_roomname);
2831 if (havebstr("ok_button")) {
2832 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2833 serv_getln(buf, sizeof buf);
2834 if (buf[0] == '2') {
2836 serv_getln(buf, sizeof buf);
2837 if (buf[0] == '2') {
2838 FlushStrBuf(final_destination);
2839 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2843 smart_goto(final_destination);
2844 FreeStrBuf(&final_destination);
2850 * \brief Delete the current room
2852 void delete_room(void)
2857 serv_puts("KILL 1");
2858 serv_getln(buf, sizeof buf);
2859 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2860 if (buf[0] != '2') {
2861 strcpy(WC->ImportantMessage, &buf[4]);
2862 display_main_menu();
2867 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2876 * \brief Perform changes to a room's network configuration
2878 void netedit(void) {
2887 /*/ TODO: do line dynamic! */
2888 if (havebstr("line_pop3host")) {
2889 strcpy(line, bstr("prefix"));
2890 strcat(line, bstr("line_pop3host"));
2892 strcat(line, bstr("line_pop3user"));
2894 strcat(line, bstr("line_pop3pass"));
2896 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2898 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2899 strcat(line, bstr("suffix"));
2901 else if (havebstr("line")) {
2902 strcpy(line, bstr("prefix"));
2903 strcat(line, bstr("line"));
2904 strcat(line, bstr("suffix"));
2919 serv_getln(buf, sizeof buf);
2920 if (buf[0] != '1') {
2926 /** This loop works for add *or* remove. Spiffy, eh? */
2927 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2928 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2929 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2930 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2931 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2932 if ( (strcasecmp(cmpa0, cmpb0))
2933 || (strcasecmp(cmpa1, cmpb1)) ) {
2934 fprintf(fp, "%s\n", buf);
2940 serv_getln(buf, sizeof buf);
2941 if (buf[0] != '4') {
2947 while (fgets(buf, sizeof buf, fp) != NULL) {
2948 buf[strlen(buf)-1] = 0;
2952 if (havebstr("add_button")) {
2953 num_addrs = num_tokens(bstr("line"), ',');
2954 if (num_addrs < 2) {
2955 /* just adding one node or address */
2959 /* adding multiple addresses separated by commas */
2960 for (i=0; i<num_addrs; ++i) {
2961 strcpy(line, bstr("prefix"));
2962 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2965 strcat(line, bstr("suffix"));
2979 * \brief Convert a room name to a folder-ish-looking name.
2980 * \param folder the folderish name
2981 * \param room the room name
2982 * \param floor the floor name
2983 * \param is_mailbox is it a mailbox?
2985 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2990 * For mailboxes, just do it straight...
2993 sprintf(folder, "My folders|%s", room);
2997 * Otherwise, prefix the floor name as a "public folders" moniker
3000 if (floor > MAX_FLOORS) {
3002 sprintf(folder, "%%%%%%|%s", room);
3005 sprintf(folder, "%s|%s", floorlist[floor], room);
3010 * Replace "\" characters with "|" for pseudo-folder-delimiting
3012 len = strlen (folder);
3013 for (i=0; i<len; ++i) {
3014 if (folder[i] == '\\') folder[i] = '|';
3022 * \brief Back end for change_view()
3023 * \param newview set newview???
3025 void do_change_view(int newview) {
3028 serv_printf("VIEW %d", newview);
3029 serv_getln(buf, sizeof buf);
3030 WC->wc_view = newview;
3031 smart_goto(WC->wc_roomname);
3037 * \brief Change the view for this room
3039 void change_view(void) {
3042 view = lbstr("view");
3043 do_change_view(view);
3048 * \brief One big expanded tree list view --- like a folder list
3049 * \param fold the folder to view
3050 * \param max_folders how many folders???
3051 * \param num_floors hom many floors???
3053 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3057 int has_subfolders = 0;
3060 parents = malloc(max_folders * sizeof(int));
3062 /** BEGIN TREE MENU */
3063 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3065 /** include NanoTree */
3066 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3068 /** initialize NanoTree */
3069 wprintf("<script type=\"text/javascript\"> \n"
3070 " showRootNode = false; \n"
3071 " sortNodes = false; \n"
3072 " dragable = false; \n"
3074 " function standardClick(treeNode) { \n"
3077 " var closedGif = 'static/folder_closed.gif'; \n"
3078 " var openGif = 'static/folder_open.gif'; \n"
3080 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3084 for (i=0; i<max_folders; ++i) {
3087 if ((i+1) < max_folders) {
3089 len = strlen(fold[i].name);
3090 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3091 && (fold[i+1].name[len] == '|') ) {
3096 levels = num_tokens(fold[i].name, '|');
3097 parents[levels] = i;
3099 wprintf("var node%d = new TreeNode(%d, '", i, i);
3101 if (fold[i].selectable) {
3102 wprintf("<a href=\"dotgoto?room=");
3103 urlescputs(fold[i].room);
3108 wprintf("<span class=\"roomlist_floor\">");
3110 else if (fold[i].hasnewmsgs) {
3111 wprintf("<span class=\"roomlist_new\">");
3114 wprintf("<span class=\"roomlist_old\">");
3116 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3121 if (has_subfolders) {
3122 wprintf("new Array(closedGif, openGif)");
3124 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3125 wprintf("'static/viewcontacts_16x.gif'");
3127 else if (fold[i].view == VIEW_CALENDAR) {
3128 wprintf("'static/calarea_16x.gif'");
3130 else if (fold[i].view == VIEW_CALBRIEF) {
3131 wprintf("'static/calarea_16x.gif'");
3133 else if (fold[i].view == VIEW_TASKS) {
3134 wprintf("'static/taskmanag_16x.gif'");
3136 else if (fold[i].view == VIEW_NOTES) {
3137 wprintf("'static/storenotes_16x.gif'");
3139 else if (fold[i].view == VIEW_MAILBOX) {
3140 wprintf("'static/privatemess_16x.gif'");
3143 wprintf("'static/chatrooms_16x.gif'");
3146 urlescputs(fold[i].name);
3150 wprintf("rootNode.addChild(node%d);\n", i);
3153 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3157 wprintf("container = document.getElementById('roomlist_div'); \n"
3163 /** END TREE MENU */
3167 * \brief Boxes and rooms and lists ... oh my!
3168 * \param fold the folder to view
3169 * \param max_folders how many folders???
3170 * \param num_floors hom many floors???
3172 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3174 char floor_name[256];
3175 char old_floor_name[256];
3176 int levels, oldlevels;
3179 static int columns = 3;
3180 int boxes_per_column = 0;
3181 int current_column = 0;
3184 strcpy(floor_name, "");
3185 strcpy(old_floor_name, "");
3188 while (nf % columns != 0) ++nf;
3189 boxes_per_column = (nf / columns);
3190 if (boxes_per_column < 1) boxes_per_column = 1;
3192 /** Outer table (for columnization) */
3193 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3194 "<tr><td valign=top>");
3198 for (i=0; i<max_folders; ++i) {
3200 levels = num_tokens(fold[i].name, '|');
3201 extract_token(floor_name, fold[i].name, 0,
3202 '|', sizeof floor_name);
3204 if ( (strcasecmp(floor_name, old_floor_name))
3205 && (!IsEmptyStr(old_floor_name)) ) {
3207 do_template("endbox", NULL);
3211 if ((num_boxes % boxes_per_column) == 0) {
3213 if (current_column < columns) {
3214 wprintf("</td><td valign=top>\n");
3218 strcpy(old_floor_name, floor_name);
3222 WCTemplputParams SubTP;
3224 Buf = NewStrBufPlain(floor_name, -1);
3225 memset(&SubTP, 0, sizeof(WCTemplputParams));
3226 SubTP.ContextType = CTX_STRBUF;
3227 SubTP.Context = Buf;
3228 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3237 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3238 if (fold[i].selectable) {
3239 wprintf("<a href=\"dotgoto?room=");
3240 urlescputs(fold[i].room);
3246 if (fold[i].hasnewmsgs) {
3247 wprintf("<span class=\"roomlist_new\">");
3250 wprintf("<span class=\"roomlist_old\">");
3252 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3255 if (fold[i].selectable) {
3261 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3262 wprintf(" (INBOX)");
3264 wprintf("<br />\n");
3267 /** End the final inner box */
3268 do_template("endbox", NULL);
3270 wprintf("</td></tr></table>\n");
3274 * \brief print a floor div???
3275 * \param which_floordiv name of the floordiv???
3277 void set_floordiv_expanded(void) {
3278 wcsession *WCC = WC;
3281 FloorDiv = NewStrBuf();
3282 StrBufAppendBuf(FloorDiv, WCC->UrlFragment2, 0);
3283 set_preference("floordiv_expanded", FloorDiv, 1);
3284 WCC->floordiv_expanded = FloorDiv;
3288 * \brief view the iconbar
3289 * \param fold the folder to view
3290 * \param max_folders how many folders???
3291 * \param num_floors hom many floors???
3293 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3295 char floor_name[256];
3296 char old_floor_name[256];
3297 char floordivtitle[256];
3298 char floordiv_id[32];
3299 int levels, oldlevels;
3303 strcpy(floor_name, "");
3304 strcpy(old_floor_name, "");
3308 for (i=0; i<max_folders; ++i) {
3310 levels = num_tokens(fold[i].name, '|');
3311 extract_token(floor_name, fold[i].name, 0,
3312 '|', sizeof floor_name);
3314 if ( (strcasecmp(floor_name, old_floor_name))
3315 && (!IsEmptyStr(old_floor_name)) ) {
3316 /** End inner box */
3318 wprintf("</div>\n"); /** floordiv */
3320 strcpy(old_floor_name, floor_name);
3324 stresc(floordivtitle, 256, floor_name, 0, 0);
3325 sprintf(floordiv_id, "floordiv%d", i);
3326 wprintf("<span class=\"ib_roomlist_floor\" "
3327 "onClick=\"expand_floor('%s')\">"
3328 "%s</span><br>\n", floordiv_id, floordivtitle);
3329 wprintf("<div id=\"%s\" style=\"display:%s\">",
3331 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3338 wprintf("<div id=\"roomdiv%d\">", i);
3340 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3342 /** choose the icon */
3343 if (fold[i].view == VIEW_ADDRESSBOOK) {
3344 icon = "viewcontacts_16x.gif" ;
3346 else if (fold[i].view == VIEW_CALENDAR) {
3347 icon = "calarea_16x.gif" ;
3349 else if (fold[i].view == VIEW_CALBRIEF) {
3350 icon = "calarea_16x.gif" ;
3352 else if (fold[i].view == VIEW_TASKS) {
3353 icon = "taskmanag_16x.gif" ;
3355 else if (fold[i].view == VIEW_NOTES) {
3356 icon = "storenotes_16x.gif" ;
3358 else if (fold[i].view == VIEW_MAILBOX) {
3359 icon = "privatemess_16x.gif" ;
3362 icon = "chatrooms_16x.gif" ;
3365 if (fold[i].selectable) {
3366 wprintf("<a href=\"dotgoto?room=");
3367 urlescputs(fold[i].room);
3369 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3374 if (fold[i].hasnewmsgs) {
3375 wprintf("<span class=\"ib_roomlist_new\">");
3378 wprintf("<span class=\"ib_roomlist_old\">");
3380 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3382 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3383 wprintf(" (INBOX)");
3386 if (fold[i].selectable) {
3393 wprintf("</div>\n"); /** roomdiv */
3396 wprintf("</div>\n"); /** floordiv */
3404 * \brief Burn the cached folder list.
3405 * \param age How old the cahce needs to be before we burn it.
3408 void burn_folder_cache(time_t age)
3410 /** If our cached folder list is very old, burn it. */
3411 if (WC->cache_fold != NULL) {
3412 if ((time(NULL) - WC->cache_timestamp) > age) {
3413 free(WC->cache_fold);
3414 WC->cache_fold = NULL;
3423 * \brief Show the room list.
3424 * (only should get called by
3425 * knrooms() because that's where output_headers() is called from)
3426 * \param viewpref the view preferences???
3429 void list_all_rooms_by_floor(const char *viewpref) {
3432 struct folder *fold = NULL;
3434 int max_folders = 0;
3435 int alloc_folders = 0;
3439 int ShowEmptyFloors;
3442 int num_floors = 1; /** add an extra one for private folders */
3445 /** If our cached folder list is very old, burn it. */
3446 burn_folder_cache(300);
3448 /** Can we do the iconbar roomlist from cache? */
3449 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3450 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3454 /** Grab the floor table so we know how to build the list... */
3457 /** Start with the mailboxes */
3460 fold = malloc(sizeof(struct folder));
3461 memset(fold, 0, sizeof(struct folder));
3462 strcpy(fold[0].name, "My folders");
3463 fold[0].is_mailbox = 1;
3465 /** Then add floors */
3467 serv_getln(buf, sizeof buf);
3468 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3469 if (max_folders >= alloc_folders) {
3470 alloc_folders = max_folders + 100;
3471 fold = realloc(fold,
3472 alloc_folders * sizeof(struct folder));
3474 memset(&fold[max_folders], 0, sizeof(struct folder));
3475 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3476 extract_token(buf3, buf, 0, '|', SIZ);
3477 fold[max_folders].floor = atol (buf3);
3482 for (i=0; i<num_floors; i++)
3483 if (IDMax < fold[i].floor)
3484 IDMax = fold[i].floor;
3485 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3486 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3487 for (i=0; i<num_floors; i++)
3488 floor_mapping[fold[i].floor]=i;
3490 /** refresh the messages index for this room */
3491 /* TODO serv_puts("GOTO ");
3492 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3493 /** Now add rooms */
3495 serv_getln(buf, sizeof buf);
3496 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3497 if (max_folders >= alloc_folders) {
3498 alloc_folders = max_folders + 100;
3499 fold = realloc(fold,
3500 alloc_folders * sizeof(struct folder));
3502 memset(&fold[max_folders], 0, sizeof(struct folder));
3503 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3504 ra_flags = extract_int(buf, 5);
3505 flags = extract_int(buf, 1);
3506 fold[max_folders].floor = extract_int(buf, 2);
3507 fold[max_folders].hasnewmsgs =
3508 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3509 if (flags & QR_MAILBOX) {
3510 fold[max_folders].is_mailbox = 1;
3512 fold[max_folders].view = extract_int(buf, 6);
3513 room_to_folder(fold[max_folders].name,
3514 fold[max_folders].room,
3515 fold[max_folders].floor,
3516 fold[max_folders].is_mailbox);
3517 fold[max_folders].selectable = 1;
3518 /* Increase the room count for the associtaed floor */
3519 if (fold[max_folders].is_mailbox) {
3520 fold[0].num_rooms++;
3523 i = floor_mapping[fold[max_folders].floor];
3524 fold[i].num_rooms++;
3530 * Remove any floors that don't have rooms
3532 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3533 if (ShowEmptyFloors)
3535 for (i=0; i<num_floors; i++)
3537 if (fold[i].num_rooms == 0) {
3538 for (j=i; j<max_folders; j++) {
3539 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3548 /** Bubble-sort the folder list */
3549 for (i=0; i<max_folders; ++i) {
3550 for (j=0; j<(max_folders-1)-i; ++j) {
3551 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3552 swap = strcasecmp(fold[j].name, fold[j+1].name);
3555 if ( (fold[j+1].is_mailbox)
3556 && (!fold[j].is_mailbox)) {
3564 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3565 memcpy(&fold[j], &fold[j+1],
3566 sizeof(struct folder));
3567 memcpy(&fold[j+1], &ftmp,
3568 sizeof(struct folder));
3574 if (!strcasecmp(viewpref, "folders")) {
3575 do_folder_view(fold, max_folders, num_floors);
3577 else if (!strcasecmp(viewpref, "hackish_view")) {
3578 for (i=0; i<max_folders; ++i) {
3579 escputs(fold[i].name);
3580 wprintf("<br />\n");
3583 else if (!strcasecmp(viewpref, "iconbar")) {
3584 do_iconbar_view(fold, max_folders, num_floors);
3587 do_rooms_view(fold, max_folders, num_floors);
3590 /* Don't free the folder list ... cache it for future use! */
3591 if (WC->cache_fold != NULL) {
3592 free(WC->cache_fold);
3594 WC->cache_fold = fold;
3595 WC->cache_max_folders = max_folders;
3596 WC->cache_num_floors = num_floors;
3597 WC->cache_timestamp = time(NULL);
3598 free(floor_mapping);
3603 * \brief Do either a known rooms list or a folders list, depending on the
3608 StrBuf *ListView = NULL;
3610 output_headers(1, 1, 2, 0, 0, 0);
3612 /** Determine whether the user is trying to change views */
3613 if (havebstr("view")) {
3614 ListView = NewStrBufPlain(bstr("view"), -1);
3615 set_preference("roomlistview", ListView, 1);
3617 /** Sanitize the input so its safe */
3618 if(!get_preference("roomlistview", &ListView) ||
3619 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3620 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3622 if (ListView == NULL) {
3623 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3624 set_preference("roomlistview", ListView, 0);
3627 StrBufPrintf(ListView, "rooms");
3633 wprintf("<div id=\"banner\">\n");
3634 wprintf("<div class=\"room_banner\">");
3636 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3637 wprintf(_("Room list"));
3639 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3640 wprintf(_("Folder list"));
3642 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3643 wprintf(_("Room list"));
3645 wprintf("</h1></div>\n");
3647 /** offer the ability to switch views */
3648 wprintf("<ul class=\"room_actions\">\n");
3649 wprintf("<li class=\"start_page\">");
3650 offer_start_page(NULL, &NoCtx);
3652 wprintf("<li><form name=\"roomlistomatic\">\n"
3653 "<select name=\"newview\" size=\"1\" "
3654 "OnChange=\"location.href=roomlistomatic.newview.options"
3655 "[selectedIndex].value\">\n");
3657 wprintf("<option %s value=\"knrooms&view=rooms\">"
3660 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3663 wprintf("<option %s value=\"knrooms&view=folders\">"
3664 "View as folder list"
3666 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3669 wprintf("</select>");
3670 wprintf("</form></li>");
3671 wprintf("</ul></div>\n");
3673 wprintf("<div id=\"content\" class=\"service\">\n");
3675 /** Display the room list in the user's preferred format */
3676 list_all_rooms_by_floor(ChrPtr(ListView));
3683 * \brief Set the message expire policy for this room and/or floor
3685 void set_room_policy(void) {
3688 if (!havebstr("ok_button")) {
3689 strcpy(WC->ImportantMessage,
3690 _("Cancelled. Changes were not saved."));
3695 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3696 serv_getln(buf, sizeof buf);
3697 strcpy(WC->ImportantMessage, &buf[4]);
3699 if (WC->axlevel >= 6) {
3700 strcat(WC->ImportantMessage, "<br />\n");
3701 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3702 serv_getln(buf, sizeof buf);
3703 strcat(WC->ImportantMessage, &buf[4]);
3709 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3710 // todo: check context
3716 floors = NewHash(1, NULL);
3718 serv_puts("LFLR"); // get floors
3719 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); // '100', we hope
3720 if (ChrPtr(Buf)[0] == '1') while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3721 floor = NewHash(1, NULL);
3723 const char *floorNum;
3724 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3726 StrBufExtract_token(Buf2, Buf, a, '|');
3728 floorNum = ChrPtr(Buf2); // hmm, should we copy Buf2 first?
3730 Put(floor, FPKEY(a), Buf2, NULL);
3732 Put(floors, HKEY(floorNum), floor, NULL);
3738 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP) {
3739 HashList *floor = (HashList *)(TP->Context);
3741 GetHash(floor, TKEY(0), &value);
3742 StrBuf *val = (StrBuf *)value;
3743 StrECMAEscAppend(TemplBuffer, val, 0);
3745 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP) {
3747 return GetRoomListHash(Target, TP);
3749 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP) {
3750 // TODO: Check context
3757 rooms = NewHash(1, NULL);
3758 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3759 if (ChrPtr(buf)[0] == '1') while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3760 room = NewHash(1, NULL);
3763 for(i=0; i<ROOM_PARAM_LEN; i++) {
3765 StrBufExtract_token(buf2, buf, i, '|');
3767 rmName = ChrPtr(buf2);
3769 Put(room, RPKEY(i), buf2, NULL);
3771 Put(rooms, rmName, strlen(rmName), room, NULL);
3773 SortByHashKey(rooms, 1);
3774 //SortByPayload(rooms, SortRoomsByListOrder);
3778 /** Unused function that orders rooms by the listorder flag */
3779 int SortRoomsByListOrder(const void *room1, const void *room2) {
3780 HashList *r1 = (HashList *)GetSearchPayload(room1);
3781 HashList *r2 = (HashList *)GetSearchPayload(room2);
3782 StrBuf *listOrderBuf1;
3783 StrBuf *listOrderBuf2;
3785 GetHash(r1, RPKEY(3), (void *)&listOrderBuf1);
3786 GetHash(r2, RPKEY(3), (void *)&listOrderBuf2);
3787 int l1 = atoi(ChrPtr(listOrderBuf1));
3788 int l2 = atoi(ChrPtr(listOrderBuf2));
3789 if (l1 < l2) return -1;
3790 else if (l1 > l2) return +1;
3793 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP) {
3794 HashList *room = (HashList *)(TP->Context);
3796 GetHash(room, TKEY(0), &value);
3797 StrBuf *val = (StrBuf *)value;
3798 StrECMAEscAppend(TemplBuffer, val, 0);
3800 void jsonRoomFlr(void) {
3801 // Send as our own (application/json) content type
3802 hprintf("HTTP/1.1 200 OK\r\n");
3803 hprintf("Content-type: application/json; charset=utf-8\r\n");
3804 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(serv_info.serv_software));
3805 hprintf("Connection: close\r\n");
3806 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3808 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3811 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3813 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3816 void _gotonext(void) { slrp_highest(); gotonext(); }
3817 void dotskip(void) {smart_goto(sbstr("room"));}
3818 void _display_private(void) { display_private("", 0); }
3819 void dotgoto(void) {
3820 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3823 smart_goto(sbstr("room"));
3826 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3828 wprintf("<div id=\"banner\">\n");
3829 embed_room_banner(NULL, navbar_default);
3830 wprintf("</div>\n");
3834 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3836 wcsession *WCC = WC;
3839 (!IsEmptyStr(WCC->ugname)))
3840 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3844 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3846 wcsession *WCC = WC;
3848 return ((WCC!=NULL) &&
3849 (!IsEmptyStr(WCC->ugname)) &&
3850 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3853 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3855 wcsession *WCC = WC;
3857 return ((WCC!=NULL) &&
3858 ((WCC->room_flags & QR_PERMANENT) != 0));
3861 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3863 wcsession *WCC = WC;
3865 return ((WCC!=NULL) &&
3866 ((WCC->room_flags & QR_INUSE) != 0));
3869 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3871 wcsession *WCC = WC;
3873 return ((WCC!=NULL) &&
3874 ((WCC->room_flags & QR_PRIVATE) != 0));
3877 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3879 wcsession *WCC = WC;
3881 return ((WCC!=NULL) &&
3882 ((WCC->room_flags & QR_PASSWORDED) != 0));
3885 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3887 wcsession *WCC = WC;
3889 return ((WCC!=NULL) &&
3890 ((WCC->room_flags & QR_GUESSNAME) != 0));
3893 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3895 wcsession *WCC = WC;
3897 return ((WCC!=NULL) &&
3898 ((WCC->room_flags & QR_DIRECTORY) != 0));
3901 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3903 wcsession *WCC = WC;
3905 return ((WCC!=NULL) &&
3906 ((WCC->room_flags & QR_UPLOAD) != 0));
3909 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3911 wcsession *WCC = WC;
3913 return ((WCC!=NULL) &&
3914 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3917 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3919 wcsession *WCC = WC;
3921 return ((WCC!=NULL) &&
3922 ((WCC->room_flags & QR_VISDIR) != 0));
3925 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3927 wcsession *WCC = WC;
3929 return ((WCC!=NULL) &&
3930 ((WCC->room_flags & QR_ANONONLY) != 0));
3933 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3935 wcsession *WCC = WC;
3937 return ((WCC!=NULL) &&
3938 ((WCC->room_flags & QR_ANONOPT) != 0));
3941 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
3943 wcsession *WCC = WC;
3945 return ((WCC!=NULL) &&
3946 ((WCC->room_flags & QR_NETWORK) != 0));
3949 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
3951 wcsession *WCC = WC;
3953 return ((WCC!=NULL) &&
3954 ((WCC->room_flags & QR_PREFONLY) != 0));
3957 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
3959 wcsession *WCC = WC;
3961 return ((WCC!=NULL) &&
3962 ((WCC->room_flags & QR_READONLY) != 0));
3965 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
3967 wcsession *WCC = WC;
3969 return ((WCC!=NULL) &&
3970 ((WCC->room_flags & QR_MAILBOX) != 0));
3974 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3976 wcsession *WCC = WC;
3978 return ( (WCC!= NULL) &&
3979 ((WCC->axlevel >= 6) ||
3980 (WCC->is_room_aide) ||
3981 (WCC->is_mailbox) ));
3988 RegisterPreference(HKEY("roomlistview"),
3989 _("Room list view"),
3992 RegisterPreference(HKEY("emptyfloors"), _("Show empty floors"), PRF_YESNO, NULL);
3994 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
3996 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
3997 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
3998 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
3999 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4000 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4001 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4002 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4003 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4004 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4005 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4006 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4007 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4008 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4009 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4010 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4011 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4012 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4013 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4014 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4015 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4016 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4017 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4018 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4019 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4020 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4022 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4023 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4024 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4025 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4026 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4027 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4028 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4029 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4030 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4031 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4032 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4033 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4034 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4035 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4036 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4038 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4039 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4041 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4042 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4043 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4044 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, NULL, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4045 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);