3 * Lots of different room-related operations.
9 char floorlist[MAX_FLOORS][SIZ]; /**< list of our floor names */
11 char *viewdefs[9]; /**< the different kinds of available views */
13 /** See GetFloorListHash and GetRoomListHash for info on these. Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys. */
14 const char FLOOR_PARAM_NAMES[(FLOOR_PARAM_LEN + 1)][15] = {"ID",
17 const char ROOM_PARAM_NAMES[(ROOM_PARAM_LEN + 1)][20] = {"NAME",
25 /* Because avoiding strlen at run time is a Good Thing(TM) */
26 const int FLOOR_PARAM_NAMELEN[(FLOOR_PARAM_LEN +1)] = {2, 4, 5};
27 const int ROOM_PARAM_NAMELEN[(ROOM_PARAM_LEN +1)] = {4, 4, 5, 9, 3, 7, 7, 8};
29 void display_whok(void);
32 * Initialize the viewdefs with localized strings
34 void initialize_viewdefs(void) {
35 viewdefs[0] = _("Bulletin Board");
36 viewdefs[1] = _("Mail Folder");
37 viewdefs[2] = _("Address Book");
38 viewdefs[3] = _("Calendar");
39 viewdefs[4] = _("Task List");
40 viewdefs[5] = _("Notes List");
41 viewdefs[6] = _("Wiki");
42 viewdefs[7] = _("Calendar List");
43 viewdefs[8] = _("Journal");
47 * Determine which views are allowed as the default for creating a new room.
49 int is_view_allowed_as_default(int which_view)
52 case VIEW_BBS: return(1);
53 case VIEW_MAILBOX: return(1);
54 case VIEW_ADDRESSBOOK: return(1);
55 case VIEW_CALENDAR: return(1);
56 case VIEW_TASKS: return(1);
57 case VIEW_NOTES: return(1);
60 case VIEW_WIKI: return(1);
61 #else /* TECH_PREVIEW */
62 case VIEW_WIKI: return(0); /* because it isn't finished yet */
63 #endif /* TECH_PREVIEW */
65 case VIEW_CALBRIEF: return(0);
66 case VIEW_JOURNAL: return(0);
67 default: return(0); /* should never get here */
73 * load the list of floors
75 void load_floorlist(void)
80 for (a = 0; a < MAX_FLOORS; ++a)
84 serv_getln(buf, sizeof buf);
86 strcpy(floorlist[0], "Main Floor");
89 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
90 extract_token(floorlist[extract_int(buf, 0)], buf, 1, '|', sizeof floorlist[0]);
96 * Free a session's march list
98 void free_march_list(wcsession *wcf)
102 while (wcf->march != NULL) {
103 mptr = wcf->march->next;
113 * remove a room from the march list
115 void remove_march(const StrBuf *aaa)
117 struct march *mptr, *mptr2;
119 if (WC->march == NULL)
122 if (!strcasecmp(WC->march->march_name, ChrPtr(aaa))) {
123 mptr = WC->march->next;
129 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
130 if (!strcasecmp(mptr->march_name, ChrPtr(aaa))) {
131 mptr2->next = mptr->next;
144 * display rooms in tree structure
146 void room_tree_list(struct roomlisting *rp)
155 room_tree_list(rp->lnext);
157 strcpy(rmname, rp->rlname);
160 wprintf("<a href=\"dotgoto&room=");
164 escputs1(rmname, 1, 1);
165 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
167 else if (f & QR_DIRECTORY)
169 else if (f & QR_NETWORK)
173 wprintf("</a><tt> </tt>\n");
175 room_tree_list(rp->rnext);
181 * \brief Room ordering stuff (compare first by floor, then by order)
182 * \param r1 first roomlist to compare
183 * \param r2 second roomlist co compare
184 * \return are they the same???
186 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
188 if ((r1 == NULL) && (r2 == NULL))
194 if (r1->rlfloor < r2->rlfloor)
196 if (r1->rlfloor > r2->rlfloor)
198 if (r1->rlorder < r2->rlorder)
200 if (r1->rlorder > r2->rlorder)
207 * \brief Common code for all room listings
208 * \param variety what???
210 void listrms(char *variety)
215 struct roomlisting *rl = NULL;
216 struct roomlisting *rp;
217 struct roomlisting *rs;
219 /** Ask the server for a room list */
221 serv_getln(buf, sizeof buf);
227 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
229 rp = malloc(sizeof(struct roomlisting));
230 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
231 rp->rlflags = extract_int(buf, 1);
232 rp->rlfloor = extract_int(buf, 2);
233 rp->rlorder = extract_int(buf, 3);
242 if (rordercmp(rp, rs) < 0) {
243 if (rs->lnext == NULL) {
250 if (rs->rnext == NULL) {
263 * If no rooms were listed, print an nbsp to make the cell
264 * borders show up anyway.
266 if (num_rooms == 0) wprintf(" ");
271 * \brief list all forgotten rooms
273 void zapped_list(void)
275 WCTemplputParams SubTP;
278 output_headers(1, 1, 1, 0, 0, 0);
279 memset(&SubTP, 0, sizeof(WCTemplputParams));
280 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
281 SubTP.Filter.ContextType = CTX_STRBUF;
283 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
289 wprintf("<br /><br />\n");
290 wprintf(_("Click on any room to un-zap it and goto that room.\n"));
291 do_template("endbox", NULL);
297 * \brief read this room's info file (set v to 1 for verbose mode)
299 void readinfo(StrBuf *Target, WCTemplputParams *TP)
304 int fullinfo_len = 0;
307 serv_getln(buf, sizeof buf);
310 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
311 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
312 strcpy(&fullinfo[fullinfo_len], buf);
313 fullinfo_len += strlen(buf);
317 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
318 strcpy(&briefinfo[50], "...");
320 wprintf("<div class=\"infos\" "
321 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
324 wprintf("</div><div id=\"room_infos\" style=\"display:none;\">");
325 wprintf("<img class=\"close_infos\" "
326 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
327 "src=\"static/closewindow.gif\" alt=\"%s\">",
342 * \brief Display room banner icon.
343 * The server doesn't actually
344 * need the room name, but we supply it in order to
345 * keep the browser from using a cached icon from
348 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
352 serv_puts("OIMG _roompic_");
353 serv_getln(buf, sizeof buf);
355 wprintf("<img height=\"64px\" src=\"image&name=_roompic_&room=");
356 urlescputs(ChrPtr(WC->wc_roomname));
359 serv_getln(buf, sizeof buf);
361 else if (WC->wc_view == VIEW_ADDRESSBOOK) {
362 wprintf("<img class=\"roompic\" alt=\"\" src=\""
363 "static/viewcontacts_48x.gif"
367 else if ( (WC->wc_view == VIEW_CALENDAR) || (WC->wc_view == VIEW_CALBRIEF) ) {
368 wprintf("<img class=\"roompic\" alt=\"\" src=\""
369 "static/calarea_48x.gif"
373 else if (WC->wc_view == VIEW_TASKS) {
374 wprintf("<img class=\"roompic\" alt=\"\" src=\""
375 "static/taskmanag_48x.gif"
379 else if (WC->wc_view == VIEW_NOTES) {
380 wprintf("<img class=\"roompic\" alt=\"\" src=\""
381 "static/storenotes_48x.gif"
385 else if (WC->wc_view == VIEW_MAILBOX) {
386 wprintf("<img class=\"roompic\" alt=\"\" src=\""
387 "static/privatemess_48x.gif"
392 wprintf("<img class=\"roompic\" alt=\"\" src=\""
393 "static/chatrooms_48x.gif"
403 * \brief Display the current view and offer an option to change it
405 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
409 wprintf("<form name=\"viewomatic\" action=\"changeview\">\n");
410 wprintf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
411 wprintf("<label for=\"view_name\">");
412 wprintf(_("View as:"));
414 "<select name=\"newview\" size=\"1\" "
415 "id=\"view_name\" class=\"selectbox\" "
416 "OnChange=\"location.href=viewomatic.newview.options"
417 "[selectedIndex].value\">\n");
419 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
421 * Only offer the views that make sense, given the default
422 * view for the room. For example, don't offer a Calendar
423 * view in a non-Calendar room.
427 || (i == WC->wc_default_view) /**< default */
428 || ( (i == 0) && (WC->wc_default_view == 1) ) /**< mail or bulletin */
429 || ( (i == 1) && (WC->wc_default_view == 0) ) /**< mail or bulletin */
430 /** || ( (i == 7) && (WC->wc_default_view == 3) ) (calendar list temporarily disabled) */
433 wprintf("<option %s value=\"changeview?view=%d\">",
434 ((i == WC->wc_view) ? "selected" : ""),
436 escputs(viewdefs[i]);
437 wprintf("</option>\n");
440 wprintf("</select></div></form>\n");
445 * \brief Display a search box
447 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
449 wprintf("<form name=\"searchomatic\" action=\"do_search\">\n");
450 wprintf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
451 wprintf("<label for=\"srchquery\">");
452 wprintf(_("Search: "));
453 wprintf("</label><input ");
454 wprintf("%s", serv_info.serv_fulltext_enabled ? "" : "disabled ");
455 wprintf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
457 wprintf("</div></form>\n");
462 * \brief Embed the room banner
464 * \param got The information returned from a GOTO server command
465 * \param navbar_style Determines which navigation buttons to display
469 void embed_room_banner(char *got, int navbar_style) {
472 char with_files[256];
476 * We need to have the information returned by a GOTO server command.
477 * If it isn't supplied, we fake it by issuing our own GOTO.
480 memset(buf, '0', 20);
482 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
483 serv_getln(buf, sizeof buf);
487 /** The browser needs some information for its own use */
488 wprintf("<script type=\"text/javascript\"> \n"
489 " room_is_trash = %d; \n"
495 * If the user happens to select the "make this my start page" link,
496 * we want it to remember the URL as a "/dotskip" one instead of
497 * a "skip" or "gotonext" or something like that.
499 snprintf(WC->this_page, sizeof(WC->this_page), "dotskip&room=%s",
500 ChrPtr(WC->wc_roomname));
502 /** Check for new mail. */
503 WC->new_mail = extract_int(&got[4], 9);
504 WC->wc_view = extract_int(&got[4], 11);
506 /* Is this a directory room and does it contain files and how many? */
507 if ((WC->room_flags & QR_DIRECTORY) && (WC->room_flags & QR_VISDIR))
510 serv_getln(buf2, sizeof buf2);
511 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
513 snprintf (with_files, sizeof with_files,
514 "; <a href=\"do_template?template=files\"> %d %s </a>",
516 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
519 strcpy (with_files, "");
521 svprintf(HKEY("NUMMSGS"), WCS_STRING,
522 _("%d new of %d messages%s"),
523 extract_int(&got[4], 1),
524 extract_int(&got[4], 2),
527 svcallback("ROOMPIC", embed_room_graphic);
528 svcallback("ROOMINFO", readinfo);
529 svcallback("VIEWOMATIC", embed_view_o_matic);
530 svcallback("SEARCHOMATIC", embed_search_o_matic);
531 svcallback("START", offer_start_page);
533 do_template("roombanner", NULL);
534 /* roombanner contains this for mobile */
535 if (navbar_style != navbar_none && !WC->is_mobile) {
537 wprintf("<div id=\"navbar\"><ul>");
539 if (navbar_style == navbar_default) wprintf(
540 "<li class=\"ungoto\">"
541 "<a href=\"ungoto\">"
542 "<img src=\"static/ungoto2_24x.gif\" alt=\"\">"
543 "<span class=\"navbar_link\">%s</span></A>"
544 "</li>\n", _("Ungoto")
547 if ( (navbar_style == navbar_default) && (WC->wc_view == VIEW_BBS) ) {
549 "<li class=\"newmess\">"
550 "<a href=\"readnew\">"
551 "<img src=\"static/newmess2_24x.gif\" alt=\"\">"
552 "<span class=\"navbar_link\">%s</span></A>"
553 "</li>\n", _("Read new messages")
557 if (navbar_style == navbar_default) {
558 switch(WC->wc_view) {
559 case VIEW_ADDRESSBOOK:
561 "<li class=\"viewcontacts\">"
562 "<a href=\"readfwd\">"
563 "<img src=\"static/viewcontacts_24x.gif\" "
565 "<span class=\"navbar_link\">"
567 "</span></a></li>\n", _("View contacts")
572 "<li class=\"staskday\">"
573 "<a href=\"readfwd?calview=day\">"
574 "<img src=\"static/taskday2_24x.gif\" "
576 "<span class=\"navbar_link\">"
578 "</span></a></li>\n", _("Day view")
581 "<li class=\"monthview\">"
582 "<a href=\"readfwd?calview=month\">"
583 "<img src=\"static/monthview2_24x.gif\" "
585 "<span class=\"navbar_link\">"
587 "</span></a></li>\n", _("Month view")
592 "<li class=\"monthview\">"
593 "<a href=\"readfwd?calview=month\">"
594 "<img src=\"static/monthview2_24x.gif\" "
596 "<span class=\"navbar_link\">"
598 "</span></a></li>\n", _("Calendar list")
603 "<li class=\"taskmanag\">"
604 "<a href=\"readfwd\">"
605 "<img src=\"static/taskmanag_24x.gif\" "
607 "<span class=\"navbar_link\">"
609 "</span></a></li>\n", _("View tasks")
614 "<li class=\"viewnotes\">"
615 "<a href=\"readfwd\">"
616 "<img src=\"static/viewnotes_24x.gif\" "
618 "<span class=\"navbar_link\">"
620 "</span></a></li>\n", _("View notes")
625 "<li class=\"readallmess\">"
626 "<a id=\"m_refresh\" href=\"readfwd\">"
627 "<img src=\"static/readallmess3_24x.gif\" "
629 "<span class=\"navbar_link\">"
631 "</span></a></li>\n", _("Refresh message list")
636 "<li class=\"readallmess\">"
637 "<a href=\"readfwd\">"
638 "<img src=\"static/readallmess3_24x.gif\" "
640 "<span class=\"navbar_link\">"
642 "</span></a></li>\n", _("Wiki home")
647 "<li class=\"readallmess\">"
648 "<a href=\"readfwd\">"
649 "<img src=\"static/readallmess3_24x.gif\" "
651 "<span class=\"navbar_link\">"
653 "</span></a></li>\n", _("Read all messages")
659 if (navbar_style == navbar_default) {
660 switch(WC->wc_view) {
661 case VIEW_ADDRESSBOOK:
663 "<li class=\"addnewcontact\">"
664 "<a href=\"display_enter\">"
665 "<img src=\"static/addnewcontact_24x.gif\" "
666 "alt=\"\"><span class=\"navbar_link\">"
668 "</span></a></li>\n", _("Add new contact")
673 wprintf("<li class=\"addevent\"><a href=\"display_enter");
674 if (havebstr("year" )) wprintf("?year=%s", bstr("year"));
675 if (havebstr("month")) wprintf("?month=%s", bstr("month"));
676 if (havebstr("day" )) wprintf("?day=%s", bstr("day"));
678 "<img src=\"static/addevent_24x.gif\" "
679 "alt=\"\"><span class=\"navbar_link\">"
681 "</span></a></li>\n", _("Add new event")
686 "<li class=\"newmess\">"
687 "<a href=\"display_enter\">"
688 "<img src=\"static/newmess3_24x.gif\" "
689 "alt=\"\"><span class=\"navbar_link\">"
691 "</span></a></li>\n", _("Add new task")
696 "<li class=\"enternewnote\">"
697 "<a href=\"add_new_note\">"
698 "<img src=\"static/enternewnote_24x.gif\" "
699 "alt=\"\"><span class=\"navbar_link\">"
701 "</span></a></li>\n", _("Add new note")
705 safestrncpy(buf, bstr("page"), sizeof buf);
708 "<li class=\"newmess\">"
709 "<a href=\"display_enter?wikipage=%s\">"
710 "<img src=\"static/newmess3_24x.gif\" "
711 "alt=\"\"><span class=\"navbar_link\">"
713 "</span></a></li>\n", buf, _("Edit this page")
718 "<li class=\"newmess\">"
719 "<a href=\"display_enter\">"
720 "<img src=\"static/newmess3_24x.gif\" "
721 "alt=\"\"><span class=\"navbar_link\">"
723 "</span></a></li>\n", _("Write mail")
728 "<li class=\"newmess\">"
729 "<a href=\"display_enter\">"
730 "<img src=\"static/newmess3_24x.gif\" "
731 "alt=\"\"><span class=\"navbar_link\">"
733 "</span></a></li>\n", _("Enter a message")
739 if (navbar_style == navbar_default) wprintf(
740 "<li class=\"skipthisroom\">"
743 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\">"
744 "<span class=\"navbar_link\">%s</span></a>"
746 _("Leave all messages marked as unread, go to next room with unread messages"),
750 if (navbar_style == navbar_default) wprintf(
751 "<li class=\"markngo\">"
752 "<a href=\"gotonext\" "
754 "<img src=\"static/markngo_24x.gif\" alt=\"\">"
755 "<span class=\"navbar_link\">%s</span></a>"
757 _("Mark all messages as read, go to next room with unread messages"),
761 wprintf("</ul></div>\n");
768 * back end routine to take the session to a new room
770 long gotoroom(const StrBuf *gname)
773 static long ls = (-1L);
776 /* store ungoto information */
777 strcpy(WC->ugname, ChrPtr(WC->wc_roomname));
780 /** move to the new room */
781 serv_printf("GOTO %s", ChrPtr(gname));
782 StrBuf_ServGetln(Buf);
783 if (GetServerStatus(Buf, &err) != 2) {
784 serv_puts("GOTO _BASEROOM_");
785 StrBuf_ServGetln(Buf);
786 if (GetServerStatus(Buf, &err) != 2) {
792 if (WC->wc_roomname == NULL)
793 WC->wc_roomname = NewStrBuf();
795 FlushStrBuf(WC->wc_roomname);
797 StrBufExtract_token(WC->wc_roomname, Buf, 0, '|');
798 StrBufCutLeft(WC->wc_roomname, 4);
799 WC->room_flags = StrBufExtract_int(Buf, 4, '|');
800 /* highest_msg_read = extract_int(&buf[4],6);
801 maxmsgnum = extract_int(&buf[4],5);
803 WC->is_mailbox = StrBufExtract_int(Buf, 7, '|');
804 ls = StrBufExtract_long(Buf, 6, '|');
805 WC->wc_floor = StrBufExtract_int(Buf, 10, '|');
806 WC->wc_view = StrBufExtract_int(Buf, 11, '|');
807 WC->wc_default_view = StrBufExtract_int(Buf, 12, '|');
808 WC->wc_is_trash = StrBufExtract_int(Buf, 13, '|');
809 WC->room_flags2 = StrBufExtract_int(Buf, 14, '|');
812 WC->is_room_aide = WC->is_aide;
814 WC->is_room_aide = (char) StrBufExtract_int(Buf, 8, '|');
816 remove_march(WC->wc_roomname);
817 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
826 * \brief Locate the room on the march list which we most want to go to.
828 * is measured given a "weight" of preference based on various factors.
829 * \param desired_floor the room number on the citadel server
830 * \return the roomname
832 char *pop_march(int desired_floor)
834 static char TheRoom[128];
836 int TheOrder = 32767;
839 struct march *mptr = NULL;
841 strcpy(TheRoom, "_BASEROOM_");
842 if (WC->march == NULL)
845 for (mptr = WC->march; mptr != NULL; mptr = mptr->next) {
847 if ((strcasecmp(mptr->march_name, "_BASEROOM_")))
848 weight = weight + 10000;
849 if (mptr->march_floor == desired_floor)
850 weight = weight + 5000;
852 weight = weight + ((128 - (mptr->march_floor)) * 128);
853 weight = weight + (128 - (mptr->march_order));
855 if (weight > TheWeight) {
857 strcpy(TheRoom, mptr->march_name);
858 TheFloor = mptr->march_floor;
859 TheOrder = mptr->march_order;
868 * Goto next room having unread messages.
870 * We want to skip over rooms that the user has already been to, and take the
871 * user back to the lobby when done. The room we end up in is placed in
872 * newroom - which is set to 0 (the lobby) initially.
873 * We start the search in the current room rather than the beginning to prevent
874 * two or more concurrent users from dragging each other back to the same room.
879 struct march *mptr = NULL;
880 struct march *mptr2 = NULL;
886 * First check to see if the march-mode list is already allocated.
887 * If it is, pop the first room off the list and go there.
890 if (WC->march == NULL) {
892 serv_getln(buf, sizeof buf);
894 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
895 if (IsEmptyStr(buf)) {
898 if (ELoop % 100 == 0)
903 extract_token(room_name, buf, 0, '|', sizeof room_name);
904 if (strcasecmp(room_name, ChrPtr(WC->wc_roomname))) {
905 mptr = (struct march *) malloc(sizeof(struct march));
907 safestrncpy(mptr->march_name, room_name, sizeof mptr->march_name);
908 mptr->march_floor = extract_int(buf, 2);
909 mptr->march_order = extract_int(buf, 3);
910 if (WC->march == NULL)
919 * add _BASEROOM_ to the end of the march list, so the user will end up
920 * in the system base room (usually the Lobby>) at the end of the loop
922 mptr = (struct march *) malloc(sizeof(struct march));
924 mptr->march_order = 0;
925 mptr->march_floor = 0;
926 strcpy(mptr->march_name, "_BASEROOM_");
927 if (WC->march == NULL) {
931 while (mptr2->next != NULL)
936 * ...and remove the room we're currently in, so a <G>oto doesn't make us
937 * walk around in circles
939 remove_march(WC->wc_roomname);
941 if (WC->march != NULL) {
942 next_room = NewStrBufPlain(pop_march(-1), -1);/*TODO: migrate march to strbuf */
944 next_room = NewStrBufPlain(HKEY("_BASEROOM_"));
948 smart_goto(next_room);
949 FreeStrBuf(&next_room);
956 void smart_goto(const StrBuf *next_room) {
964 * mark all messages in current room as having been read
966 void slrp_highest(void)
970 serv_puts("SLRP HIGHEST");
971 serv_getln(buf, sizeof buf);
976 * un-goto the previous room
982 if (!strcmp(WC->ugname, "")) {
983 smart_goto(WC->wc_roomname);
986 serv_printf("GOTO %s", WC->ugname);
988 StrBuf_ServGetln(Buf);
989 if (GetServerStatus(Buf, NULL) != 2) {
990 smart_goto(WC->wc_roomname);
994 if (WC->uglsn >= 0L) {
995 serv_printf("SLRP %ld", WC->uglsn);
996 StrBuf_ServGetln(Buf);
999 StrBufAppendBufPlain(Buf, WC->ugname, -1, 0);
1000 strcpy(WC->ugname, "");
1005 typedef struct __room_states {
1020 * Set/clear/read the "self-service list subscribe" flag for a room
1022 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1023 * returns the new value.
1026 int self_service(int newval) {
1027 int current_value = 0;
1033 int flags, floor, order, view, flags2;
1036 serv_getln(buf, sizeof buf);
1037 if (buf[0] != '2') return(0);
1039 extract_token(name, &buf[4], 0, '|', sizeof name);
1040 extract_token(password, &buf[4], 1, '|', sizeof password);
1041 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1042 flags = extract_int(&buf[4], 3);
1043 floor = extract_int(&buf[4], 4);
1044 order = extract_int(&buf[4], 5);
1045 view = extract_int(&buf[4], 6);
1046 flags2 = extract_int(&buf[4], 7);
1048 if (flags2 & QR2_SELFLIST) {
1056 flags2 = flags2 | QR2_SELFLIST;
1058 else if (newval == 0) {
1059 flags2 = flags2 & ~QR2_SELFLIST;
1062 return(current_value);
1065 if (newval != current_value) {
1066 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1067 name, password, dirname, flags,
1068 floor, order, view, flags2);
1069 serv_getln(buf, sizeof buf);
1076 int is_selflist(room_states *RoomFlags)
1078 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1081 int is_publiclist(room_states *RoomFlags)
1083 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1086 int is_moderatedlist(room_states *RoomFlags)
1088 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1092 * Set/clear/read the "self-service list subscribe" flag for a room
1094 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1095 * returns the new value.
1098 int get_roomflags(room_states *RoomOps)
1103 serv_getln(buf, sizeof buf);
1104 if (buf[0] != '2') return(0);
1106 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1107 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1108 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1109 RoomOps->flags = extract_int(&buf[4], 3);
1110 RoomOps->floor = extract_int(&buf[4], 4);
1111 RoomOps->order = extract_int(&buf[4], 5);
1112 RoomOps->view = extract_int(&buf[4], 6);
1113 RoomOps->flags2 = extract_int(&buf[4], 7);
1117 int set_roomflags(room_states *RoomOps)
1121 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1130 serv_getln(buf, sizeof buf);
1140 * display the form for editing a room
1142 void display_editroom(void)
1147 char remote_room[128];
1150 char er_password[10];
1151 char er_dirname[15];
1152 char er_roomaide[26];
1159 char *not_shared_with;
1162 int floorpolicy = 0;
1164 char pop3_host[128];
1169 if (IsEmptyStr(tab)) tab = "admin";
1172 output_headers(1, 1, 1, 0, 0, 0);
1174 wprintf("<div class=\"fix_scrollbar_bug\">");
1176 wprintf("<br />\n");
1178 /* print the tabbed dialog */
1179 wprintf("<div align=\"center\">");
1180 wprintf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\""
1181 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1184 wprintf("<td class=\"");
1185 if (!strcmp(tab, "admin")) {
1186 wprintf(" tab_cell_label\">");
1187 wprintf(_("Administration"));
1190 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=admin\">");
1191 wprintf(_("Administration"));
1195 wprintf("<td> </td>\n");
1197 if ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
1199 wprintf("<td class=\"");
1200 if (!strcmp(tab, "config")) {
1201 wprintf(" tab_cell_label\">");
1202 wprintf(_("Configuration"));
1205 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=config\">");
1206 wprintf(_("Configuration"));
1210 wprintf("<td> </td>\n");
1212 wprintf("<td class=\"");
1213 if (!strcmp(tab, "expire")) {
1214 wprintf(" tab_cell_label\">");
1215 wprintf(_("Message expire policy"));
1218 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=expire\">");
1219 wprintf(_("Message expire policy"));
1223 wprintf("<td> </td>\n");
1225 wprintf("<td class=\"");
1226 if (!strcmp(tab, "access")) {
1227 wprintf(" tab_cell_label\">");
1228 wprintf(_("Access controls"));
1231 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=access\">");
1232 wprintf(_("Access controls"));
1236 wprintf("<td> </td>\n");
1238 wprintf("<td class=\"");
1239 if (!strcmp(tab, "sharing")) {
1240 wprintf(" tab_cell_label\">");
1241 wprintf(_("Sharing"));
1244 wprintf(" tab_cell_edit\"><a href=\"display_editroom&tab=sharing\">");
1245 wprintf(_("Sharing"));
1249 wprintf("<td> </td>\n");
1251 wprintf("<td class=\"");
1252 if (!strcmp(tab, "listserv")) {
1253 wprintf(" tab_cell_label\">");
1254 wprintf(_("Mailing list service"));
1257 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=listserv\">");
1258 wprintf(_("Mailing list service"));
1262 wprintf("<td> </td>\n");
1266 wprintf("<td class=\"");
1267 if (!strcmp(tab, "feeds")) {
1268 wprintf(" tab_cell_label\">");
1269 wprintf(_("Remote retrieval"));
1272 wprintf("< tab_cell_edit\"><a href=\"display_editroom&tab=feeds\">");
1273 wprintf(_("Remote retrieval"));
1277 wprintf("<td> </td>\n");
1279 wprintf("</tr></table>\n");
1280 wprintf("</div>\n");
1281 /* end tabbed dialog */
1283 wprintf("<script type=\"text/javascript\">"
1284 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1288 /* begin content of whatever tab is open now */
1290 if (!strcmp(tab, "admin")) {
1291 wprintf("<div class=\"tabcontent\">");
1293 "<li><a href=\"delete_room\" "
1294 "onClick=\"return confirm('");
1295 wprintf(_("Are you sure you want to delete this room?"));
1296 wprintf("');\">\n");
1297 wprintf(_("Delete this room"));
1299 "<li><a href=\"display_editroompic\">\n");
1300 wprintf(_("Set or change the icon for this room's banner"));
1302 "<li><a href=\"display_editinfo\">\n");
1303 wprintf(_("Edit this room's Info file"));
1309 if (!strcmp(tab, "config")) {
1310 wprintf("<div class=\"tabcontent\">");
1312 serv_getln(buf, sizeof buf);
1314 if (!strncmp(buf, "550", 3)) {
1315 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1316 _("Higher access is required to access this function.")
1319 else if (buf[0] != '2') {
1320 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1323 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1324 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1325 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1326 er_flags = extract_int(&buf[4], 3);
1327 er_floor = extract_int(&buf[4], 4);
1328 er_flags2 = extract_int(&buf[4], 7);
1330 wprintf("<form method=\"POST\" action=\"editroom\">\n");
1331 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1333 wprintf("<ul><li>");
1334 wprintf(_("Name of room: "));
1335 wprintf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\"%d\">\n",
1341 wprintf(_("Resides on floor: "));
1342 wprintf("<select NAME=\"er_floor\" SIZE=\"1\"");
1343 if (er_flags & QR_MAILBOX)
1344 wprintf("disabled >\n");
1345 for (i = 0; i < 128; ++i)
1346 if (!IsEmptyStr(floorlist[i])) {
1347 wprintf("<OPTION ");
1349 wprintf("SELECTED ");
1350 wprintf("VALUE=\"%d\">", i);
1351 escputs(floorlist[i]);
1352 wprintf("</OPTION>\n");
1354 wprintf("</select>\n");
1357 wprintf(_("Type of room:"));
1360 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1361 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1362 wprintf("CHECKED ");
1363 wprintf("OnChange=\""
1364 " if (this.form.type[0].checked == true) { "
1365 " this.form.er_floor.disabled = false; "
1368 wprintf(_("Public (automatically appears to everyone)"));
1371 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1372 if ((er_flags & QR_PRIVATE) &&
1373 (er_flags & QR_GUESSNAME))
1374 wprintf("CHECKED ");
1375 wprintf(" OnChange=\""
1376 " if (this.form.type[1].checked == true) { "
1377 " this.form.er_floor.disabled = false; "
1380 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
1382 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1383 if ((er_flags & QR_PRIVATE) &&
1384 (er_flags & QR_PASSWORDED))
1385 wprintf("CHECKED ");
1386 wprintf(" OnChange=\""
1387 " if (this.form.type[2].checked == true) { "
1388 " this.form.er_floor.disabled = false; "
1391 wprintf(_("Private - require password: "));
1392 wprintf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1395 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1396 if ((er_flags & QR_PRIVATE)
1397 && ((er_flags & QR_GUESSNAME) == 0)
1398 && ((er_flags & QR_PASSWORDED) == 0))
1399 wprintf("CHECKED ");
1400 wprintf(" OnChange=\""
1401 " if (this.form.type[3].checked == true) { "
1402 " this.form.er_floor.disabled = false; "
1405 wprintf(_("Private - invitation only"));
1407 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1408 if (er_flags & QR_MAILBOX)
1409 wprintf("CHECKED ");
1410 wprintf (" OnChange=\""
1411 " if (this.form.type[4].checked == true) { "
1412 " this.form.er_floor.disabled = true; "
1415 wprintf(_("Personal (mailbox for you only)"));
1417 wprintf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1419 wprintf(_("If private, cause current users to forget room"));
1421 wprintf("\n</ul>\n");
1423 wprintf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1424 if (er_flags & QR_PREFONLY)
1425 wprintf("CHECKED ");
1427 wprintf(_("Preferred users only"));
1429 wprintf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1430 if (er_flags & QR_READONLY)
1431 wprintf("CHECKED ");
1433 wprintf(_("Read-only room"));
1435 wprintf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1436 if (er_flags2 & QR2_COLLABDEL)
1437 wprintf("CHECKED ");
1439 wprintf(_("All users allowed to post may also delete messages"));
1441 /** directory stuff */
1442 wprintf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1443 if (er_flags & QR_DIRECTORY)
1444 wprintf("CHECKED ");
1446 wprintf(_("File directory room"));
1448 wprintf("\n<ul><li>");
1449 wprintf(_("Directory name: "));
1450 wprintf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1453 wprintf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1454 if (er_flags & QR_UPLOAD)
1455 wprintf("CHECKED ");
1457 wprintf(_("Uploading allowed"));
1459 wprintf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1460 if (er_flags & QR_DOWNLOAD)
1461 wprintf("CHECKED ");
1463 wprintf(_("Downloading allowed"));
1465 wprintf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1466 if (er_flags & QR_VISDIR)
1467 wprintf("CHECKED ");
1469 wprintf(_("Visible directory"));
1472 /** end of directory stuff */
1474 wprintf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1475 if (er_flags & QR_NETWORK)
1476 wprintf("CHECKED ");
1478 wprintf(_("Network shared room"));
1480 wprintf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1481 if (er_flags & QR_PERMANENT)
1482 wprintf("CHECKED ");
1484 wprintf(_("Permanent (does not auto-purge)"));
1486 wprintf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1487 if (er_flags2 & QR2_SUBJECTREQ)
1488 wprintf("CHECKED ");
1490 wprintf(_("Subject Required (Force users to specify a message subject)"));
1492 /** start of anon options */
1495 wprintf(_("Anonymous messages"));
1498 wprintf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1499 if (((er_flags & QR_ANONONLY) == 0)
1500 && ((er_flags & QR_ANONOPT) == 0))
1501 wprintf("CHECKED ");
1503 wprintf(_("No anonymous messages"));
1505 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1506 if (er_flags & QR_ANONONLY)
1507 wprintf("CHECKED ");
1509 wprintf(_("All messages are anonymous"));
1511 wprintf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1512 if (er_flags & QR_ANONOPT)
1513 wprintf("CHECKED ");
1515 wprintf(_("Prompt user when entering messages"));
1518 /* end of anon options */
1521 wprintf(_("Room aide: "));
1523 serv_getln(buf, sizeof buf);
1524 if (buf[0] != '2') {
1525 wprintf("<em>%s</em>\n", &buf[4]);
1527 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1528 wprintf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1531 wprintf("</ul><CENTER>\n");
1532 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1533 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1535 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1545 /* Sharing the room with other Citadel nodes... */
1546 if (!strcmp(tab, "sharing")) {
1547 wprintf("<div class=\"tabcontent\">");
1549 shared_with = strdup("");
1550 not_shared_with = strdup("");
1552 /** Learn the current configuration */
1553 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1554 serv_getln(buf, sizeof buf);
1555 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1556 extract_token(node, buf, 0, '|', sizeof node);
1557 not_shared_with = realloc(not_shared_with,
1558 strlen(not_shared_with) + 32);
1559 strcat(not_shared_with, node);
1560 strcat(not_shared_with, "\n");
1564 serv_getln(buf, sizeof buf);
1565 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1566 extract_token(cmd, buf, 0, '|', sizeof cmd);
1567 extract_token(node, buf, 1, '|', sizeof node);
1568 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1569 if (!strcasecmp(cmd, "ignet_push_share")) {
1570 shared_with = realloc(shared_with,
1571 strlen(shared_with) + 32);
1572 strcat(shared_with, node);
1573 if (!IsEmptyStr(remote_room)) {
1574 strcat(shared_with, "|");
1575 strcat(shared_with, remote_room);
1577 strcat(shared_with, "\n");
1581 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1582 extract_token(buf, shared_with, i, '\n', sizeof buf);
1583 extract_token(node, buf, 0, '|', sizeof node);
1584 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1585 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1586 if (!strcasecmp(node, cmd)) {
1587 remove_token(not_shared_with, j, '\n');
1592 /* Display the stuff */
1593 wprintf("<CENTER><br />"
1594 "<table border=1 cellpadding=5><tr>"
1596 wprintf(_("Shared with"));
1597 wprintf("</I></B></td>"
1599 wprintf(_("Not shared with"));
1600 wprintf("</I></B></td></tr>\n"
1601 "<tr><td VALIGN=TOP>\n");
1603 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1604 wprintf(_("Remote node name"));
1605 wprintf("</td><td>");
1606 wprintf(_("Remote room name"));
1607 wprintf("</td><td>");
1608 wprintf(_("Actions"));
1609 wprintf("</td></tr>\n");
1611 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1612 extract_token(buf, shared_with, i, '\n', sizeof buf);
1613 extract_token(node, buf, 0, '|', sizeof node);
1614 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1615 if (!IsEmptyStr(node)) {
1616 wprintf("<form method=\"POST\" action=\"netedit\">");
1617 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1618 wprintf("<tr><td>%s</td>\n", node);
1621 if (!IsEmptyStr(remote_room)) {
1622 escputs(remote_room);
1628 wprintf("<input type=\"hidden\" NAME=\"line\" "
1629 "VALUE=\"ignet_push_share|");
1631 if (!IsEmptyStr(remote_room)) {
1633 urlescputs(remote_room);
1636 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1637 wprintf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1638 wprintf("<input type=\"submit\" "
1639 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1640 wprintf("</td></tr></form>\n");
1644 wprintf("</table>\n");
1645 wprintf("</td><td VALIGN=TOP>\n");
1646 wprintf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1647 wprintf(_("Remote node name"));
1648 wprintf("</td><td>");
1649 wprintf(_("Remote room name"));
1650 wprintf("</td><td>");
1651 wprintf(_("Actions"));
1652 wprintf("</td></tr>\n");
1654 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1655 extract_token(node, not_shared_with, i, '\n', sizeof node);
1656 if (!IsEmptyStr(node)) {
1657 wprintf("<form method=\"POST\" action=\"netedit\">");
1658 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1659 wprintf("<tr><td>");
1662 "<input type=\"INPUT\" "
1666 wprintf("<input type=\"hidden\" "
1668 "VALUE=\"ignet_push_share|");
1671 wprintf("<input type=\"hidden\" NAME=\"tab\" "
1672 "VALUE=\"sharing\">\n");
1673 wprintf("<input type=\"hidden\" NAME=\"cmd\" "
1674 "VALUE=\"add\">\n");
1675 wprintf("<input type=\"submit\" "
1676 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1677 wprintf("</td></tr></form>\n");
1681 wprintf("</table>\n");
1682 wprintf("</td></tr>"
1683 "</table></CENTER><br />\n"
1684 "<I><B>%s</B><ul><li>", _("Notes:"));
1685 wprintf(_("When sharing a room, "
1686 "it must be shared from both ends. Adding a node to "
1687 "the 'shared' list sends messages out, but in order to"
1688 " receive messages, the other nodes must be configured"
1689 " to send messages out to your system as well. "
1690 "<li>If the remote room name is blank, it is assumed "
1691 "that the room name is identical on the remote node."
1692 "<li>If the remote room name is different, the remote "
1693 "node must also configure the name of the room here."
1700 /* Mailing list management */
1701 if (!strcmp(tab, "listserv")) {
1702 room_states RoomFlags;
1703 wprintf("<div class=\"tabcontent\">");
1705 wprintf("<br /><center>"
1706 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1707 "<tr><td VALIGN=TOP>");
1709 wprintf(_("<i>The contents of this room are being "
1710 "mailed <b>as individual messages</b> "
1711 "to the following list recipients:"
1712 "</i><br /><br />\n"));
1715 serv_getln(buf, sizeof buf);
1716 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1717 extract_token(cmd, buf, 0, '|', sizeof cmd);
1718 if (!strcasecmp(cmd, "listrecp")) {
1719 extract_token(recp, buf, 1, '|', sizeof recp);
1722 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line=listrecp|");
1725 wprintf(_("(remove)"));
1726 wprintf("</A><br />");
1729 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1730 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1731 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1732 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1733 wprintf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1734 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1735 wprintf("</form>\n");
1737 wprintf("</td><td VALIGN=TOP>\n");
1739 wprintf(_("<i>The contents of this room are being "
1740 "mailed <b>in digest form</b> "
1741 "to the following list recipients:"
1742 "</i><br /><br />\n"));
1745 serv_getln(buf, sizeof buf);
1746 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1747 extract_token(cmd, buf, 0, '|', sizeof cmd);
1748 if (!strcasecmp(cmd, "digestrecp")) {
1749 extract_token(recp, buf, 1, '|', sizeof recp);
1752 wprintf(" <a href=\"netedit&cmd=remove&tab=listserv&line="
1756 wprintf(_("(remove)"));
1757 wprintf("</A><br />");
1760 wprintf("<br /><form method=\"POST\" action=\"netedit\">\n"
1761 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1762 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1763 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1764 wprintf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1765 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1766 wprintf("</form>\n");
1768 wprintf("</td></tr></table>\n");
1770 /** Pop open an address book -- begin **/
1771 wprintf("<div align=right>"
1772 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1774 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1779 _("Add recipients from Contacts or other address books"),
1780 _("Add recipients from Contacts or other address books")
1782 /* Pop open an address book -- end **/
1784 wprintf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1786 get_roomflags (&RoomFlags);
1788 /* Self Service subscription? */
1789 wprintf("<table><tr><td>\n");
1790 wprintf(_("Allow self-service subscribe/unsubscribe requests."));
1791 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1792 " <tr><td colspan=\"2\">\n",
1793 (is_selflist(&RoomFlags))?"checked":"");
1794 wprintf(_("The URL for subscribe/unsubscribe is: "));
1795 wprintf("<TT>%s://%s/listsub</TT></td></tr>\n",
1796 (is_https ? "https" : "http"),
1798 /* Public posting? */
1799 wprintf("<tr><td>");
1800 wprintf(_("Allow non-subscribers to mail to this room."));
1801 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1802 (is_publiclist(&RoomFlags))?"checked":"");
1804 /* Moderated List? */
1805 wprintf("<tr><td>");
1806 wprintf(_("Room post publication needs Aide permission."));
1807 wprintf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1808 (is_moderatedlist(&RoomFlags))?"checked":"");
1811 wprintf("<tr><td colspan=\"2\" align=\"center\">"
1812 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1813 wprintf("</table></form>");
1816 wprintf("</CENTER>\n");
1821 /* Configuration of The Dreaded Auto-Purger */
1822 if (!strcmp(tab, "expire")) {
1823 wprintf("<div class=\"tabcontent\">");
1825 serv_puts("GPEX room");
1826 serv_getln(buf, sizeof buf);
1827 if (!strncmp(buf, "550", 3)) {
1828 wprintf("<br><br><div align=center>%s</div><br><br>\n",
1829 _("Higher access is required to access this function.")
1832 else if (buf[0] != '2') {
1833 wprintf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1836 roompolicy = extract_int(&buf[4], 0);
1837 roomvalue = extract_int(&buf[4], 1);
1839 serv_puts("GPEX floor");
1840 serv_getln(buf, sizeof buf);
1841 if (buf[0] == '2') {
1842 floorpolicy = extract_int(&buf[4], 0);
1843 floorvalue = extract_int(&buf[4], 1);
1846 wprintf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1847 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1848 wprintf("<table border=0 cellspacing=5>\n");
1849 wprintf("<tr><td>");
1850 wprintf(_("Message expire policy for this room"));
1852 escputs(ChrPtr(WC->wc_roomname));
1853 wprintf(")</td><td>");
1854 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1855 ((roompolicy == 0) ? "CHECKED" : "") );
1856 wprintf(_("Use the default policy for this floor"));
1857 wprintf("<br />\n");
1858 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1859 ((roompolicy == 1) ? "CHECKED" : "") );
1860 wprintf(_("Never automatically expire messages"));
1861 wprintf("<br />\n");
1862 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1863 ((roompolicy == 2) ? "CHECKED" : "") );
1864 wprintf(_("Expire by message count"));
1865 wprintf("<br />\n");
1866 wprintf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1867 ((roompolicy == 3) ? "CHECKED" : "") );
1868 wprintf(_("Expire by message age"));
1870 wprintf(_("Number of messages or days: "));
1871 wprintf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1872 wprintf("</td></tr>\n");
1874 if (WC->axlevel >= 6) {
1875 wprintf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1876 wprintf("<tr><td>");
1877 wprintf(_("Message expire policy for this floor"));
1879 escputs(floorlist[WC->wc_floor]);
1880 wprintf(")</td><td>");
1881 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1882 ((floorpolicy == 0) ? "CHECKED" : "") );
1883 wprintf(_("Use the system default"));
1884 wprintf("<br />\n");
1885 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1886 ((floorpolicy == 1) ? "CHECKED" : "") );
1887 wprintf(_("Never automatically expire messages"));
1888 wprintf("<br />\n");
1889 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1890 ((floorpolicy == 2) ? "CHECKED" : "") );
1891 wprintf(_("Expire by message count"));
1892 wprintf("<br />\n");
1893 wprintf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1894 ((floorpolicy == 3) ? "CHECKED" : "") );
1895 wprintf(_("Expire by message age"));
1897 wprintf(_("Number of messages or days: "));
1898 wprintf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1902 wprintf("<CENTER>\n");
1903 wprintf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1904 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1906 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1907 wprintf("</CENTER></td><tr>\n");
1909 wprintf("</table>\n"
1910 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1918 /* Access controls */
1919 if (!strcmp(tab, "access")) {
1920 wprintf("<div class=\"tabcontent\">");
1925 /* Fetch messages from remote locations */
1926 if (!strcmp(tab, "feeds")) {
1927 wprintf("<div class=\"tabcontent\">");
1930 wprintf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1931 wprintf("</i><br />\n");
1933 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
1934 "<tr class=\"even\"><th>");
1935 wprintf(_("Remote host"));
1936 wprintf("</th><th>");
1937 wprintf(_("User name"));
1938 wprintf("</th><th>");
1939 wprintf(_("Password"));
1940 wprintf("</th><th>");
1941 wprintf(_("Keep messages on server?"));
1942 wprintf("</th><th>");
1943 wprintf(_("Interval"));
1944 wprintf("</th><th> </th></tr>");
1947 serv_getln(buf, sizeof buf);
1949 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1950 extract_token(cmd, buf, 0, '|', sizeof cmd);
1951 if (!strcasecmp(cmd, "pop3client")) {
1952 safestrncpy(recp, &buf[11], sizeof recp);
1955 wprintf("<tr class=\"%s\">",
1956 (bg ? "even" : "odd")
1960 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1965 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1969 wprintf("<td>*****</td>"); /* Don't show the password */
1971 wprintf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1973 wprintf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1975 wprintf("<td class=\"button_link\">");
1976 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=pop3client|");
1979 wprintf(_("(remove)"));
1980 wprintf("</a></td>");
1986 wprintf("<form method=\"POST\" action=\"netedit\">\n"
1988 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1989 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1990 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1992 wprintf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1995 wprintf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1998 wprintf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2001 wprintf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2004 wprintf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2007 wprintf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2008 wprintf("</td></tr>");
2009 wprintf("</form></table>\n");
2014 wprintf(_("Fetch the following RSS feeds and store them in this room:"));
2015 wprintf("</i><br />\n");
2017 wprintf("<table class=\"altern\" border=0 cellpadding=5>"
2018 "<tr class=\"even\"><th>");
2019 wprintf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2020 wprintf(_("Feed URL"));
2021 wprintf("</th><th>");
2022 wprintf("</th></tr>");
2025 serv_getln(buf, sizeof buf);
2027 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2028 extract_token(cmd, buf, 0, '|', sizeof cmd);
2029 if (!strcasecmp(cmd, "rssclient")) {
2030 safestrncpy(recp, &buf[10], sizeof recp);
2033 wprintf("<tr class=\"%s\">",
2034 (bg ? "even" : "odd")
2038 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2042 wprintf("<td class=\"button_link\">");
2043 wprintf(" <a href=\"netedit&cmd=remove&tab=feeds&line=rssclient|");
2046 wprintf(_("(remove)"));
2047 wprintf("</a></td>");
2053 wprintf("<form method=\"POST\" action=\"netedit\">\n"
2055 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2056 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2057 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2059 wprintf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2060 "maxlength=\"256\" name=\"line_pop3host\">\n");
2063 wprintf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2064 wprintf("</td></tr>");
2065 wprintf("</form></table>\n");
2071 /* end content of whatever tab is open now */
2072 wprintf("</div>\n");
2074 address_book_popup();
2080 * Toggle self-service list subscription
2082 void toggle_self_service(void) {
2083 room_states RoomFlags;
2085 get_roomflags (&RoomFlags);
2087 if (yesbstr("QR2_SelfList"))
2088 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2090 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2092 if (yesbstr("QR2_SMTP_PUBLIC"))
2093 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2095 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2097 if (yesbstr("QR2_Moderated"))
2098 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2100 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2101 if (yesbstr("QR2_SubsOnly"))
2102 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2104 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2106 set_roomflags (&RoomFlags);
2114 * save new parameters for a room
2121 StrBuf *er_password;
2123 StrBuf *er_roomaide;
2126 int er_listingorder;
2132 if (!havebstr("ok_button")) {
2133 strcpy(WC->ImportantMessage,
2134 _("Cancelled. Changes were not saved."));
2140 StrBuf_ServGetln(Buf);
2141 if (GetServerStatus(Buf, NULL) != 2) {
2142 StrBufCutLeft(Buf, 4);
2143 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2148 StrBufCutLeft(Buf, 4);
2149 StrBufExtract_token(er_name, Buf, 0, '|');
2150 StrBufExtract_token(er_password, Buf, 1, '|');
2151 StrBufExtract_token(er_dirname, Buf, 2, '|');
2152 er_flags = StrBufExtract_int(Buf, 3, '|');
2153 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2154 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2155 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2157 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2158 if (StrLength(er_roomaide) == 0) {
2160 StrBuf_ServGetln(Buf);
2161 if (GetServerStatus(Buf, NULL) != 2) {
2162 FlushStrBuf(er_roomaide);
2164 StrBufCutLeft(Buf, 4);
2165 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2168 Ptr = sbstr("er_name");
2169 if (StrLength(Ptr) > 0) {
2170 FlushStrBuf(er_name);
2171 StrBufAppendBuf(er_name, Ptr, 0);
2174 Ptr = sbstr("er_password");
2175 if (StrLength(Ptr) > 0) {
2176 FlushStrBuf(er_password);
2177 StrBufAppendBuf(er_password, Ptr, 0);
2181 Ptr = sbstr("er_dirname");
2182 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2183 FlushStrBuf(er_dirname);
2184 StrBufAppendBuf(er_dirname, Ptr, 0);
2188 Ptr = sbstr("type");
2189 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2191 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2192 er_flags |= (QR_PRIVATE);
2194 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2195 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2197 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2198 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2200 if (!strcmp(ChrPtr(Ptr), "personal")) {
2201 er_flags |= QR_MAILBOX;
2203 er_flags &= ~QR_MAILBOX;
2206 if (yesbstr("prefonly")) {
2207 er_flags |= QR_PREFONLY;
2209 er_flags &= ~QR_PREFONLY;
2212 if (yesbstr("readonly")) {
2213 er_flags |= QR_READONLY;
2215 er_flags &= ~QR_READONLY;
2219 if (yesbstr("collabdel")) {
2220 er_flags2 |= QR2_COLLABDEL;
2222 er_flags2 &= ~QR2_COLLABDEL;
2225 if (yesbstr("permanent")) {
2226 er_flags |= QR_PERMANENT;
2228 er_flags &= ~QR_PERMANENT;
2231 if (yesbstr("subjectreq")) {
2232 er_flags2 |= QR2_SUBJECTREQ;
2234 er_flags2 &= ~QR2_SUBJECTREQ;
2237 if (yesbstr("network")) {
2238 er_flags |= QR_NETWORK;
2240 er_flags &= ~QR_NETWORK;
2243 if (yesbstr("directory")) {
2244 er_flags |= QR_DIRECTORY;
2246 er_flags &= ~QR_DIRECTORY;
2249 if (yesbstr("ulallowed")) {
2250 er_flags |= QR_UPLOAD;
2252 er_flags &= ~QR_UPLOAD;
2255 if (yesbstr("dlallowed")) {
2256 er_flags |= QR_DOWNLOAD;
2258 er_flags &= ~QR_DOWNLOAD;
2261 if (yesbstr("visdir")) {
2262 er_flags |= QR_VISDIR;
2264 er_flags &= ~QR_VISDIR;
2267 Ptr = sbstr("anon");
2269 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2270 if (!strcmp(ChrPtr(Ptr), "anononly"))
2271 er_flags |= QR_ANONONLY;
2272 if (!strcmp(ChrPtr(Ptr), "anon2"))
2273 er_flags |= QR_ANONOPT;
2275 bump = yesbstr("bump");
2277 er_floor = ibstr("er_floor");
2279 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2281 ChrPtr(er_password),
2290 StrBuf_ServGetln(Buf);
2291 if (GetServerStatus(Buf, NULL) != 2) {
2292 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2295 FreeStrBuf(&er_name);
2296 FreeStrBuf(&er_password);
2297 FreeStrBuf(&er_dirname);
2298 FreeStrBuf(&er_roomaide);
2303 if (StrLength(er_roomaide) > 0) {
2304 serv_printf("SETA %s", ChrPtr(er_roomaide));
2305 StrBuf_ServGetln(Buf);
2306 if (GetServerStatus(Buf, NULL) != 2) {
2307 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2308 display_main_menu();
2310 FreeStrBuf(&er_name);
2311 FreeStrBuf(&er_password);
2312 FreeStrBuf(&er_dirname);
2313 FreeStrBuf(&er_roomaide);
2318 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2321 FreeStrBuf(&er_name);
2322 FreeStrBuf(&er_password);
2323 FreeStrBuf(&er_dirname);
2324 FreeStrBuf(&er_roomaide);
2330 * Display form for Invite, Kick, and show Who Knows a room
2332 void do_invt_kick(void) {
2333 char buf[SIZ], room[SIZ], username[SIZ];
2336 serv_getln(buf, sizeof buf);
2338 if (buf[0] != '2') {
2342 extract_token(room, &buf[4], 0, '|', sizeof room);
2344 strcpy(username, bstr("username"));
2346 if (havebstr("kick_button")) {
2347 sprintf(buf, "KICK %s", username);
2349 serv_getln(buf, sizeof buf);
2351 if (buf[0] != '2') {
2352 strcpy(WC->ImportantMessage, &buf[4]);
2354 sprintf(WC->ImportantMessage,
2355 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2360 if (havebstr("invite_button")) {
2361 sprintf(buf, "INVT %s", username);
2363 serv_getln(buf, sizeof buf);
2365 if (buf[0] != '2') {
2366 strcpy(WC->ImportantMessage, &buf[4]);
2368 sprintf(WC->ImportantMessage,
2369 _("<B><I>User %s invited to room %s.</I></B>\n"),
2380 * Display form for Invite, Kick, and show Who Knows a room
2382 void display_whok(void)
2384 char buf[SIZ], room[SIZ], username[SIZ];
2387 serv_getln(buf, sizeof buf);
2389 if (buf[0] != '2') {
2393 extract_token(room, &buf[4], 0, '|', sizeof room);
2396 wprintf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2397 wprintf(_("The users listed below have access to this room. "
2398 "To remove a user from the access list, select the user "
2399 "name from the list and click 'Kick'."));
2400 wprintf("<br /><br />");
2402 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2403 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2404 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2405 wprintf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2407 serv_getln(buf, sizeof buf);
2408 if (buf[0] == '1') {
2409 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2410 extract_token(username, buf, 0, '|', sizeof username);
2411 wprintf("<OPTION>");
2416 wprintf("</select><br />\n");
2418 wprintf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2419 wprintf("</form></CENTER>\n");
2421 wprintf("</td><td>");
2422 wprintf(_("To grant another user access to this room, enter the "
2423 "user name in the box below and click 'Invite'."));
2424 wprintf("<br /><br />");
2426 wprintf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2427 wprintf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2428 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2429 wprintf(_("Invite:"));
2431 wprintf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2432 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2433 "<input type=\"submit\" value=\"%s\">"
2434 "</form></CENTER>\n", _("Invite"));
2435 /* Pop open an address book -- begin **/
2437 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2439 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2442 _("Users"), _("Users")
2444 /* Pop open an address book -- end **/
2446 wprintf("</td></tr></table>\n");
2447 address_book_popup();
2454 * display the form for entering a new room
2456 void display_entroom(void)
2461 serv_puts("CRE8 0");
2462 serv_getln(buf, sizeof buf);
2464 if (buf[0] != '2') {
2465 strcpy(WC->ImportantMessage, &buf[4]);
2466 display_main_menu();
2470 output_headers(1, 1, 1, 0, 0, 0);
2472 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2473 do_template("beginbox", NULL);
2475 wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2476 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2478 wprintf("<table class=\"altern\"> ");
2480 wprintf("<tr class=\"even\"><td>");
2481 wprintf(_("Name of room: "));
2482 wprintf("</td><td>");
2483 wprintf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2484 wprintf("</td></tr>");
2486 wprintf("<tr class=\"odd\"><td>");
2487 wprintf(_("Resides on floor: "));
2488 wprintf("</td><td>");
2490 wprintf("<select name=\"er_floor\" size=\"1\">\n");
2491 for (i = 0; i < 128; ++i)
2492 if (!IsEmptyStr(floorlist[i])) {
2493 wprintf("<option ");
2494 wprintf("value=\"%d\">", i);
2495 escputs(floorlist[i]);
2496 wprintf("</option>\n");
2498 wprintf("</select>\n");
2499 wprintf("</td></tr>");
2502 * Our clever little snippet of JavaScript automatically selects
2503 * a public room if the view is set to Bulletin Board or wiki, and
2504 * it selects a mailbox room otherwise. The user can override this,
2505 * of course. We also disable the floor selector for mailboxes.
2507 wprintf("<tr class=\"even\"><td>");
2508 wprintf(_("Default view for room: "));
2509 wprintf("</td><td>");
2510 wprintf("<select name=\"er_view\" size=\"1\" OnChange=\""
2511 " if ( (this.form.er_view.value == 0) "
2512 " || (this.form.er_view.value == 6) ) { "
2513 " this.form.type[0].checked=true; "
2514 " this.form.er_floor.disabled = false; "
2517 " this.form.type[4].checked=true; "
2518 " this.form.er_floor.disabled = true; "
2521 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2522 if (is_view_allowed_as_default(i)) {
2523 wprintf("<option %s value=\"%d\">",
2524 ((i == 0) ? "selected" : ""), i );
2525 escputs(viewdefs[i]);
2526 wprintf("</option>\n");
2529 wprintf("</select>\n");
2530 wprintf("</td></tr>");
2532 wprintf("<tr class=\"even\"><td>");
2533 wprintf(_("Type of room:"));
2534 wprintf("</td><td>");
2535 wprintf("<ul class=\"adminlist\">\n");
2537 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2538 wprintf("CHECKED OnChange=\""
2539 " if (this.form.type[0].checked == true) { "
2540 " this.form.er_floor.disabled = false; "
2543 wprintf(_("Public (automatically appears to everyone)"));
2546 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2547 " if (this.form.type[1].checked == true) { "
2548 " this.form.er_floor.disabled = false; "
2551 wprintf(_("Private - hidden (accessible to anyone who knows its name)"));
2554 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2555 " if (this.form.type[2].checked == true) { "
2556 " this.form.er_floor.disabled = false; "
2559 wprintf(_("Private - require password: "));
2560 wprintf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2563 wprintf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2564 " if (this.form.type[3].checked == true) { "
2565 " this.form.er_floor.disabled = false; "
2568 wprintf(_("Private - invitation only"));
2571 wprintf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2573 " if (this.form.type[4].checked == true) { "
2574 " this.form.er_floor.disabled = true; "
2577 wprintf(_("Personal (mailbox for you only)"));
2580 wprintf("\n</ul>\n");
2581 wprintf("</td></tr></table>\n");
2583 wprintf("<div class=\"buttons\">\n");
2584 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2586 wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2587 wprintf("</div>\n");
2588 wprintf("</form>\n<hr />");
2589 serv_printf("MESG roomaccess");
2590 serv_getln(buf, sizeof buf);
2591 if (buf[0] == '1') {
2595 do_template("endbox", NULL);
2604 * support function for entroom() -- sets the default view
2606 void er_set_default_view(int newview) {
2619 serv_getln(buf, sizeof buf);
2620 if (buf[0] != '2') return;
2622 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2623 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2624 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2625 rm_bits1 = extract_int(&buf[4], 3);
2626 rm_floor = extract_int(&buf[4], 4);
2627 rm_listorder = extract_int(&buf[4], 5);
2628 rm_bits2 = extract_int(&buf[4], 7);
2630 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2631 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2632 rm_listorder, newview, rm_bits2
2634 serv_getln(buf, sizeof buf);
2645 const StrBuf *er_name;
2646 const StrBuf *er_type;
2647 const StrBuf *er_password;
2652 if (!havebstr("ok_button")) {
2653 strcpy(WC->ImportantMessage,
2654 _("Cancelled. No new room was created."));
2655 display_main_menu();
2658 er_name = sbstr("er_name");
2659 er_type = sbstr("type");
2660 er_password = sbstr("er_password");
2661 er_floor = ibstr("er_floor");
2662 er_view = ibstr("er_view");
2665 if (!strcmp(ChrPtr(er_type), "hidden"))
2667 else if (!strcmp(ChrPtr(er_type), "passworded"))
2669 else if (!strcmp(ChrPtr(er_type), "invonly"))
2671 else if (!strcmp(ChrPtr(er_type), "personal"))
2674 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2677 ChrPtr(er_password),
2682 serv_getln(buf, sizeof buf);
2683 if (buf[0] != '2') {
2684 strcpy(WC->ImportantMessage, &buf[4]);
2685 display_main_menu();
2688 /** TODO: Room created, now udate the left hand icon bar for this user */
2689 burn_folder_cache(0); /* burn the old folder cache */
2693 do_change_view(er_view); /* Now go there */
2698 * \brief display the screen to enter a private room
2700 void display_private(char *rname, int req_pass)
2702 WCTemplputParams SubTP;
2704 output_headers(1, 1, 1, 0, 0, 0);
2706 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2707 memset(&SubTP, 0, sizeof(WCTemplputParams));
2708 SubTP.Filter.ContextType = CTX_STRBUF;
2709 SubTP.Context = Buf;
2710 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2715 wprintf(_("If you know the name of a hidden (guess-name) or "
2716 "passworded room, you can enter that room by typing "
2717 "its name below. Once you gain access to a private "
2718 "room, it will appear in your regular room listings "
2719 "so you don't have to keep returning here."));
2722 wprintf("<form method=\"post\" action=\"goto_private\">\n");
2723 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2725 wprintf("<table class=\"altern\"> "
2726 "<tr class=\"even\"><td>");
2727 wprintf(_("Enter room name:"));
2729 "<input type=\"text\" name=\"gr_name\" "
2730 "value=\"%s\" maxlength=\"128\">\n", rname);
2733 wprintf("</td></tr><tr class=\"odd\"><td>");
2734 wprintf(_("Enter room password:"));
2735 wprintf("</td><td>");
2736 wprintf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2738 wprintf("</td></tr></table>\n");
2740 wprintf("<div class=\"buttons\">\n");
2741 wprintf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2743 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2747 wprintf("</div></form>\n");
2749 do_template("endbox", NULL);
2755 * \brief goto a private room
2757 void goto_private(void)
2762 if (!havebstr("ok_button")) {
2763 display_main_menu();
2766 strcpy(hold_rm, ChrPtr(WC->wc_roomname));
2767 serv_printf("GOTO %s|%s",
2770 serv_getln(buf, sizeof buf);
2772 if (buf[0] == '2') {
2773 smart_goto(sbstr("gr_name"));
2776 if (!strncmp(buf, "540", 3)) {
2777 display_private(bstr("gr_name"), 1);
2780 output_headers(1, 1, 1, 0, 0, 0);
2781 wprintf("%s\n", &buf[4]);
2788 * \brief display the screen to zap a room
2790 void display_zap(void)
2792 output_headers(1, 1, 2, 0, 0, 0);
2794 wprintf("<div id=\"banner\">\n");
2796 wprintf(_("Zap (forget/unsubscribe) the current room"));
2798 wprintf("</div>\n");
2800 wprintf("<div id=\"content\" class=\"service\">\n");
2802 wprintf(_("If you select this option, <em>%s</em> will "
2803 "disappear from your room list. Is this what you wish "
2804 "to do?<br />\n"), ChrPtr(WC->wc_roomname));
2806 wprintf("<form method=\"POST\" action=\"zap\">\n");
2807 wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2808 wprintf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2810 wprintf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2811 wprintf("</form>\n");
2822 StrBuf *final_destination;
2825 * If the forget-room routine fails for any reason, we fall back
2826 * to the current room; otherwise, we go to the Lobby
2828 final_destination = NewStrBufDup(WC->wc_roomname);
2830 if (havebstr("ok_button")) {
2831 serv_printf("GOTO %s", ChrPtr(WC->wc_roomname));
2832 serv_getln(buf, sizeof buf);
2833 if (buf[0] == '2') {
2835 serv_getln(buf, sizeof buf);
2836 if (buf[0] == '2') {
2837 FlushStrBuf(final_destination);
2838 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2842 smart_goto(final_destination);
2843 FreeStrBuf(&final_destination);
2849 * \brief Delete the current room
2851 void delete_room(void)
2856 serv_puts("KILL 1");
2857 serv_getln(buf, sizeof buf);
2858 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2859 if (buf[0] != '2') {
2860 strcpy(WC->ImportantMessage, &buf[4]);
2861 display_main_menu();
2866 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2875 * \brief Perform changes to a room's network configuration
2877 void netedit(void) {
2886 /*/ TODO: do line dynamic! */
2887 if (havebstr("line_pop3host")) {
2888 strcpy(line, bstr("prefix"));
2889 strcat(line, bstr("line_pop3host"));
2891 strcat(line, bstr("line_pop3user"));
2893 strcat(line, bstr("line_pop3pass"));
2895 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2897 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2898 strcat(line, bstr("suffix"));
2900 else if (havebstr("line")) {
2901 strcpy(line, bstr("prefix"));
2902 strcat(line, bstr("line"));
2903 strcat(line, bstr("suffix"));
2918 serv_getln(buf, sizeof buf);
2919 if (buf[0] != '1') {
2925 /** This loop works for add *or* remove. Spiffy, eh? */
2926 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2927 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2928 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2929 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2930 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2931 if ( (strcasecmp(cmpa0, cmpb0))
2932 || (strcasecmp(cmpa1, cmpb1)) ) {
2933 fprintf(fp, "%s\n", buf);
2939 serv_getln(buf, sizeof buf);
2940 if (buf[0] != '4') {
2946 while (fgets(buf, sizeof buf, fp) != NULL) {
2947 buf[strlen(buf)-1] = 0;
2951 if (havebstr("add_button")) {
2952 num_addrs = num_tokens(bstr("line"), ',');
2953 if (num_addrs < 2) {
2954 /* just adding one node or address */
2958 /* adding multiple addresses separated by commas */
2959 for (i=0; i<num_addrs; ++i) {
2960 strcpy(line, bstr("prefix"));
2961 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2964 strcat(line, bstr("suffix"));
2978 * \brief Convert a room name to a folder-ish-looking name.
2979 * \param folder the folderish name
2980 * \param room the room name
2981 * \param floor the floor name
2982 * \param is_mailbox is it a mailbox?
2984 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2989 * For mailboxes, just do it straight...
2992 sprintf(folder, "My folders|%s", room);
2996 * Otherwise, prefix the floor name as a "public folders" moniker
2999 if (floor > MAX_FLOORS) {
3001 sprintf(folder, "%%%%%%|%s", room);
3004 sprintf(folder, "%s|%s", floorlist[floor], room);
3009 * Replace "\" characters with "|" for pseudo-folder-delimiting
3011 len = strlen (folder);
3012 for (i=0; i<len; ++i) {
3013 if (folder[i] == '\\') folder[i] = '|';
3021 * \brief Back end for change_view()
3022 * \param newview set newview???
3024 void do_change_view(int newview) {
3027 serv_printf("VIEW %d", newview);
3028 serv_getln(buf, sizeof buf);
3029 WC->wc_view = newview;
3030 smart_goto(WC->wc_roomname);
3036 * \brief Change the view for this room
3038 void change_view(void) {
3041 view = lbstr("view");
3042 do_change_view(view);
3047 * \brief One big expanded tree list view --- like a folder list
3048 * \param fold the folder to view
3049 * \param max_folders how many folders???
3050 * \param num_floors hom many floors???
3052 void do_folder_view(struct folder *fold, int max_folders, int num_floors) {
3056 int has_subfolders = 0;
3059 parents = malloc(max_folders * sizeof(int));
3061 /** BEGIN TREE MENU */
3062 wprintf("<div id=\"roomlist_div\">Loading folder list...</div>\n");
3064 /** include NanoTree */
3065 wprintf("<script type=\"text/javascript\" src=\"static/nanotree.js\"></script>\n");
3067 /** initialize NanoTree */
3068 wprintf("<script type=\"text/javascript\"> \n"
3069 " showRootNode = false; \n"
3070 " sortNodes = false; \n"
3071 " dragable = false; \n"
3073 " function standardClick(treeNode) { \n"
3076 " var closedGif = 'static/folder_closed.gif'; \n"
3077 " var openGif = 'static/folder_open.gif'; \n"
3079 " rootNode = new TreeNode(1, 'root node - hide'); \n"
3083 for (i=0; i<max_folders; ++i) {
3086 if ((i+1) < max_folders) {
3088 len = strlen(fold[i].name);
3089 if ( (!strncasecmp(fold[i].name, fold[i+1].name, len))
3090 && (fold[i+1].name[len] == '|') ) {
3095 levels = num_tokens(fold[i].name, '|');
3096 parents[levels] = i;
3098 wprintf("var node%d = new TreeNode(%d, '", i, i);
3100 if (fold[i].selectable) {
3101 wprintf("<a href=\"dotgoto?room=");
3102 urlescputs(fold[i].room);
3107 wprintf("<span class=\"roomlist_floor\">");
3109 else if (fold[i].hasnewmsgs) {
3110 wprintf("<span class=\"roomlist_new\">");
3113 wprintf("<span class=\"roomlist_old\">");
3115 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3120 if (has_subfolders) {
3121 wprintf("new Array(closedGif, openGif)");
3123 else if (fold[i].view == VIEW_ADDRESSBOOK) {
3124 wprintf("'static/viewcontacts_16x.gif'");
3126 else if (fold[i].view == VIEW_CALENDAR) {
3127 wprintf("'static/calarea_16x.gif'");
3129 else if (fold[i].view == VIEW_CALBRIEF) {
3130 wprintf("'static/calarea_16x.gif'");
3132 else if (fold[i].view == VIEW_TASKS) {
3133 wprintf("'static/taskmanag_16x.gif'");
3135 else if (fold[i].view == VIEW_NOTES) {
3136 wprintf("'static/storenotes_16x.gif'");
3138 else if (fold[i].view == VIEW_MAILBOX) {
3139 wprintf("'static/privatemess_16x.gif'");
3142 wprintf("'static/chatrooms_16x.gif'");
3145 urlescputs(fold[i].name);
3149 wprintf("rootNode.addChild(node%d);\n", i);
3152 wprintf("node%d.addChild(node%d);\n", parents[levels-1], i);
3156 wprintf("container = document.getElementById('roomlist_div'); \n"
3162 /** END TREE MENU */
3166 * \brief Boxes and rooms and lists ... oh my!
3167 * \param fold the folder to view
3168 * \param max_folders how many folders???
3169 * \param num_floors hom many floors???
3171 void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
3173 char floor_name[256];
3174 char old_floor_name[256];
3175 int levels, oldlevels;
3178 static int columns = 3;
3179 int boxes_per_column = 0;
3180 int current_column = 0;
3183 strcpy(floor_name, "");
3184 strcpy(old_floor_name, "");
3187 while (nf % columns != 0) ++nf;
3188 boxes_per_column = (nf / columns);
3189 if (boxes_per_column < 1) boxes_per_column = 1;
3191 /** Outer table (for columnization) */
3192 wprintf("<table BORDER=0 WIDTH=96%% CELLPADDING=5>"
3193 "<tr><td valign=top>");
3197 for (i=0; i<max_folders; ++i) {
3199 levels = num_tokens(fold[i].name, '|');
3200 extract_token(floor_name, fold[i].name, 0,
3201 '|', sizeof floor_name);
3203 if ( (strcasecmp(floor_name, old_floor_name))
3204 && (!IsEmptyStr(old_floor_name)) ) {
3206 do_template("endbox", NULL);
3210 if ((num_boxes % boxes_per_column) == 0) {
3212 if (current_column < columns) {
3213 wprintf("</td><td valign=top>\n");
3217 strcpy(old_floor_name, floor_name);
3221 WCTemplputParams SubTP;
3223 Buf = NewStrBufPlain(floor_name, -1);
3224 memset(&SubTP, 0, sizeof(WCTemplputParams));
3225 SubTP.Filter.ContextType = CTX_STRBUF;
3226 SubTP.Context = Buf;
3227 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
3236 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3237 if (fold[i].selectable) {
3238 wprintf("<a href=\"dotgoto?room=");
3239 urlescputs(fold[i].room);
3245 if (fold[i].hasnewmsgs) {
3246 wprintf("<span class=\"roomlist_new\">");
3249 wprintf("<span class=\"roomlist_old\">");
3251 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3254 if (fold[i].selectable) {
3260 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3261 wprintf(" (INBOX)");
3263 wprintf("<br />\n");
3266 /** End the final inner box */
3267 do_template("endbox", NULL);
3269 wprintf("</td></tr></table>\n");
3273 * \brief print a floor div???
3274 * \param which_floordiv name of the floordiv???
3276 void set_floordiv_expanded(void) {
3277 wcsession *WCC = WC;
3280 FloorDiv = NewStrBuf();
3281 StrBufAppendBuf(FloorDiv, WCC->UrlFragment2, 0);
3282 set_preference("floordiv_expanded", FloorDiv, 1);
3283 WCC->floordiv_expanded = FloorDiv;
3287 * \brief view the iconbar
3288 * \param fold the folder to view
3289 * \param max_folders how many folders???
3290 * \param num_floors hom many floors???
3292 void do_iconbar_view(struct folder *fold, int max_folders, int num_floors) {
3294 char floor_name[256];
3295 char old_floor_name[256];
3296 char floordivtitle[256];
3297 char floordiv_id[32];
3298 int levels, oldlevels;
3302 strcpy(floor_name, "");
3303 strcpy(old_floor_name, "");
3307 for (i=0; i<max_folders; ++i) {
3309 levels = num_tokens(fold[i].name, '|');
3310 extract_token(floor_name, fold[i].name, 0,
3311 '|', sizeof floor_name);
3313 if ( (strcasecmp(floor_name, old_floor_name))
3314 && (!IsEmptyStr(old_floor_name)) ) {
3315 /** End inner box */
3317 wprintf("</div>\n"); /** floordiv */
3319 strcpy(old_floor_name, floor_name);
3323 stresc(floordivtitle, 256, floor_name, 0, 0);
3324 sprintf(floordiv_id, "floordiv%d", i);
3325 wprintf("<span class=\"ib_roomlist_floor\" "
3326 "onClick=\"expand_floor('%s')\">"
3327 "%s</span><br>\n", floordiv_id, floordivtitle);
3328 wprintf("<div id=\"%s\" style=\"display:%s\">",
3330 (!strcasecmp(floordiv_id, ChrPtr(WC->floordiv_expanded)) ? "block" : "none")
3337 wprintf("<div id=\"roomdiv%d\">", i);
3339 if (levels>2) for (t=0; t<(levels-2); ++t) wprintf(" ");
3341 /** choose the icon */
3342 if (fold[i].view == VIEW_ADDRESSBOOK) {
3343 icon = "viewcontacts_16x.gif" ;
3345 else if (fold[i].view == VIEW_CALENDAR) {
3346 icon = "calarea_16x.gif" ;
3348 else if (fold[i].view == VIEW_CALBRIEF) {
3349 icon = "calarea_16x.gif" ;
3351 else if (fold[i].view == VIEW_TASKS) {
3352 icon = "taskmanag_16x.gif" ;
3354 else if (fold[i].view == VIEW_NOTES) {
3355 icon = "storenotes_16x.gif" ;
3357 else if (fold[i].view == VIEW_MAILBOX) {
3358 icon = "privatemess_16x.gif" ;
3361 icon = "chatrooms_16x.gif" ;
3364 if (fold[i].selectable) {
3365 wprintf("<a href=\"dotgoto?room=");
3366 urlescputs(fold[i].room);
3368 wprintf("<img border=0 src=\"static/%s\" alt=\"\"> ", icon);
3373 if (fold[i].hasnewmsgs) {
3374 wprintf("<span class=\"ib_roomlist_new\">");
3377 wprintf("<span class=\"ib_roomlist_old\">");
3379 extract_token(buf, fold[i].name, levels-1, '|', sizeof buf);
3381 if (!strcasecmp(fold[i].name, "My Folders|Mail")) {
3382 wprintf(" (INBOX)");
3385 if (fold[i].selectable) {
3392 wprintf("</div>\n"); /** roomdiv */
3395 wprintf("</div>\n"); /** floordiv */
3403 * \brief Burn the cached folder list.
3404 * \param age How old the cahce needs to be before we burn it.
3407 void burn_folder_cache(time_t age)
3409 /** If our cached folder list is very old, burn it. */
3410 if (WC->cache_fold != NULL) {
3411 if ((time(NULL) - WC->cache_timestamp) > age) {
3412 free(WC->cache_fold);
3413 WC->cache_fold = NULL;
3422 * \brief Show the room list.
3423 * (only should get called by
3424 * knrooms() because that's where output_headers() is called from)
3425 * \param viewpref the view preferences???
3428 void list_all_rooms_by_floor(const char *viewpref) {
3431 struct folder *fold = NULL;
3433 int max_folders = 0;
3434 int alloc_folders = 0;
3438 int ShowEmptyFloors;
3441 int num_floors = 1; /** add an extra one for private folders */
3444 /** If our cached folder list is very old, burn it. */
3445 burn_folder_cache(300);
3447 /** Can we do the iconbar roomlist from cache? */
3448 if ((WC->cache_fold != NULL) && (!strcasecmp(viewpref, "iconbar"))) {
3449 do_iconbar_view(WC->cache_fold, WC->cache_max_folders, WC->cache_num_floors);
3453 /** Grab the floor table so we know how to build the list... */
3456 /** Start with the mailboxes */
3459 fold = malloc(sizeof(struct folder));
3460 memset(fold, 0, sizeof(struct folder));
3461 strcpy(fold[0].name, "My folders");
3462 fold[0].is_mailbox = 1;
3464 /** Then add floors */
3466 serv_getln(buf, sizeof buf);
3467 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3468 if (max_folders >= alloc_folders) {
3469 alloc_folders = max_folders + 100;
3470 fold = realloc(fold,
3471 alloc_folders * sizeof(struct folder));
3473 memset(&fold[max_folders], 0, sizeof(struct folder));
3474 extract_token(fold[max_folders].name, buf, 1, '|', sizeof fold[max_folders].name);
3475 extract_token(buf3, buf, 0, '|', SIZ);
3476 fold[max_folders].floor = atol (buf3);
3481 for (i=0; i<num_floors; i++)
3482 if (IDMax < fold[i].floor)
3483 IDMax = fold[i].floor;
3484 floor_mapping = malloc (sizeof (int) * (IDMax + 1));
3485 memset (floor_mapping, 0, sizeof (int) * (IDMax + 1));
3486 for (i=0; i<num_floors; i++)
3487 floor_mapping[fold[i].floor]=i;
3489 /** refresh the messages index for this room */
3490 /* TODO serv_puts("GOTO ");
3491 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")); */
3492 /** Now add rooms */
3494 serv_getln(buf, sizeof buf);
3495 if (buf[0]=='1') while(serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
3496 if (max_folders >= alloc_folders) {
3497 alloc_folders = max_folders + 100;
3498 fold = realloc(fold,
3499 alloc_folders * sizeof(struct folder));
3501 memset(&fold[max_folders], 0, sizeof(struct folder));
3502 extract_token(fold[max_folders].room, buf, 0, '|', sizeof fold[max_folders].room);
3503 ra_flags = extract_int(buf, 5);
3504 flags = extract_int(buf, 1);
3505 fold[max_folders].floor = extract_int(buf, 2);
3506 fold[max_folders].hasnewmsgs =
3507 ((ra_flags & UA_HASNEWMSGS) ? 1 : 0 );
3508 if (flags & QR_MAILBOX) {
3509 fold[max_folders].is_mailbox = 1;
3511 fold[max_folders].view = extract_int(buf, 6);
3512 room_to_folder(fold[max_folders].name,
3513 fold[max_folders].room,
3514 fold[max_folders].floor,
3515 fold[max_folders].is_mailbox);
3516 fold[max_folders].selectable = 1;
3517 /* Increase the room count for the associtaed floor */
3518 if (fold[max_folders].is_mailbox) {
3519 fold[0].num_rooms++;
3522 i = floor_mapping[fold[max_folders].floor];
3523 fold[i].num_rooms++;
3529 * Remove any floors that don't have rooms
3531 get_pref_yesno("emptyfloors", &ShowEmptyFloors, 0);
3532 if (ShowEmptyFloors)
3534 for (i=0; i<num_floors; i++)
3536 if (fold[i].num_rooms == 0) {
3537 for (j=i; j<max_folders; j++) {
3538 memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
3547 /** Bubble-sort the folder list */
3548 for (i=0; i<max_folders; ++i) {
3549 for (j=0; j<(max_folders-1)-i; ++j) {
3550 if (fold[j].is_mailbox == fold[j+1].is_mailbox) {
3551 swap = strcasecmp(fold[j].name, fold[j+1].name);
3554 if ( (fold[j+1].is_mailbox)
3555 && (!fold[j].is_mailbox)) {
3563 memcpy(&ftmp, &fold[j], sizeof(struct folder));
3564 memcpy(&fold[j], &fold[j+1],
3565 sizeof(struct folder));
3566 memcpy(&fold[j+1], &ftmp,
3567 sizeof(struct folder));
3573 if (!strcasecmp(viewpref, "folders")) {
3574 do_folder_view(fold, max_folders, num_floors);
3576 else if (!strcasecmp(viewpref, "hackish_view")) {
3577 for (i=0; i<max_folders; ++i) {
3578 escputs(fold[i].name);
3579 wprintf("<br />\n");
3582 else if (!strcasecmp(viewpref, "iconbar")) {
3583 do_iconbar_view(fold, max_folders, num_floors);
3586 do_rooms_view(fold, max_folders, num_floors);
3589 /* Don't free the folder list ... cache it for future use! */
3590 if (WC->cache_fold != NULL) {
3591 free(WC->cache_fold);
3593 WC->cache_fold = fold;
3594 WC->cache_max_folders = max_folders;
3595 WC->cache_num_floors = num_floors;
3596 WC->cache_timestamp = time(NULL);
3597 free(floor_mapping);
3602 * \brief Do either a known rooms list or a folders list, depending on the
3607 StrBuf *ListView = NULL;
3609 output_headers(1, 1, 2, 0, 0, 0);
3611 /** Determine whether the user is trying to change views */
3612 if (havebstr("view")) {
3613 ListView = NewStrBufPlain(bstr("view"), -1);
3614 set_preference("roomlistview", ListView, 1);
3616 /** Sanitize the input so its safe */
3617 if(!get_preference("roomlistview", &ListView) ||
3618 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3619 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3621 if (ListView == NULL) {
3622 ListView = NewStrBufPlain("rooms", sizeof("rooms") - 1);
3623 set_preference("roomlistview", ListView, 0);
3626 StrBufPrintf(ListView, "rooms");
3632 wprintf("<div id=\"banner\">\n");
3633 wprintf("<div class=\"room_banner\">");
3635 if (!strcasecmp(ChrPtr(ListView), "rooms")) {
3636 wprintf(_("Room list"));
3638 else if (!strcasecmp(ChrPtr(ListView), "folders")) {
3639 wprintf(_("Folder list"));
3641 else if (!strcasecmp(ChrPtr(ListView), "table")) {
3642 wprintf(_("Room list"));
3644 wprintf("</h1></div>\n");
3646 /** offer the ability to switch views */
3647 wprintf("<ul class=\"room_actions\">\n");
3648 wprintf("<li class=\"start_page\">");
3649 offer_start_page(NULL, &NoCtx);
3651 wprintf("<li><form name=\"roomlistomatic\">\n"
3652 "<select name=\"newview\" size=\"1\" "
3653 "OnChange=\"location.href=roomlistomatic.newview.options"
3654 "[selectedIndex].value\">\n");
3656 wprintf("<option %s value=\"knrooms&view=rooms\">"
3659 ( !strcasecmp(ChrPtr(ListView), "rooms") ? "SELECTED" : "" )
3662 wprintf("<option %s value=\"knrooms&view=folders\">"
3663 "View as folder list"
3665 ( !strcasecmp(ChrPtr(ListView), "folders") ? "SELECTED" : "" )
3668 wprintf("</select>");
3669 wprintf("</form></li>");
3670 wprintf("</ul></div>\n");
3672 wprintf("<div id=\"content\" class=\"service\">\n");
3674 /** Display the room list in the user's preferred format */
3675 list_all_rooms_by_floor(ChrPtr(ListView));
3682 * \brief Set the message expire policy for this room and/or floor
3684 void set_room_policy(void) {
3687 if (!havebstr("ok_button")) {
3688 strcpy(WC->ImportantMessage,
3689 _("Cancelled. Changes were not saved."));
3694 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3695 serv_getln(buf, sizeof buf);
3696 strcpy(WC->ImportantMessage, &buf[4]);
3698 if (WC->axlevel >= 6) {
3699 strcat(WC->ImportantMessage, "<br />\n");
3700 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3701 serv_getln(buf, sizeof buf);
3702 strcat(WC->ImportantMessage, &buf[4]);
3708 HashList *GetFloorListHash(StrBuf *Target, WCTemplputParams *TP) {
3709 /* todo: check context */
3715 floors = NewHash(1, NULL);
3717 serv_puts("LFLR"); /* get floors */
3718 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err); /* '100', we hope */
3719 if (ChrPtr(Buf)[0] == '1') while(StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(Buf), "000")) {
3721 const char *floorNum;
3722 floor = NewHash(1, NULL);
3723 for(a=0; a<FLOOR_PARAM_LEN; a++) {
3725 StrBufExtract_token(Buf2, Buf, a, '|');
3727 floorNum = ChrPtr(Buf2); /* hmm, should we copy Buf2 first? */
3729 Put(floor, FPKEY(a), Buf2, NULL);
3731 Put(floors, HKEY(floorNum), floor, NULL);
3737 void tmplput_FLOOR_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3740 HashList *floor = (HashList *)(TP->Context);
3742 GetHash(floor, TKEY(0), &value);
3743 val = (StrBuf *)value;
3744 StrECMAEscAppend(TemplBuffer, val, 0);
3746 HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP)
3749 return GetRoomListHash(Target, TP);
3751 HashList *GetRoomListHash(StrBuf *Target, WCTemplputParams *TP)
3753 /* TODO: Check context */
3760 rooms = NewHash(1, NULL);
3761 StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err);
3762 if (ChrPtr(buf)[0] == '1') while(StrBufTCP_read_line(buf, &WC->serv_sock, 0, &Err), strcmp(ChrPtr(buf), "000")) {
3765 room = NewHash(1, NULL);
3766 for(i=0; i<ROOM_PARAM_LEN; i++) {
3768 StrBufExtract_token(buf2, buf, i, '|');
3770 rmName = ChrPtr(buf2);
3772 Put(room, RPKEY(i), buf2, NULL);
3774 Put(rooms, rmName, strlen(rmName), room, NULL);
3776 SortByHashKey(rooms, 1);
3777 /*SortByPayload(rooms, SortRoomsByListOrder); */
3781 /** Unused function that orders rooms by the listorder flag */
3782 int SortRoomsByListOrder(const void *room1, const void *room2)
3786 HashList *r1 = (HashList *)GetSearchPayload(room1);
3787 HashList *r2 = (HashList *)GetSearchPayload(room2);
3788 StrBuf *listOrderBuf1;
3789 StrBuf *listOrderBuf2;
3791 GetHash(r1, RPKEY(3), (void *)&listOrderBuf1);
3792 GetHash(r2, RPKEY(3), (void *)&listOrderBuf2);
3793 l1 = atoi(ChrPtr(listOrderBuf1));
3794 l2 = atoi(ChrPtr(listOrderBuf2));
3795 if (l1 < l2) return -1;
3796 else if (l1 > l2) return +1;
3799 void tmplput_ROOM_Value(StrBuf *TemplBuffer, WCTemplputParams *TP)
3803 HashList *room = (HashList *)(TP->Context);
3805 GetHash(room, TKEY(0), &value);
3806 val = (StrBuf *)value;
3807 StrECMAEscAppend(TemplBuffer, val, 0);
3809 void jsonRoomFlr(void) {
3810 /* Send as our own (application/json) content type */
3811 hprintf("HTTP/1.1 200 OK\r\n");
3812 hprintf("Content-type: application/json; charset=utf-8\r\n");
3813 hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(serv_info.serv_software));
3814 hprintf("Connection: close\r\n");
3815 hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
3817 DoTemplate(HKEY("json_roomflr"),NULL,&NoCtx);
3820 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3822 StrBufAppendTemplate(Target, TP, WC->wc_roomname, 0);
3825 void _gotonext(void) { slrp_highest(); gotonext(); }
3826 void dotskip(void) {smart_goto(sbstr("room"));}
3827 void _display_private(void) { display_private("", 0); }
3828 void dotgoto(void) {
3829 if (WC->wc_view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3832 smart_goto(sbstr("room"));
3835 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3837 wprintf("<div id=\"banner\">\n");
3838 embed_room_banner(NULL, navbar_default);
3839 wprintf("</div>\n");
3843 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3845 wcsession *WCC = WC;
3848 (!IsEmptyStr(WCC->ugname)))
3849 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3853 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3855 wcsession *WCC = WC;
3857 return ((WCC!=NULL) &&
3858 (!IsEmptyStr(WCC->ugname)) &&
3859 (strcasecmp(WCC->ugname, ChrPtr(WCC->wc_roomname)) == 0));
3862 int ConditionalRoomHas_QR_PERMANENT(StrBuf *Target, WCTemplputParams *TP)
3864 wcsession *WCC = WC;
3866 return ((WCC!=NULL) &&
3867 ((WCC->room_flags & QR_PERMANENT) != 0));
3870 int ConditionalRoomHas_QR_INUSE(StrBuf *Target, WCTemplputParams *TP)
3872 wcsession *WCC = WC;
3874 return ((WCC!=NULL) &&
3875 ((WCC->room_flags & QR_INUSE) != 0));
3878 int ConditionalRoomHas_QR_PRIVATE(StrBuf *Target, WCTemplputParams *TP)
3880 wcsession *WCC = WC;
3882 return ((WCC!=NULL) &&
3883 ((WCC->room_flags & QR_PRIVATE) != 0));
3886 int ConditionalRoomHas_QR_PASSWORDED(StrBuf *Target, WCTemplputParams *TP)
3888 wcsession *WCC = WC;
3890 return ((WCC!=NULL) &&
3891 ((WCC->room_flags & QR_PASSWORDED) != 0));
3894 int ConditionalRoomHas_QR_GUESSNAME(StrBuf *Target, WCTemplputParams *TP)
3896 wcsession *WCC = WC;
3898 return ((WCC!=NULL) &&
3899 ((WCC->room_flags & QR_GUESSNAME) != 0));
3902 int ConditionalRoomHas_QR_DIRECTORY(StrBuf *Target, WCTemplputParams *TP)
3904 wcsession *WCC = WC;
3906 return ((WCC!=NULL) &&
3907 ((WCC->room_flags & QR_DIRECTORY) != 0));
3910 int ConditionalRoomHas_QR_UPLOAD(StrBuf *Target, WCTemplputParams *TP)
3912 wcsession *WCC = WC;
3914 return ((WCC!=NULL) &&
3915 ((WCC->room_flags & QR_UPLOAD) != 0));
3918 int ConditionalRoomHas_QR_DOWNLOAD(StrBuf *Target, WCTemplputParams *TP)
3920 wcsession *WCC = WC;
3922 return ((WCC!=NULL) &&
3923 ((WCC->room_flags & QR_DOWNLOAD) != 0));
3926 int ConditionalRoomHas_QR_VISDIR(StrBuf *Target, WCTemplputParams *TP)
3928 wcsession *WCC = WC;
3930 return ((WCC!=NULL) &&
3931 ((WCC->room_flags & QR_VISDIR) != 0));
3934 int ConditionalRoomHas_QR_ANONONLY(StrBuf *Target, WCTemplputParams *TP)
3936 wcsession *WCC = WC;
3938 return ((WCC!=NULL) &&
3939 ((WCC->room_flags & QR_ANONONLY) != 0));
3942 int ConditionalRoomHas_QR_ANONOPT(StrBuf *Target, WCTemplputParams *TP)
3944 wcsession *WCC = WC;
3946 return ((WCC!=NULL) &&
3947 ((WCC->room_flags & QR_ANONOPT) != 0));
3950 int ConditionalRoomHas_QR_NETWORK(StrBuf *Target, WCTemplputParams *TP)
3952 wcsession *WCC = WC;
3954 return ((WCC!=NULL) &&
3955 ((WCC->room_flags & QR_NETWORK) != 0));
3958 int ConditionalRoomHas_QR_PREFONLY(StrBuf *Target, WCTemplputParams *TP)
3960 wcsession *WCC = WC;
3962 return ((WCC!=NULL) &&
3963 ((WCC->room_flags & QR_PREFONLY) != 0));
3966 int ConditionalRoomHas_QR_READONLY(StrBuf *Target, WCTemplputParams *TP)
3968 wcsession *WCC = WC;
3970 return ((WCC!=NULL) &&
3971 ((WCC->room_flags & QR_READONLY) != 0));
3974 int ConditionalRoomHas_QR_MAILBOX(StrBuf *Target, WCTemplputParams *TP)
3976 wcsession *WCC = WC;
3978 return ((WCC!=NULL) &&
3979 ((WCC->room_flags & QR_MAILBOX) != 0));
3983 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3985 wcsession *WCC = WC;
3987 return ( (WCC!= NULL) &&
3988 ((WCC->axlevel >= 6) ||
3989 (WCC->is_room_aide) ||
3990 (WCC->is_mailbox) ));
3997 RegisterPreference(HKEY("roomlistview"),
3998 _("Room list view"),
4001 RegisterPreference(HKEY("emptyfloors"), _("Show empty floors"), PRF_YESNO, NULL);
4003 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
4005 WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
4006 WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, NEED_URL);
4007 WebcitAddUrlHandler(HKEY("skip"), gotonext, NEED_URL);
4008 WebcitAddUrlHandler(HKEY("ungoto"), ungoto, NEED_URL);
4009 WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
4010 WebcitAddUrlHandler(HKEY("dotskip"), dotskip, NEED_URL);
4011 WebcitAddUrlHandler(HKEY("display_private"), _display_private, 0);
4012 WebcitAddUrlHandler(HKEY("goto_private"), goto_private, NEED_URL);
4013 WebcitAddUrlHandler(HKEY("zapped_list"), zapped_list, 0);
4014 WebcitAddUrlHandler(HKEY("display_zap"), display_zap, 0);
4015 WebcitAddUrlHandler(HKEY("zap"), zap, 0);
4016 WebcitAddUrlHandler(HKEY("display_entroom"), display_entroom, 0);
4017 WebcitAddUrlHandler(HKEY("entroom"), entroom, 0);
4018 WebcitAddUrlHandler(HKEY("display_whok"), display_whok, 0);
4019 WebcitAddUrlHandler(HKEY("do_invt_kick"), do_invt_kick, 0);
4020 WebcitAddUrlHandler(HKEY("display_editroom"), display_editroom, 0);
4021 WebcitAddUrlHandler(HKEY("netedit"), netedit, 0);
4022 WebcitAddUrlHandler(HKEY("editroom"), editroom, 0);
4023 WebcitAddUrlHandler(HKEY("delete_room"), delete_room, 0);
4024 WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
4025 WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX);
4026 WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
4027 WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
4028 WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
4029 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
4031 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
4032 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE);
4033 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE);
4034 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE);
4035 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE);
4036 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE);
4037 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE);
4038 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE);
4039 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE);
4040 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE);
4041 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE);
4042 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE);
4043 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE);
4044 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE);
4045 RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE);
4047 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
4048 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
4050 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
4051 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, DeleteHash, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
4052 RegisterNamespace("FLOOR:INFO", 1, 2, tmplput_FLOOR_Value, CTX_FLOORS);
4053 RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, NULL, CTX_ROOMS, CTX_NONE, IT_NOFLAG);
4054 RegisterNamespace("ROOM:INFO", 1, 2, tmplput_ROOM_Value, CTX_ROOMS);