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);
21 * Initialize the viewdefs with localized strings
23 void initialize_viewdefs(void) {
24 viewdefs[0] = _("Bulletin Board");
25 viewdefs[1] = _("Mail Folder");
26 viewdefs[2] = _("Address Book");
27 viewdefs[3] = _("Calendar");
28 viewdefs[4] = _("Task List");
29 viewdefs[5] = _("Notes List");
30 viewdefs[6] = _("Wiki");
31 viewdefs[7] = _("Calendar List");
32 viewdefs[8] = _("Journal");
36 * Determine which views are allowed as the default for creating a new room.
38 int is_view_allowed_as_default(int which_view)
41 case VIEW_BBS: return(1);
42 case VIEW_MAILBOX: return(1);
43 case VIEW_ADDRESSBOOK: return(1);
44 case VIEW_CALENDAR: return(1);
45 case VIEW_TASKS: return(1);
46 case VIEW_NOTES: return(1);
47 case VIEW_WIKI: return(1);
48 case VIEW_CALBRIEF: return(0);
49 case VIEW_JOURNAL: return(0);
50 default: return(0); /* should never get here */
56 * load the list of floors
58 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 (!Done && (StrBuf_ServGetln(Buf)>=0)) {
73 if ( (StrLength(Buf)==3) &&
74 !strcmp(ChrPtr(Buf), "000")) {
78 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
86 * display rooms in tree structure
88 void room_tree_list(struct roomlisting *rp)
97 room_tree_list(rp->lnext);
99 strcpy(rmname, rp->rlname);
102 wc_printf("<a href=\"dotgoto?room=");
106 escputs1(rmname, 1, 1);
107 if ((f & QR_DIRECTORY) && (f & QR_NETWORK))
109 else if (f & QR_DIRECTORY)
111 else if (f & QR_NETWORK)
115 wc_printf("</a><tt> </tt>\n");
117 room_tree_list(rp->rnext);
123 * Room ordering stuff (compare first by floor, then by order)
125 int rordercmp(struct roomlisting *r1, struct roomlisting *r2)
127 if ((r1 == NULL) && (r2 == NULL))
133 if (r1->rlfloor < r2->rlfloor)
135 if (r1->rlfloor > r2->rlfloor)
137 if (r1->rlorder < r2->rlorder)
139 if (r1->rlorder > r2->rlorder)
146 * Common code for all room listings
148 void listrms(char *variety)
153 struct roomlisting *rl = NULL;
154 struct roomlisting *rp;
155 struct roomlisting *rs;
157 /* Ask the server for a room list */
159 serv_getln(buf, sizeof buf);
165 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
167 rp = malloc(sizeof(struct roomlisting));
168 extract_token(rp->rlname, buf, 0, '|', sizeof rp->rlname);
169 rp->rlflags = extract_int(buf, 1);
170 rp->rlfloor = extract_int(buf, 2);
171 rp->rlorder = extract_int(buf, 3);
180 if (rordercmp(rp, rs) < 0) {
181 if (rs->lnext == NULL) {
188 if (rs->rnext == NULL) {
201 * If no rooms were listed, print an nbsp to make the cell
202 * borders show up anyway.
204 if (num_rooms == 0) wc_printf(" ");
209 * list all forgotten rooms
211 void zapped_list(void)
213 WCTemplputParams SubTP;
216 output_headers(1, 1, 1, 0, 0, 0);
217 memset(&SubTP, 0, sizeof(WCTemplputParams));
218 Buf = NewStrBufPlain(_("Zapped (forgotten) rooms"), -1);
219 SubTP.Filter.ContextType = CTX_STRBUF;
221 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
227 wc_printf("<br /><br />\n");
228 wc_printf(_("Click on any room to un-zap it and goto that room.\n"));
229 do_template("endbox", NULL);
235 * read this room's info file (set v to 1 for verbose mode)
237 void readinfo(StrBuf *Target, WCTemplputParams *TP)
242 int fullinfo_len = 0;
245 serv_getln(buf, sizeof buf);
248 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
249 if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
250 strcpy(&fullinfo[fullinfo_len], buf);
251 fullinfo_len += strlen(buf);
255 safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
256 strcpy(&briefinfo[50], "...");
258 wc_printf("<div class=\"infos\" "
259 "onclick=\"javascript:Effect.Appear('room_infos', { duration: 0.5 });\" "
263 wc_printf("</div><div id=\"room_infos\" style=\"display:none;\">");
264 wc_printf("<img class=\"close_infos\" "
265 "onclick=\"javascript:Effect.Fade('room_infos', { duration: 0.5 });\" "
266 "src=\"static/closewindow.gif\" alt=\"%s\" width=\"16\" height=\"16\">",
281 * Display room banner icon.
282 * The server doesn't actually need the room name, but we supply it in
283 * order to keep the browser from using a cached icon from another room.
285 void embed_room_graphic(StrBuf *Target, WCTemplputParams *TP)
289 serv_puts("OIMG _roompic_");
290 serv_getln(buf, sizeof buf);
292 wc_printf("<img height=\"64px\" src=\"image?name=_roompic_&room=");
293 urlescputs(ChrPtr(WC->CurRoom.name));
296 serv_getln(buf, sizeof buf);
298 else if (WC->CurRoom.view == VIEW_ADDRESSBOOK) {
299 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
300 "static/viewcontacts_48x.gif"
304 else if ( (WC->CurRoom.view == VIEW_CALENDAR) || (WC->CurRoom.view == VIEW_CALBRIEF) ) {
305 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
306 "static/calarea_48x.gif"
307 "\" width=\"48\" height=\"48\">"
310 else if (WC->CurRoom.view == VIEW_TASKS) {
311 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
312 "static/taskmanag_48x.gif"
313 "\" width=\"48\" height=\"48\">"
316 else if (WC->CurRoom.view == VIEW_NOTES) {
317 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
318 "static/storenotes_48x.gif"
319 "\" width=\"48\" height=\"48\">"
322 else if (WC->CurRoom.view == VIEW_MAILBOX) {
323 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
324 "static/privatemess_48x.gif"
325 "\" width=\"48\" height=\"48\">"
329 wc_printf("<img class=\"roompic\" alt=\"\" src=\""
330 "static/chatrooms_48x.gif"
331 "\" width=\"48\" height=\"48\">"
340 * Display the current view and offer an option to change it
342 void embed_view_o_matic(StrBuf *Target, WCTemplputParams *TP)
346 wc_printf("<form name=\"viewomatic\" action=\"changeview\">\n");
347 wc_printf("\t<div style=\"display: inline;\">\n\t<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
348 wc_printf("<label for=\"view_name\">");
349 wc_printf(_("View as:"));
350 wc_printf("</label> "
351 "<select name=\"newview\" size=\"1\" "
352 "id=\"view_name\" class=\"selectbox\" "
353 "OnChange=\"location.href=viewomatic.newview.options"
354 "[selectedIndex].value\">\n");
356 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
358 * Only offer the views that make sense, given the default
359 * view for the room. For example, don't offer a Calendar
360 * view in a non-Calendar room.
363 (i == WC->CurRoom.view)
364 || (i == WC->CurRoom.defview) /* default */
365 || ( (i == 0) && (WC->CurRoom.defview == 1) ) /* mail or bulletin */
366 || ( (i == 1) && (WC->CurRoom.defview == 0) ) /* mail or bulletin */
367 /* || ( (i == 7) && (WC->CurRoom.defview == 3) ) (calendar list temporarily disabled) */
370 wc_printf("<option %s value=\"changeview?view=%d\">",
371 ((i == WC->CurRoom.view) ? "selected" : ""),
373 escputs(viewdefs[i]);
374 wc_printf("</option>\n");
377 wc_printf("</select></div></form>\n");
382 * Display a search box
384 void embed_search_o_matic(StrBuf *Target, WCTemplputParams *TP)
386 wc_printf("<form name=\"searchomatic\" action=\"do_search\">\n");
387 wc_printf("<div style=\"display: inline;\"><input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
388 wc_printf("<label for=\"srchquery\">");
389 wc_printf(_("Search: "));
390 wc_printf("</label><input ");
391 wc_printf("%s", WC->serv_info->serv_fulltext_enabled ? "" : "disabled ");
392 wc_printf("type=\"text\" name=\"query\" id=\"srchquery\" size=\"15\" maxlength=\"128\" class=\"inputbox\">\n"
394 wc_printf("</div></form>\n");
399 * Embed the room banner
401 * got The information returned from a GOTO server command
402 * navbar_style Determines which navigation buttons to display
406 void embed_room_banner(char *got, int navbar_style) {
410 char with_files[256];
414 * We need to have the information returned by a GOTO server command.
415 * If it isn't supplied, we fake it by issuing our own GOTO.
418 memset(buf, '0', 20);
420 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
421 serv_getln(buf, sizeof buf);
425 /* The browser needs some information for its own use */
426 wc_printf("<script type=\"text/javascript\"> \n"
427 " room_is_trash = %d; \n"
429 ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0)
433 * If the user happens to select the "make this my start page" link,
434 * we want it to remember the URL as a "/dotskip" one instead of
435 * a "skip" or "gotonext" or something like that.
437 if (WCC->Hdr->this_page == NULL) {
438 WCC->Hdr->this_page = NewStrBuf();
440 StrBufPrintf(WCC->Hdr->this_page,
442 ChrPtr(WC->CurRoom.name)
445 /* Check for new mail. */
446 WC->new_mail = extract_int(&got[4], 9);
447 WC->CurRoom.view = extract_int(&got[4], 11);
449 /* Is this a directory room and does it contain files and how many? */
450 if ((WC->CurRoom.QRFlags & QR_DIRECTORY) && (WC->CurRoom.QRFlags & QR_VISDIR))
453 serv_getln(buf2, sizeof buf2);
454 if (buf2[0] == '1') while (serv_getln(buf2, sizeof buf2), strcmp(buf2, "000"))
456 snprintf (with_files, sizeof with_files,
457 "; <a href=\"do_template?template=files\"> %d %s </a>",
459 ((file_count>1) || (file_count == 0) ? _("files") : _("file")));
462 strcpy (with_files, "");
464 svprintf(HKEY("NUMMSGS"), WCS_STRING,
465 _("%d new of %d messages%s"),
466 extract_int(&got[4], 1),
467 extract_int(&got[4], 2),
470 svcallback("ROOMPIC", embed_room_graphic);
471 svcallback("ROOMINFO", readinfo);
472 svcallback("VIEWOMATIC", embed_view_o_matic);
473 svcallback("SEARCHOMATIC", embed_search_o_matic);
474 svcallback("START", offer_start_page);
476 do_template("roombanner", NULL);
477 /* roombanner contains this for mobile */
478 if (navbar_style != navbar_none && (WC->is_mobile < 1)) {
480 wc_printf("<div id=\"navbar\"><ul>");
482 if (navbar_style == navbar_default) wc_printf(
483 "<li class=\"ungoto\">"
484 "<a href=\"ungoto\">"
485 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
486 "<span class=\"navbar_link\">%s</span></A>"
487 "</li>\n", _("Ungoto")
490 if ( (navbar_style == navbar_default) && (WC->CurRoom.view == VIEW_BBS) ) {
492 "<li class=\"newmess\">"
493 "<a href=\"readnew\">"
494 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
495 "<span class=\"navbar_link\">%s</span></A>"
496 "</li>\n", _("Read new messages")
500 if (navbar_style == navbar_default) {
501 switch(WC->CurRoom.view) {
502 case VIEW_ADDRESSBOOK:
504 "<li class=\"viewcontacts\">"
505 "<a href=\"readfwd\">"
506 "<img src=\"static/viewcontacts_24x.gif\" "
507 "alt=\"\" width=\"24\" height=\"24\">"
508 "<span class=\"navbar_link\">"
510 "</span></a></li>\n", _("View contacts")
515 "<li class=\"staskday\">"
516 "<a href=\"readfwd?calview=day\">"
517 "<img src=\"static/taskday2_24x.gif\" "
518 "alt=\"\" width=\"24\" height=\"24\">"
519 "<span class=\"navbar_link\">"
521 "</span></a></li>\n", _("Day view")
524 "<li class=\"monthview\">"
525 "<a href=\"readfwd?calview=month\">"
526 "<img src=\"static/monthview2_24x.gif\" "
527 "alt=\"\" width=\"24\" height=\"24\">"
528 "<span class=\"navbar_link\">"
530 "</span></a></li>\n", _("Month view")
535 "<li class=\"monthview\">"
536 "<a href=\"readfwd?calview=month\">"
537 "<img src=\"static/monthview2_24x.gif\" "
538 "alt=\"\" width=\"24\" height=\"24\">"
539 "<span class=\"navbar_link\">"
541 "</span></a></li>\n", _("Calendar list")
546 "<li class=\"taskmanag\">"
547 "<a href=\"readfwd\">"
548 "<img src=\"static/taskmanag_24x.gif\" "
549 "alt=\"\" width=\"24\" height=\"24\">"
550 "<span class=\"navbar_link\">"
552 "</span></a></li>\n", _("View tasks")
557 "<li class=\"viewnotes\">"
558 "<a href=\"readfwd\">"
559 "<img src=\"static/viewnotes_24x.gif\" "
560 "alt=\"\" width=\"24\" height=\"24\">"
561 "<span class=\"navbar_link\">"
563 "</span></a></li>\n", _("View notes")
568 "<li class=\"readallmess\">"
569 "<a id=\"m_refresh\" href=\"readfwd\">"
570 "<img src=\"static/readallmess3_24x.gif\" "
571 "alt=\"\" width=\"24\" height=\"24\">"
572 "<span class=\"navbar_link\">"
574 "</span></a></li>\n", _("Refresh message list")
579 "<li class=\"readallmess\">"
580 "<a href=\"wiki?page=home\">"
581 "<img src=\"static/readallmess3_24x.gif\" "
582 "alt=\"\" width=\"24\" height=\"24\">"
583 "<span class=\"navbar_link\">"
585 "</span></a></li>\n", _("Wiki home")
590 "<li class=\"readallmess\">"
591 "<a href=\"readfwd\">"
592 "<img src=\"static/readallmess3_24x.gif\" "
593 "alt=\"\" width=\"24\" height=\"24\">"
594 "<span class=\"navbar_link\">"
596 "</span></a></li>\n", _("Read all messages")
602 if (navbar_style == navbar_default) {
603 switch(WC->CurRoom.view) {
604 case VIEW_ADDRESSBOOK:
606 "<li class=\"addnewcontact\">"
607 "<a href=\"display_enter\">"
608 "<img src=\"static/addnewcontact_24x.gif\" "
609 "alt=\"\" width=\"24\" height=\"24\">"
610 "<span class=\"navbar_link\">"
612 "</span></a></li>\n", _("Add new contact")
617 wc_printf("<li class=\"addevent\"><a href=\"display_enter");
618 if (havebstr("year" )) wc_printf("?year=%s", bstr("year"));
619 if (havebstr("month")) wc_printf("?month=%s", bstr("month"));
620 if (havebstr("day" )) wc_printf("?day=%s", bstr("day"));
622 "<img src=\"static/addevent_24x.gif\" "
623 "alt=\"\" width=\"24\" height=\"24\">"
624 "<span class=\"navbar_link\">"
626 "</span></a></li>\n", _("Add new event")
631 "<li class=\"newmess\">"
632 "<a href=\"display_enter\">"
633 "<img src=\"static/newmess3_24x.gif\" "
634 "alt=\"\" width=\"24\" height=\"24\">"
635 "<span class=\"navbar_link\">"
637 "</span></a></li>\n", _("Add new task")
642 "<li class=\"enternewnote\">"
643 "<a href=\"add_new_note\">"
644 "<img src=\"static/enternewnote_24x.gif\" "
645 "alt=\"\" width=\"24\" height=\"24\">"
646 "<span class=\"navbar_link\">"
648 "</span></a></li>\n", _("Add new note")
652 safestrncpy(buf, bstr("page"), sizeof buf);
653 if (IsEmptyStr(buf)) {
654 safestrncpy(buf, "home", sizeof buf);
658 "<li class=\"newmess\">"
659 "<a href=\"display_enter?page=%s\">"
660 "<img src=\"static/newmess3_24x.gif\" "
661 "alt=\"\" width=\"24\" height=\"24\">"
662 "<span class=\"navbar_link\">"
664 "</span></a></li>\n", buf, _("Edit this page")
667 if (bmstrcasestr((char *)ChrPtr(WCC->Hdr->HR.ReqLine), "wiki_history")) {
668 /* already viewing history; display a link to the current page */
670 "<li class=\"newmess\">"
671 "<a href=\"wiki?page=%s\">"
672 "<img src=\"static/newmess3_24x.gif\" "
673 "alt=\"\" width=\"24\" height=\"24\">"
674 "<span class=\"navbar_link\">"
676 "</span></a></li>\n", buf, _("Current version")
680 /* display a link to the history */
682 "<li class=\"newmess\">"
683 "<a href=\"wiki_history?page=%s\">"
684 "<img src=\"static/newmess3_24x.gif\" "
685 "alt=\"\" width=\"24\" height=\"24\">"
686 "<span class=\"navbar_link\">"
688 "</span></a></li>\n", buf, _("History")
694 "<li class=\"newmess\">"
695 "<a href=\"display_enter\">"
696 "<img src=\"static/newmess3_24x.gif\" "
697 "alt=\"\" width=\"24\" height=\"24\">"
698 "<span class=\"navbar_link\">"
700 "</span></a></li>\n", _("Write mail")
703 "<li class=\"newmess\">"
704 "<a href=\"javascript:deleteAllSelectedMessages();\">"
705 "<img src=\"static/delete.gif\" "
706 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
708 "</span></a></li>\n", _("Delete")
713 "<li class=\"newmess\">"
714 "<a href=\"display_enter\">"
715 "<img src=\"static/newmess3_24x.gif\" "
716 "alt=\"\" width=\"24\" height=\"24\">"
717 "<span class=\"navbar_link\">"
719 "</span></a></li>\n", _("Enter a message")
725 if (navbar_style == navbar_default) wc_printf(
726 "<li class=\"skipthisroom\">"
729 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
730 "width=\"24\" height=\"24\">"
731 "<span class=\"navbar_link\">%s</span></a>"
733 _("Leave all messages marked as unread, go to next room with unread messages"),
737 if (navbar_style == navbar_default) wc_printf(
738 "<li class=\"markngo\">"
739 "<a href=\"gotonext\" "
741 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
742 "width=\"24\" height=\"24\">"
743 "<span class=\"navbar_link\">%s</span></a>"
745 _("Mark all messages as read, go to next room with unread messages"),
749 wc_printf("</ul></div>\n");
756 * back end routine to take the session to a new room
758 long gotoroom(const StrBuf *gname)
762 static long ls = (-1L);
765 /* store ungoto information */
766 strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
770 /* move to the new room */
771 serv_printf("GOTO %s", ChrPtr(gname));
772 StrBuf_ServGetln(Buf);
773 if (GetServerStatus(Buf, &err) != 2) {
774 serv_puts("GOTO _BASEROOM_");
775 StrBuf_ServGetln(Buf);
777 * well, we know that this is the fallback case,
778 * but we're interested that the first command
779 * didn't work out in first place.
781 if (GetServerStatus(Buf, NULL) != 2) {
786 ParseGoto(&WCC->CurRoom, Buf);
788 remove_march(WCC->CurRoom.name);
789 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
797 void ParseGoto(folder *room, StrBuf *Line)
805 if (StrLength(Line) < 4) {
809 /* ignore the commandstate... */
810 Pos = ChrPtr(Line) + 4;
812 if (room->RoomNameParts != NULL)
815 for (i=0; i < room->nRoomNameParts; i++)
816 FreeStrBuf(&room->RoomNameParts[i]);
817 free(room->RoomNameParts);
818 room->RoomNameParts = NULL;
823 pBuf = NewStrBufPlain(NULL, StrLength(Line));
826 memset(room, 0, sizeof(folder));
829 StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
831 room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|');
832 if (room->nNewMessages > 0)
833 room->RAFlags |= UA_HASNEWMSGS;
835 room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
837 room->ShowInfo = StrBufExtractNext_long(Line, &Pos, '|');
839 room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
841 room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
842 room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
844 room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
846 flag = StrBufExtractNext_long(Line, &Pos, '|');
847 if (WCC->is_aide || flag)
848 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;
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 ( (WC->axlevel >= 6) || (WC->is_room_aide) ) {
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=\"%d\">\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 free (not_shared_with);
1623 /* Mailing list management */
1624 if (!strcmp(tab, "listserv")) {
1625 room_states RoomFlags;
1626 wc_printf("<div class=\"tabcontent\">");
1628 wc_printf("<br /><center>"
1629 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1630 "<tr><td VALIGN=TOP>");
1632 wc_printf(_("<i>The contents of this room are being "
1633 "mailed <b>as individual messages</b> "
1634 "to the following list recipients:"
1635 "</i><br /><br />\n"));
1638 serv_getln(buf, sizeof buf);
1639 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1640 extract_token(cmd, buf, 0, '|', sizeof cmd);
1641 if (!strcasecmp(cmd, "listrecp")) {
1642 extract_token(recp, buf, 1, '|', sizeof recp);
1645 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line=listrecp|");
1648 wc_printf(_("(remove)"));
1649 wc_printf("</A><br />");
1652 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1653 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1654 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1655 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1656 wc_printf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1657 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1658 wc_printf("</form>\n");
1660 wc_printf("</td><td VALIGN=TOP>\n");
1662 wc_printf(_("<i>The contents of this room are being "
1663 "mailed <b>in digest form</b> "
1664 "to the following list recipients:"
1665 "</i><br /><br />\n"));
1668 serv_getln(buf, sizeof buf);
1669 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1670 extract_token(cmd, buf, 0, '|', sizeof cmd);
1671 if (!strcasecmp(cmd, "digestrecp")) {
1672 extract_token(recp, buf, 1, '|', sizeof recp);
1675 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line="
1679 wc_printf(_("(remove)"));
1680 wc_printf("</A><br />");
1683 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1684 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1685 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1686 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1687 wc_printf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1688 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1689 wc_printf("</form>\n");
1691 wc_printf("</td></tr></table>\n");
1693 /** Pop open an address book -- begin **/
1694 wc_printf("<div align=right>"
1695 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1697 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1702 _("Add recipients from Contacts or other address books"),
1703 _("Add recipients from Contacts or other address books")
1705 /* Pop open an address book -- end **/
1707 wc_printf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1709 get_roomflags (&RoomFlags);
1711 /* Self Service subscription? */
1712 wc_printf("<table><tr><td>\n");
1713 wc_printf(_("Allow self-service subscribe/unsubscribe requests."));
1714 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1715 " <tr><td colspan=\"2\">\n",
1716 (is_selflist(&RoomFlags))?"checked":"");
1717 wc_printf(_("The URL for subscribe/unsubscribe is: "));
1718 wc_printf("<TT>%s://%s/listsub</TT></td></tr>\n",
1719 (is_https ? "https" : "http"),
1720 ChrPtr(WC->Hdr->HR.http_host));
1721 /* Public posting? */
1722 wc_printf("<tr><td>");
1723 wc_printf(_("Allow non-subscribers to mail to this room."));
1724 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1725 (is_publiclist(&RoomFlags))?"checked":"");
1727 /* Moderated List? */
1728 wc_printf("<tr><td>");
1729 wc_printf(_("Room post publication needs Aide permission."));
1730 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1731 (is_moderatedlist(&RoomFlags))?"checked":"");
1734 wc_printf("<tr><td colspan=\"2\" align=\"center\">"
1735 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1736 wc_printf("</table></form>");
1739 wc_printf("</CENTER>\n");
1740 wc_printf("</div>");
1744 /* Configuration of The Dreaded Auto-Purger */
1745 if (!strcmp(tab, "expire")) {
1746 wc_printf("<div class=\"tabcontent\">");
1748 serv_puts("GPEX room");
1749 serv_getln(buf, sizeof buf);
1750 if (!strncmp(buf, "550", 3)) {
1751 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1752 _("Higher access is required to access this function.")
1755 else if (buf[0] != '2') {
1756 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1759 roompolicy = extract_int(&buf[4], 0);
1760 roomvalue = extract_int(&buf[4], 1);
1762 serv_puts("GPEX floor");
1763 serv_getln(buf, sizeof buf);
1764 if (buf[0] == '2') {
1765 floorpolicy = extract_int(&buf[4], 0);
1766 floorvalue = extract_int(&buf[4], 1);
1769 wc_printf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1770 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1771 wc_printf("<table border=0 cellspacing=5>\n");
1772 wc_printf("<tr><td>");
1773 wc_printf(_("Message expire policy for this room"));
1774 wc_printf("<br />(");
1775 escputs(ChrPtr(WC->CurRoom.name));
1776 wc_printf(")</td><td>");
1777 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1778 ((roompolicy == 0) ? "CHECKED" : "") );
1779 wc_printf(_("Use the default policy for this floor"));
1780 wc_printf("<br />\n");
1781 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1782 ((roompolicy == 1) ? "CHECKED" : "") );
1783 wc_printf(_("Never automatically expire messages"));
1784 wc_printf("<br />\n");
1785 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1786 ((roompolicy == 2) ? "CHECKED" : "") );
1787 wc_printf(_("Expire by message count"));
1788 wc_printf("<br />\n");
1789 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1790 ((roompolicy == 3) ? "CHECKED" : "") );
1791 wc_printf(_("Expire by message age"));
1792 wc_printf("<br />");
1793 wc_printf(_("Number of messages or days: "));
1794 wc_printf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1795 wc_printf("</td></tr>\n");
1797 if (WC->axlevel >= 6) {
1798 wc_printf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1799 wc_printf("<tr><td>");
1800 wc_printf(_("Message expire policy for this floor"));
1801 wc_printf("<br />(");
1802 escputs(floorlist[WC->CurRoom.floorid]);
1803 wc_printf(")</td><td>");
1804 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1805 ((floorpolicy == 0) ? "CHECKED" : "") );
1806 wc_printf(_("Use the system default"));
1807 wc_printf("<br />\n");
1808 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1809 ((floorpolicy == 1) ? "CHECKED" : "") );
1810 wc_printf(_("Never automatically expire messages"));
1811 wc_printf("<br />\n");
1812 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1813 ((floorpolicy == 2) ? "CHECKED" : "") );
1814 wc_printf(_("Expire by message count"));
1815 wc_printf("<br />\n");
1816 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1817 ((floorpolicy == 3) ? "CHECKED" : "") );
1818 wc_printf(_("Expire by message age"));
1819 wc_printf("<br />");
1820 wc_printf(_("Number of messages or days: "));
1821 wc_printf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1825 wc_printf("<CENTER>\n");
1826 wc_printf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1827 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1828 wc_printf(" ");
1829 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1830 wc_printf("</CENTER></td><tr>\n");
1832 wc_printf("</table>\n"
1833 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1838 wc_printf("</div>");
1841 /* Access controls */
1842 if (!strcmp(tab, "access")) {
1843 wc_printf("<div class=\"tabcontent\">");
1845 wc_printf("</div>");
1848 /* Fetch messages from remote locations */
1849 if (!strcmp(tab, "feeds")) {
1850 wc_printf("<div class=\"tabcontent\">");
1853 wc_printf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1854 wc_printf("</i><br />\n");
1856 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1857 "<tr class=\"even\"><th>");
1858 wc_printf(_("Remote host"));
1859 wc_printf("</th><th>");
1860 wc_printf(_("User name"));
1861 wc_printf("</th><th>");
1862 wc_printf(_("Password"));
1863 wc_printf("</th><th>");
1864 wc_printf(_("Keep messages on server?"));
1865 wc_printf("</th><th>");
1866 wc_printf(_("Interval"));
1867 wc_printf("</th><th> </th></tr>");
1870 serv_getln(buf, sizeof buf);
1872 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1873 extract_token(cmd, buf, 0, '|', sizeof cmd);
1874 if (!strcasecmp(cmd, "pop3client")) {
1875 safestrncpy(recp, &buf[11], sizeof recp);
1878 wc_printf("<tr class=\"%s\">",
1879 (bg ? "even" : "odd")
1883 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1888 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1892 wc_printf("<td>*****</td>"); /* Don't show the password */
1894 wc_printf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1896 wc_printf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1898 wc_printf("<td class=\"button_link\">");
1899 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=pop3client|");
1902 wc_printf(_("(remove)"));
1903 wc_printf("</a></td>");
1909 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1911 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1912 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1913 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1915 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1918 wc_printf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1921 wc_printf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1924 wc_printf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1927 wc_printf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
1930 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1931 wc_printf("</td></tr>");
1932 wc_printf("</form></table>\n");
1934 wc_printf("<hr>\n");
1937 wc_printf(_("Fetch the following RSS feeds and store them in this room:"));
1938 wc_printf("</i><br />\n");
1940 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1941 "<tr class=\"even\"><th>");
1942 wc_printf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1943 wc_printf(_("Feed URL"));
1944 wc_printf("</th><th>");
1945 wc_printf("</th></tr>");
1948 serv_getln(buf, sizeof buf);
1950 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1951 extract_token(cmd, buf, 0, '|', sizeof cmd);
1952 if (!strcasecmp(cmd, "rssclient")) {
1953 safestrncpy(recp, &buf[10], sizeof recp);
1956 wc_printf("<tr class=\"%s\">",
1957 (bg ? "even" : "odd")
1961 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1965 wc_printf("<td class=\"button_link\">");
1966 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=rssclient|");
1969 wc_printf(_("(remove)"));
1970 wc_printf("</a></td>");
1976 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1978 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1979 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
1980 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1982 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
1983 "maxlength=\"256\" name=\"line_pop3host\">\n");
1986 wc_printf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
1987 wc_printf("</td></tr>");
1988 wc_printf("</form></table>\n");
1990 wc_printf("</div>");
1994 /* end content of whatever tab is open now */
1995 wc_printf("</div>\n");
1997 address_book_popup();
2003 * Toggle self-service list subscription
2005 void toggle_self_service(void) {
2006 room_states RoomFlags;
2008 get_roomflags (&RoomFlags);
2010 if (yesbstr("QR2_SelfList"))
2011 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2013 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2015 if (yesbstr("QR2_SMTP_PUBLIC"))
2016 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2018 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2020 if (yesbstr("QR2_Moderated"))
2021 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2023 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2024 if (yesbstr("QR2_SubsOnly"))
2025 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2027 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2029 set_roomflags (&RoomFlags);
2037 * save new parameters for a room
2044 StrBuf *er_password;
2046 StrBuf *er_roomaide;
2049 int er_listingorder;
2055 if (!havebstr("ok_button")) {
2056 strcpy(WC->ImportantMessage,
2057 _("Cancelled. Changes were not saved."));
2063 StrBuf_ServGetln(Buf);
2064 if (GetServerStatus(Buf, NULL) != 2) {
2065 StrBufCutLeft(Buf, 4);
2066 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2072 er_name = NewStrBuf();
2073 er_password = NewStrBuf();
2074 er_dirname = NewStrBuf();
2075 er_roomaide = NewStrBuf();
2077 StrBufCutLeft(Buf, 4);
2078 StrBufExtract_token(er_name, Buf, 0, '|');
2079 StrBufExtract_token(er_password, Buf, 1, '|');
2080 StrBufExtract_token(er_dirname, Buf, 2, '|');
2081 er_flags = StrBufExtract_int(Buf, 3, '|');
2082 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2083 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2084 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2086 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2087 if (StrLength(er_roomaide) == 0) {
2089 StrBuf_ServGetln(Buf);
2090 if (GetServerStatus(Buf, NULL) != 2) {
2091 FlushStrBuf(er_roomaide);
2093 StrBufCutLeft(Buf, 4);
2094 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2097 Ptr = sbstr("er_name");
2098 if (StrLength(Ptr) > 0) {
2099 FlushStrBuf(er_name);
2100 StrBufAppendBuf(er_name, Ptr, 0);
2103 Ptr = sbstr("er_password");
2104 if (StrLength(Ptr) > 0) {
2105 FlushStrBuf(er_password);
2106 StrBufAppendBuf(er_password, Ptr, 0);
2110 Ptr = sbstr("er_dirname");
2111 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2112 FlushStrBuf(er_dirname);
2113 StrBufAppendBuf(er_dirname, Ptr, 0);
2117 Ptr = sbstr("type");
2118 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2120 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2121 er_flags |= (QR_PRIVATE);
2123 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2124 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2126 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2127 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2129 if (!strcmp(ChrPtr(Ptr), "personal")) {
2130 er_flags |= QR_MAILBOX;
2132 er_flags &= ~QR_MAILBOX;
2135 if (yesbstr("prefonly")) {
2136 er_flags |= QR_PREFONLY;
2138 er_flags &= ~QR_PREFONLY;
2141 if (yesbstr("readonly")) {
2142 er_flags |= QR_READONLY;
2144 er_flags &= ~QR_READONLY;
2148 if (yesbstr("collabdel")) {
2149 er_flags2 |= QR2_COLLABDEL;
2151 er_flags2 &= ~QR2_COLLABDEL;
2154 if (yesbstr("permanent")) {
2155 er_flags |= QR_PERMANENT;
2157 er_flags &= ~QR_PERMANENT;
2160 if (yesbstr("subjectreq")) {
2161 er_flags2 |= QR2_SUBJECTREQ;
2163 er_flags2 &= ~QR2_SUBJECTREQ;
2166 if (yesbstr("network")) {
2167 er_flags |= QR_NETWORK;
2169 er_flags &= ~QR_NETWORK;
2172 if (yesbstr("directory")) {
2173 er_flags |= QR_DIRECTORY;
2175 er_flags &= ~QR_DIRECTORY;
2178 if (yesbstr("ulallowed")) {
2179 er_flags |= QR_UPLOAD;
2181 er_flags &= ~QR_UPLOAD;
2184 if (yesbstr("dlallowed")) {
2185 er_flags |= QR_DOWNLOAD;
2187 er_flags &= ~QR_DOWNLOAD;
2190 if (yesbstr("visdir")) {
2191 er_flags |= QR_VISDIR;
2193 er_flags &= ~QR_VISDIR;
2196 Ptr = sbstr("anon");
2198 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2199 if (!strcmp(ChrPtr(Ptr), "anononly"))
2200 er_flags |= QR_ANONONLY;
2201 if (!strcmp(ChrPtr(Ptr), "anon2"))
2202 er_flags |= QR_ANONOPT;
2204 bump = yesbstr("bump");
2206 er_floor = ibstr("er_floor");
2208 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2210 ChrPtr(er_password),
2219 StrBuf_ServGetln(Buf);
2220 if (GetServerStatus(Buf, NULL) != 2) {
2221 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2224 FreeStrBuf(&er_name);
2225 FreeStrBuf(&er_password);
2226 FreeStrBuf(&er_dirname);
2227 FreeStrBuf(&er_roomaide);
2232 if (StrLength(er_roomaide) > 0) {
2233 serv_printf("SETA %s", ChrPtr(er_roomaide));
2234 StrBuf_ServGetln(Buf);
2235 if (GetServerStatus(Buf, NULL) != 2) {
2236 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2237 display_main_menu();
2239 FreeStrBuf(&er_name);
2240 FreeStrBuf(&er_password);
2241 FreeStrBuf(&er_dirname);
2242 FreeStrBuf(&er_roomaide);
2247 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2250 FreeStrBuf(&er_name);
2251 FreeStrBuf(&er_password);
2252 FreeStrBuf(&er_dirname);
2253 FreeStrBuf(&er_roomaide);
2259 * Display form for Invite, Kick, and show Who Knows a room
2261 void do_invt_kick(void) {
2262 char buf[SIZ], room[SIZ], username[SIZ];
2265 serv_getln(buf, sizeof buf);
2267 if (buf[0] != '2') {
2271 extract_token(room, &buf[4], 0, '|', sizeof room);
2273 strcpy(username, bstr("username"));
2275 if (havebstr("kick_button")) {
2276 sprintf(buf, "KICK %s", username);
2278 serv_getln(buf, sizeof buf);
2280 if (buf[0] != '2') {
2281 strcpy(WC->ImportantMessage, &buf[4]);
2283 sprintf(WC->ImportantMessage,
2284 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2289 if (havebstr("invite_button")) {
2290 sprintf(buf, "INVT %s", username);
2292 serv_getln(buf, sizeof buf);
2294 if (buf[0] != '2') {
2295 strcpy(WC->ImportantMessage, &buf[4]);
2297 sprintf(WC->ImportantMessage,
2298 _("<B><I>User %s invited to room %s.</I></B>\n"),
2309 * Display form for Invite, Kick, and show Who Knows a room
2311 void display_whok(void)
2313 char buf[SIZ], room[SIZ], username[SIZ];
2316 serv_getln(buf, sizeof buf);
2318 if (buf[0] != '2') {
2322 extract_token(room, &buf[4], 0, '|', sizeof room);
2325 wc_printf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2326 wc_printf(_("The users listed below have access to this room. "
2327 "To remove a user from the access list, select the user "
2328 "name from the list and click 'Kick'."));
2329 wc_printf("<br /><br />");
2331 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2332 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2333 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2334 wc_printf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2336 serv_getln(buf, sizeof buf);
2337 if (buf[0] == '1') {
2338 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2339 extract_token(username, buf, 0, '|', sizeof username);
2340 wc_printf("<OPTION>");
2345 wc_printf("</select><br />\n");
2347 wc_printf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2348 wc_printf("</form></CENTER>\n");
2350 wc_printf("</td><td>");
2351 wc_printf(_("To grant another user access to this room, enter the "
2352 "user name in the box below and click 'Invite'."));
2353 wc_printf("<br /><br />");
2355 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2356 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2357 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2358 wc_printf(_("Invite:"));
2360 wc_printf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2361 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2362 "<input type=\"submit\" value=\"%s\">"
2363 "</form></CENTER>\n", _("Invite"));
2364 /* Pop open an address book -- begin **/
2366 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2368 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2371 _("Users"), _("Users")
2373 /* Pop open an address book -- end **/
2375 wc_printf("</td></tr></table>\n");
2376 address_book_popup();
2383 * display the form for entering a new room
2385 void display_entroom(void)
2392 serv_puts("CRE8 0");
2393 serv_getln(buf, sizeof buf);
2395 if (buf[0] != '2') {
2396 strcpy(WC->ImportantMessage, &buf[4]);
2397 display_main_menu();
2402 output_headers(1, 1, 1, 0, 0, 0);
2404 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2405 do_template("beginbox", NULL);
2407 wc_printf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2408 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2410 wc_printf("<table class=\"altern\"> ");
2412 wc_printf("<tr class=\"even\"><td>");
2413 wc_printf(_("Name of room: "));
2414 wc_printf("</td><td>");
2415 wc_printf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2416 wc_printf("</td></tr>");
2418 wc_printf("<tr class=\"odd\"><td>");
2419 wc_printf(_("Resides on floor: "));
2420 wc_printf("</td><td>");
2421 load_floorlist(Buf);
2422 wc_printf("<select name=\"er_floor\" size=\"1\">\n");
2423 for (i = 0; i < 128; ++i)
2424 if (!IsEmptyStr(floorlist[i])) {
2425 wc_printf("<option ");
2426 wc_printf("value=\"%d\">", i);
2427 escputs(floorlist[i]);
2428 wc_printf("</option>\n");
2430 wc_printf("</select>\n");
2431 wc_printf("</td></tr>");
2434 * Our clever little snippet of JavaScript automatically selects
2435 * a public room if the view is set to Bulletin Board or wiki, and
2436 * it selects a mailbox room otherwise. The user can override this,
2437 * of course. We also disable the floor selector for mailboxes.
2439 wc_printf("<tr class=\"even\"><td>");
2440 wc_printf(_("Default view for room: "));
2441 wc_printf("</td><td>");
2442 wc_printf("<select name=\"er_view\" size=\"1\" OnChange=\""
2443 " if ( (this.form.er_view.value == 0) "
2444 " || (this.form.er_view.value == 6) ) { "
2445 " this.form.type[0].checked=true; "
2446 " this.form.er_floor.disabled = false; "
2449 " this.form.type[4].checked=true; "
2450 " this.form.er_floor.disabled = true; "
2453 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2454 if (is_view_allowed_as_default(i)) {
2455 wc_printf("<option %s value=\"%d\">",
2456 ((i == 0) ? "selected" : ""), i );
2457 escputs(viewdefs[i]);
2458 wc_printf("</option>\n");
2461 wc_printf("</select>\n");
2462 wc_printf("</td></tr>");
2464 wc_printf("<tr class=\"even\"><td>");
2465 wc_printf(_("Type of room:"));
2466 wc_printf("</td><td>");
2467 wc_printf("<ul class=\"adminlist\">\n");
2469 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2470 wc_printf("CHECKED OnChange=\""
2471 " if (this.form.type[0].checked == true) { "
2472 " this.form.er_floor.disabled = false; "
2475 wc_printf(_("Public (automatically appears to everyone)"));
2478 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2479 " if (this.form.type[1].checked == true) { "
2480 " this.form.er_floor.disabled = false; "
2483 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
2486 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2487 " if (this.form.type[2].checked == true) { "
2488 " this.form.er_floor.disabled = false; "
2491 wc_printf(_("Private - require password: "));
2492 wc_printf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2495 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2496 " if (this.form.type[3].checked == true) { "
2497 " this.form.er_floor.disabled = false; "
2500 wc_printf(_("Private - invitation only"));
2503 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2505 " if (this.form.type[4].checked == true) { "
2506 " this.form.er_floor.disabled = true; "
2509 wc_printf(_("Personal (mailbox for you only)"));
2512 wc_printf("\n</ul>\n");
2513 wc_printf("</td></tr></table>\n");
2515 wc_printf("<div class=\"buttons\">\n");
2516 wc_printf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2517 wc_printf(" ");
2518 wc_printf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2519 wc_printf("</div>\n");
2520 wc_printf("</form>\n<hr />");
2521 serv_printf("MESG roomaccess");
2522 serv_getln(buf, sizeof buf);
2523 if (buf[0] == '1') {
2527 do_template("endbox", NULL);
2537 * support function for entroom() -- sets the default view
2539 void er_set_default_view(int newview) {
2552 serv_getln(buf, sizeof buf);
2553 if (buf[0] != '2') return;
2555 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2556 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2557 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2558 rm_bits1 = extract_int(&buf[4], 3);
2559 rm_floor = extract_int(&buf[4], 4);
2560 rm_listorder = extract_int(&buf[4], 5);
2561 rm_bits2 = extract_int(&buf[4], 7);
2563 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2564 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2565 rm_listorder, newview, rm_bits2
2567 serv_getln(buf, sizeof buf);
2578 const StrBuf *er_name;
2579 const StrBuf *er_type;
2580 const StrBuf *er_password;
2585 if (!havebstr("ok_button")) {
2586 strcpy(WC->ImportantMessage,
2587 _("Cancelled. No new room was created."));
2588 display_main_menu();
2591 er_name = sbstr("er_name");
2592 er_type = sbstr("type");
2593 er_password = sbstr("er_password");
2594 er_floor = ibstr("er_floor");
2595 er_view = ibstr("er_view");
2598 if (!strcmp(ChrPtr(er_type), "hidden"))
2600 else if (!strcmp(ChrPtr(er_type), "passworded"))
2602 else if (!strcmp(ChrPtr(er_type), "invonly"))
2604 else if (!strcmp(ChrPtr(er_type), "personal"))
2607 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2610 ChrPtr(er_password),
2615 serv_getln(buf, sizeof buf);
2616 if (buf[0] != '2') {
2617 strcpy(WC->ImportantMessage, &buf[4]);
2618 display_main_menu();
2621 /** TODO: Room created, now udate the left hand icon bar for this user */
2622 burn_folder_cache(0); /* burn the old folder cache */
2626 do_change_view(er_view); /* Now go there */
2631 * \brief display the screen to enter a private room
2633 void display_private(char *rname, int req_pass)
2635 WCTemplputParams SubTP;
2637 output_headers(1, 1, 1, 0, 0, 0);
2639 Buf = NewStrBufPlain(_("Go to a hidden room"), -1);
2640 memset(&SubTP, 0, sizeof(WCTemplputParams));
2641 SubTP.Filter.ContextType = CTX_STRBUF;
2642 SubTP.Context = Buf;
2643 DoTemplate(HKEY("beginbox"), NULL, &SubTP);
2648 wc_printf(_("If you know the name of a hidden (guess-name) or "
2649 "passworded room, you can enter that room by typing "
2650 "its name below. Once you gain access to a private "
2651 "room, it will appear in your regular room listings "
2652 "so you don't have to keep returning here."));
2655 wc_printf("<form method=\"post\" action=\"goto_private\">\n");
2656 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2658 wc_printf("<table class=\"altern\"> "
2659 "<tr class=\"even\"><td>");
2660 wc_printf(_("Enter room name:"));
2661 wc_printf("</td><td>"
2662 "<input type=\"text\" name=\"gr_name\" "
2663 "value=\"%s\" maxlength=\"128\">\n", rname);
2666 wc_printf("</td></tr><tr class=\"odd\"><td>");
2667 wc_printf(_("Enter room password:"));
2668 wc_printf("</td><td>");
2669 wc_printf("<input type=\"password\" name=\"gr_pass\" maxlength=\"9\">\n");
2671 wc_printf("</td></tr></table>\n");
2673 wc_printf("<div class=\"buttons\">\n");
2674 wc_printf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">"
2676 "<input type=\"submit\" name=\"cancel_button\" value=\"%s\">",
2680 wc_printf("</div></form>\n");
2682 do_template("endbox", NULL);
2688 * \brief goto a private room
2690 void goto_private(void)
2695 if (!havebstr("ok_button")) {
2696 display_main_menu();
2699 strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
2700 serv_printf("GOTO %s|%s",
2703 serv_getln(buf, sizeof buf);
2705 if (buf[0] == '2') {
2706 smart_goto(sbstr("gr_name"));
2709 if (!strncmp(buf, "540", 3)) {
2710 display_private(bstr("gr_name"), 1);
2713 output_headers(1, 1, 1, 0, 0, 0);
2714 wc_printf("%s\n", &buf[4]);
2721 * \brief display the screen to zap a room
2723 void display_zap(void)
2725 output_headers(1, 1, 2, 0, 0, 0);
2727 wc_printf("<div id=\"banner\">\n");
2729 wc_printf(_("Zap (forget/unsubscribe) the current room"));
2730 wc_printf("</h1>\n");
2731 wc_printf("</div>\n");
2733 wc_printf("<div id=\"content\" class=\"service\">\n");
2735 wc_printf(_("If you select this option, <em>%s</em> will "
2736 "disappear from your room list. Is this what you wish "
2737 "to do?<br />\n"), ChrPtr(WC->CurRoom.name));
2739 wc_printf("<form method=\"POST\" action=\"zap\">\n");
2740 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2741 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Zap this room"));
2742 wc_printf(" ");
2743 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
2744 wc_printf("</form>\n");
2755 StrBuf *final_destination;
2758 * If the forget-room routine fails for any reason, we fall back
2759 * to the current room; otherwise, we go to the Lobby
2761 final_destination = NewStrBufDup(WC->CurRoom.name);
2763 if (havebstr("ok_button")) {
2764 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
2765 serv_getln(buf, sizeof buf);
2766 if (buf[0] == '2') {
2768 serv_getln(buf, sizeof buf);
2769 if (buf[0] == '2') {
2770 FlushStrBuf(final_destination);
2771 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2775 smart_goto(final_destination);
2776 FreeStrBuf(&final_destination);
2782 * \brief Delete the current room
2784 void delete_room(void)
2789 serv_puts("KILL 1");
2790 serv_getln(buf, sizeof buf);
2791 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2792 if (buf[0] != '2') {
2793 strcpy(WC->ImportantMessage, &buf[4]);
2794 display_main_menu();
2799 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2808 * \brief Perform changes to a room's network configuration
2810 void netedit(void) {
2819 /*/ TODO: do line dynamic! */
2820 if (havebstr("line_pop3host")) {
2821 strcpy(line, bstr("prefix"));
2822 strcat(line, bstr("line_pop3host"));
2824 strcat(line, bstr("line_pop3user"));
2826 strcat(line, bstr("line_pop3pass"));
2828 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2830 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2831 strcat(line, bstr("suffix"));
2833 else if (havebstr("line")) {
2834 strcpy(line, bstr("prefix"));
2835 strcat(line, bstr("line"));
2836 strcat(line, bstr("suffix"));
2851 serv_getln(buf, sizeof buf);
2852 if (buf[0] != '1') {
2858 /** This loop works for add *or* remove. Spiffy, eh? */
2859 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2860 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2861 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2862 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2863 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2864 if ( (strcasecmp(cmpa0, cmpb0))
2865 || (strcasecmp(cmpa1, cmpb1)) ) {
2866 fprintf(fp, "%s\n", buf);
2872 serv_getln(buf, sizeof buf);
2873 if (buf[0] != '4') {
2879 while (fgets(buf, sizeof buf, fp) != NULL) {
2880 buf[strlen(buf)-1] = 0;
2884 if (havebstr("add_button")) {
2885 num_addrs = num_tokens(bstr("line"), ',');
2886 if (num_addrs < 2) {
2887 /* just adding one node or address */
2891 /* adding multiple addresses separated by commas */
2892 for (i=0; i<num_addrs; ++i) {
2893 strcpy(line, bstr("prefix"));
2894 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2897 strcat(line, bstr("suffix"));
2911 * \brief Convert a room name to a folder-ish-looking name.
2912 * \param folder the folderish name
2913 * \param room the room name
2914 * \param floor the floor name
2915 * \param is_mailbox is it a mailbox?
2917 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2922 * For mailboxes, just do it straight...
2925 sprintf(folder, "My folders|%s", room);
2929 * Otherwise, prefix the floor name as a "public folders" moniker
2932 if (floor > MAX_FLOORS) {
2934 sprintf(folder, "%%%%%%|%s", room);
2937 sprintf(folder, "%s|%s", floorlist[floor], room);
2942 * Replace "\" characters with "|" for pseudo-folder-delimiting
2944 len = strlen (folder);
2945 for (i=0; i<len; ++i) {
2946 if (folder[i] == '\\') folder[i] = '|';
2954 * \brief Back end for change_view()
2955 * \param newview set newview???
2957 void do_change_view(int newview) {
2960 serv_printf("VIEW %d", newview);
2961 serv_getln(buf, sizeof buf);
2962 WC->CurRoom.view = newview;
2963 smart_goto(WC->CurRoom.name);
2969 * \brief Change the view for this room
2971 void change_view(void) {
2974 view = lbstr("view");
2975 do_change_view(view);
2979 * \brief Burn the cached folder list.
2980 * \param age How old the cahce needs to be before we burn it.
2983 void burn_folder_cache(time_t age)
2985 /** If our cached folder list is very old, burn it. */
2986 if (WC->cache_fold != NULL) {
2987 if ((time(NULL) - WC->cache_timestamp) > age) {
2988 free(WC->cache_fold);
2989 WC->cache_fold = NULL;
2997 * \brief Do either a known rooms list or a folders list, depending on the
3002 StrBuf *ListView = NULL;
3004 /** Determine whether the user is trying to change views */
3005 if (havebstr("view")) {
3006 ListView = NewStrBufDup(SBSTR("view"));
3007 set_preference("roomlistview", ListView, 1);
3009 /** Sanitize the input so its safe */
3010 if(!get_preference("roomlistview", &ListView) ||
3011 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
3012 (strcasecmp(ChrPtr(ListView), "table") != 0)))
3014 if (ListView == NULL) {
3015 ListView = NewStrBufPlain(HKEY("rooms"));
3016 set_preference("roomlistview", ListView, 0);
3019 StrBufPlain(ListView, HKEY("rooms"));
3029 * \brief Set the message expire policy for this room and/or floor
3031 void set_room_policy(void) {
3034 if (!havebstr("ok_button")) {
3035 strcpy(WC->ImportantMessage,
3036 _("Cancelled. Changes were not saved."));
3041 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3042 serv_getln(buf, sizeof buf);
3043 strcpy(WC->ImportantMessage, &buf[4]);
3045 if (WC->axlevel >= 6) {
3046 strcat(WC->ImportantMessage, "<br />\n");
3047 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3048 serv_getln(buf, sizeof buf);
3049 strcat(WC->ImportantMessage, &buf[4]);
3055 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3057 StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
3061 void _display_private(void) {
3062 display_private("", 0);
3065 void dotgoto(void) {
3066 if (!havebstr("room")) {
3067 readloop(readnew, eUseDefault);
3070 if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3073 smart_goto(sbstr("room"));
3078 void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
3080 wcsession *WCC = WC;
3083 StrBufAppendTemplate(Target, TP,
3088 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3090 wc_printf("<div id=\"banner\">\n");
3091 embed_room_banner(NULL, navbar_default);
3092 wc_printf("</div>\n");
3096 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3098 wcsession *WCC = WC;
3101 (!IsEmptyStr(WCC->ugname)))
3102 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3105 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
3107 wcsession *WCC = WC;
3108 return (WCC != NULL)? (WCC->is_room_aide == 0) : 0;
3111 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
3113 wcsession *WCC = WC;
3114 return (WCC == NULL)? 0 :
3115 ( (WCC->is_room_aide) || /////TODO!
3116 (WCC->CurRoom.is_inbox) ||
3117 (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
3120 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3122 wcsession *WCC = WC;
3124 return ((WCC!=NULL) &&
3125 (!IsEmptyStr(WCC->ugname)) &&
3126 (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0));
3129 int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3132 wcsession *WCC = WC;
3134 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3135 if (QR_CheckFlag == 0)
3136 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3137 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3139 return ((WCC!=NULL) &&
3140 ((WCC->CurRoom.QRFlags & QR_CheckFlag) != 0));
3143 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3146 folder *Folder = (folder *)(TP->Context);
3148 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3149 if (QR_CheckFlag == 0)
3150 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3151 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3152 return ((Folder->QRFlags & QR_CheckFlag) != 0);
3156 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3158 wcsession *WCC = WC;
3160 return ( (WCC!= NULL) &&
3161 ((WCC->axlevel >= 6) ||
3162 (WCC->is_room_aide) ||
3163 (WCC->CurRoom.is_inbox) ));
3166 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
3168 wcsession *WCC = WC;
3170 if ((WCC == NULL) ||
3171 (TP->Tokens->nParameters < 3) ||
3172 (TP->Tokens->Params[2]->Type != TYPE_STR)||
3173 (TP->Tokens->Params[2]->len < 7))
3176 switch(WCC->CurRoom.view) {
3178 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_BBS"));
3180 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_MAILBOX"));
3181 case VIEW_ADDRESSBOOK:
3182 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_ADDRESSBOOK"));
3184 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_TASKS"));
3186 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_NOTES"));
3188 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_WIKI"));
3190 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_JOURNAL"));
3192 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALENDAR"));
3194 return (!strcasecmp(TP->Tokens->Params[2]->Start, "VIEW_CALBRIEF"));
3204 RegisterPreference("roomlistview",
3205 _("Room list view"),
3208 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
3210 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
3212 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
3213 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
3214 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
3215 WebcitAddUrlHandler(HKEY("display_private"), "", 0, _display_private, 0);
3216 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
3217 WebcitAddUrlHandler(HKEY("zapped_list"), "", 0, zapped_list, 0);
3218 WebcitAddUrlHandler(HKEY("display_zap"), "", 0, display_zap, 0);
3219 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
3220 WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0);
3221 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
3222 WebcitAddUrlHandler(HKEY("display_whok"), "", 0, display_whok, 0);
3223 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
3224 WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0);
3225 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
3226 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
3227 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
3228 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
3229 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
3230 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
3231 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
3233 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
3234 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalCurrentRoomHas_QRFlag, CTX_NONE);
3235 RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
3237 REGISTERTokenParamDefine(QR_PERMANENT);
3238 REGISTERTokenParamDefine(QR_INUSE);
3239 REGISTERTokenParamDefine(QR_PRIVATE);
3240 REGISTERTokenParamDefine(QR_PASSWORDED);
3241 REGISTERTokenParamDefine(QR_GUESSNAME);
3242 REGISTERTokenParamDefine(QR_DIRECTORY);
3243 REGISTERTokenParamDefine(QR_UPLOAD);
3244 REGISTERTokenParamDefine(QR_DOWNLOAD);
3245 REGISTERTokenParamDefine(QR_VISDIR);
3246 REGISTERTokenParamDefine(QR_ANONONLY);
3247 REGISTERTokenParamDefine(QR_ANONOPT);
3248 REGISTERTokenParamDefine(QR_NETWORK);
3249 REGISTERTokenParamDefine(QR_PREFONLY);
3250 REGISTERTokenParamDefine(QR_READONLY);
3251 REGISTERTokenParamDefine(QR_MAILBOX);
3252 REGISTERTokenParamDefine(QR2_SYSTEM);
3253 REGISTERTokenParamDefine(QR2_SELFLIST);
3254 REGISTERTokenParamDefine(QR2_COLLABDEL);
3255 REGISTERTokenParamDefine(QR2_SUBJECTREQ);
3256 REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
3257 REGISTERTokenParamDefine(QR2_MODERATED);
3259 REGISTERTokenParamDefine(UA_KNOWN);
3260 REGISTERTokenParamDefine(UA_GOTOALLOWED);
3261 REGISTERTokenParamDefine(UA_HASNEWMSGS);
3262 REGISTERTokenParamDefine(UA_ZAPPED);
3263 REGISTERTokenParamDefine(UA_POSTALLOWED);
3264 REGISTERTokenParamDefine(UA_ADMINALLOWED);
3265 REGISTERTokenParamDefine(UA_DELETEALLOWED);
3266 REGISTERTokenParamDefine(UA_ISTRASH);
3268 REGISTERTokenParamDefine(US_NEEDVALID);
3269 REGISTERTokenParamDefine(US_PERM);
3270 REGISTERTokenParamDefine(US_LASTOLD);
3271 REGISTERTokenParamDefine(US_EXPERT);
3272 REGISTERTokenParamDefine(US_UNLISTED);
3273 REGISTERTokenParamDefine(US_NOPROMPT);
3274 REGISTERTokenParamDefine(US_PROMPTCTL);
3275 REGISTERTokenParamDefine(US_DISAPPEAR);
3276 REGISTERTokenParamDefine(US_REGIS);
3277 REGISTERTokenParamDefine(US_PAGINATOR);
3278 REGISTERTokenParamDefine(US_INTERNET);
3279 REGISTERTokenParamDefine(US_FLOORS);
3280 REGISTERTokenParamDefine(US_COLOR);
3281 REGISTERTokenParamDefine(US_USER_SET);
3284 RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
3285 RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
3287 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
3288 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
3290 RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
3291 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
3292 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
3299 SessionDestroyModule_ROOMOPS
3302 FlushFolder(&sess->CurRoom);
3303 if (sess->cache_fold != NULL) {
3304 free(sess->cache_fold);
3307 free_march_list(sess);
3308 DeleteHash(&sess->Floors);