3 * Lots of different room-related operations.
10 char floorlist[MAX_FLOORS][SIZ]; /* list of our floor names */
12 char *viewdefs[9]; /* the different kinds of available views */
14 /* See GetFloorListHash and GetRoomListHash for info on these.
15 * Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys.
18 void display_whok(void);
19 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP);
22 * Initialize the viewdefs with localized strings
24 void initialize_viewdefs(void) {
25 viewdefs[0] = _("Bulletin Board");
26 viewdefs[1] = _("Mail Folder");
27 viewdefs[2] = _("Address Book");
28 viewdefs[3] = _("Calendar");
29 viewdefs[4] = _("Task List");
30 viewdefs[5] = _("Notes List");
31 viewdefs[6] = _("Wiki");
32 viewdefs[7] = _("Calendar List");
33 viewdefs[8] = _("Journal");
37 * Determine which views are allowed as the default for creating a new room.
39 int is_view_allowed_as_default(int which_view)
42 case VIEW_BBS: return(1);
43 case VIEW_MAILBOX: return(1);
44 case VIEW_ADDRESSBOOK: return(1);
45 case VIEW_CALENDAR: return(1);
46 case VIEW_TASKS: return(1);
47 case VIEW_NOTES: return(1);
48 case VIEW_WIKI: return(1);
49 case VIEW_CALBRIEF: return(0);
50 case VIEW_JOURNAL: return(0);
51 default: return(0); /* should never get here */
57 * load the list of floors
59 void load_floorlist(StrBuf *Buf)
63 for (a = 0; a < MAX_FLOORS; ++a)
67 StrBuf_ServGetln(Buf);
68 if (GetServerStatus(Buf, NULL) != 1) {
69 strcpy(floorlist[0], "Main Floor");
72 while (StrBuf_ServGetln(Buf) >= 0) {
73 if ( (StrLength(Buf)==3) &&
74 !strcmp(ChrPtr(Buf), "000")) {
77 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
85 * display rooms in tree structure
87 void room_tree_list(struct roomlisting *rp)
96 room_tree_list(rp->lnext);
98 strcpy(rmname, rp->rlname);
101 wc_printf("<a href=\"dotgoto?room=");
105 escputs1(rmname, 1, 1);
106 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
108 else if (f & QR_DIRECTORY)
110 else if (f & QR_NETWORK)
114 wc_printf("</a><tt> </tt>\n");
116 room_tree_list(rp->rnext);
122 * Room ordering stuff (compare first by floor, then by order)
124 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
126 if ((r1 == NULL) && (r2 == NULL))
132 if (r1->rlfloor < r2->rlfloor)
134 if (r1->rlfloor > r2->rlfloor)
136 if (r1->rlorder < r2->rlorder)
138 if (r1->rlorder > r2->rlorder)
145 * Common code for all room listings
147 void listrms(char *variety)
152 struct roomlisting *rl = NULL;
153 struct roomlisting *rp;
154 struct roomlisting *rs;
156 /* Ask the server for a room list */
158 serv_getln(buf, sizeof buf);
164 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
166 rp = malloc(sizeof(struct roomlisting));
167 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
168 rp->rlflags = extract_int(buf, 1);
169 rp->rlfloor = extract_int(buf, 2);
170 rp->rlorder = extract_int(buf, 3);
179 if (rordercmp(rp, rs) < 0) {
180 if (rs->lnext == NULL) {
187 if (rs->rnext == NULL) {
200 * If no rooms were listed, print an nbsp to make the cell
201 * borders show up anyway.
203 if (num_rooms == 0) wc_printf(" ");
208 * list all forgotten rooms
210 void zapped_list(void)
212 WCTemplputParams SubTP;
215 output_headers(1, 1, 1, 0, 0, 0);
216 memset(&SubTP, 0, sizeof(WCTemplputParams));
217 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
218 SubTP.Filter.ContextType = CTX_STRBUF;
220 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
226 wc_printf("<br /><br />\n");
227 wc_printf(_("Click on any room to un-zap it and goto that room.\n"));
228 do_template("endbox", NULL);
234 * read this room's info file (set v to 1 for verbose mode)
236 void readinfo(StrBuf *Target, WCTemplputParams *TP)
241 int fullinfo_len = 0;
244 serv_getln(buf, sizeof buf);
247 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
248 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
249 strcpy(&fullinfo[fullinfo_len], buf);
250 fullinfo_len += strlen(buf);
254 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
255 strcpy(&briefinfo[50], "...");
257 wc_printf("<div class=\"infos\" "
258 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
262 wc_printf("</div><div id=\"room_infos\" style=\"display:none;\">");
263 wc_printf("<img class=\"close_infos\" "
264 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
265 "src=\"static/closewindow.gif\" alt=\"%s\" width=\"16\" height=\"16\">",
280 * Display room banner icon.
281 * The server doesn't actually need the room name, but we supply it in
282 * order to keep the browser from using a cached icon from another room.
284 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
288 serv_puts("OIMG _roompic_");
289 serv_getln(buf, sizeof buf);
291 wc_printf("<img height=\"64px\" src=\"image?name=_roompic_&room=");
292 urlescputs(ChrPtr(WC->CurRoom.name));
295 serv_getln(buf, sizeof buf);
297 else if (WC->CurRoom.view == VIEW_ADDRESSBOOK) {
298 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
299 "static/viewcontacts_48x.gif"
303 else if ( (WC->CurRoom.view == VIEW_CALENDAR) || (WC->CurRoom.view == VIEW_CALBRIEF) ) {
304 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
305 "static/calarea_48x.gif"
306 "\" width=\"48\" height=\"48\">"
309 else if (WC->CurRoom.view == VIEW_TASKS) {
310 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
311 "static/taskmanag_48x.gif"
312 "\" width=\"48\" height=\"48\">"
315 else if (WC->CurRoom.view == VIEW_NOTES) {
316 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
317 "static/storenotes_48x.gif"
318 "\" width=\"48\" height=\"48\">"
321 else if (WC->CurRoom.view == VIEW_MAILBOX) {
322 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
323 "static/privatemess_48x.gif"
324 "\" width=\"48\" height=\"48\">"
328 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
329 "static/chatrooms_48x.gif"
330 "\" width=\"48\" height=\"48\">"
339 * Display the current view and offer an option to change it
341 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
345 wc_printf("<form name=\"viewomatic\" action=\"changeview\">\n");
346 wc_printf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
347 wc_printf("<label for=\"view_name\">");
348 wc_printf(_("View as:"));
349 wc_printf("</label> "
350 "<select name=\"newview\" size=\"1\" "
351 "id=\"view_name\" class=\"selectbox\" "
352 "OnChange=\"location.href=viewomatic.newview.options"
353 "[selectedIndex].value\">\n");
355 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
357 * Only offer the views that make sense, given the default
358 * view for the room. For example, don't offer a Calendar
359 * view in a non-Calendar room.
362 (i == WC->CurRoom.view)
363 || (i == WC->CurRoom.defview) /* default */
364 || ( (i == 0) && (WC->CurRoom.defview == 1) ) /* mail or bulletin */
365 || ( (i == 1) && (WC->CurRoom.defview == 0) ) /* mail or bulletin */
366 /* || ( (i == 7) && (WC->CurRoom.defview == 3) ) (calendar list temporarily disabled) */
369 wc_printf("<option %s value=\"changeview?view=%d\">",
370 ((i == WC->CurRoom.view) ? "selected" : ""),
372 escputs(viewdefs[i]);
373 wc_printf("</option>\n");
376 wc_printf("</select></div></form>\n");
381 * Display a search box
383 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
385 wc_printf("<form name=\"searchomatic\" action=\"do_search\">\n");
386 wc_printf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
387 wc_printf("<label for=\"srchquery\">");
388 wc_printf(_("Search: "));
389 wc_printf("</label><input ");
390 wc_printf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
391 wc_printf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
393 wc_printf("</div></form>\n");
398 * Embed the room banner
400 * got The information returned from a GOTO server command
401 * navbar_style Determines which navigation buttons to display
405 void embed_room_banner(char *got, int navbar_style) {
409 char with_files[256];
413 * We need to have the information returned by a GOTO server command.
414 * If it isn't supplied, we fake it by issuing our own GOTO.
417 memset(buf, '0', 20);
419 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
420 serv_getln(buf, sizeof buf);
424 /* The browser needs some information for its own use */
425 wc_printf("<script type=\"text/javascript\"> \n"
426 " room_is_trash = %d; \n"
428 ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0)
432 * If the user happens to select the "make this my start page" link,
433 * we want it to remember the URL as a "/dotskip" one instead of
434 * a "skip" or "gotonext" or something like that.
436 if (WCC->Hdr->this_page == NULL) {
437 WCC->Hdr->this_page = NewStrBuf();
439 StrBufPrintf(WCC->Hdr->this_page,
441 ChrPtr(WC->CurRoom.name)
444 /* Check for new mail. */
445 WC->new_mail = extract_int(&got[4], 9);
446 WC->CurRoom.view = extract_int(&got[4], 11);
448 /* Is this a directory room and does it contain files and how many? */
449 if ((WC->CurRoom.QRFlags & QR_DIRECTORY) && (WC->CurRoom.QRFlags & QR_VISDIR))
452 serv_getln(buf2, sizeof buf2);
453 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
455 snprintf (with_files, sizeof with_files,
456 "; <a href=\"do_template?template=files\"> %d %s </a>",
458 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
461 strcpy (with_files, "");
463 svprintf(HKEY("NUMMSGS"), WCS_STRING,
464 _("%d new of %d messages%s"),
465 extract_int(&got[4], 1),
466 extract_int(&got[4], 2),
469 svcallback("ROOMPIC", embed_room_graphic);
470 svcallback("ROOMINFO", readinfo);
471 svcallback("VIEWOMATIC", embed_view_o_matic);
472 svcallback("SEARCHOMATIC", embed_search_o_matic);
473 svcallback("START", offer_start_page);
475 do_template("roombanner", NULL);
476 /* roombanner contains this for mobile */
477 if (navbar_style != navbar_none && (WC->is_mobile < 1)) {
479 wc_printf("<div id=\"navbar\"><ul>");
481 if (navbar_style == navbar_default) wc_printf(
482 "<li class=\"ungoto\">"
483 "<a href=\"ungoto\">"
484 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
485 "<span class=\"navbar_link\">%s</span></A>"
486 "</li>\n", _("Ungoto")
489 if ( (navbar_style == navbar_default) && (WC->CurRoom.view == VIEW_BBS) ) {
491 "<li class=\"newmess\">"
492 "<a href=\"readnew\">"
493 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
494 "<span class=\"navbar_link\">%s</span></A>"
495 "</li>\n", _("Read new messages")
499 if (navbar_style == navbar_default) {
500 switch(WC->CurRoom.view) {
501 case VIEW_ADDRESSBOOK:
503 "<li class=\"viewcontacts\">"
504 "<a href=\"readfwd\">"
505 "<img src=\"static/viewcontacts_24x.gif\" "
506 "alt=\"\" width=\"24\" height=\"24\">"
507 "<span class=\"navbar_link\">"
509 "</span></a></li>\n", _("View contacts")
514 "<li class=\"staskday\">"
515 "<a href=\"readfwd?calview=day\">"
516 "<img src=\"static/taskday2_24x.gif\" "
517 "alt=\"\" width=\"24\" height=\"24\">"
518 "<span class=\"navbar_link\">"
520 "</span></a></li>\n", _("Day view")
523 "<li class=\"monthview\">"
524 "<a href=\"readfwd?calview=month\">"
525 "<img src=\"static/monthview2_24x.gif\" "
526 "alt=\"\" width=\"24\" height=\"24\">"
527 "<span class=\"navbar_link\">"
529 "</span></a></li>\n", _("Month view")
534 "<li class=\"monthview\">"
535 "<a href=\"readfwd?calview=month\">"
536 "<img src=\"static/monthview2_24x.gif\" "
537 "alt=\"\" width=\"24\" height=\"24\">"
538 "<span class=\"navbar_link\">"
540 "</span></a></li>\n", _("Calendar list")
545 "<li class=\"taskmanag\">"
546 "<a href=\"readfwd\">"
547 "<img src=\"static/taskmanag_24x.gif\" "
548 "alt=\"\" width=\"24\" height=\"24\">"
549 "<span class=\"navbar_link\">"
551 "</span></a></li>\n", _("View tasks")
556 "<li class=\"viewnotes\">"
557 "<a href=\"readfwd\">"
558 "<img src=\"static/viewnotes_24x.gif\" "
559 "alt=\"\" width=\"24\" height=\"24\">"
560 "<span class=\"navbar_link\">"
562 "</span></a></li>\n", _("View notes")
567 "<li class=\"readallmess\">"
568 "<a id=\"m_refresh\" href=\"readfwd\">"
569 "<img src=\"static/readallmess3_24x.gif\" "
570 "alt=\"\" width=\"24\" height=\"24\">"
571 "<span class=\"navbar_link\">"
573 "</span></a></li>\n", _("Refresh message list")
578 "<li class=\"readallmess\">"
579 "<a href=\"wiki?page=home\">"
580 "<img src=\"static/readallmess3_24x.gif\" "
581 "alt=\"\" width=\"24\" height=\"24\">"
582 "<span class=\"navbar_link\">"
584 "</span></a></li>\n", _("Wiki home")
589 "<li class=\"readallmess\">"
590 "<a href=\"readfwd\">"
591 "<img src=\"static/readallmess3_24x.gif\" "
592 "alt=\"\" width=\"24\" height=\"24\">"
593 "<span class=\"navbar_link\">"
595 "</span></a></li>\n", _("Read all messages")
601 if (navbar_style == navbar_default) {
602 switch(WC->CurRoom.view) {
603 case VIEW_ADDRESSBOOK:
605 "<li class=\"addnewcontact\">"
606 "<a href=\"display_enter\">"
607 "<img src=\"static/addnewcontact_24x.gif\" "
608 "alt=\"\" width=\"24\" height=\"24\">"
609 "<span class=\"navbar_link\">"
611 "</span></a></li>\n", _("Add new contact")
616 wc_printf("<li class=\"addevent\"><a href=\"display_enter");
617 if (havebstr("year" )) wc_printf("?year=%s", bstr("year"));
618 if (havebstr("month")) wc_printf("?month=%s", bstr("month"));
619 if (havebstr("day" )) wc_printf("?day=%s", bstr("day"));
621 "<img src=\"static/addevent_24x.gif\" "
622 "alt=\"\" width=\"24\" height=\"24\">"
623 "<span class=\"navbar_link\">"
625 "</span></a></li>\n", _("Add new event")
630 "<li class=\"newmess\">"
631 "<a href=\"display_enter\">"
632 "<img src=\"static/newmess3_24x.gif\" "
633 "alt=\"\" width=\"24\" height=\"24\">"
634 "<span class=\"navbar_link\">"
636 "</span></a></li>\n", _("Add new task")
641 "<li class=\"enternewnote\">"
642 "<a href=\"add_new_note\">"
643 "<img src=\"static/enternewnote_24x.gif\" "
644 "alt=\"\" width=\"24\" height=\"24\">"
645 "<span class=\"navbar_link\">"
647 "</span></a></li>\n", _("Add new note")
651 safestrncpy(buf, bstr("page"), sizeof buf);
652 if (IsEmptyStr(buf)) {
653 safestrncpy(buf, "home", sizeof buf);
657 "<li class=\"newmess\">"
658 "<a href=\"display_enter?page=%s\">"
659 "<img src=\"static/newmess3_24x.gif\" "
660 "alt=\"\" width=\"24\" height=\"24\">"
661 "<span class=\"navbar_link\">"
663 "</span></a></li>\n", buf, _("Edit this page")
666 if (bmstrcasestr((char *)ChrPtr(WCC->Hdr->HR.ReqLine), "wiki_history")) {
667 /* already viewing history; display a link to the current page */
669 "<li class=\"newmess\">"
670 "<a href=\"wiki?page=%s\">"
671 "<img src=\"static/newmess3_24x.gif\" "
672 "alt=\"\" width=\"24\" height=\"24\">"
673 "<span class=\"navbar_link\">"
675 "</span></a></li>\n", buf, _("Current version")
679 /* display a link to the history */
681 "<li class=\"newmess\">"
682 "<a href=\"wiki_history?page=%s\">"
683 "<img src=\"static/newmess3_24x.gif\" "
684 "alt=\"\" width=\"24\" height=\"24\">"
685 "<span class=\"navbar_link\">"
687 "</span></a></li>\n", buf, _("History")
693 "<li class=\"newmess\">"
694 "<a href=\"display_enter\">"
695 "<img src=\"static/newmess3_24x.gif\" "
696 "alt=\"\" width=\"24\" height=\"24\">"
697 "<span class=\"navbar_link\">"
699 "</span></a></li>\n", _("Write mail")
702 "<li class=\"newmess\">"
703 "<a href=\"javascript:deleteAllSelectedMessages();\">"
704 "<img src=\"static/delete.gif\" "
705 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
707 "</span></a></li>\n", _("Delete")
712 "<li class=\"newmess\">"
713 "<a href=\"display_enter\">"
714 "<img src=\"static/newmess3_24x.gif\" "
715 "alt=\"\" width=\"24\" height=\"24\">"
716 "<span class=\"navbar_link\">"
718 "</span></a></li>\n", _("Enter a message")
724 if (navbar_style == navbar_default) wc_printf(
725 "<li class=\"skipthisroom\">"
728 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
729 "width=\"24\" height=\"24\">"
730 "<span class=\"navbar_link\">%s</span></a>"
732 _("Leave all messages marked as unread, go to next room with unread messages"),
736 if (navbar_style == navbar_default) wc_printf(
737 "<li class=\"markngo\">"
738 "<a href=\"gotonext\" "
740 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
741 "width=\"24\" height=\"24\">"
742 "<span class=\"navbar_link\">%s</span></a>"
744 _("Mark all messages as read, go to next room with unread messages"),
748 wc_printf("</ul></div>\n");
755 * back end routine to take the session to a new room
757 long gotoroom(const StrBuf *gname)
761 static long ls = (-1L);
764 /* store ungoto information */
765 strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
769 /* move to the new room */
770 serv_printf("GOTO %s", ChrPtr(gname));
771 StrBuf_ServGetln(Buf);
772 if (GetServerStatus(Buf, &err) != 2) {
773 serv_puts("GOTO _BASEROOM_");
774 StrBuf_ServGetln(Buf);
776 * well, we know that this is the fallback case,
777 * but we're interested that the first command
778 * didn't work out in first place.
780 if (GetServerStatus(Buf, NULL) != 2) {
785 ParseGoto(&WCC->CurRoom, Buf);
787 remove_march(WCC->CurRoom.name);
788 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
796 void ParseGoto(folder *room, StrBuf *Line)
804 if (StrLength(Line) < 4) {
808 /* ignore the commandstate... */
809 Pos = ChrPtr(Line) + 4;
811 if (room->RoomNameParts != NULL)
814 for (i=0; i < room->nRoomNameParts; i++)
815 FreeStrBuf(&room->RoomNameParts[i]);
816 free(room->RoomNameParts);
817 room->RoomNameParts = NULL;
822 pBuf = NewStrBufPlain(NULL, StrLength(Line));
825 memset(room, 0, sizeof(folder));
828 StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
830 room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|');
831 if (room->nNewMessages > 0)
832 room->RAFlags |= UA_HASNEWMSGS;
834 room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
836 room->ShowInfo = StrBufExtractNext_long(Line, &Pos, '|');
838 room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
840 room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
841 room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
843 room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
845 flag = StrBufExtractNext_long(Line, &Pos, '|');
846 if (WCC->is_aide || flag) {
847 room->RAFlags |= UA_ADMINALLOWED;
850 room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
852 room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor
854 room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view
856 room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview
858 flag = StrBufExtractNext_long(Line, &Pos, '|');
860 room->RAFlags |= UA_ISTRASH; // wc_is_trash
862 room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2
864 /* find out, whether we are in a sub-room */
865 room->nRoomNameParts = StrBufNum_tokens(room->name, '\\');
866 if (room->nRoomNameParts > 1)
871 room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1));
872 memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1));
873 for (i=0; i < room->nRoomNameParts; i++)
875 room->RoomNameParts[i] = NewStrBuf();
876 StrBufExtract_NextToken(room->RoomNameParts[i],
877 room->name, &Pos, '\\');
881 /* Private mailboxes on the main floor get remapped to the personal folder */
882 if ((room->QRFlags & QR_MAILBOX) &&
883 (room->floorid == 0))
885 room->floorid = VIRTUAL_MY_FLOOR;
886 if ((room->nRoomNameParts == 1) &&
887 (StrLength(room->name) == 4) &&
888 (strcmp(ChrPtr(room->name), "Mail") == 0))
894 /* get a pointer to the floor we're on: */
895 GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
896 room->Floor = (const Floor*) vFloor;
903 void smart_goto(const StrBuf *next_room) {
905 readloop(readnew, eUseDefault);
911 * mark all messages in current room as having been read
913 void slrp_highest(void)
917 serv_puts("SLRP HIGHEST");
918 serv_getln(buf, sizeof buf);
922 typedef struct __room_states {
937 * Set/clear/read the "self-service list subscribe" flag for a room
939 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
940 * returns the new value.
943 int self_service(int newval) {
944 int current_value = 0;
950 int flags, floor, order, view, flags2;
953 serv_getln(buf, sizeof buf);
954 if (buf[0] != '2') return(0);
956 extract_token(name, &buf[4], 0, '|', sizeof name);
957 extract_token(password, &buf[4], 1, '|', sizeof password);
958 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
959 flags = extract_int(&buf[4], 3);
960 floor = extract_int(&buf[4], 4);
961 order = extract_int(&buf[4], 5);
962 view = extract_int(&buf[4], 6);
963 flags2 = extract_int(&buf[4], 7);
965 if (flags2 & QR2_SELFLIST) {
973 flags2 = flags2 | QR2_SELFLIST;
975 else if (newval == 0) {
976 flags2 = flags2 & ~QR2_SELFLIST;
979 return(current_value);
982 if (newval != current_value) {
983 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
984 name, password, dirname, flags,
985 floor, order, view, flags2);
986 serv_getln(buf, sizeof buf);
993 int is_selflist(room_states *RoomFlags)
995 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
998 int is_publiclist(room_states *RoomFlags)
1000 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1003 int is_moderatedlist(room_states *RoomFlags)
1005 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1009 * Set/clear/read the "self-service list subscribe" flag for a room
1011 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1012 * returns the new value.
1015 int get_roomflags(room_states *RoomOps)
1020 serv_getln(buf, sizeof buf);
1021 if (buf[0] != '2') return(0);
1023 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1024 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1025 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1026 RoomOps->flags = extract_int(&buf[4], 3);
1027 RoomOps->floor = extract_int(&buf[4], 4);
1028 RoomOps->order = extract_int(&buf[4], 5);
1029 RoomOps->view = extract_int(&buf[4], 6);
1030 RoomOps->flags2 = extract_int(&buf[4], 7);
1034 int set_roomflags(room_states *RoomOps)
1038 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1047 serv_getln(buf, sizeof buf);
1057 * display the form for editing a room
1059 void display_editroom(void)
1065 char remote_room[128];
1068 char er_password[10];
1069 char er_dirname[15];
1070 char er_roomaide[26];
1077 char *not_shared_with = NULL;
1080 int floorpolicy = 0;
1082 char pop3_host[128];
1087 if (IsEmptyStr(tab)) tab = "admin";
1090 load_floorlist(Buf);
1092 output_headers(1, 1, 1, 0, 0, 0);
1094 wc_printf("<div class=\"fix_scrollbar_bug\">");
1096 wc_printf("<br />\n");
1098 /* print the tabbed dialog */
1099 wc_printf("<div align=\"center\">");
1100 wc_printf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
1101 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1104 wc_printf("<td class=\"");
1105 if (!strcmp(tab, "admin")) {
1106 wc_printf(" tab_cell_label\">");
1107 wc_printf(_("Administration"));
1110 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1111 wc_printf(_("Administration"));
1114 wc_printf("</td>\n");
1115 wc_printf("<td> </td>\n");
1117 if ( ConditionalHaveRoomeditRights(NULL, NULL)) {
1119 wc_printf("<td class=\"");
1120 if (!strcmp(tab, "config")) {
1121 wc_printf(" tab_cell_label\">");
1122 wc_printf(_("Configuration"));
1125 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1126 wc_printf(_("Configuration"));
1129 wc_printf("</td>\n");
1130 wc_printf("<td> </td>\n");
1132 wc_printf("<td class=\"");
1133 if (!strcmp(tab, "expire")) {
1134 wc_printf(" tab_cell_label\">");
1135 wc_printf(_("Message expire policy"));
1138 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1139 wc_printf(_("Message expire policy"));
1142 wc_printf("</td>\n");
1143 wc_printf("<td> </td>\n");
1145 wc_printf("<td class=\"");
1146 if (!strcmp(tab, "access")) {
1147 wc_printf(" tab_cell_label\">");
1148 wc_printf(_("Access controls"));
1151 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1152 wc_printf(_("Access controls"));
1155 wc_printf("</td>\n");
1156 wc_printf("<td> </td>\n");
1158 wc_printf("<td class=\"");
1159 if (!strcmp(tab, "sharing")) {
1160 wc_printf(" tab_cell_label\">");
1161 wc_printf(_("Sharing"));
1164 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1165 wc_printf(_("Sharing"));
1168 wc_printf("</td>\n");
1169 wc_printf("<td> </td>\n");
1171 wc_printf("<td class=\"");
1172 if (!strcmp(tab, "listserv")) {
1173 wc_printf(" tab_cell_label\">");
1174 wc_printf(_("Mailing list service"));
1177 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1178 wc_printf(_("Mailing list service"));
1181 wc_printf("</td>\n");
1182 wc_printf("<td> </td>\n");
1186 wc_printf("<td class=\"");
1187 if (!strcmp(tab, "feeds")) {
1188 wc_printf(" tab_cell_label\">");
1189 wc_printf(_("Remote retrieval"));
1192 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1193 wc_printf(_("Remote retrieval"));
1196 wc_printf("</td>\n");
1197 wc_printf("<td> </td>\n");
1199 wc_printf("</tr></table>\n");
1200 wc_printf("</div>\n");
1201 /* end tabbed dialog */
1203 wc_printf("<script type=\"text/javascript\">"
1204 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1208 /* begin content of whatever tab is open now */
1210 if (!strcmp(tab, "admin")) {
1211 wc_printf("<div class=\"tabcontent\">");
1213 "<li><a href=\"delete_room\" "
1214 "onClick=\"return confirm('");
1215 wc_printf(_("Are you sure you want to delete this room?"));
1216 wc_printf("');\">\n");
1217 wc_printf(_("Delete this room"));
1219 "<li><a href=\"display_editroompic?which_room=");
1220 urlescputs(ChrPtr(WC->CurRoom.name));
1222 wc_printf(_("Set or change the icon for this room's banner"));
1224 "<li><a href=\"display_editinfo\">\n");
1225 wc_printf(_("Edit this room's Info file"));
1228 wc_printf("</div>");
1231 if (!strcmp(tab, "config")) {
1232 wc_printf("<div class=\"tabcontent\">");
1234 serv_getln(buf, sizeof buf);
1236 if (!strncmp(buf, "550", 3)) {
1237 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1238 _("Higher access is required to access this function.")
1241 else if (buf[0] != '2') {
1242 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1245 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1246 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1247 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1248 er_flags = extract_int(&buf[4], 3);
1249 er_floor = extract_int(&buf[4], 4);
1250 er_flags2 = extract_int(&buf[4], 7);
1252 wc_printf("<form method=\"POST\" action=\"editroom\">\n");
1253 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1255 wc_printf("<ul><li>");
1256 wc_printf(_("Name of room: "));
1257 wc_printf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\""ULONG_FMT"\">\n",
1263 wc_printf(_("Resides on floor: "));
1264 wc_printf("<select NAME=\"er_floor\" SIZE=\"1\"");
1265 if (er_flags & QR_MAILBOX)
1266 wc_printf("disabled >\n");
1267 for (i = 0; i < 128; ++i)
1268 if (!IsEmptyStr(floorlist[i])) {
1269 wc_printf("<OPTION ");
1271 wc_printf("SELECTED ");
1272 wc_printf("VALUE=\"%d\">", i);
1273 escputs(floorlist[i]);
1274 wc_printf("</OPTION>\n");
1276 wc_printf("</select>\n");
1279 wc_printf(_("Type of room:"));
1280 wc_printf("<ul>\n");
1282 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1283 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1284 wc_printf("CHECKED ");
1285 wc_printf("OnChange=\""
1286 " if (this.form.type[0].checked == true) { "
1287 " this.form.er_floor.disabled = false; "
1290 wc_printf(_("Public (automatically appears to everyone)"));
1293 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1294 if ((er_flags & QR_PRIVATE) &&
1295 (er_flags & QR_GUESSNAME))
1296 wc_printf("CHECKED ");
1297 wc_printf(" OnChange=\""
1298 " if (this.form.type[1].checked == true) { "
1299 " this.form.er_floor.disabled = false; "
1302 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
1304 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1305 if ((er_flags & QR_PRIVATE) &&
1306 (er_flags & QR_PASSWORDED))
1307 wc_printf("CHECKED ");
1308 wc_printf(" OnChange=\""
1309 " if (this.form.type[2].checked == true) { "
1310 " this.form.er_floor.disabled = false; "
1313 wc_printf(_("Private - require password: "));
1314 wc_printf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1317 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1318 if ((er_flags & QR_PRIVATE)
1319 && ((er_flags & QR_GUESSNAME) == 0)
1320 && ((er_flags & QR_PASSWORDED) == 0))
1321 wc_printf("CHECKED ");
1322 wc_printf(" OnChange=\""
1323 " if (this.form.type[3].checked == true) { "
1324 " this.form.er_floor.disabled = false; "
1327 wc_printf(_("Private - invitation only"));
1329 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1330 if (er_flags & QR_MAILBOX)
1331 wc_printf("CHECKED ");
1332 wc_printf (" OnChange=\""
1333 " if (this.form.type[4].checked == true) { "
1334 " this.form.er_floor.disabled = true; "
1337 wc_printf(_("Personal (mailbox for you only)"));
1339 wc_printf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1341 wc_printf(_("If private, cause current users to forget room"));
1343 wc_printf("\n</ul>\n");
1345 wc_printf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1346 if (er_flags & QR_PREFONLY)
1347 wc_printf("CHECKED ");
1349 wc_printf(_("Preferred users only"));
1351 wc_printf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1352 if (er_flags & QR_READONLY)
1353 wc_printf("CHECKED ");
1355 wc_printf(_("Read-only room"));
1357 wc_printf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1358 if (er_flags2 & QR2_COLLABDEL)
1359 wc_printf("CHECKED ");
1361 wc_printf(_("All users allowed to post may also delete messages"));
1363 /** directory stuff */
1364 wc_printf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1365 if (er_flags & QR_DIRECTORY)
1366 wc_printf("CHECKED ");
1368 wc_printf(_("File directory room"));
1370 wc_printf("\n<ul><li>");
1371 wc_printf(_("Directory name: "));
1372 wc_printf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1375 wc_printf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1376 if (er_flags & QR_UPLOAD)
1377 wc_printf("CHECKED ");
1379 wc_printf(_("Uploading allowed"));
1381 wc_printf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1382 if (er_flags & QR_DOWNLOAD)
1383 wc_printf("CHECKED ");
1385 wc_printf(_("Downloading allowed"));
1387 wc_printf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1388 if (er_flags & QR_VISDIR)
1389 wc_printf("CHECKED ");
1391 wc_printf(_("Visible directory"));
1392 wc_printf("</ul>\n");
1394 /** end of directory stuff */
1396 wc_printf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1397 if (er_flags & QR_NETWORK)
1398 wc_printf("CHECKED ");
1400 wc_printf(_("Network shared room"));
1402 wc_printf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1403 if (er_flags & QR_PERMANENT)
1404 wc_printf("CHECKED ");
1406 wc_printf(_("Permanent (does not auto-purge)"));
1408 wc_printf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1409 if (er_flags2 & QR2_SUBJECTREQ)
1410 wc_printf("CHECKED ");
1412 wc_printf(_("Subject Required (Force users to specify a message subject)"));
1414 /** start of anon options */
1416 wc_printf("\n<li>");
1417 wc_printf(_("Anonymous messages"));
1418 wc_printf("<ul>\n");
1420 wc_printf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1421 if (((er_flags & QR_ANONONLY) == 0)
1422 && ((er_flags & QR_ANONOPT) == 0))
1423 wc_printf("CHECKED ");
1425 wc_printf(_("No anonymous messages"));
1427 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1428 if (er_flags & QR_ANONONLY)
1429 wc_printf("CHECKED ");
1431 wc_printf(_("All messages are anonymous"));
1433 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1434 if (er_flags & QR_ANONOPT)
1435 wc_printf("CHECKED ");
1437 wc_printf(_("Prompt user when entering messages"));
1438 wc_printf("</ul>\n");
1440 /* end of anon options */
1443 wc_printf(_("Room aide: "));
1445 serv_getln(buf, sizeof buf);
1446 if (buf[0] != '2') {
1447 wc_printf("<em>%s</em>\n", &buf[4]);
1449 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1450 wc_printf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1453 wc_printf("</ul><CENTER>\n");
1454 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1455 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1457 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1463 wc_printf("</div>");
1467 /* Sharing the room with other Citadel nodes... */
1468 if (!strcmp(tab, "sharing")) {
1469 wc_printf("<div class=\"tabcontent\">");
1471 shared_with = strdup("");
1472 not_shared_with = strdup("");
1474 /** Learn the current configuration */
1475 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1476 serv_getln(buf, sizeof buf);
1477 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1478 extract_token(node, buf, 0, '|', sizeof node);
1479 not_shared_with = realloc(not_shared_with,
1480 strlen(not_shared_with) + 32);
1481 strcat(not_shared_with, node);
1482 strcat(not_shared_with, "\n");
1486 serv_getln(buf, sizeof buf);
1487 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1488 extract_token(cmd, buf, 0, '|', sizeof cmd);
1489 extract_token(node, buf, 1, '|', sizeof node);
1490 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1491 if (!strcasecmp(cmd, "ignet_push_share")) {
1492 shared_with = realloc(shared_with,
1493 strlen(shared_with) + 32);
1494 strcat(shared_with, node);
1495 if (!IsEmptyStr(remote_room)) {
1496 strcat(shared_with, "|");
1497 strcat(shared_with, remote_room);
1499 strcat(shared_with, "\n");
1503 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1504 extract_token(buf, shared_with, i, '\n', sizeof buf);
1505 extract_token(node, buf, 0, '|', sizeof node);
1506 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1507 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1508 if (!strcasecmp(node, cmd)) {
1509 remove_token(not_shared_with, j, '\n');
1514 /* Display the stuff */
1515 wc_printf("<CENTER><br />"
1516 "<table border=1 cellpadding=5><tr>"
1518 wc_printf(_("Shared with"));
1519 wc_printf("</I></B></td>"
1521 wc_printf(_("Not shared with"));
1522 wc_printf("</I></B></td></tr>\n"
1523 "<tr><td VALIGN=TOP>\n");
1525 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1526 wc_printf(_("Remote node name"));
1527 wc_printf("</td><td>");
1528 wc_printf(_("Remote room name"));
1529 wc_printf("</td><td>");
1530 wc_printf(_("Actions"));
1531 wc_printf("</td></tr>\n");
1533 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1534 extract_token(buf, shared_with, i, '\n', sizeof buf);
1535 extract_token(node, buf, 0, '|', sizeof node);
1536 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1537 if (!IsEmptyStr(node)) {
1538 wc_printf("<form method=\"POST\" action=\"netedit\">");
1539 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1540 wc_printf("<tr><td>%s</td>\n", node);
1543 if (!IsEmptyStr(remote_room)) {
1544 escputs(remote_room);
1550 wc_printf("<input type=\"hidden\" NAME=\"line\" "
1551 "VALUE=\"ignet_push_share|");
1553 if (!IsEmptyStr(remote_room)) {
1555 urlescputs(remote_room);
1558 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1559 wc_printf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1560 wc_printf("<input type=\"submit\" "
1561 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1562 wc_printf("</td></tr></form>\n");
1566 wc_printf("</table>\n");
1567 wc_printf("</td><td VALIGN=TOP>\n");
1568 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1569 wc_printf(_("Remote node name"));
1570 wc_printf("</td><td>");
1571 wc_printf(_("Remote room name"));
1572 wc_printf("</td><td>");
1573 wc_printf(_("Actions"));
1574 wc_printf("</td></tr>\n");
1576 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1577 extract_token(node, not_shared_with, i, '\n', sizeof node);
1578 if (!IsEmptyStr(node)) {
1579 wc_printf("<form method=\"POST\" action=\"netedit\">");
1580 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1581 wc_printf("<tr><td>");
1583 wc_printf("</td><td>"
1584 "<input type=\"INPUT\" "
1588 wc_printf("<input type=\"hidden\" "
1590 "VALUE=\"ignet_push_share|");
1593 wc_printf("<input type=\"hidden\" NAME=\"tab\" "
1594 "VALUE=\"sharing\">\n");
1595 wc_printf("<input type=\"hidden\" NAME=\"cmd\" "
1596 "VALUE=\"add\">\n");
1597 wc_printf("<input type=\"submit\" "
1598 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1599 wc_printf("</td></tr></form>\n");
1603 wc_printf("</table>\n");
1604 wc_printf("</td></tr>"
1605 "</table></CENTER><br />\n"
1606 "<I><B>%s</B><ul><li>", _("Notes:"));
1607 wc_printf(_("When sharing a room, "
1608 "it must be shared from both ends. Adding a node to "
1609 "the 'shared' list sends messages out, but in order to"
1610 " receive messages, the other nodes must be configured"
1611 " to send messages out to your system as well. "
1612 "<li>If the remote room name is blank, it is assumed "
1613 "that the room name is identical on the remote node."
1614 "<li>If the remote room name is different, the remote "
1615 "node must also configure the name of the room here."
1619 wc_printf("</div>");
1622 if (not_shared_with != NULL)
1623 free (not_shared_with);
1625 /* Mailing list management */
1626 if (!strcmp(tab, "listserv")) {
1627 room_states RoomFlags;
1628 wc_printf("<div class=\"tabcontent\">");
1630 wc_printf("<br /><center>"
1631 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1632 "<tr><td VALIGN=TOP>");
1634 wc_printf(_("<i>The contents of this room are being "
1635 "mailed <b>as individual messages</b> "
1636 "to the following list recipients:"
1637 "</i><br /><br />\n"));
1640 serv_getln(buf, sizeof buf);
1641 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1642 extract_token(cmd, buf, 0, '|', sizeof cmd);
1643 if (!strcasecmp(cmd, "listrecp")) {
1644 extract_token(recp, buf, 1, '|', sizeof recp);
1647 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line=listrecp|");
1650 wc_printf(_("(remove)"));
1651 wc_printf("</A><br />");
1654 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1655 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1656 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1657 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1658 wc_printf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1659 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1660 wc_printf("</form>\n");
1662 wc_printf("</td><td VALIGN=TOP>\n");
1664 wc_printf(_("<i>The contents of this room are being "
1665 "mailed <b>in digest form</b> "
1666 "to the following list recipients:"
1667 "</i><br /><br />\n"));
1670 serv_getln(buf, sizeof buf);
1671 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1672 extract_token(cmd, buf, 0, '|', sizeof cmd);
1673 if (!strcasecmp(cmd, "digestrecp")) {
1674 extract_token(recp, buf, 1, '|', sizeof recp);
1677 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line="
1681 wc_printf(_("(remove)"));
1682 wc_printf("</A><br />");
1685 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1686 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1687 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1688 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1689 wc_printf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1690 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1691 wc_printf("</form>\n");
1693 wc_printf("</td></tr></table>\n");
1695 /** Pop open an address book -- begin **/
1696 wc_printf("<div align=right>"
1697 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1699 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1704 _("Add recipients from Contacts or other address books"),
1705 _("Add recipients from Contacts or other address books")
1707 /* Pop open an address book -- end **/
1709 wc_printf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1711 get_roomflags (&RoomFlags);
1713 /* Self Service subscription? */
1714 wc_printf("<table><tr><td>\n");
1715 wc_printf(_("Allow self-service subscribe/unsubscribe requests."));
1716 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1717 " <tr><td colspan=\"2\">\n",
1718 (is_selflist(&RoomFlags))?"checked":"");
1719 wc_printf(_("The URL for subscribe/unsubscribe is: "));
1720 wc_printf("<TT>%s://%s/listsub</TT></td></tr>\n",
1721 (is_https ? "https" : "http"),
1722 ChrPtr(WC->Hdr->HR.http_host));
1723 /* Public posting? */
1724 wc_printf("<tr><td>");
1725 wc_printf(_("Allow non-subscribers to mail to this room."));
1726 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1727 (is_publiclist(&RoomFlags))?"checked":"");
1729 /* Moderated List? */
1730 wc_printf("<tr><td>");
1731 wc_printf(_("Room post publication needs Aide permission."));
1732 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1733 (is_moderatedlist(&RoomFlags))?"checked":"");
1736 wc_printf("<tr><td colspan=\"2\" align=\"center\">"
1737 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1738 wc_printf("</table></form>");
1741 wc_printf("</CENTER>\n");
1742 wc_printf("</div>");
1746 /* Configuration of The Dreaded Auto-Purger */
1747 if (!strcmp(tab, "expire")) {
1748 wc_printf("<div class=\"tabcontent\">");
1750 serv_puts("GPEX room");
1751 serv_getln(buf, sizeof buf);
1752 if (!strncmp(buf, "550", 3)) {
1753 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1754 _("Higher access is required to access this function.")
1757 else if (buf[0] != '2') {
1758 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1761 roompolicy = extract_int(&buf[4], 0);
1762 roomvalue = extract_int(&buf[4], 1);
1764 serv_puts("GPEX floor");
1765 serv_getln(buf, sizeof buf);
1766 if (buf[0] == '2') {
1767 floorpolicy = extract_int(&buf[4], 0);
1768 floorvalue = extract_int(&buf[4], 1);
1771 wc_printf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1772 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1773 wc_printf("<table border=0 cellspacing=5>\n");
1774 wc_printf("<tr><td>");
1775 wc_printf(_("Message expire policy for this room"));
1776 wc_printf("<br />(");
1777 escputs(ChrPtr(WC->CurRoom.name));
1778 wc_printf(")</td><td>");
1779 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1780 ((roompolicy == 0) ? "CHECKED" : "") );
1781 wc_printf(_("Use the default policy for this floor"));
1782 wc_printf("<br />\n");
1783 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1784 ((roompolicy == 1) ? "CHECKED" : "") );
1785 wc_printf(_("Never automatically expire messages"));
1786 wc_printf("<br />\n");
1787 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1788 ((roompolicy == 2) ? "CHECKED" : "") );
1789 wc_printf(_("Expire by message count"));
1790 wc_printf("<br />\n");
1791 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1792 ((roompolicy == 3) ? "CHECKED" : "") );
1793 wc_printf(_("Expire by message age"));
1794 wc_printf("<br />");
1795 wc_printf(_("Number of messages or days: "));
1796 wc_printf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1797 wc_printf("</td></tr>\n");
1799 if (WC->axlevel >= 6) {
1800 wc_printf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1801 wc_printf("<tr><td>");
1802 wc_printf(_("Message expire policy for this floor"));
1803 wc_printf("<br />(");
1804 escputs(floorlist[WC->CurRoom.floorid]);
1805 wc_printf(")</td><td>");
1806 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1807 ((floorpolicy == 0) ? "CHECKED" : "") );
1808 wc_printf(_("Use the system default"));
1809 wc_printf("<br />\n");
1810 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1811 ((floorpolicy == 1) ? "CHECKED" : "") );
1812 wc_printf(_("Never automatically expire messages"));
1813 wc_printf("<br />\n");
1814 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1815 ((floorpolicy == 2) ? "CHECKED" : "") );
1816 wc_printf(_("Expire by message count"));
1817 wc_printf("<br />\n");
1818 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1819 ((floorpolicy == 3) ? "CHECKED" : "") );
1820 wc_printf(_("Expire by message age"));
1821 wc_printf("<br />");
1822 wc_printf(_("Number of messages or days: "));
1823 wc_printf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1827 wc_printf("<CENTER>\n");
1828 wc_printf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1829 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1830 wc_printf(" ");
1831 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1832 wc_printf("</CENTER></td><tr>\n");
1834 wc_printf("</table>\n"
1835 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1840 wc_printf("</div>");
1843 /* Access controls */
1844 if (!strcmp(tab, "access")) {
1845 wc_printf("<div class=\"tabcontent\">");
1847 wc_printf("</div>");
1850 /* Fetch messages from remote locations */
1851 if (!strcmp(tab, "feeds")) {
1852 wc_printf("<div class=\"tabcontent\">");
1855 wc_printf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1856 wc_printf("</i><br />\n");
1858 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1859 "<tr class=\"even\"><th>");
1860 wc_printf(_("Remote host"));
1861 wc_printf("</th><th>");
1862 wc_printf(_("User name"));
1863 wc_printf("</th><th>");
1864 wc_printf(_("Password"));
1865 wc_printf("</th><th>");
1866 wc_printf(_("Keep messages on server?"));
1867 wc_printf("</th><th>");
1868 wc_printf(_("Interval"));
1869 wc_printf("</th><th> </th></tr>");
1872 serv_getln(buf, sizeof buf);
1874 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1875 extract_token(cmd, buf, 0, '|', sizeof cmd);
1876 if (!strcasecmp(cmd, "pop3client")) {
1877 safestrncpy(recp, &buf[11], sizeof recp);
1880 wc_printf("<tr class=\"%s\">",
1881 (bg ? "even" : "odd")
1885 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1890 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1894 wc_printf("<td>*****</td>"); /* Don't show the password */
1896 wc_printf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1898 wc_printf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1900 wc_printf("<td class=\"button_link\">");
1901 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=pop3client|");
1904 wc_printf(_("(remove)"));
1905 wc_printf("</a></td>");
1911 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1913 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1914 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1915 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1917 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1920 wc_printf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1923 wc_printf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1926 wc_printf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1929 wc_printf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
1932 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1933 wc_printf("</td></tr>");
1934 wc_printf("</form></table>\n");
1936 wc_printf("<hr>\n");
1939 wc_printf(_("Fetch the following RSS feeds and store them in this room:"));
1940 wc_printf("</i><br />\n");
1942 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1943 "<tr class=\"even\"><th>");
1944 wc_printf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1945 wc_printf(_("Feed URL"));
1946 wc_printf("</th><th>");
1947 wc_printf("</th></tr>");
1950 serv_getln(buf, sizeof buf);
1952 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1953 extract_token(cmd, buf, 0, '|', sizeof cmd);
1954 if (!strcasecmp(cmd, "rssclient")) {
1955 safestrncpy(recp, &buf[10], sizeof recp);
1958 wc_printf("<tr class=\"%s\">",
1959 (bg ? "even" : "odd")
1963 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1967 wc_printf("<td class=\"button_link\">");
1968 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=rssclient|");
1971 wc_printf(_("(remove)"));
1972 wc_printf("</a></td>");
1978 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1980 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1981 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
1982 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1984 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
1985 "maxlength=\"256\" name=\"line_pop3host\">\n");
1988 wc_printf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
1989 wc_printf("</td></tr>");
1990 wc_printf("</form></table>\n");
1992 wc_printf("</div>");
1996 /* end content of whatever tab is open now */
1997 wc_printf("</div>\n");
1999 address_book_popup();
2005 * Toggle self-service list subscription
2007 void toggle_self_service(void) {
2008 room_states RoomFlags;
2010 get_roomflags (&RoomFlags);
2012 if (yesbstr("QR2_SelfList"))
2013 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2015 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2017 if (yesbstr("QR2_SMTP_PUBLIC"))
2018 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2020 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2022 if (yesbstr("QR2_Moderated"))
2023 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2025 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2026 if (yesbstr("QR2_SubsOnly"))
2027 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2029 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2031 set_roomflags (&RoomFlags);
2039 * save new parameters for a room
2046 StrBuf *er_password;
2048 StrBuf *er_roomaide;
2051 int er_listingorder;
2057 if (!havebstr("ok_button")) {
2058 strcpy(WC->ImportantMessage,
2059 _("Cancelled. Changes were not saved."));
2065 StrBuf_ServGetln(Buf);
2066 if (GetServerStatus(Buf, NULL) != 2) {
2067 StrBufCutLeft(Buf, 4);
2068 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2074 er_name = NewStrBuf();
2075 er_password = NewStrBuf();
2076 er_dirname = NewStrBuf();
2077 er_roomaide = NewStrBuf();
2079 StrBufCutLeft(Buf, 4);
2080 StrBufExtract_token(er_name, Buf, 0, '|');
2081 StrBufExtract_token(er_password, Buf, 1, '|');
2082 StrBufExtract_token(er_dirname, Buf, 2, '|');
2083 er_flags = StrBufExtract_int(Buf, 3, '|');
2084 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2085 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2086 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2088 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2089 if (StrLength(er_roomaide) == 0) {
2091 StrBuf_ServGetln(Buf);
2092 if (GetServerStatus(Buf, NULL) != 2) {
2093 FlushStrBuf(er_roomaide);
2095 StrBufCutLeft(Buf, 4);
2096 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2099 Ptr = sbstr("er_name");
2100 if (StrLength(Ptr) > 0) {
2101 FlushStrBuf(er_name);
2102 StrBufAppendBuf(er_name, Ptr, 0);
2105 Ptr = sbstr("er_password");
2106 if (StrLength(Ptr) > 0) {
2107 FlushStrBuf(er_password);
2108 StrBufAppendBuf(er_password, Ptr, 0);
2112 Ptr = sbstr("er_dirname");
2113 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2114 FlushStrBuf(er_dirname);
2115 StrBufAppendBuf(er_dirname, Ptr, 0);
2119 Ptr = sbstr("type");
2120 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2122 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2123 er_flags |= (QR_PRIVATE);
2125 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2126 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2128 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2129 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2131 if (!strcmp(ChrPtr(Ptr), "personal")) {
2132 er_flags |= QR_MAILBOX;
2134 er_flags &= ~QR_MAILBOX;
2137 if (yesbstr("prefonly")) {
2138 er_flags |= QR_PREFONLY;
2140 er_flags &= ~QR_PREFONLY;
2143 if (yesbstr("readonly")) {
2144 er_flags |= QR_READONLY;
2146 er_flags &= ~QR_READONLY;
2150 if (yesbstr("collabdel")) {
2151 er_flags2 |= QR2_COLLABDEL;
2153 er_flags2 &= ~QR2_COLLABDEL;
2156 if (yesbstr("permanent")) {
2157 er_flags |= QR_PERMANENT;
2159 er_flags &= ~QR_PERMANENT;
2162 if (yesbstr("subjectreq")) {
2163 er_flags2 |= QR2_SUBJECTREQ;
2165 er_flags2 &= ~QR2_SUBJECTREQ;
2168 if (yesbstr("network")) {
2169 er_flags |= QR_NETWORK;
2171 er_flags &= ~QR_NETWORK;
2174 if (yesbstr("directory")) {
2175 er_flags |= QR_DIRECTORY;
2177 er_flags &= ~QR_DIRECTORY;
2180 if (yesbstr("ulallowed")) {
2181 er_flags |= QR_UPLOAD;
2183 er_flags &= ~QR_UPLOAD;
2186 if (yesbstr("dlallowed")) {
2187 er_flags |= QR_DOWNLOAD;
2189 er_flags &= ~QR_DOWNLOAD;
2192 if (yesbstr("visdir")) {
2193 er_flags |= QR_VISDIR;
2195 er_flags &= ~QR_VISDIR;
2198 Ptr = sbstr("anon");
2200 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2201 if (!strcmp(ChrPtr(Ptr), "anononly"))
2202 er_flags |= QR_ANONONLY;
2203 if (!strcmp(ChrPtr(Ptr), "anon2"))
2204 er_flags |= QR_ANONOPT;
2206 bump = yesbstr("bump");
2208 er_floor = ibstr("er_floor");
2210 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2212 ChrPtr(er_password),
2221 StrBuf_ServGetln(Buf);
2222 if (GetServerStatus(Buf, NULL) != 2) {
2223 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2226 FreeStrBuf(&er_name);
2227 FreeStrBuf(&er_password);
2228 FreeStrBuf(&er_dirname);
2229 FreeStrBuf(&er_roomaide);
2234 if (StrLength(er_roomaide) > 0) {
2235 serv_printf("SETA %s", ChrPtr(er_roomaide));
2236 StrBuf_ServGetln(Buf);
2237 if (GetServerStatus(Buf, NULL) != 2) {
2238 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2239 display_main_menu();
2241 FreeStrBuf(&er_name);
2242 FreeStrBuf(&er_password);
2243 FreeStrBuf(&er_dirname);
2244 FreeStrBuf(&er_roomaide);
2249 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2252 FreeStrBuf(&er_name);
2253 FreeStrBuf(&er_password);
2254 FreeStrBuf(&er_dirname);
2255 FreeStrBuf(&er_roomaide);
2261 * Display form for Invite, Kick, and show Who Knows a room
2263 void do_invt_kick(void) {
2264 char buf[SIZ], room[SIZ], username[SIZ];
2267 serv_getln(buf, sizeof buf);
2269 if (buf[0] != '2') {
2273 extract_token(room, &buf[4], 0, '|', sizeof room);
2275 strcpy(username, bstr("username"));
2277 if (havebstr("kick_button")) {
2278 sprintf(buf, "KICK %s", username);
2280 serv_getln(buf, sizeof buf);
2282 if (buf[0] != '2') {
2283 strcpy(WC->ImportantMessage, &buf[4]);
2285 sprintf(WC->ImportantMessage,
2286 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2291 if (havebstr("invite_button")) {
2292 sprintf(buf, "INVT %s", username);
2294 serv_getln(buf, sizeof buf);
2296 if (buf[0] != '2') {
2297 strcpy(WC->ImportantMessage, &buf[4]);
2299 sprintf(WC->ImportantMessage,
2300 _("<B><I>User %s invited to room %s.</I></B>\n"),
2311 * Display form for Invite, Kick, and show Who Knows a room
2313 void display_whok(void)
2315 char buf[SIZ], room[SIZ], username[SIZ];
2318 serv_getln(buf, sizeof buf);
2320 if (buf[0] != '2') {
2324 extract_token(room, &buf[4], 0, '|', sizeof room);
2327 wc_printf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2328 wc_printf(_("The users listed below have access to this room. "
2329 "To remove a user from the access list, select the user "
2330 "name from the list and click 'Kick'."));
2331 wc_printf("<br /><br />");
2333 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2334 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2335 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2336 wc_printf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2338 serv_getln(buf, sizeof buf);
2339 if (buf[0] == '1') {
2340 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2341 extract_token(username, buf, 0, '|', sizeof username);
2342 wc_printf("<OPTION>");
2347 wc_printf("</select><br />\n");
2349 wc_printf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2350 wc_printf("</form></CENTER>\n");
2352 wc_printf("</td><td>");
2353 wc_printf(_("To grant another user access to this room, enter the "
2354 "user name in the box below and click 'Invite'."));
2355 wc_printf("<br /><br />");
2357 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2358 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2359 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2360 wc_printf(_("Invite:"));
2362 wc_printf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2363 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2364 "<input type=\"submit\" value=\"%s\">"
2365 "</form></CENTER>\n", _("Invite"));
2366 /* Pop open an address book -- begin **/
2368 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2370 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2373 _("Users"), _("Users")
2375 /* Pop open an address book -- end **/
2377 wc_printf("</td></tr></table>\n");
2378 address_book_popup();
2385 * display the form for entering a new room
2387 void display_entroom(void)
2394 serv_puts("CRE8 0");
2395 serv_getln(buf, sizeof buf);
2397 if (buf[0] != '2') {
2398 strcpy(WC->ImportantMessage, &buf[4]);
2399 display_main_menu();
2404 output_headers(1, 1, 1, 0, 0, 0);
2406 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2407 do_template("beginbox", NULL);
2409 wc_printf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2410 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2412 wc_printf("<table class=\"altern\"> ");
2414 wc_printf("<tr class=\"even\"><td>");
2415 wc_printf(_("Name of room: "));
2416 wc_printf("</td><td>");
2417 wc_printf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2418 wc_printf("</td></tr>");
2420 wc_printf("<tr class=\"odd\"><td>");
2421 wc_printf(_("Resides on floor: "));
2422 wc_printf("</td><td>");
2423 load_floorlist(Buf);
2424 wc_printf("<select name=\"er_floor\" size=\"1\">\n");
2425 for (i = 0; i < 128; ++i)
2426 if (!IsEmptyStr(floorlist[i])) {
2427 wc_printf("<option ");
2428 wc_printf("value=\"%d\">", i);
2429 escputs(floorlist[i]);
2430 wc_printf("</option>\n");
2432 wc_printf("</select>\n");
2433 wc_printf("</td></tr>");
2436 * Our clever little snippet of JavaScript automatically selects
2437 * a public room if the view is set to Bulletin Board or wiki, and
2438 * it selects a mailbox room otherwise. The user can override this,
2439 * of course. We also disable the floor selector for mailboxes.
2441 wc_printf("<tr class=\"even\"><td>");
2442 wc_printf(_("Default view for room: "));
2443 wc_printf("</td><td>");
2444 wc_printf("<select name=\"er_view\" size=\"1\" OnChange=\""
2445 " if ( (this.form.er_view.value == 0) "
2446 " || (this.form.er_view.value == 6) ) { "
2447 " this.form.type[0].checked=true; "
2448 " this.form.er_floor.disabled = false; "
2451 " this.form.type[4].checked=true; "
2452 " this.form.er_floor.disabled = true; "
2455 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2456 if (is_view_allowed_as_default(i)) {
2457 wc_printf("<option %s value=\"%d\">",
2458 ((i == 0) ? "selected" : ""), i );
2459 escputs(viewdefs[i]);
2460 wc_printf("</option>\n");
2463 wc_printf("</select>\n");
2464 wc_printf("</td></tr>");
2466 wc_printf("<tr class=\"even\"><td>");
2467 wc_printf(_("Type of room:"));
2468 wc_printf("</td><td>");
2469 wc_printf("<ul class=\"adminlist\">\n");
2471 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2472 wc_printf("CHECKED OnChange=\""
2473 " if (this.form.type[0].checked == true) { "
2474 " this.form.er_floor.disabled = false; "
2477 wc_printf(_("Public (automatically appears to everyone)"));
2480 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2481 " if (this.form.type[1].checked == true) { "
2482 " this.form.er_floor.disabled = false; "
2485 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
2488 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2489 " if (this.form.type[2].checked == true) { "
2490 " this.form.er_floor.disabled = false; "
2493 wc_printf(_("Private - require password: "));
2494 wc_printf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2497 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2498 " if (this.form.type[3].checked == true) { "
2499 " this.form.er_floor.disabled = false; "
2502 wc_printf(_("Private - invitation only"));
2505 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2507 " if (this.form.type[4].checked == true) { "
2508 " this.form.er_floor.disabled = true; "
2511 wc_printf(_("Personal (mailbox for you only)"));
2514 wc_printf("\n</ul>\n");
2515 wc_printf("</td></tr></table>\n");
2517 wc_printf("<div class=\"buttons\">\n");
2518 wc_printf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2519 wc_printf(" ");
2520 wc_printf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2521 wc_printf("</div>\n");
2522 wc_printf("</form>\n<hr />");
2523 serv_printf("MESG roomaccess");
2524 serv_getln(buf, sizeof buf);
2525 if (buf[0] == '1') {
2529 do_template("endbox", NULL);
2539 * support function for entroom() -- sets the default view
2541 void er_set_default_view(int newview) {
2554 serv_getln(buf, sizeof buf);
2555 if (buf[0] != '2') return;
2557 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2558 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2559 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2560 rm_bits1 = extract_int(&buf[4], 3);
2561 rm_floor = extract_int(&buf[4], 4);
2562 rm_listorder = extract_int(&buf[4], 5);
2563 rm_bits2 = extract_int(&buf[4], 7);
2565 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2566 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2567 rm_listorder, newview, rm_bits2
2569 serv_getln(buf, sizeof buf);
2580 const StrBuf *er_name;
2581 const StrBuf *er_type;
2582 const StrBuf *er_password;
2586 wcsession *WCC = WC;
2588 if (!havebstr("ok_button")) {
2589 strcpy(WC->ImportantMessage,
2590 _("Cancelled. No new room was created."));
2591 display_main_menu();
2594 er_name = sbstr("er_name");
2595 er_type = sbstr("type");
2596 er_password = sbstr("er_password");
2597 er_floor = ibstr("er_floor");
2598 er_view = ibstr("er_view");
2601 if (!strcmp(ChrPtr(er_type), "hidden"))
2603 else if (!strcmp(ChrPtr(er_type), "passworded"))
2605 else if (!strcmp(ChrPtr(er_type), "invonly"))
2607 else if (!strcmp(ChrPtr(er_type), "personal"))
2610 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2613 ChrPtr(er_password),
2618 serv_getln(buf, sizeof buf);
2619 if (buf[0] != '2') {
2620 strcpy(WCC->ImportantMessage, &buf[4]);
2621 display_main_menu();
2624 /** TODO: Room created, now update the left hand icon bar for this user */
2625 burn_folder_cache(0); /* burn the old folder cache */
2629 serv_printf("VIEW %d", er_view);
2630 serv_getln(buf, sizeof buf);
2631 WCC->CurRoom.view = er_view;
2633 if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ) {
2634 display_editroom ();
2636 do_change_view(er_view); /* Now go there */
2643 * \brief display the screen to enter a private room
2645 void display_private(char *rname, int req_pass)
2647 WCTemplputParams SubTP;
2649 output_headers(1, 1, 1, 0, 0, 0);
2651 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2652 memset(&SubTP, 0, sizeof(WCTemplputParams));
2653 SubTP.Filter.ContextType = CTX_STRBUF;
2654 SubTP.Context = Buf;
2655 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2660 wc_printf(_("If you know the name of a hidden (guess-name) or "
2661 "passworded room, you can enter that room by typing "
2662 "its name below. Once you gain access to a private "
2663 "room, it will appear in your regular room listings "
2664 "so you don't have to keep returning here."));
2667 wc_printf("<form method=\"post\" action=\"goto_private\">\n");
2668 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2670 wc_printf("<table class=\"altern\"> "
2671 "<tr class=\"even\"><td>");
2672 wc_printf(_("Enter room name:"));
2673 wc_printf("</td><td>"
2674 "<input type=\"text\" name=\"gr_name\" "
2675 "value=\"%s\" maxlength=\"128\">\n", rname);
2678 wc_printf("</td></tr><tr class=\"odd\"><td>");
2679 wc_printf(_("Enter room password:"));
2680 wc_printf("</td><td>");
2681 wc_printf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2683 wc_printf("</td></tr></table>\n");
2685 wc_printf("<div class=\"buttons\">\n");
2686 wc_printf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2688 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2692 wc_printf("</div></form>\n");
2694 do_template("endbox", NULL);
2700 * \brief goto a private room
2702 void goto_private(void)
2707 if (!havebstr("ok_button")) {
2708 display_main_menu();
2711 strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
2712 serv_printf("GOTO %s|%s",
2715 serv_getln(buf, sizeof buf);
2717 if (buf[0] == '2') {
2718 smart_goto(sbstr("gr_name"));
2721 if (!strncmp(buf, "540", 3)) {
2722 display_private(bstr("gr_name"), 1);
2725 output_headers(1, 1, 1, 0, 0, 0);
2726 wc_printf("%s\n", &buf[4]);
2733 * \brief display the screen to zap a room
2735 void display_zap(void)
2737 output_headers(1, 1, 2, 0, 0, 0);
2739 wc_printf("<div id=\"banner\">\n");
2741 wc_printf(_("Zap (forget/unsubscribe) the current room"));
2742 wc_printf("</h1>\n");
2743 wc_printf("</div>\n");
2745 wc_printf("<div id=\"content\" class=\"service\">\n");
2747 wc_printf(_("If you select this option, <em>%s</em> will "
2748 "disappear from your room list. Is this what you wish "
2749 "to do?<br />\n"), ChrPtr(WC->CurRoom.name));
2751 wc_printf("<form method=\"POST\" action=\"zap\">\n");
2752 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2753 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2754 wc_printf(" ");
2755 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2756 wc_printf("</form>\n");
2767 StrBuf *final_destination;
2770 * If the forget-room routine fails for any reason, we fall back
2771 * to the current room; otherwise, we go to the Lobby
2773 final_destination = NewStrBufDup(WC->CurRoom.name);
2775 if (havebstr("ok_button")) {
2776 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
2777 serv_getln(buf, sizeof buf);
2778 if (buf[0] == '2') {
2780 serv_getln(buf, sizeof buf);
2781 if (buf[0] == '2') {
2782 FlushStrBuf(final_destination);
2783 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2787 smart_goto(final_destination);
2788 FreeStrBuf(&final_destination);
2794 * \brief Delete the current room
2796 void delete_room(void)
2801 serv_puts("KILL 1");
2802 serv_getln(buf, sizeof buf);
2803 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2804 if (buf[0] != '2') {
2805 strcpy(WC->ImportantMessage, &buf[4]);
2806 display_main_menu();
2811 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2820 * \brief Perform changes to a room's network configuration
2822 void netedit(void) {
2831 /*/ TODO: do line dynamic! */
2832 if (havebstr("line_pop3host")) {
2833 strcpy(line, bstr("prefix"));
2834 strcat(line, bstr("line_pop3host"));
2836 strcat(line, bstr("line_pop3user"));
2838 strcat(line, bstr("line_pop3pass"));
2840 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2842 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2843 strcat(line, bstr("suffix"));
2845 else if (havebstr("line")) {
2846 strcpy(line, bstr("prefix"));
2847 strcat(line, bstr("line"));
2848 strcat(line, bstr("suffix"));
2863 serv_getln(buf, sizeof buf);
2864 if (buf[0] != '1') {
2870 /** This loop works for add *or* remove. Spiffy, eh? */
2871 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2872 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2873 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2874 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2875 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2876 if ( (strcasecmp(cmpa0, cmpb0))
2877 || (strcasecmp(cmpa1, cmpb1)) ) {
2878 fprintf(fp, "%s\n", buf);
2884 serv_getln(buf, sizeof buf);
2885 if (buf[0] != '4') {
2891 while (fgets(buf, sizeof buf, fp) != NULL) {
2892 buf[strlen(buf)-1] = 0;
2896 if (havebstr("add_button")) {
2897 num_addrs = num_tokens(bstr("line"), ',');
2898 if (num_addrs < 2) {
2899 /* just adding one node or address */
2903 /* adding multiple addresses separated by commas */
2904 for (i=0; i<num_addrs; ++i) {
2905 strcpy(line, bstr("prefix"));
2906 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2909 strcat(line, bstr("suffix"));
2923 * \brief Convert a room name to a folder-ish-looking name.
2924 * \param folder the folderish name
2925 * \param room the room name
2926 * \param floor the floor name
2927 * \param is_mailbox is it a mailbox?
2929 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2934 * For mailboxes, just do it straight...
2937 sprintf(folder, "My folders|%s", room);
2941 * Otherwise, prefix the floor name as a "public folders" moniker
2944 if (floor > MAX_FLOORS) {
2946 sprintf(folder, "%%%%%%|%s", room);
2949 sprintf(folder, "%s|%s", floorlist[floor], room);
2954 * Replace "\" characters with "|" for pseudo-folder-delimiting
2956 len = strlen (folder);
2957 for (i=0; i<len; ++i) {
2958 if (folder[i] == '\\') folder[i] = '|';
2966 * \brief Back end for change_view()
2967 * \param newview set newview???
2969 void do_change_view(int newview) {
2972 serv_printf("VIEW %d", newview);
2973 serv_getln(buf, sizeof buf);
2974 WC->CurRoom.view = newview;
2975 smart_goto(WC->CurRoom.name);
2981 * \brief Change the view for this room
2983 void change_view(void) {
2986 view = lbstr("view");
2987 do_change_view(view);
2991 * \brief Burn the cached folder list.
2992 * \param age How old the cahce needs to be before we burn it.
2995 void burn_folder_cache(time_t age)
2997 /** If our cached folder list is very old, burn it. */
2998 if (WC->cache_fold != NULL) {
2999 if ((time(NULL) - WC->cache_timestamp) > age) {
3000 free(WC->cache_fold);
3001 WC->cache_fold = NULL;
3009 * \brief Do either a known rooms list or a folders list, depending on the
3014 StrBuf *ListView = NULL;
3016 /** Determine whether the user is trying to change views */
3017 if (havebstr("view")) {
3018 ListView = NewStrBufDup(SBSTR("view"));
3019 set_preference("roomlistview", ListView, 1);
3021 /** Sanitize the input so its safe */
3022 if ((get_preference("roomlistview", &ListView) == 0)||
3024 (strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3025 (strcasecmp(ChrPtr(ListView), "rooms") != 0)
3029 ListView = NewStrBufPlain(HKEY("rooms"));
3030 set_preference("roomlistview", ListView, 0);
3038 * \brief Set the message expire policy for this room and/or floor
3040 void set_room_policy(void) {
3043 if (!havebstr("ok_button")) {
3044 strcpy(WC->ImportantMessage,
3045 _("Cancelled. Changes were not saved."));
3050 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3051 serv_getln(buf, sizeof buf);
3052 strcpy(WC->ImportantMessage, &buf[4]);
3054 if (WC->axlevel >= 6) {
3055 strcat(WC->ImportantMessage, "<br />\n");
3056 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3057 serv_getln(buf, sizeof buf);
3058 strcat(WC->ImportantMessage, &buf[4]);
3064 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3066 StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
3070 void _display_private(void) {
3071 display_private("", 0);
3074 void dotgoto(void) {
3075 if (!havebstr("room")) {
3076 readloop(readnew, eUseDefault);
3079 if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3082 smart_goto(sbstr("room"));
3087 void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
3089 wcsession *WCC = WC;
3092 StrBufAppendTemplate(Target, TP,
3097 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3099 wc_printf("<div id=\"banner\">\n");
3100 embed_room_banner(NULL, navbar_default);
3101 wc_printf("</div>\n");
3105 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3107 wcsession *WCC = WC;
3110 (!IsEmptyStr(WCC->ugname)))
3111 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3114 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
3116 wcsession *WCC = WC;
3117 return (WCC != NULL)?
3118 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
3121 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
3123 wcsession *WCC = WC;
3124 return (WCC == NULL)? 0 :
3125 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
3126 (WCC->CurRoom.is_inbox) ||
3127 (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
3130 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3132 wcsession *WCC = WC;
3134 return ((WCC!=NULL) &&
3135 (!IsEmptyStr(WCC->ugname)) &&
3136 (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0));
3139 int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3142 wcsession *WCC = WC;
3144 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3145 if (QR_CheckFlag == 0)
3146 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3147 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3149 return ((WCC!=NULL) &&
3150 ((WCC->CurRoom.QRFlags & QR_CheckFlag) != 0));
3153 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3156 folder *Folder = (folder *)(TP->Context);
3158 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3159 if (QR_CheckFlag == 0)
3160 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3161 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3162 return ((Folder->QRFlags & QR_CheckFlag) != 0);
3166 int ConditionalCurrentRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3169 wcsession *WCC = WC;
3171 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3172 if (QR2_CheckFlag == 0)
3173 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3174 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3176 return ((WCC!=NULL) &&
3177 ((WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0));
3180 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3183 folder *Folder = (folder *)(TP->Context);
3185 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3186 if (QR2_CheckFlag == 0)
3187 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3188 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3189 return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
3193 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3195 wcsession *WCC = WC;
3197 return ( (WCC!= NULL) &&
3198 ((WCC->axlevel >= 6) ||
3199 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
3200 (WCC->CurRoom.is_inbox) ));
3203 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
3205 wcsession *WCC = WC;
3207 if ((WCC == NULL) ||
3208 (TP->Tokens->nParameters < 3))
3210 return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
3217 RegisterPreference("roomlistview",
3218 _("Room list view"),
3221 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
3223 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
3225 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
3226 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
3227 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
3228 WebcitAddUrlHandler(HKEY("display_private"), "", 0, _display_private, 0);
3229 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
3230 WebcitAddUrlHandler(HKEY("zapped_list"), "", 0, zapped_list, 0);
3231 WebcitAddUrlHandler(HKEY("display_zap"), "", 0, display_zap, 0);
3232 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
3233 WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0);
3234 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
3235 WebcitAddUrlHandler(HKEY("display_whok"), "", 0, display_whok, 0);
3236 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
3237 WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0);
3238 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
3239 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
3240 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
3241 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
3242 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
3243 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
3244 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
3246 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
3247 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalCurrentRoomHas_QRFlag, CTX_NONE);
3248 RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
3250 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalCurrentRoomHas_QRFlag2, CTX_NONE);
3251 RegisterConditional(HKEY("COND:ROOM:FLAG:QR2"), 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
3253 REGISTERTokenParamDefine(QR_PERMANENT);
3254 REGISTERTokenParamDefine(QR_INUSE);
3255 REGISTERTokenParamDefine(QR_PRIVATE);
3256 REGISTERTokenParamDefine(QR_PASSWORDED);
3257 REGISTERTokenParamDefine(QR_GUESSNAME);
3258 REGISTERTokenParamDefine(QR_DIRECTORY);
3259 REGISTERTokenParamDefine(QR_UPLOAD);
3260 REGISTERTokenParamDefine(QR_DOWNLOAD);
3261 REGISTERTokenParamDefine(QR_VISDIR);
3262 REGISTERTokenParamDefine(QR_ANONONLY);
3263 REGISTERTokenParamDefine(QR_ANONOPT);
3264 REGISTERTokenParamDefine(QR_NETWORK);
3265 REGISTERTokenParamDefine(QR_PREFONLY);
3266 REGISTERTokenParamDefine(QR_READONLY);
3267 REGISTERTokenParamDefine(QR_MAILBOX);
3268 REGISTERTokenParamDefine(QR2_SYSTEM);
3269 REGISTERTokenParamDefine(QR2_SELFLIST);
3270 REGISTERTokenParamDefine(QR2_COLLABDEL);
3271 REGISTERTokenParamDefine(QR2_SUBJECTREQ);
3272 REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
3273 REGISTERTokenParamDefine(QR2_MODERATED);
3275 REGISTERTokenParamDefine(UA_KNOWN);
3276 REGISTERTokenParamDefine(UA_GOTOALLOWED);
3277 REGISTERTokenParamDefine(UA_HASNEWMSGS);
3278 REGISTERTokenParamDefine(UA_ZAPPED);
3279 REGISTERTokenParamDefine(UA_POSTALLOWED);
3280 REGISTERTokenParamDefine(UA_ADMINALLOWED);
3281 REGISTERTokenParamDefine(UA_DELETEALLOWED);
3282 REGISTERTokenParamDefine(UA_ISTRASH);
3284 REGISTERTokenParamDefine(US_NEEDVALID);
3285 REGISTERTokenParamDefine(US_PERM);
3286 REGISTERTokenParamDefine(US_LASTOLD);
3287 REGISTERTokenParamDefine(US_EXPERT);
3288 REGISTERTokenParamDefine(US_UNLISTED);
3289 REGISTERTokenParamDefine(US_NOPROMPT);
3290 REGISTERTokenParamDefine(US_PROMPTCTL);
3291 REGISTERTokenParamDefine(US_DISAPPEAR);
3292 REGISTERTokenParamDefine(US_REGIS);
3293 REGISTERTokenParamDefine(US_PAGINATOR);
3294 REGISTERTokenParamDefine(US_INTERNET);
3295 REGISTERTokenParamDefine(US_FLOORS);
3296 REGISTERTokenParamDefine(US_COLOR);
3297 REGISTERTokenParamDefine(US_USER_SET);
3299 REGISTERTokenParamDefine(VIEW_BBS);
3300 REGISTERTokenParamDefine(VIEW_MAILBOX);
3301 REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
3302 REGISTERTokenParamDefine(VIEW_CALENDAR);
3303 REGISTERTokenParamDefine(VIEW_TASKS);
3304 REGISTERTokenParamDefine(VIEW_NOTES);
3305 REGISTERTokenParamDefine(VIEW_WIKI);
3306 REGISTERTokenParamDefine(VIEW_CALBRIEF);
3307 REGISTERTokenParamDefine(VIEW_JOURNAL);
3308 REGISTERTokenParamDefine(VIEW_BLOG);
3311 REGISTERTokenParamDefine(ignet_push_share);
3312 REGISTERTokenParamDefine(listrecp);
3313 REGISTERTokenParamDefine(digestrecp);
3314 REGISTERTokenParamDefine(pop3client);
3315 REGISTERTokenParamDefine(rssclient);
3316 REGISTERTokenParamDefine(participate);
3318 RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
3319 RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
3321 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
3322 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
3324 RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
3325 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
3326 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
3333 SessionDestroyModule_ROOMOPS
3336 FlushFolder(&sess->CurRoom);
3337 if (sess->cache_fold != NULL) {
3338 free(sess->cache_fold);
3341 free_march_list(sess);
3342 DeleteHash(&sess->Floors);