3 * Lots of different room-related operations.
10 char floorlist[MAX_FLOORS][SIZ]; /* list of our floor names */
12 /* See GetFloorListHash and GetRoomListHash for info on these.
13 * Basically we pull LFLR/LKRA etc. and set up a room HashList with these keys.
16 void display_whok(void);
17 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP);
20 char *viewdefs[VIEW_MAX]; /* the different kinds of available views */
22 ROOM_VIEWS exchangeable_views[VIEW_MAX][VIEW_MAX] = { /* the different kinds of available views for a view */
23 {VIEW_BBS, VIEW_MAILBOX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX },
24 {VIEW_BBS, VIEW_MAILBOX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX },
25 {VIEW_MAX, VIEW_MAX, VIEW_ADDRESSBOOK, VIEW_CALENDAR, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX },
26 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_CALENDAR, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX /*VIEW_CALBRIEF*/, VIEW_MAX, VIEW_MAX },
27 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_TASKS, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, },
28 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_NOTES, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, },
29 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_WIKI, VIEW_MAX, VIEW_MAX, VIEW_MAX},
30 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_CALENDAR, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX/*VIEW_CALBRIEF*/, VIEW_MAX, VIEW_MAX},
31 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_JOURNAL, VIEW_MAX },
32 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_BLOG },
34 /* the brief calendar view is disabled: VIEW_CALBRIEF */
37 * Initialize the viewdefs with localized strings
39 void initialize_viewdefs(void) {
40 viewdefs[VIEW_BBS] = _("Bulletin Board");
41 viewdefs[VIEW_MAILBOX] = _("Mail Folder");
42 viewdefs[VIEW_ADDRESSBOOK] = _("Address Book");
43 viewdefs[VIEW_CALENDAR] = _("Calendar");
44 viewdefs[VIEW_TASKS] = _("Task List");
45 viewdefs[VIEW_NOTES] = _("Notes List");
46 viewdefs[VIEW_WIKI] = _("Wiki");
47 viewdefs[VIEW_CALBRIEF] = _("Calendar List");
48 viewdefs[VIEW_JOURNAL] = _("Journal");
49 viewdefs[VIEW_BLOG] = _("Blog");
53 * Determine which views are allowed as the default for creating a new room.
55 int is_view_allowed_as_default(int which_view)
58 case VIEW_BBS: return(1);
59 case VIEW_MAILBOX: return(1);
60 case VIEW_ADDRESSBOOK: return(1);
61 case VIEW_CALENDAR: return(1);
62 case VIEW_TASKS: return(1);
63 case VIEW_NOTES: return(1);
64 case VIEW_WIKI: return(1);
65 case VIEW_CALBRIEF: return(0);
66 case VIEW_JOURNAL: return(0);
67 default: return(0); /* should never get here */
73 * load the list of floors
75 void load_floorlist(StrBuf *Buf)
80 for (a = 0; a < MAX_FLOORS; ++a)
84 StrBuf_ServGetln(Buf);
85 if (GetServerStatus(Buf, NULL) != 1) {
86 strcpy(floorlist[0], "Main Floor");
89 while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
90 if ( (StrLength(Buf)==3) &&
91 !strcmp(ChrPtr(Buf), "000")) {
95 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
102 * Embed the room banner
104 * got The information returned from a GOTO server command
105 * navbar_style Determines which navigation buttons to display
109 void embed_room_banner(void)
114 /* refresh current room states... */
115 /* dosen't work??? gotoroom(NULL); */
117 /* The browser needs some information for its own use */
118 wc_printf("<script type=\"text/javascript\"> \n"
119 " room_is_trash = %d; \n"
121 ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0)
125 * If the user happens to select the "make this my start page" link,
126 * we want it to remember the URL as a "/dotskip" one instead of
127 * a "skip" or "gotonext" or something like that.
129 if (WCC->Hdr->this_page == NULL) {
130 WCC->Hdr->this_page = NewStrBuf();
132 StrBufPrintf(WCC->Hdr->this_page,
134 ChrPtr(WC->CurRoom.name)
137 do_template("roombanner", NULL);
138 /* roombanner contains this for mobile */
143 wc_printf("<div id=\"navbar\"><ul>");
146 "<li class=\"ungoto\">"
147 "<a href=\"ungoto\">"
148 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
149 "<span class=\"navbar_link\">%s</span></A>"
150 "</li>\n", _("Ungoto")
153 if (WC->CurRoom.view == VIEW_BBS) {
155 "<li class=\"newmess\">"
156 "<a href=\"readnew\">"
157 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
158 "<span class=\"navbar_link\">%s</span></A>"
159 "</li>\n", _("Read new messages")
163 switch(WC->CurRoom.view) {
164 case VIEW_ADDRESSBOOK:
166 "<li class=\"viewcontacts\">"
167 "<a href=\"readfwd\">"
168 "<img src=\"static/viewcontacts_24x.gif\" "
169 "alt=\"\" width=\"24\" height=\"24\">"
170 "<span class=\"navbar_link\">"
172 "</span></a></li>\n", _("View contacts")
177 "<li class=\"staskday\">"
178 "<a href=\"readfwd?calview=day\">"
179 "<img src=\"static/taskday2_24x.gif\" "
180 "alt=\"\" width=\"24\" height=\"24\">"
181 "<span class=\"navbar_link\">"
183 "</span></a></li>\n", _("Day view")
186 "<li class=\"monthview\">"
187 "<a href=\"readfwd?calview=month\">"
188 "<img src=\"static/monthview2_24x.gif\" "
189 "alt=\"\" width=\"24\" height=\"24\">"
190 "<span class=\"navbar_link\">"
192 "</span></a></li>\n", _("Month view")
197 "<li class=\"monthview\">"
198 "<a href=\"readfwd?calview=month\">"
199 "<img src=\"static/monthview2_24x.gif\" "
200 "alt=\"\" width=\"24\" height=\"24\">"
201 "<span class=\"navbar_link\">"
203 "</span></a></li>\n", _("Calendar list")
208 "<li class=\"taskmanag\">"
209 "<a href=\"readfwd\">"
210 "<img src=\"static/taskmanag_24x.gif\" "
211 "alt=\"\" width=\"24\" height=\"24\">"
212 "<span class=\"navbar_link\">"
214 "</span></a></li>\n", _("View tasks")
219 "<li class=\"viewnotes\">"
220 "<a href=\"readfwd\">"
221 "<img src=\"static/viewnotes_24x.gif\" "
222 "alt=\"\" width=\"24\" height=\"24\">"
223 "<span class=\"navbar_link\">"
225 "</span></a></li>\n", _("View notes")
230 "<li class=\"readallmess\">"
231 "<a id=\"m_refresh\" href=\"readfwd\">"
232 "<img src=\"static/readallmess3_24x.gif\" "
233 "alt=\"\" width=\"24\" height=\"24\">"
234 "<span class=\"navbar_link\">"
236 "</span></a></li>\n", _("Refresh message list")
241 "<li class=\"readallmess\">"
242 "<a href=\"wiki?page=home\">"
243 "<img src=\"static/readallmess3_24x.gif\" "
244 "alt=\"\" width=\"24\" height=\"24\">"
245 "<span class=\"navbar_link\">"
247 "</span></a></li>\n", _("Wiki home")
252 "<li class=\"readallmess\">"
253 "<a href=\"readfwd\">"
254 "<img src=\"static/readallmess3_24x.gif\" "
255 "alt=\"\" width=\"24\" height=\"24\">"
256 "<span class=\"navbar_link\">"
258 "</span></a></li>\n", _("Read all messages")
263 switch(WC->CurRoom.view) {
264 case VIEW_ADDRESSBOOK:
266 "<li class=\"addnewcontact\">"
267 "<a href=\"display_enter\">"
268 "<img src=\"static/addnewcontact_24x.gif\" "
269 "alt=\"\" width=\"24\" height=\"24\">"
270 "<span class=\"navbar_link\">"
272 "</span></a></li>\n", _("Add new contact")
277 wc_printf("<li class=\"addevent\"><a href=\"display_enter");
278 if (havebstr("year" )) wc_printf("?year=%s", bstr("year"));
279 if (havebstr("month")) wc_printf("?month=%s", bstr("month"));
280 if (havebstr("day" )) wc_printf("?day=%s", bstr("day"));
282 "<img src=\"static/addevent_24x.gif\" "
283 "alt=\"\" width=\"24\" height=\"24\">"
284 "<span class=\"navbar_link\">"
286 "</span></a></li>\n", _("Add new event")
291 "<li class=\"newmess\">"
292 "<a href=\"display_enter\">"
293 "<img src=\"static/newmess3_24x.gif\" "
294 "alt=\"\" width=\"24\" height=\"24\">"
295 "<span class=\"navbar_link\">"
297 "</span></a></li>\n", _("Add new task")
302 "<li class=\"enternewnote\">"
303 "<a href=\"add_new_note\">"
304 "<img src=\"static/enternewnote_24x.gif\" "
305 "alt=\"\" width=\"24\" height=\"24\">"
306 "<span class=\"navbar_link\">"
308 "</span></a></li>\n", _("Add new note")
312 safestrncpy(buf, bstr("page"), sizeof buf);
313 if (IsEmptyStr(buf)) {
314 safestrncpy(buf, "home", sizeof buf);
318 "<li class=\"newmess\">"
319 "<a href=\"display_enter?page=%s\">"
320 "<img src=\"static/newmess3_24x.gif\" "
321 "alt=\"\" width=\"24\" height=\"24\">"
322 "<span class=\"navbar_link\">"
324 "</span></a></li>\n", buf, _("Edit this page")
327 if (bmstrcasestr((char *)ChrPtr(WCC->Hdr->HR.ReqLine), "wiki_history")) {
328 /* already viewing history; display a link to the current page */
330 "<li class=\"newmess\">"
331 "<a href=\"wiki?page=%s\">"
332 "<img src=\"static/newmess3_24x.gif\" "
333 "alt=\"\" width=\"24\" height=\"24\">"
334 "<span class=\"navbar_link\">"
336 "</span></a></li>\n", buf, _("Current version")
340 /* display a link to the history */
342 "<li class=\"newmess\">"
343 "<a href=\"wiki_history?page=%s\">"
344 "<img src=\"static/newmess3_24x.gif\" "
345 "alt=\"\" width=\"24\" height=\"24\">"
346 "<span class=\"navbar_link\">"
348 "</span></a></li>\n", buf, _("History")
354 "<li class=\"newmess\">"
355 "<a href=\"display_enter\">"
356 "<img src=\"static/newmess3_24x.gif\" "
357 "alt=\"\" width=\"24\" height=\"24\">"
358 "<span class=\"navbar_link\">"
360 "</span></a></li>\n", _("Write mail")
363 "<li class=\"newmess\">"
364 "<a href=\"javascript:deleteAllSelectedMessages();\">"
365 "<img src=\"static/delete.gif\" "
366 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
368 "</span></a></li>\n", _("Delete")
373 "<li class=\"newmess\">"
374 "<a href=\"display_enter\">"
375 "<img src=\"static/newmess3_24x.gif\" "
376 "alt=\"\" width=\"24\" height=\"24\">"
377 "<span class=\"navbar_link\">"
379 "</span></a></li>\n", _("Enter a message")
385 "<li class=\"skipthisroom\">"
388 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
389 "width=\"24\" height=\"24\">"
390 "<span class=\"navbar_link\">%s</span></a>"
392 _("Leave all messages marked as unread, go to next room with unread messages"),
397 "<li class=\"markngo\">"
398 "<a href=\"gotonext\" "
400 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
401 "width=\"24\" height=\"24\">"
402 "<span class=\"navbar_link\">%s</span></a>"
404 _("Mark all messages as read, go to next room with unread messages"),
408 wc_printf("</ul></div>\n");
413 * back end routine to take the session to a new room
415 long gotoroom(const StrBuf *gname)
419 static long ls = (-1L);
422 /* store ungoto information */
423 if (StrLength(gname) > 0)
424 strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
428 /* move to the new room */
429 if (StrLength(gname) > 0)
430 serv_printf("GOTO %s", ChrPtr(gname));
431 else /* or just refresh the current state... */
432 serv_printf("GOTO 00000000000000000000");
433 StrBuf_ServGetln(Buf);
434 if (GetServerStatus(Buf, &err) != 2) {
435 serv_puts("GOTO _BASEROOM_");
436 StrBuf_ServGetln(Buf);
438 * well, we know that this is the fallback case,
439 * but we're interested that the first command
440 * didn't work out in first place.
442 if (GetServerStatus(Buf, NULL) != 2) {
447 ParseGoto(&WCC->CurRoom, Buf);
449 if (StrLength(gname) > 0)
451 remove_march(WCC->CurRoom.name);
452 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
461 void ParseGoto(folder *room, StrBuf *Line)
469 if (StrLength(Line) < 4) {
473 /* ignore the commandstate... */
474 Pos = ChrPtr(Line) + 4;
476 if (room->RoomNameParts != NULL)
479 for (i=0; i < room->nRoomNameParts; i++)
480 FreeStrBuf(&room->RoomNameParts[i]);
481 free(room->RoomNameParts);
482 room->RoomNameParts = NULL;
487 pBuf = NewStrBufPlain(NULL, StrLength(Line));
490 memset(room, 0, sizeof(folder));
493 StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
495 room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|');
496 if (room->nNewMessages > 0)
497 room->RAFlags |= UA_HASNEWMSGS;
499 room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
501 room->ShowInfo = StrBufExtractNext_long(Line, &Pos, '|');
503 room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
505 room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
506 room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
508 room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
510 flag = StrBufExtractNext_long(Line, &Pos, '|');
511 if (WCC->is_aide || flag) {
512 room->RAFlags |= UA_ADMINALLOWED;
515 room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
517 room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor
519 room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view
521 room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview
523 flag = StrBufExtractNext_long(Line, &Pos, '|');
525 room->RAFlags |= UA_ISTRASH; // wc_is_trash
527 room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2
529 /* find out, whether we are in a sub-room */
530 room->nRoomNameParts = StrBufNum_tokens(room->name, '\\');
531 if (room->nRoomNameParts > 1)
536 room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1));
537 memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1));
538 for (i=0; i < room->nRoomNameParts; i++)
540 room->RoomNameParts[i] = NewStrBuf();
541 StrBufExtract_NextToken(room->RoomNameParts[i],
542 room->name, &Pos, '\\');
546 /* Private mailboxes on the main floor get remapped to the personal folder */
547 if ((room->QRFlags & QR_MAILBOX) &&
548 (room->floorid == 0))
550 room->floorid = VIRTUAL_MY_FLOOR;
551 if ((room->nRoomNameParts == 1) &&
552 (StrLength(room->name) == 4) &&
553 (strcmp(ChrPtr(room->name), "Mail") == 0))
559 /* get a pointer to the floor we're on: */
560 if (WCC->Floors == NULL)
561 GetFloorListHash(NULL, NULL);
563 GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
564 room->Floor = (const Floor*) vFloor;
567 void LoadRoomAide(void)
572 if (WCC->CurRoom.RoomAideLoaded)
575 WCC->CurRoom.RoomAideLoaded = 1;
578 StrBuf_ServGetln(Buf);
579 if (GetServerStatus(Buf, NULL) != 2) {
580 FlushStrBuf(WCC->CurRoom.RoomAide);
581 AppendImportantMessage (ChrPtr(Buf) + 4,
586 Pos = ChrPtr(Buf) + 4;
588 FreeStrBuf(&WCC->CurRoom.RoomAide);
589 WCC->CurRoom.RoomAide = NewStrBufPlain (NULL, StrLength (Buf));
591 StrBufExtract_NextToken(WCC->CurRoom.RoomAide, Buf, &Pos, '|');
595 void tmplput_CurrentRoomFloorName(StrBuf *Target, WCTemplputParams *TP)
598 folder *Folder = &WCC->CurRoom;
599 const Floor *pFloor = Folder->Floor;
604 StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
607 void tmplput_CurrentRoomAide(StrBuf *Target, WCTemplputParams *TP)
613 StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
617 void LoadRoomXA (void)
622 if (WCC->CurRoom.XALoaded)
625 WCC->CurRoom.XALoaded = 1;
628 StrBuf_ServGetln(Buf);
629 if (GetServerStatus(Buf, NULL) != 2) {
630 FlushStrBuf(WCC->CurRoom.XAPass);
631 FlushStrBuf(WCC->CurRoom.Directory);
633 AppendImportantMessage (ChrPtr(Buf) + 4,
638 Pos = ChrPtr(Buf) + 4;
640 FreeStrBuf(&WCC->CurRoom.XAPass);
641 FreeStrBuf(&WCC->CurRoom.Directory);
643 WCC->CurRoom.XAPass = NewStrBufPlain (NULL, StrLength (Buf));
644 WCC->CurRoom.Directory = NewStrBufPlain (NULL, StrLength (Buf));
646 StrBufSkip_NTokenS(Buf, &Pos, '|', 1); /* The Name, we already know... */
647 StrBufExtract_NextToken(WCC->CurRoom.XAPass, Buf, &Pos, '|');
648 StrBufExtract_NextToken(WCC->CurRoom.Directory, Buf, &Pos, '|');
649 StrBufSkip_NTokenS(Buf, &Pos, '|', 2); /* QRFlags, FloorNum we already know... */
650 WCC->CurRoom.Order = StrBufExtractNext_long(Buf, &Pos, '|');
651 /* defview, we already know you. */
652 /* QR2Flags, we already know them... */
659 void LoadXRoomPic(void)
664 if (WCC->CurRoom.XHaveRoomPicLoaded)
667 WCC->CurRoom.XHaveRoomPicLoaded = 1;
669 serv_puts("OIMG _roompic_");
670 StrBuf_ServGetln(Buf);
671 if (GetServerStatus(Buf, NULL) != 2) {
672 WCC->CurRoom.XHaveRoomPic = 0;
674 WCC->CurRoom.XHaveRoomPic = 1;
677 StrBuf_ServGetln(Buf);
678 GetServerStatus(Buf, NULL);
682 int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
690 return WCC->CurRoom.XHaveRoomPic == 1;
693 void LoadXRoomInfoText(void)
699 if (WCC->CurRoom.XHaveInfoTextLoaded)
702 WCC->CurRoom.XHaveInfoTextLoaded = 1;
707 StrBuf_ServGetln(Buf);
708 if (GetServerStatus(Buf, NULL) == 1) {
709 WCC->CurRoom.XInfoText = NewStrBuf ();
711 while (!Done && StrBuf_ServGetln(Buf)>=0) {
712 if ( (StrLength(Buf)==3) &&
713 !strcmp(ChrPtr(Buf), "000"))
716 StrBufAppendBuf(WCC->CurRoom.XInfoText, Buf, 0);
723 int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
731 return (StrLength(WCC->CurRoom.XInfoText)>0);
734 void tmplput_CurrentRoomInfoText(StrBuf *Target, WCTemplputParams *TP)
740 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 1);
743 void LoadXRoomXCountFiles(void)
749 if (WCC->CurRoom.XHaveDownloadCount)
752 WCC->CurRoom.XHaveDownloadCount = 1;
756 StrBuf_ServGetln(Buf);
757 if (GetServerStatus(Buf, NULL) == 1) {
759 while (!Done && StrBuf_ServGetln(Buf)>=0) {
760 if ( (StrLength(Buf)==3) &&
761 !strcmp(ChrPtr(Buf), "000"))
764 WCC->CurRoom.XDownloadCount++;
771 void tmplput_CurrentRoomXNFiles(StrBuf *Target, WCTemplputParams *TP)
775 LoadXRoomXCountFiles();
777 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
780 void tmplput_CurrentRoomX_FileString(StrBuf *Target, WCTemplputParams *TP)
784 LoadXRoomXCountFiles();
786 if (WCC->CurRoom.XDownloadCount == 1)
787 StrBufAppendBufPlain(Target, _("file"), -1, 0);
789 StrBufAppendBufPlain(Target, _("files"), -1, 0);
792 void tmplput_CurrentRoomPass(StrBuf *Target, WCTemplputParams *TP)
798 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
800 void tmplput_CurrentRoomDirectory(StrBuf *Target, WCTemplputParams *TP)
806 StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
808 void tmplput_CurrentRoomOrder(StrBuf *Target, WCTemplputParams *TP)
814 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
816 void tmplput_CurrentRoomDefView(StrBuf *Target, WCTemplputParams *TP)
820 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.defview);
823 void tmplput_CurrentRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP)
829 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
832 void tmplput_CurrentRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP)
838 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
841 int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
851 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
852 return CheckThis == WCC->CurRoom.Order;
855 int ConditionalThisRoomDefView(StrBuf *Target, WCTemplputParams *TP)
863 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
864 return CheckThis == WCC->CurRoom.defview;
867 int ConditionalThisRoomCurrView(StrBuf *Target, WCTemplputParams *TP)
875 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
876 return CheckThis == WCC->CurRoom.view;
879 int ConditionalThisRoomHaveView(StrBuf *Target, WCTemplputParams *TP)
887 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
888 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
890 LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
891 "Roomview [%ld] not valid\n",
896 return exchangeable_views [WCC->CurRoom.defview][CheckThis] != VIEW_MAX;
899 void tmplput_CurrentRoomViewString(StrBuf *Target, WCTemplputParams *TP)
905 (WCC->CurRoom.defview >= VIEW_MAX) ||
906 (WCC->CurRoom.defview < VIEW_BBS))
908 LogTemplateError(Target, "Token", ERR_PARM2, TP,
909 "Roomview [%ld] not valid\n",
911 WCC->CurRoom.defview : -1);
915 Buf = NewStrBufPlain(_(viewdefs[WCC->CurRoom.defview]), -1);
916 StrBufAppendTemplate(Target, TP, Buf, 0);
920 void tmplput_RoomViewString(StrBuf *Target, WCTemplputParams *TP)
925 CheckThis = GetTemplateTokenNumber(Target, TP, 0, 0);
926 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
928 LogTemplateError(Target, "Token", ERR_PARM2, TP,
929 "Roomview [%ld] not valid\n",
934 Buf = NewStrBufPlain(_(viewdefs[CheckThis]), -1);
935 StrBufAppendTemplate(Target, TP, Buf, 0);
943 void smart_goto(const StrBuf *next_room) {
945 readloop(readnew, eUseDefault);
951 * mark all messages in current room as having been read
953 void slrp_highest(void)
957 serv_puts("SLRP HIGHEST");
958 serv_getln(buf, sizeof buf);
962 typedef struct __room_states {
977 * Set/clear/read the "self-service list subscribe" flag for a room
979 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
980 * returns the new value.
983 int self_service(int newval) {
984 int current_value = 0;
990 int flags, floor, order, view, flags2;
993 serv_getln(buf, sizeof buf);
994 if (buf[0] != '2') return(0);
996 extract_token(name, &buf[4], 0, '|', sizeof name);
997 extract_token(password, &buf[4], 1, '|', sizeof password);
998 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
999 flags = extract_int(&buf[4], 3);
1000 floor = extract_int(&buf[4], 4);
1001 order = extract_int(&buf[4], 5);
1002 view = extract_int(&buf[4], 6);
1003 flags2 = extract_int(&buf[4], 7);
1005 if (flags2 & QR2_SELFLIST) {
1013 flags2 = flags2 | QR2_SELFLIST;
1015 else if (newval == 0) {
1016 flags2 = flags2 & ~QR2_SELFLIST;
1019 return(current_value);
1022 if (newval != current_value) {
1023 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1024 name, password, dirname, flags,
1025 floor, order, view, flags2);
1026 serv_getln(buf, sizeof buf);
1033 int is_selflist(room_states *RoomFlags)
1035 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1038 int is_publiclist(room_states *RoomFlags)
1040 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1043 int is_moderatedlist(room_states *RoomFlags)
1045 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1049 * Set/clear/read the "self-service list subscribe" flag for a room
1051 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1052 * returns the new value.
1055 int get_roomflags(room_states *RoomOps)
1060 serv_getln(buf, sizeof buf);
1061 if (buf[0] != '2') return(0);
1063 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1064 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1065 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1066 RoomOps->flags = extract_int(&buf[4], 3);
1067 RoomOps->floor = extract_int(&buf[4], 4);
1068 RoomOps->order = extract_int(&buf[4], 5);
1069 RoomOps->view = extract_int(&buf[4], 6);
1070 RoomOps->flags2 = extract_int(&buf[4], 7);
1074 int set_roomflags(room_states *RoomOps)
1078 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1087 serv_getln(buf, sizeof buf);
1097 * display the form for editing a room
1099 void display_editroom(void)
1104 char remote_room[128];
1107 char er_password[10];
1108 char er_dirname[15];
1109 char er_roomaide[26];
1116 char *not_shared_with = NULL;
1119 int floorpolicy = 0;
1121 char pop3_host[128];
1126 if (IsEmptyStr(tab)) tab = "admin";
1128 // Buf = NewStrBuf();
1129 // load_floorlist(Buf);
1130 // FreeStrBuf(&Buf);
1131 output_headers(1, 1, 1, 0, 0, 0);
1133 wc_printf("<div class=\"fix_scrollbar_bug\">");
1135 wc_printf("<br />\n");
1137 /* print the tabbed dialog */
1138 wc_printf("<div align=\"center\">");
1139 wc_printf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
1140 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1143 wc_printf("<td class=\"");
1144 if (!strcmp(tab, "admin")) {
1145 wc_printf(" tab_cell_label\">");
1146 wc_printf(_("Administration"));
1149 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1150 wc_printf(_("Administration"));
1153 wc_printf("</td>\n");
1154 wc_printf("<td> </td>\n");
1156 if ( ConditionalHaveRoomeditRights(NULL, NULL)) {
1158 wc_printf("<td class=\"");
1159 if (!strcmp(tab, "config")) {
1160 wc_printf(" tab_cell_label\">");
1161 wc_printf(_("Configuration"));
1164 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1165 wc_printf(_("Configuration"));
1168 wc_printf("</td>\n");
1169 wc_printf("<td> </td>\n");
1171 wc_printf("<td class=\"");
1172 if (!strcmp(tab, "expire")) {
1173 wc_printf(" tab_cell_label\">");
1174 wc_printf(_("Message expire policy"));
1177 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1178 wc_printf(_("Message expire policy"));
1181 wc_printf("</td>\n");
1182 wc_printf("<td> </td>\n");
1184 wc_printf("<td class=\"");
1185 if (!strcmp(tab, "access")) {
1186 wc_printf(" tab_cell_label\">");
1187 wc_printf(_("Access controls"));
1190 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1191 wc_printf(_("Access controls"));
1194 wc_printf("</td>\n");
1195 wc_printf("<td> </td>\n");
1197 wc_printf("<td class=\"");
1198 if (!strcmp(tab, "sharing")) {
1199 wc_printf(" tab_cell_label\">");
1200 wc_printf(_("Sharing"));
1203 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1204 wc_printf(_("Sharing"));
1207 wc_printf("</td>\n");
1208 wc_printf("<td> </td>\n");
1210 wc_printf("<td class=\"");
1211 if (!strcmp(tab, "listserv")) {
1212 wc_printf(" tab_cell_label\">");
1213 wc_printf(_("Mailing list service"));
1216 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1217 wc_printf(_("Mailing list service"));
1220 wc_printf("</td>\n");
1221 wc_printf("<td> </td>\n");
1225 wc_printf("<td class=\"");
1226 if (!strcmp(tab, "feeds")) {
1227 wc_printf(" tab_cell_label\">");
1228 wc_printf(_("Remote retrieval"));
1231 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1232 wc_printf(_("Remote retrieval"));
1235 wc_printf("</td>\n");
1236 wc_printf("<td> </td>\n");
1238 wc_printf("</tr></table>\n");
1239 wc_printf("</div>\n");
1240 /* end tabbed dialog */
1242 wc_printf("<script type=\"text/javascript\">"
1243 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1247 /* begin content of whatever tab is open now */
1249 if (!strcmp(tab, "admin")) {
1250 wc_printf("<div class=\"tabcontent\">");
1252 "<li><a href=\"delete_room\" "
1253 "onClick=\"return confirm('");
1254 wc_printf(_("Are you sure you want to delete this room?"));
1255 wc_printf("');\">\n");
1256 wc_printf(_("Delete this room"));
1258 "<li><a href=\"display_editroompic?which_room=");
1259 urlescputs(ChrPtr(WC->CurRoom.name));
1261 wc_printf(_("Set or change the icon for this room's banner"));
1263 "<li><a href=\"display_editinfo\">\n");
1264 wc_printf(_("Edit this room's Info file"));
1267 wc_printf("</div>");
1270 if (!strcmp(tab, "config")) {
1271 wc_printf("<div class=\"tabcontent\">");
1273 serv_getln(buf, sizeof buf);
1275 if (!strncmp(buf, "550", 3)) {
1276 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1277 _("Higher access is required to access this function.")
1280 else if (buf[0] != '2') {
1281 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1284 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1285 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1286 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1287 er_flags = extract_int(&buf[4], 3);
1288 er_floor = extract_int(&buf[4], 4);
1289 er_flags2 = extract_int(&buf[4], 7);
1291 wc_printf("<form method=\"POST\" action=\"editroom\">\n");
1292 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1294 wc_printf("<ul><li>");
1295 wc_printf(_("Name of room: "));
1296 wc_printf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\""ULONG_FMT"\">\n",
1302 wc_printf(_("Resides on floor: "));
1303 wc_printf("<select NAME=\"er_floor\" SIZE=\"1\"");
1304 if (er_flags & QR_MAILBOX)
1305 wc_printf("disabled >\n");
1306 for (i = 0; i < 128; ++i)
1307 if (!IsEmptyStr(floorlist[i])) {
1308 wc_printf("<OPTION ");
1310 wc_printf("SELECTED ");
1311 wc_printf("VALUE=\"%d\">", i);
1312 escputs(floorlist[i]);
1313 wc_printf("</OPTION>\n");
1315 wc_printf("</select>\n");
1318 wc_printf(_("Type of room:"));
1319 wc_printf("<ul>\n");
1321 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1322 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1323 wc_printf("CHECKED ");
1324 wc_printf("OnChange=\""
1325 " if (this.form.type[0].checked == true) { "
1326 " this.form.er_floor.disabled = false; "
1329 wc_printf(_("Public (automatically appears to everyone)"));
1332 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1333 if ((er_flags & QR_PRIVATE) &&
1334 (er_flags & QR_GUESSNAME))
1335 wc_printf("CHECKED ");
1336 wc_printf(" OnChange=\""
1337 " if (this.form.type[1].checked == true) { "
1338 " this.form.er_floor.disabled = false; "
1341 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
1343 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1344 if ((er_flags & QR_PRIVATE) &&
1345 (er_flags & QR_PASSWORDED))
1346 wc_printf("CHECKED ");
1347 wc_printf(" OnChange=\""
1348 " if (this.form.type[2].checked == true) { "
1349 " this.form.er_floor.disabled = false; "
1352 wc_printf(_("Private - require password: "));
1353 wc_printf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1356 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1357 if ((er_flags & QR_PRIVATE)
1358 && ((er_flags & QR_GUESSNAME) == 0)
1359 && ((er_flags & QR_PASSWORDED) == 0))
1360 wc_printf("CHECKED ");
1361 wc_printf(" OnChange=\""
1362 " if (this.form.type[3].checked == true) { "
1363 " this.form.er_floor.disabled = false; "
1366 wc_printf(_("Private - invitation only"));
1368 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1369 if (er_flags & QR_MAILBOX)
1370 wc_printf("CHECKED ");
1371 wc_printf (" OnChange=\""
1372 " if (this.form.type[4].checked == true) { "
1373 " this.form.er_floor.disabled = true; "
1376 wc_printf(_("Personal (mailbox for you only)"));
1378 wc_printf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1380 wc_printf(_("If private, cause current users to forget room"));
1382 wc_printf("\n</ul>\n");
1384 wc_printf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1385 if (er_flags & QR_PREFONLY)
1386 wc_printf("CHECKED ");
1388 wc_printf(_("Preferred users only"));
1390 wc_printf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1391 if (er_flags & QR_READONLY)
1392 wc_printf("CHECKED ");
1394 wc_printf(_("Read-only room"));
1396 wc_printf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1397 if (er_flags2 & QR2_COLLABDEL)
1398 wc_printf("CHECKED ");
1400 wc_printf(_("All users allowed to post may also delete messages"));
1402 /** directory stuff */
1403 wc_printf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1404 if (er_flags & QR_DIRECTORY)
1405 wc_printf("CHECKED ");
1407 wc_printf(_("File directory room"));
1409 wc_printf("\n<ul><li>");
1410 wc_printf(_("Directory name: "));
1411 wc_printf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1414 wc_printf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1415 if (er_flags & QR_UPLOAD)
1416 wc_printf("CHECKED ");
1418 wc_printf(_("Uploading allowed"));
1420 wc_printf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1421 if (er_flags & QR_DOWNLOAD)
1422 wc_printf("CHECKED ");
1424 wc_printf(_("Downloading allowed"));
1426 wc_printf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1427 if (er_flags & QR_VISDIR)
1428 wc_printf("CHECKED ");
1430 wc_printf(_("Visible directory"));
1431 wc_printf("</ul>\n");
1433 /** end of directory stuff */
1435 wc_printf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1436 if (er_flags & QR_NETWORK)
1437 wc_printf("CHECKED ");
1439 wc_printf(_("Network shared room"));
1441 wc_printf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1442 if (er_flags & QR_PERMANENT)
1443 wc_printf("CHECKED ");
1445 wc_printf(_("Permanent (does not auto-purge)"));
1447 wc_printf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1448 if (er_flags2 & QR2_SUBJECTREQ)
1449 wc_printf("CHECKED ");
1451 wc_printf(_("Subject Required (Force users to specify a message subject)"));
1453 /** start of anon options */
1455 wc_printf("\n<li>");
1456 wc_printf(_("Anonymous messages"));
1457 wc_printf("<ul>\n");
1459 wc_printf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1460 if (((er_flags & QR_ANONONLY) == 0)
1461 && ((er_flags & QR_ANONOPT) == 0))
1462 wc_printf("CHECKED ");
1464 wc_printf(_("No anonymous messages"));
1466 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1467 if (er_flags & QR_ANONONLY)
1468 wc_printf("CHECKED ");
1470 wc_printf(_("All messages are anonymous"));
1472 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1473 if (er_flags & QR_ANONOPT)
1474 wc_printf("CHECKED ");
1476 wc_printf(_("Prompt user when entering messages"));
1477 wc_printf("</ul>\n");
1479 /* end of anon options */
1482 wc_printf(_("Room aide: "));
1484 serv_getln(buf, sizeof buf);
1485 if (buf[0] != '2') {
1486 wc_printf("<em>%s</em>\n", &buf[4]);
1488 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1489 wc_printf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1492 wc_printf("</ul><CENTER>\n");
1493 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1494 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1496 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1502 wc_printf("</div>");
1506 /* Sharing the room with other Citadel nodes... */
1507 if (!strcmp(tab, "sharing")) {
1508 wc_printf("<div class=\"tabcontent\">");
1510 shared_with = strdup("");
1511 not_shared_with = strdup("");
1513 /** Learn the current configuration */
1514 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1515 serv_getln(buf, sizeof buf);
1516 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1517 extract_token(node, buf, 0, '|', sizeof node);
1518 not_shared_with = realloc(not_shared_with,
1519 strlen(not_shared_with) + 32);
1520 strcat(not_shared_with, node);
1521 strcat(not_shared_with, "\n");
1525 serv_getln(buf, sizeof buf);
1526 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1527 extract_token(cmd, buf, 0, '|', sizeof cmd);
1528 extract_token(node, buf, 1, '|', sizeof node);
1529 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1530 if (!strcasecmp(cmd, "ignet_push_share")) {
1531 shared_with = realloc(shared_with,
1532 strlen(shared_with) + 32);
1533 strcat(shared_with, node);
1534 if (!IsEmptyStr(remote_room)) {
1535 strcat(shared_with, "|");
1536 strcat(shared_with, remote_room);
1538 strcat(shared_with, "\n");
1542 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1543 extract_token(buf, shared_with, i, '\n', sizeof buf);
1544 extract_token(node, buf, 0, '|', sizeof node);
1545 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1546 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1547 if (!strcasecmp(node, cmd)) {
1548 remove_token(not_shared_with, j, '\n');
1553 /* Display the stuff */
1554 wc_printf("<CENTER><br />"
1555 "<table border=1 cellpadding=5><tr>"
1557 wc_printf(_("Shared with"));
1558 wc_printf("</I></B></td>"
1560 wc_printf(_("Not shared with"));
1561 wc_printf("</I></B></td></tr>\n"
1562 "<tr><td VALIGN=TOP>\n");
1564 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1565 wc_printf(_("Remote node name"));
1566 wc_printf("</td><td>");
1567 wc_printf(_("Remote room name"));
1568 wc_printf("</td><td>");
1569 wc_printf(_("Actions"));
1570 wc_printf("</td></tr>\n");
1572 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1573 extract_token(buf, shared_with, i, '\n', sizeof buf);
1574 extract_token(node, buf, 0, '|', sizeof node);
1575 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1576 if (!IsEmptyStr(node)) {
1577 wc_printf("<form method=\"POST\" action=\"netedit\">");
1578 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1579 wc_printf("<tr><td>%s</td>\n", node);
1582 if (!IsEmptyStr(remote_room)) {
1583 escputs(remote_room);
1589 wc_printf("<input type=\"hidden\" NAME=\"line\" "
1590 "VALUE=\"ignet_push_share|");
1592 if (!IsEmptyStr(remote_room)) {
1594 urlescputs(remote_room);
1597 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1598 wc_printf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1599 wc_printf("<input type=\"submit\" "
1600 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1601 wc_printf("</td></tr></form>\n");
1605 wc_printf("</table>\n");
1606 wc_printf("</td><td VALIGN=TOP>\n");
1607 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1608 wc_printf(_("Remote node name"));
1609 wc_printf("</td><td>");
1610 wc_printf(_("Remote room name"));
1611 wc_printf("</td><td>");
1612 wc_printf(_("Actions"));
1613 wc_printf("</td></tr>\n");
1615 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1616 extract_token(node, not_shared_with, i, '\n', sizeof node);
1617 if (!IsEmptyStr(node)) {
1618 wc_printf("<form method=\"POST\" action=\"netedit\">");
1619 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1620 wc_printf("<tr><td>");
1622 wc_printf("</td><td>"
1623 "<input type=\"INPUT\" "
1627 wc_printf("<input type=\"hidden\" "
1629 "VALUE=\"ignet_push_share|");
1632 wc_printf("<input type=\"hidden\" NAME=\"tab\" "
1633 "VALUE=\"sharing\">\n");
1634 wc_printf("<input type=\"hidden\" NAME=\"cmd\" "
1635 "VALUE=\"add\">\n");
1636 wc_printf("<input type=\"submit\" "
1637 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1638 wc_printf("</td></tr></form>\n");
1642 wc_printf("</table>\n");
1643 wc_printf("</td></tr>"
1644 "</table></CENTER><br />\n"
1645 "<I><B>%s</B><ul><li>", _("Notes:"));
1646 wc_printf(_("When sharing a room, "
1647 "it must be shared from both ends. Adding a node to "
1648 "the 'shared' list sends messages out, but in order to"
1649 " receive messages, the other nodes must be configured"
1650 " to send messages out to your system as well. "
1651 "<li>If the remote room name is blank, it is assumed "
1652 "that the room name is identical on the remote node."
1653 "<li>If the remote room name is different, the remote "
1654 "node must also configure the name of the room here."
1658 wc_printf("</div>");
1661 if (not_shared_with != NULL)
1662 free (not_shared_with);
1664 /* Mailing list management */
1665 if (!strcmp(tab, "listserv")) {
1666 room_states RoomFlags;
1667 wc_printf("<div class=\"tabcontent\">");
1669 wc_printf("<br /><center>"
1670 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1671 "<tr><td VALIGN=TOP>");
1673 wc_printf(_("<i>The contents of this room are being "
1674 "mailed <b>as individual messages</b> "
1675 "to the following list recipients:"
1676 "</i><br /><br />\n"));
1679 serv_getln(buf, sizeof buf);
1680 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1681 extract_token(cmd, buf, 0, '|', sizeof cmd);
1682 if (!strcasecmp(cmd, "listrecp")) {
1683 extract_token(recp, buf, 1, '|', sizeof recp);
1686 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line=listrecp|");
1689 wc_printf(_("(remove)"));
1690 wc_printf("</A><br />");
1693 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1694 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1695 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1696 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1697 wc_printf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1698 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1699 wc_printf("</form>\n");
1701 wc_printf("</td><td VALIGN=TOP>\n");
1703 wc_printf(_("<i>The contents of this room are being "
1704 "mailed <b>in digest form</b> "
1705 "to the following list recipients:"
1706 "</i><br /><br />\n"));
1709 serv_getln(buf, sizeof buf);
1710 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1711 extract_token(cmd, buf, 0, '|', sizeof cmd);
1712 if (!strcasecmp(cmd, "digestrecp")) {
1713 extract_token(recp, buf, 1, '|', sizeof recp);
1716 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line="
1720 wc_printf(_("(remove)"));
1721 wc_printf("</A><br />");
1724 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1725 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1726 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1727 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1728 wc_printf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1729 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1730 wc_printf("</form>\n");
1732 wc_printf("</td></tr></table>\n");
1734 /** Pop open an address book -- begin **/
1735 wc_printf("<div align=right>"
1736 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1738 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1743 _("Add recipients from Contacts or other address books"),
1744 _("Add recipients from Contacts or other address books")
1746 /* Pop open an address book -- end **/
1748 wc_printf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1750 get_roomflags (&RoomFlags);
1752 /* Self Service subscription? */
1753 wc_printf("<table><tr><td>\n");
1754 wc_printf(_("Allow self-service subscribe/unsubscribe requests."));
1755 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1756 " <tr><td colspan=\"2\">\n",
1757 (is_selflist(&RoomFlags))?"checked":"");
1758 wc_printf(_("The URL for subscribe/unsubscribe is: "));
1759 wc_printf("<TT>%s://%s/listsub</TT></td></tr>\n",
1760 (is_https ? "https" : "http"),
1761 ChrPtr(WC->Hdr->HR.http_host));
1762 /* Public posting? */
1763 wc_printf("<tr><td>");
1764 wc_printf(_("Allow non-subscribers to mail to this room."));
1765 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1766 (is_publiclist(&RoomFlags))?"checked":"");
1768 /* Moderated List? */
1769 wc_printf("<tr><td>");
1770 wc_printf(_("Room post publication needs Aide permission."));
1771 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1772 (is_moderatedlist(&RoomFlags))?"checked":"");
1775 wc_printf("<tr><td colspan=\"2\" align=\"center\">"
1776 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1777 wc_printf("</table></form>");
1780 wc_printf("</CENTER>\n");
1781 wc_printf("</div>");
1785 /* Configuration of The Dreaded Auto-Purger */
1786 if (!strcmp(tab, "expire")) {
1787 wc_printf("<div class=\"tabcontent\">");
1789 serv_puts("GPEX room");
1790 serv_getln(buf, sizeof buf);
1791 if (!strncmp(buf, "550", 3)) {
1792 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1793 _("Higher access is required to access this function.")
1796 else if (buf[0] != '2') {
1797 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1800 roompolicy = extract_int(&buf[4], 0);
1801 roomvalue = extract_int(&buf[4], 1);
1803 serv_puts("GPEX floor");
1804 serv_getln(buf, sizeof buf);
1805 if (buf[0] == '2') {
1806 floorpolicy = extract_int(&buf[4], 0);
1807 floorvalue = extract_int(&buf[4], 1);
1810 wc_printf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1811 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1812 wc_printf("<table border=0 cellspacing=5>\n");
1813 wc_printf("<tr><td>");
1814 wc_printf(_("Message expire policy for this room"));
1815 wc_printf("<br />(");
1816 escputs(ChrPtr(WC->CurRoom.name));
1817 wc_printf(")</td><td>");
1818 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1819 ((roompolicy == 0) ? "CHECKED" : "") );
1820 wc_printf(_("Use the default policy for this floor"));
1821 wc_printf("<br />\n");
1822 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1823 ((roompolicy == 1) ? "CHECKED" : "") );
1824 wc_printf(_("Never automatically expire messages"));
1825 wc_printf("<br />\n");
1826 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1827 ((roompolicy == 2) ? "CHECKED" : "") );
1828 wc_printf(_("Expire by message count"));
1829 wc_printf("<br />\n");
1830 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1831 ((roompolicy == 3) ? "CHECKED" : "") );
1832 wc_printf(_("Expire by message age"));
1833 wc_printf("<br />");
1834 wc_printf(_("Number of messages or days: "));
1835 wc_printf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1836 wc_printf("</td></tr>\n");
1838 if (WC->axlevel >= 6) {
1839 wc_printf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1840 wc_printf("<tr><td>");
1841 wc_printf(_("Message expire policy for this floor"));
1842 wc_printf("<br />(");
1843 escputs(floorlist[WC->CurRoom.floorid]);
1844 wc_printf(")</td><td>");
1845 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1846 ((floorpolicy == 0) ? "CHECKED" : "") );
1847 wc_printf(_("Use the system default"));
1848 wc_printf("<br />\n");
1849 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1850 ((floorpolicy == 1) ? "CHECKED" : "") );
1851 wc_printf(_("Never automatically expire messages"));
1852 wc_printf("<br />\n");
1853 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1854 ((floorpolicy == 2) ? "CHECKED" : "") );
1855 wc_printf(_("Expire by message count"));
1856 wc_printf("<br />\n");
1857 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1858 ((floorpolicy == 3) ? "CHECKED" : "") );
1859 wc_printf(_("Expire by message age"));
1860 wc_printf("<br />");
1861 wc_printf(_("Number of messages or days: "));
1862 wc_printf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1866 wc_printf("<CENTER>\n");
1867 wc_printf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1868 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1869 wc_printf(" ");
1870 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1871 wc_printf("</CENTER></td><tr>\n");
1873 wc_printf("</table>\n"
1874 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1879 wc_printf("</div>");
1882 /* Access controls */
1883 if (!strcmp(tab, "access")) {
1884 wc_printf("<div class=\"tabcontent\">");
1886 wc_printf("</div>");
1889 /* Fetch messages from remote locations */
1890 if (!strcmp(tab, "feeds")) {
1891 wc_printf("<div class=\"tabcontent\">");
1894 wc_printf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1895 wc_printf("</i><br />\n");
1897 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1898 "<tr class=\"even\"><th>");
1899 wc_printf(_("Remote host"));
1900 wc_printf("</th><th>");
1901 wc_printf(_("User name"));
1902 wc_printf("</th><th>");
1903 wc_printf(_("Password"));
1904 wc_printf("</th><th>");
1905 wc_printf(_("Keep messages on server?"));
1906 wc_printf("</th><th>");
1907 wc_printf(_("Interval"));
1908 wc_printf("</th><th> </th></tr>");
1911 serv_getln(buf, sizeof buf);
1913 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1914 extract_token(cmd, buf, 0, '|', sizeof cmd);
1915 if (!strcasecmp(cmd, "pop3client")) {
1916 safestrncpy(recp, &buf[11], sizeof recp);
1919 wc_printf("<tr class=\"%s\">",
1920 (bg ? "even" : "odd")
1924 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1929 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1933 wc_printf("<td>*****</td>"); /* Don't show the password */
1935 wc_printf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1937 wc_printf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1939 wc_printf("<td class=\"button_link\">");
1940 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=pop3client|");
1943 wc_printf(_("(remove)"));
1944 wc_printf("</a></td>");
1950 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1952 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1953 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1954 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1956 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1959 wc_printf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1962 wc_printf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1965 wc_printf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1968 wc_printf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
1971 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1972 wc_printf("</td></tr>");
1973 wc_printf("</form></table>\n");
1975 wc_printf("<hr>\n");
1978 wc_printf(_("Fetch the following RSS feeds and store them in this room:"));
1979 wc_printf("</i><br />\n");
1981 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1982 "<tr class=\"even\"><th>");
1983 wc_printf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1984 wc_printf(_("Feed URL"));
1985 wc_printf("</th><th>");
1986 wc_printf("</th></tr>");
1989 serv_getln(buf, sizeof buf);
1991 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1992 extract_token(cmd, buf, 0, '|', sizeof cmd);
1993 if (!strcasecmp(cmd, "rssclient")) {
1994 safestrncpy(recp, &buf[10], sizeof recp);
1997 wc_printf("<tr class=\"%s\">",
1998 (bg ? "even" : "odd")
2002 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2006 wc_printf("<td class=\"button_link\">");
2007 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=rssclient|");
2010 wc_printf(_("(remove)"));
2011 wc_printf("</a></td>");
2017 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
2019 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2020 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2021 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2023 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2024 "maxlength=\"256\" name=\"line_pop3host\">\n");
2027 wc_printf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2028 wc_printf("</td></tr>");
2029 wc_printf("</form></table>\n");
2031 wc_printf("</div>");
2035 /* end content of whatever tab is open now */
2036 wc_printf("</div>\n");
2038 address_book_popup();
2044 * Toggle self-service list subscription
2046 void toggle_self_service(void) {
2047 room_states RoomFlags;
2049 get_roomflags (&RoomFlags);
2051 if (yesbstr("QR2_SelfList"))
2052 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2054 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2056 if (yesbstr("QR2_SMTP_PUBLIC"))
2057 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2059 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2061 if (yesbstr("QR2_Moderated"))
2062 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2064 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2065 if (yesbstr("QR2_SubsOnly"))
2066 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2068 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2070 set_roomflags (&RoomFlags);
2078 * save new parameters for a room
2085 StrBuf *er_password;
2087 StrBuf *er_roomaide;
2090 int er_listingorder;
2096 if (!havebstr("ok_button")) {
2097 strcpy(WC->ImportantMessage,
2098 _("Cancelled. Changes were not saved."));
2104 StrBuf_ServGetln(Buf);
2105 if (GetServerStatus(Buf, NULL) != 2) {
2106 StrBufCutLeft(Buf, 4);
2107 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2113 er_name = NewStrBuf();
2114 er_password = NewStrBuf();
2115 er_dirname = NewStrBuf();
2116 er_roomaide = NewStrBuf();
2118 StrBufCutLeft(Buf, 4);
2119 StrBufExtract_token(er_name, Buf, 0, '|');
2120 StrBufExtract_token(er_password, Buf, 1, '|');
2121 StrBufExtract_token(er_dirname, Buf, 2, '|');
2122 er_flags = StrBufExtract_int(Buf, 3, '|');
2123 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2124 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2125 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2127 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2128 if (StrLength(er_roomaide) == 0) {
2130 StrBuf_ServGetln(Buf);
2131 if (GetServerStatus(Buf, NULL) != 2) {
2132 FlushStrBuf(er_roomaide);
2134 StrBufCutLeft(Buf, 4);
2135 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2138 Ptr = sbstr("er_name");
2139 if (StrLength(Ptr) > 0) {
2140 FlushStrBuf(er_name);
2141 StrBufAppendBuf(er_name, Ptr, 0);
2144 Ptr = sbstr("er_password");
2145 if (StrLength(Ptr) > 0) {
2146 FlushStrBuf(er_password);
2147 StrBufAppendBuf(er_password, Ptr, 0);
2151 Ptr = sbstr("er_dirname");
2152 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2153 FlushStrBuf(er_dirname);
2154 StrBufAppendBuf(er_dirname, Ptr, 0);
2158 Ptr = sbstr("type");
2159 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2161 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2162 er_flags |= (QR_PRIVATE);
2164 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2165 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2167 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2168 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2170 if (!strcmp(ChrPtr(Ptr), "personal")) {
2171 er_flags |= QR_MAILBOX;
2173 er_flags &= ~QR_MAILBOX;
2176 if (yesbstr("prefonly")) {
2177 er_flags |= QR_PREFONLY;
2179 er_flags &= ~QR_PREFONLY;
2182 if (yesbstr("readonly")) {
2183 er_flags |= QR_READONLY;
2185 er_flags &= ~QR_READONLY;
2189 if (yesbstr("collabdel")) {
2190 er_flags2 |= QR2_COLLABDEL;
2192 er_flags2 &= ~QR2_COLLABDEL;
2195 if (yesbstr("permanent")) {
2196 er_flags |= QR_PERMANENT;
2198 er_flags &= ~QR_PERMANENT;
2201 if (yesbstr("subjectreq")) {
2202 er_flags2 |= QR2_SUBJECTREQ;
2204 er_flags2 &= ~QR2_SUBJECTREQ;
2207 if (yesbstr("network")) {
2208 er_flags |= QR_NETWORK;
2210 er_flags &= ~QR_NETWORK;
2213 if (yesbstr("directory")) {
2214 er_flags |= QR_DIRECTORY;
2216 er_flags &= ~QR_DIRECTORY;
2219 if (yesbstr("ulallowed")) {
2220 er_flags |= QR_UPLOAD;
2222 er_flags &= ~QR_UPLOAD;
2225 if (yesbstr("dlallowed")) {
2226 er_flags |= QR_DOWNLOAD;
2228 er_flags &= ~QR_DOWNLOAD;
2231 if (yesbstr("visdir")) {
2232 er_flags |= QR_VISDIR;
2234 er_flags &= ~QR_VISDIR;
2237 Ptr = sbstr("anon");
2239 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2240 if (!strcmp(ChrPtr(Ptr), "anononly"))
2241 er_flags |= QR_ANONONLY;
2242 if (!strcmp(ChrPtr(Ptr), "anon2"))
2243 er_flags |= QR_ANONOPT;
2245 bump = yesbstr("bump");
2247 er_floor = ibstr("er_floor");
2249 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2251 ChrPtr(er_password),
2260 StrBuf_ServGetln(Buf);
2261 if (GetServerStatus(Buf, NULL) != 2) {
2262 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2265 FreeStrBuf(&er_name);
2266 FreeStrBuf(&er_password);
2267 FreeStrBuf(&er_dirname);
2268 FreeStrBuf(&er_roomaide);
2273 if (StrLength(er_roomaide) > 0) {
2274 serv_printf("SETA %s", ChrPtr(er_roomaide));
2275 StrBuf_ServGetln(Buf);
2276 if (GetServerStatus(Buf, NULL) != 2) {
2277 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2278 display_main_menu();
2280 FreeStrBuf(&er_name);
2281 FreeStrBuf(&er_password);
2282 FreeStrBuf(&er_dirname);
2283 FreeStrBuf(&er_roomaide);
2288 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2291 FreeStrBuf(&er_name);
2292 FreeStrBuf(&er_password);
2293 FreeStrBuf(&er_dirname);
2294 FreeStrBuf(&er_roomaide);
2300 * Display form for Invite, Kick, and show Who Knows a room
2302 void do_invt_kick(void) {
2303 char buf[SIZ], room[SIZ], username[SIZ];
2306 serv_getln(buf, sizeof buf);
2308 if (buf[0] != '2') {
2312 extract_token(room, &buf[4], 0, '|', sizeof room);
2314 strcpy(username, bstr("username"));
2316 if (havebstr("kick_button")) {
2317 sprintf(buf, "KICK %s", username);
2319 serv_getln(buf, sizeof buf);
2321 if (buf[0] != '2') {
2322 strcpy(WC->ImportantMessage, &buf[4]);
2324 sprintf(WC->ImportantMessage,
2325 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2330 if (havebstr("invite_button")) {
2331 sprintf(buf, "INVT %s", username);
2333 serv_getln(buf, sizeof buf);
2335 if (buf[0] != '2') {
2336 strcpy(WC->ImportantMessage, &buf[4]);
2338 sprintf(WC->ImportantMessage,
2339 _("<B><I>User %s invited to room %s.</I></B>\n"),
2350 * Display form for Invite, Kick, and show Who Knows a room
2352 void display_whok(void)
2354 char buf[SIZ], room[SIZ], username[SIZ];
2357 serv_getln(buf, sizeof buf);
2359 if (buf[0] != '2') {
2363 extract_token(room, &buf[4], 0, '|', sizeof room);
2366 wc_printf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2367 wc_printf(_("The users listed below have access to this room. "
2368 "To remove a user from the access list, select the user "
2369 "name from the list and click 'Kick'."));
2370 wc_printf("<br /><br />");
2372 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2373 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2374 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2375 wc_printf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2377 serv_getln(buf, sizeof buf);
2378 if (buf[0] == '1') {
2379 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2380 extract_token(username, buf, 0, '|', sizeof username);
2381 wc_printf("<OPTION>");
2386 wc_printf("</select><br />\n");
2388 wc_printf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2389 wc_printf("</form></CENTER>\n");
2391 wc_printf("</td><td>");
2392 wc_printf(_("To grant another user access to this room, enter the "
2393 "user name in the box below and click 'Invite'."));
2394 wc_printf("<br /><br />");
2396 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2397 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2398 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2399 wc_printf(_("Invite:"));
2401 wc_printf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2402 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2403 "<input type=\"submit\" value=\"%s\">"
2404 "</form></CENTER>\n", _("Invite"));
2405 /* Pop open an address book -- begin **/
2407 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2409 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2412 _("Users"), _("Users")
2414 /* Pop open an address book -- end **/
2416 wc_printf("</td></tr></table>\n");
2417 address_book_popup();
2424 * display the form for entering a new room
2426 void display_entroom(void)
2433 serv_puts("CRE8 0");
2434 serv_getln(buf, sizeof buf);
2436 if (buf[0] != '2') {
2437 strcpy(WC->ImportantMessage, &buf[4]);
2438 display_main_menu();
2443 output_headers(1, 1, 1, 0, 0, 0);
2445 svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
2446 do_template("beginbox", NULL);
2448 wc_printf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
2449 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2451 wc_printf("<table class=\"altern\"> ");
2453 wc_printf("<tr class=\"even\"><td>");
2454 wc_printf(_("Name of room: "));
2455 wc_printf("</td><td>");
2456 wc_printf("<input type=\"text\" NAME=\"er_name\" MAXLENGTH=\"127\">\n");
2457 wc_printf("</td></tr>");
2459 wc_printf("<tr class=\"odd\"><td>");
2460 wc_printf(_("Resides on floor: "));
2461 wc_printf("</td><td>");
2462 // load_floorlist(Buf);
2463 wc_printf("<select name=\"er_floor\" size=\"1\">\n");
2464 for (i = 0; i < 128; ++i)
2465 if (!IsEmptyStr(floorlist[i])) {
2466 wc_printf("<option ");
2467 wc_printf("value=\"%d\">", i);
2468 escputs(floorlist[i]);
2469 wc_printf("</option>\n");
2471 wc_printf("</select>\n");
2472 wc_printf("</td></tr>");
2475 * Our clever little snippet of JavaScript automatically selects
2476 * a public room if the view is set to Bulletin Board or wiki, and
2477 * it selects a mailbox room otherwise. The user can override this,
2478 * of course. We also disable the floor selector for mailboxes.
2480 wc_printf("<tr class=\"even\"><td>");
2481 wc_printf(_("Default view for room: "));
2482 wc_printf("</td><td>");
2483 wc_printf("<select name=\"er_view\" size=\"1\" OnChange=\""
2484 " if ( (this.form.er_view.value == 0) "
2485 " || (this.form.er_view.value == 6) ) { "
2486 " this.form.type[0].checked=true; "
2487 " this.form.er_floor.disabled = false; "
2490 " this.form.type[4].checked=true; "
2491 " this.form.er_floor.disabled = true; "
2494 for (i=0; i<(sizeof viewdefs / sizeof (char *)); ++i) {
2495 if (is_view_allowed_as_default(i)) {
2496 wc_printf("<option %s value=\"%d\">",
2497 ((i == 0) ? "selected" : ""), i );
2498 escputs(viewdefs[i]);
2499 wc_printf("</option>\n");
2502 wc_printf("</select>\n");
2503 wc_printf("</td></tr>");
2505 wc_printf("<tr class=\"even\"><td>");
2506 wc_printf(_("Type of room:"));
2507 wc_printf("</td><td>");
2508 wc_printf("<ul class=\"adminlist\">\n");
2510 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
2511 wc_printf("CHECKED OnChange=\""
2512 " if (this.form.type[0].checked == true) { "
2513 " this.form.er_floor.disabled = false; "
2516 wc_printf(_("Public (automatically appears to everyone)"));
2519 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" OnChange=\""
2520 " if (this.form.type[1].checked == true) { "
2521 " this.form.er_floor.disabled = false; "
2524 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
2527 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" OnChange=\""
2528 " if (this.form.type[2].checked == true) { "
2529 " this.form.er_floor.disabled = false; "
2532 wc_printf(_("Private - require password: "));
2533 wc_printf("<input type=\"text\" NAME=\"er_password\" MAXLENGTH=\"9\">\n");
2536 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" OnChange=\""
2537 " if (this.form.type[3].checked == true) { "
2538 " this.form.er_floor.disabled = false; "
2541 wc_printf(_("Private - invitation only"));
2544 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" "
2546 " if (this.form.type[4].checked == true) { "
2547 " this.form.er_floor.disabled = true; "
2550 wc_printf(_("Personal (mailbox for you only)"));
2553 wc_printf("\n</ul>\n");
2554 wc_printf("</td></tr></table>\n");
2556 wc_printf("<div class=\"buttons\">\n");
2557 wc_printf("<input type=\"submit\" name=\"ok_button\" value=\"%s\">", _("Create new room"));
2558 wc_printf(" ");
2559 wc_printf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\">", _("Cancel"));
2560 wc_printf("</div>\n");
2561 wc_printf("</form>\n<hr />");
2562 serv_printf("MESG roomaccess");
2563 serv_getln(buf, sizeof buf);
2564 if (buf[0] == '1') {
2568 do_template("endbox", NULL);
2578 * support function for entroom() -- sets the default view
2580 void er_set_default_view(int newview) {
2593 serv_getln(buf, sizeof buf);
2594 if (buf[0] != '2') return;
2596 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2597 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2598 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2599 rm_bits1 = extract_int(&buf[4], 3);
2600 rm_floor = extract_int(&buf[4], 4);
2601 rm_listorder = extract_int(&buf[4], 5);
2602 rm_bits2 = extract_int(&buf[4], 7);
2604 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2605 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2606 rm_listorder, newview, rm_bits2
2608 serv_getln(buf, sizeof buf);
2619 const StrBuf *er_name;
2620 const StrBuf *er_type;
2621 const StrBuf *er_password;
2625 wcsession *WCC = WC;
2627 if (!havebstr("ok_button")) {
2628 strcpy(WC->ImportantMessage,
2629 _("Cancelled. No new room was created."));
2630 display_main_menu();
2633 er_name = sbstr("er_name");
2634 er_type = sbstr("type");
2635 er_password = sbstr("er_password");
2636 er_floor = ibstr("er_floor");
2637 er_view = ibstr("er_view");
2640 if (!strcmp(ChrPtr(er_type), "hidden"))
2642 else if (!strcmp(ChrPtr(er_type), "passworded"))
2644 else if (!strcmp(ChrPtr(er_type), "invonly"))
2646 else if (!strcmp(ChrPtr(er_type), "personal"))
2649 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2652 ChrPtr(er_password),
2657 serv_getln(buf, sizeof buf);
2658 if (buf[0] != '2') {
2659 strcpy(WCC->ImportantMessage, &buf[4]);
2660 display_main_menu();
2663 /** TODO: Room created, now update the left hand icon bar for this user */
2664 burn_folder_cache(0); /* burn the old folder cache */
2668 serv_printf("VIEW %d", er_view);
2669 serv_getln(buf, sizeof buf);
2670 WCC->CurRoom.view = er_view;
2672 if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ) {
2673 display_editroom ();
2675 do_change_view(er_view); /* Now go there */
2682 * \brief goto a private room
2684 void goto_private(void)
2689 if (!havebstr("ok_button")) {
2690 display_main_menu();
2694 strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
2695 serv_printf("GOTO %s|%s",
2698 serv_getln(buf, sizeof buf);
2700 if (buf[0] == '2') {
2701 smart_goto(sbstr("gr_name"));
2704 if (!strncmp(buf, "540", 3)) {
2705 DoTemplate(HKEY("room_display_private"), NULL, &NoCtx);
2708 output_headers(1, 1, 1, 0, 0, 0);
2709 wc_printf("%s\n", &buf[4]);
2722 StrBuf *final_destination;
2725 * If the forget-room routine fails for any reason, we fall back
2726 * to the current room; otherwise, we go to the Lobby
2728 final_destination = NewStrBufDup(WC->CurRoom.name);
2730 if (havebstr("ok_button")) {
2731 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
2732 serv_getln(buf, sizeof buf);
2733 if (buf[0] == '2') {
2735 serv_getln(buf, sizeof buf);
2736 if (buf[0] == '2') {
2737 FlushStrBuf(final_destination);
2738 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2743 smart_goto(final_destination);
2744 FreeStrBuf(&final_destination);
2750 * \brief Delete the current room
2752 void delete_room(void)
2757 serv_puts("KILL 1");
2758 serv_getln(buf, sizeof buf);
2759 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2761 if (buf[0] != '2') {
2762 strcpy(WC->ImportantMessage, &buf[4]);
2763 display_main_menu();
2768 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2777 * \brief Perform changes to a room's network configuration
2779 void netedit(void) {
2788 /*/ TODO: do line dynamic! */
2789 if (havebstr("line_pop3host")) {
2790 strcpy(line, bstr("prefix"));
2791 strcat(line, bstr("line_pop3host"));
2793 strcat(line, bstr("line_pop3user"));
2795 strcat(line, bstr("line_pop3pass"));
2797 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2799 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2800 strcat(line, bstr("suffix"));
2802 else if (havebstr("line")) {
2803 strcpy(line, bstr("prefix"));
2804 strcat(line, bstr("line"));
2805 strcat(line, bstr("suffix"));
2820 serv_getln(buf, sizeof buf);
2821 if (buf[0] != '1') {
2827 /** This loop works for add *or* remove. Spiffy, eh? */
2828 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2829 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2830 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2831 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2832 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2833 if ( (strcasecmp(cmpa0, cmpb0))
2834 || (strcasecmp(cmpa1, cmpb1)) ) {
2835 fprintf(fp, "%s\n", buf);
2841 serv_getln(buf, sizeof buf);
2842 if (buf[0] != '4') {
2848 while (fgets(buf, sizeof buf, fp) != NULL) {
2849 buf[strlen(buf)-1] = 0;
2853 if (havebstr("add_button")) {
2854 num_addrs = num_tokens(bstr("line"), ',');
2855 if (num_addrs < 2) {
2856 /* just adding one node or address */
2860 /* adding multiple addresses separated by commas */
2861 for (i=0; i<num_addrs; ++i) {
2862 strcpy(line, bstr("prefix"));
2863 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2866 strcat(line, bstr("suffix"));
2880 * \brief Convert a room name to a folder-ish-looking name.
2881 * \param folder the folderish name
2882 * \param room the room name
2883 * \param floor the floor name
2884 * \param is_mailbox is it a mailbox?
2886 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2891 * For mailboxes, just do it straight...
2894 sprintf(folder, "My folders|%s", room);
2898 * Otherwise, prefix the floor name as a "public folders" moniker
2901 if (floor > MAX_FLOORS) {
2903 sprintf(folder, "%%%%%%|%s", room);
2906 sprintf(folder, "%s|%s", floorlist[floor], room);
2911 * Replace "\" characters with "|" for pseudo-folder-delimiting
2913 len = strlen (folder);
2914 for (i=0; i<len; ++i) {
2915 if (folder[i] == '\\') folder[i] = '|';
2923 * \brief Back end for change_view()
2924 * \param newview set newview???
2926 void do_change_view(int newview) {
2929 serv_printf("VIEW %d", newview);
2930 serv_getln(buf, sizeof buf);
2931 WC->CurRoom.view = newview;
2932 smart_goto(WC->CurRoom.name);
2938 * \brief Change the view for this room
2940 void change_view(void) {
2943 view = lbstr("view");
2944 do_change_view(view);
2948 * \brief Burn the cached folder list.
2949 * \param age How old the cahce needs to be before we burn it.
2952 void burn_folder_cache(time_t age)
2954 /** If our cached folder list is very old, burn it. */
2955 if (WC->cache_fold != NULL) {
2956 if ((time(NULL) - WC->cache_timestamp) > age) {
2957 free(WC->cache_fold);
2958 WC->cache_fold = NULL;
2966 * \brief Do either a known rooms list or a folders list, depending on the
2971 StrBuf *ListView = NULL;
2973 /** Determine whether the user is trying to change views */
2974 if (havebstr("view")) {
2975 ListView = NewStrBufDup(SBSTR("view"));
2976 set_preference("roomlistview", ListView, 1);
2978 /** Sanitize the input so its safe */
2979 if((get_preference("roomlistview", &ListView) != 0)||
2980 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
2981 (strcasecmp(ChrPtr(ListView), "table") != 0)))
2983 if (ListView == NULL) {
2984 ListView = NewStrBufPlain(HKEY("rooms"));
2985 set_preference("roomlistview", ListView, 0);
2989 ListView = NewStrBufPlain(HKEY("rooms"));
2990 set_preference("roomlistview", ListView, 0);
2994 FreeStrBuf(&ListView);
3001 * \brief Set the message expire policy for this room and/or floor
3003 void set_room_policy(void) {
3006 if (!havebstr("ok_button")) {
3007 strcpy(WC->ImportantMessage,
3008 _("Cancelled. Changes were not saved."));
3013 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
3014 serv_getln(buf, sizeof buf);
3015 strcpy(WC->ImportantMessage, &buf[4]);
3017 if (WC->axlevel >= 6) {
3018 strcat(WC->ImportantMessage, "<br />\n");
3019 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
3020 serv_getln(buf, sizeof buf);
3021 strcat(WC->ImportantMessage, &buf[4]);
3027 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
3029 StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
3032 void dotgoto(void) {
3033 if (!havebstr("room")) {
3034 readloop(readnew, eUseDefault);
3037 if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
3040 smart_goto(sbstr("room"));
3045 void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
3047 wcsession *WCC = WC;
3050 StrBufAppendTemplate(Target, TP,
3055 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
3057 wc_printf("<div id=\"banner\">\n");
3058 embed_room_banner();
3059 wc_printf("</div>\n");
3063 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
3065 wcsession *WCC = WC;
3068 (!IsEmptyStr(WCC->ugname)))
3069 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3072 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
3074 wcsession *WCC = WC;
3075 return (WCC != NULL)?
3076 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
3079 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
3081 wcsession *WCC = WC;
3082 return (WCC == NULL)? 0 :
3083 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
3084 (WCC->CurRoom.is_inbox) ||
3085 (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
3088 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3090 wcsession *WCC = WC;
3092 return ((WCC!=NULL) &&
3093 (!IsEmptyStr(WCC->ugname)) &&
3094 (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0));
3098 int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
3100 folder *Folder = (folder *)(TP->Context);
3103 UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3104 if (UA_CheckFlag == 0)
3105 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3106 "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
3108 return ((Folder->RAFlags & UA_CheckFlag) != 0);
3113 int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3116 wcsession *WCC = WC;
3118 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3119 if (QR_CheckFlag == 0)
3120 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3121 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3123 return ((WCC!=NULL) &&
3124 ((WCC->CurRoom.QRFlags & QR_CheckFlag) != 0));
3127 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3130 folder *Folder = (folder *)(TP->Context);
3132 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3133 if (QR_CheckFlag == 0)
3134 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3135 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3136 return ((Folder->QRFlags & QR_CheckFlag) != 0);
3140 int ConditionalCurrentRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3143 wcsession *WCC = WC;
3145 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3146 if (QR2_CheckFlag == 0)
3147 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3148 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3150 return ((WCC!=NULL) &&
3151 ((WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0));
3154 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3157 folder *Folder = (folder *)(TP->Context);
3159 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3160 if (QR2_CheckFlag == 0)
3161 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3162 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3163 return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
3167 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3169 wcsession *WCC = WC;
3171 return ( (WCC!= NULL) &&
3172 ((WCC->axlevel >= 6) ||
3173 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
3174 (WCC->CurRoom.is_inbox) ));
3177 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
3179 wcsession *WCC = WC;
3181 if ((WCC == NULL) ||
3182 (TP->Tokens->nParameters < 3))
3184 return ((WCC->CurRoom.view < VIEW_BBS) ||
3185 (WCC->CurRoom.view > VIEW_MAX));
3188 return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
3192 HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP)
3194 wcsession *WCC = WC;
3198 HashList *Whok = NULL;
3204 StrBuf_ServGetln(Line);
3205 if (GetServerStatus(Line, &State) == 1)
3207 Whok = NewHash(1, Flathash);
3208 while(!Done && StrBuf_ServGetln(Line))
3209 if ( (StrLength(Line)==3) &&
3210 !strcmp(ChrPtr(Line), "000"))
3217 const char *Pos = NULL;
3218 Token = NewStrBufPlain (NULL, StrLength(Line));
3219 StrBufExtract_NextToken(Token, Line, &Pos, '|');
3227 else if (State == 550)
3228 StrBufAppendBufPlain(WCC->ImportantMsg,
3229 _("Higher access is required to access this function."), -1, 0);
3236 void _FlushRoomList(wcsession *WCC)
3238 free_march_list(WCC);
3239 DeleteHash(&WCC->Floors);
3240 DeleteHash(&WCC->Rooms);
3241 DeleteHash(&WCC->FloorsByName);
3244 void FlushRoomlist(void)
3246 wcsession *WCC = WC;
3247 _FlushRoomList(WCC);
3255 initialize_viewdefs();
3256 RegisterPreference("roomlistview",
3257 _("Room list view"),
3260 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
3262 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
3265 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
3266 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
3267 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
3269 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
3270 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
3271 WebcitAddUrlHandler(HKEY("display_entroom"), "", 0, display_entroom, 0);
3272 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
3273 WebcitAddUrlHandler(HKEY("display_whok"), "", 0, display_whok, 0);
3274 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
3275 WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0);
3276 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
3277 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
3278 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
3279 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
3280 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
3281 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
3282 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
3284 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
3285 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalCurrentRoomHas_QRFlag, CTX_NONE);
3286 RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
3288 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalCurrentRoomHas_QRFlag2, CTX_NONE);
3289 RegisterConditional(HKEY("COND:ROOM:FLAG:QR2"), 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
3290 RegisterConditional(HKEY("COND:ROOM:FLAG:UA"), 0, ConditionalRoomHas_UAFlag, CTX_ROOMS);
3292 RegisterIterator("ITERATE:THISROOM:WHO_KNOWS", 0, NULL, GetWhoKnowsHash, NULL, DeleteHash, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
3293 RegisterNamespace("THISROOM:MSGS:NEW", 0, 0, tmplput_CurrentRoom_nNewMessages, NULL, CTX_NONE);
3294 RegisterNamespace("THISROOM:MSGS:TOTAL", 0, 0, tmplput_CurrentRoom_nTotalMessages, NULL, CTX_NONE);
3296 RegisterNamespace("THISROOM:FLOOR:NAME", 0, 1, tmplput_CurrentRoomFloorName, NULL, CTX_NONE);
3297 RegisterNamespace("THISROOM:AIDE", 0, 1, tmplput_CurrentRoomAide, NULL, CTX_NONE);
3298 RegisterNamespace("THISROOM:PASS", 0, 1, tmplput_CurrentRoomPass, NULL, CTX_NONE);
3299 RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_CurrentRoomDirectory, NULL, CTX_NONE);
3300 RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_CurrentRoomOrder, NULL, CTX_NONE);
3301 RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE);
3302 RegisterConditional(HKEY("COND:THISROOM:HAVE_VIEW"), 0, ConditionalThisRoomHaveView, CTX_NONE);
3303 RegisterNamespace("THISROOM:VIEW_STRING", 0, 1, tmplput_CurrentRoomViewString, NULL, CTX_NONE);
3304 RegisterNamespace("ROOM:VIEW_STRING", 1, 2, tmplput_RoomViewString, NULL, CTX_NONE);
3306 RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_CurrentRoomInfoText, NULL, CTX_NONE);
3307 RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE);
3308 RegisterConditional(HKEY("COND:THISROOM:DEFAULT_VIEW"), 0, ConditionalThisRoomDefView, CTX_NONE);
3309 RegisterConditional(HKEY("COND:THISROOM:CURR_VIEW"), 0, ConditionalThisRoomCurrView, CTX_NONE);
3310 RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE);
3311 RegisterConditional(HKEY("COND:THISROOM:HAVE_INFOTEXT"), 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
3312 RegisterNamespace("THISROOM:FILES:N", 0, 1, tmplput_CurrentRoomXNFiles, NULL, CTX_NONE);
3313 RegisterNamespace("THISROOM:FILES:STR", 0, 1, tmplput_CurrentRoomX_FileString, NULL, CTX_NONE);
3315 REGISTERTokenParamDefine(QR_PERMANENT);
3316 REGISTERTokenParamDefine(QR_INUSE);
3317 REGISTERTokenParamDefine(QR_PRIVATE);
3318 REGISTERTokenParamDefine(QR_PASSWORDED);
3319 REGISTERTokenParamDefine(QR_GUESSNAME);
3320 REGISTERTokenParamDefine(QR_DIRECTORY);
3321 REGISTERTokenParamDefine(QR_UPLOAD);
3322 REGISTERTokenParamDefine(QR_DOWNLOAD);
3323 REGISTERTokenParamDefine(QR_VISDIR);
3324 REGISTERTokenParamDefine(QR_ANONONLY);
3325 REGISTERTokenParamDefine(QR_ANONOPT);
3326 REGISTERTokenParamDefine(QR_NETWORK);
3327 REGISTERTokenParamDefine(QR_PREFONLY);
3328 REGISTERTokenParamDefine(QR_READONLY);
3329 REGISTERTokenParamDefine(QR_MAILBOX);
3330 REGISTERTokenParamDefine(QR2_SYSTEM);
3331 REGISTERTokenParamDefine(QR2_SELFLIST);
3332 REGISTERTokenParamDefine(QR2_COLLABDEL);
3333 REGISTERTokenParamDefine(QR2_SUBJECTREQ);
3334 REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
3335 REGISTERTokenParamDefine(QR2_MODERATED);
3337 REGISTERTokenParamDefine(UA_KNOWN);
3338 REGISTERTokenParamDefine(UA_GOTOALLOWED);
3339 REGISTERTokenParamDefine(UA_HASNEWMSGS);
3340 REGISTERTokenParamDefine(UA_ZAPPED);
3341 REGISTERTokenParamDefine(UA_POSTALLOWED);
3342 REGISTERTokenParamDefine(UA_ADMINALLOWED);
3343 REGISTERTokenParamDefine(UA_DELETEALLOWED);
3344 REGISTERTokenParamDefine(UA_ISTRASH);
3346 REGISTERTokenParamDefine(US_NEEDVALID);
3347 REGISTERTokenParamDefine(US_PERM);
3348 REGISTERTokenParamDefine(US_LASTOLD);
3349 REGISTERTokenParamDefine(US_EXPERT);
3350 REGISTERTokenParamDefine(US_UNLISTED);
3351 REGISTERTokenParamDefine(US_NOPROMPT);
3352 REGISTERTokenParamDefine(US_PROMPTCTL);
3353 REGISTERTokenParamDefine(US_DISAPPEAR);
3354 REGISTERTokenParamDefine(US_REGIS);
3355 REGISTERTokenParamDefine(US_PAGINATOR);
3356 REGISTERTokenParamDefine(US_INTERNET);
3357 REGISTERTokenParamDefine(US_FLOORS);
3358 REGISTERTokenParamDefine(US_COLOR);
3359 REGISTERTokenParamDefine(US_USER_SET);
3361 REGISTERTokenParamDefine(VIEW_BBS);
3362 REGISTERTokenParamDefine(VIEW_MAILBOX);
3363 REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
3364 REGISTERTokenParamDefine(VIEW_CALENDAR);
3365 REGISTERTokenParamDefine(VIEW_TASKS);
3366 REGISTERTokenParamDefine(VIEW_NOTES);
3367 REGISTERTokenParamDefine(VIEW_WIKI);
3368 REGISTERTokenParamDefine(VIEW_CALBRIEF);
3369 REGISTERTokenParamDefine(VIEW_JOURNAL);
3370 REGISTERTokenParamDefine(VIEW_BLOG);
3373 REGISTERTokenParamDefine(ignet_push_share);
3374 { /* these are the parts of an IGNET push config */
3375 REGISTERTokenParamDefine(GNET_IGNET_NODE);
3376 REGISTERTokenParamDefine(GNET_IGNET_ROOM);
3378 REGISTERTokenParamDefine(listrecp);
3379 REGISTERTokenParamDefine(digestrecp);
3380 REGISTERTokenParamDefine(pop3client);
3381 { /* These are the parts of a pop3 client line... */
3382 REGISTERTokenParamDefine(GNET_POP3_HOST);
3383 REGISTERTokenParamDefine(GNET_POP3_USER);
3384 REGISTERTokenParamDefine(GNET_POP3_DONT_DELETE_REMOTE);
3385 REGISTERTokenParamDefine(GNET_POP3_INTERVAL);
3387 REGISTERTokenParamDefine(rssclient);
3388 REGISTERTokenParamDefine(participate);
3390 RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
3391 RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
3393 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
3394 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
3396 RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
3397 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
3398 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
3405 SessionDestroyModule_ROOMOPS
3408 FlushFolder(&sess->CurRoom);
3409 if (sess->cache_fold != NULL) {
3410 free(sess->cache_fold);
3413 _FlushRoomList (sess);