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 */
36 allowed_default_views[VIEW_MAX] = {
37 1, /* VIEW_BBS Bulletin board view */
38 1, /* VIEW_MAILBOX Mailbox summary */
39 1, /* VIEW_ADDRESSBOOK Address book view */
40 1, /* VIEW_CALENDAR Calendar view */
41 1, /* VIEW_TASKS Tasks view */
42 1, /* VIEW_NOTES Notes view */
43 1, /* VIEW_WIKI Wiki view */
44 0, /* VIEW_CALBRIEF Brief Calendar view */
45 0, /* VIEW_JOURNAL Journal view */
46 0 /* VIEW_BLOG Blog view (not yet implemented) */
51 * Initialize the viewdefs with localized strings
53 void initialize_viewdefs(void) {
54 viewdefs[VIEW_BBS] = _("Bulletin Board");
55 viewdefs[VIEW_MAILBOX] = _("Mail Folder");
56 viewdefs[VIEW_ADDRESSBOOK] = _("Address Book");
57 viewdefs[VIEW_CALENDAR] = _("Calendar");
58 viewdefs[VIEW_TASKS] = _("Task List");
59 viewdefs[VIEW_NOTES] = _("Notes List");
60 viewdefs[VIEW_WIKI] = _("Wiki");
61 viewdefs[VIEW_CALBRIEF] = _("Calendar List");
62 viewdefs[VIEW_JOURNAL] = _("Journal");
63 viewdefs[VIEW_BLOG] = _("Blog");
69 * load the list of floors
71 void load_floorlist(StrBuf *Buf)
76 for (a = 0; a < MAX_FLOORS; ++a)
80 StrBuf_ServGetln(Buf);
81 if (GetServerStatus(Buf, NULL) != 1) {
82 strcpy(floorlist[0], "Main Floor");
85 while (!Done && (StrBuf_ServGetln(Buf)>=0)) {
86 if ( (StrLength(Buf)==3) &&
87 !strcmp(ChrPtr(Buf), "000")) {
91 extract_token(floorlist[StrBufExtract_int(Buf, 0, '|')], ChrPtr(Buf), 1, '|', sizeof floorlist[0]);
98 * Embed the room banner
100 * got The information returned from a GOTO server command
101 * navbar_style Determines which navigation buttons to display
105 void embed_room_banner(void)
110 /* refresh current room states... */
111 /* dosen't work??? gotoroom(NULL); */
113 /* The browser needs some information for its own use */
114 wc_printf("<script type=\"text/javascript\"> \n"
115 " room_is_trash = %d; \n"
117 ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0)
121 * If the user happens to select the "make this my start page" link,
122 * we want it to remember the URL as a "/dotskip" one instead of
123 * a "skip" or "gotonext" or something like that.
125 if (WCC->Hdr->this_page == NULL) {
126 WCC->Hdr->this_page = NewStrBuf();
128 StrBufPrintf(WCC->Hdr->this_page,
130 ChrPtr(WC->CurRoom.name)
133 do_template("roombanner", NULL);
134 /* roombanner contains this for mobile */
139 wc_printf("<div id=\"navbar\"><ul>");
142 "<li class=\"ungoto\">"
143 "<a href=\"ungoto\">"
144 "<img src=\"static/ungoto2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
145 "<span class=\"navbar_link\">%s</span></A>"
146 "</li>\n", _("Ungoto")
149 if (WC->CurRoom.view == VIEW_BBS) {
151 "<li class=\"newmess\">"
152 "<a href=\"readnew\">"
153 "<img src=\"static/newmess2_24x.gif\" alt=\"\" width=\"24\" height=\"24\">"
154 "<span class=\"navbar_link\">%s</span></A>"
155 "</li>\n", _("Read new messages")
159 switch(WC->CurRoom.view) {
160 case VIEW_ADDRESSBOOK:
162 "<li class=\"viewcontacts\">"
163 "<a href=\"readfwd\">"
164 "<img src=\"static/viewcontacts_24x.gif\" "
165 "alt=\"\" width=\"24\" height=\"24\">"
166 "<span class=\"navbar_link\">"
168 "</span></a></li>\n", _("View contacts")
171 "<li class=\"addnewcontact\">"
172 "<a href=\"display_enter\">"
173 "<img src=\"static/addnewcontact_24x.gif\" "
174 "alt=\"\" width=\"24\" height=\"24\">"
175 "<span class=\"navbar_link\">"
177 "</span></a></li>\n", _("Add new contact")
182 "<li class=\"staskday\">"
183 "<a href=\"readfwd?calview=day\">"
184 "<img src=\"static/taskday2_24x.gif\" "
185 "alt=\"\" width=\"24\" height=\"24\">"
186 "<span class=\"navbar_link\">"
188 "</span></a></li>\n", _("Day view")
191 "<li class=\"monthview\">"
192 "<a href=\"readfwd?calview=month\">"
193 "<img src=\"static/monthview2_24x.gif\" "
194 "alt=\"\" width=\"24\" height=\"24\">"
195 "<span class=\"navbar_link\">"
197 "</span></a></li>\n", _("Month view")
199 wc_printf("<li class=\"addevent\"><a href=\"display_enter");
200 if (havebstr("year" )) wc_printf("?year=%s", bstr("year"));
201 if (havebstr("month")) wc_printf("?month=%s", bstr("month"));
202 if (havebstr("day" )) wc_printf("?day=%s", bstr("day"));
204 "<img src=\"static/addevent_24x.gif\" "
205 "alt=\"\" width=\"24\" height=\"24\">"
206 "<span class=\"navbar_link\">"
208 "</span></a></li>\n", _("Add new event")
213 "<li class=\"monthview\">"
214 "<a href=\"readfwd?calview=month\">"
215 "<img src=\"static/monthview2_24x.gif\" "
216 "alt=\"\" width=\"24\" height=\"24\">"
217 "<span class=\"navbar_link\">"
219 "</span></a></li>\n", _("Calendar list")
224 "<li class=\"taskmanag\">"
225 "<a href=\"readfwd\">"
226 "<img src=\"static/taskmanag_24x.gif\" "
227 "alt=\"\" width=\"24\" height=\"24\">"
228 "<span class=\"navbar_link\">"
230 "</span></a></li>\n", _("View tasks")
233 "<li class=\"newmess\">"
234 "<a href=\"display_enter\">"
235 "<img src=\"static/newmess3_24x.gif\" "
236 "alt=\"\" width=\"24\" height=\"24\">"
237 "<span class=\"navbar_link\">"
239 "</span></a></li>\n", _("Add new task")
244 "<li class=\"viewnotes\">"
245 "<a href=\"readfwd\">"
246 "<img src=\"static/viewnotes_24x.gif\" "
247 "alt=\"\" width=\"24\" height=\"24\">"
248 "<span class=\"navbar_link\">"
250 "</span></a></li>\n", _("View notes")
253 "<li class=\"enternewnote\">"
254 "<a href=\"add_new_note\">"
255 "<img src=\"static/enternewnote_24x.gif\" "
256 "alt=\"\" width=\"24\" height=\"24\">"
257 "<span class=\"navbar_link\">"
259 "</span></a></li>\n", _("Add new note")
264 "<li class=\"readallmess\">"
265 "<a id=\"m_refresh\" href=\"readfwd\">"
266 "<img src=\"static/readallmess3_24x.gif\" "
267 "alt=\"\" width=\"24\" height=\"24\">"
268 "<span class=\"navbar_link\">"
270 "</span></a></li>\n", _("Refresh message list")
275 "<li class=\"readallmess\">"
276 "<a href=\"wiki?page=home\">"
277 "<img src=\"static/readallmess3_24x.gif\" "
278 "alt=\"\" width=\"24\" height=\"24\">"
279 "<span class=\"navbar_link\">"
281 "</span></a></li>\n", _("Wiki home")
283 safestrncpy(buf, bstr("page"), sizeof buf);
284 if (IsEmptyStr(buf)) {
285 safestrncpy(buf, "home", sizeof buf);
289 "<li class=\"newmess\">"
290 "<a href=\"display_enter?page=%s\">"
291 "<img src=\"static/newmess3_24x.gif\" "
292 "alt=\"\" width=\"24\" height=\"24\">"
293 "<span class=\"navbar_link\">"
295 "</span></a></li>\n", buf, _("Edit this page")
298 if (bmstrcasestr((char *)ChrPtr(WCC->Hdr->HR.ReqLine), "wiki_history")) {
299 /* already viewing history; display a link to the current page */
301 "<li class=\"newmess\">"
302 "<a href=\"wiki?page=%s\">"
303 "<img src=\"static/newmess3_24x.gif\" "
304 "alt=\"\" width=\"24\" height=\"24\">"
305 "<span class=\"navbar_link\">"
307 "</span></a></li>\n", buf, _("Current version")
311 /* display a link to the history */
313 "<li class=\"newmess\">"
314 "<a href=\"wiki_history?page=%s\">"
315 "<img src=\"static/newmess3_24x.gif\" "
316 "alt=\"\" width=\"24\" height=\"24\">"
317 "<span class=\"navbar_link\">"
319 "</span></a></li>\n", buf, _("History")
325 "<li class=\"readallmess\">"
326 "<a href=\"readfwd\">"
327 "<img src=\"static/readallmess3_24x.gif\" "
328 "alt=\"\" width=\"24\" height=\"24\">"
329 "<span class=\"navbar_link\">"
331 "</span></a></li>\n", _("Read all messages")
334 "<li class=\"newmess\">"
335 "<a href=\"display_enter\">"
336 "<img src=\"static/newmess3_24x.gif\" "
337 "alt=\"\" width=\"24\" height=\"24\">"
338 "<span class=\"navbar_link\">"
340 "</span></a></li>\n", _("Write mail")
343 "<li class=\"newmess\">"
344 "<a href=\"javascript:deleteAllSelectedMessages();\">"
345 "<img src=\"static/delete.gif\" "
346 "alt=\"\" width=\"24\" height=\"24\"><span class=\"navbar_link\">"
348 "</span></a></li>\n", _("Delete")
353 "<li class=\"readallmess\">"
354 "<a href=\"readfwd\">"
355 "<img src=\"static/readallmess3_24x.gif\" "
356 "alt=\"\" width=\"24\" height=\"24\">"
357 "<span class=\"navbar_link\">"
359 "</span></a></li>\n", _("Read all messages")
362 "<li class=\"newmess\">"
363 "<a href=\"display_enter\">"
364 "<img src=\"static/newmess3_24x.gif\" "
365 "alt=\"\" width=\"24\" height=\"24\">"
366 "<span class=\"navbar_link\">"
368 "</span></a></li>\n", _("Enter a message")
374 "<li class=\"skipthisroom\">"
377 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
378 "width=\"24\" height=\"24\">"
379 "<span class=\"navbar_link\">%s</span></a>"
381 _("Leave all messages marked as unread, go to next room with unread messages"),
386 "<li class=\"markngo\">"
387 "<a href=\"gotonext\" "
389 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
390 "width=\"24\" height=\"24\">"
391 "<span class=\"navbar_link\">%s</span></a>"
393 _("Mark all messages as read, go to next room with unread messages"),
397 wc_printf("</ul></div>\n");
402 * back end routine to take the session to a new room
404 long gotoroom(const StrBuf *gname)
408 static long ls = (-1L);
411 /* store ungoto information */
412 if (StrLength(gname) > 0)
413 strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
417 /* move to the new room */
418 if (StrLength(gname) > 0)
419 serv_printf("GOTO %s", ChrPtr(gname));
420 else /* or just refresh the current state... */
421 serv_printf("GOTO 00000000000000000000");
422 StrBuf_ServGetln(Buf);
423 if (GetServerStatus(Buf, &err) != 2) {
424 serv_puts("GOTO _BASEROOM_");
425 StrBuf_ServGetln(Buf);
427 * well, we know that this is the fallback case,
428 * but we're interested that the first command
429 * didn't work out in first place.
431 if (GetServerStatus(Buf, NULL) != 2) {
436 ParseGoto(&WCC->CurRoom, Buf);
438 if (StrLength(gname) > 0)
440 remove_march(WCC->CurRoom.name);
441 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
450 void ParseGoto(folder *room, StrBuf *Line)
458 if (StrLength(Line) < 4) {
462 /* ignore the commandstate... */
463 Pos = ChrPtr(Line) + 4;
465 if (room->RoomNameParts != NULL)
468 for (i=0; i < room->nRoomNameParts; i++)
469 FreeStrBuf(&room->RoomNameParts[i]);
470 free(room->RoomNameParts);
471 room->RoomNameParts = NULL;
476 pBuf = NewStrBufPlain(NULL, StrLength(Line));
479 memset(room, 0, sizeof(folder));
482 StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
484 room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|');
485 if (room->nNewMessages > 0)
486 room->RAFlags |= UA_HASNEWMSGS;
488 room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
490 room->ShowInfo = StrBufExtractNext_long(Line, &Pos, '|');
492 room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
494 room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
495 room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
497 room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
499 flag = StrBufExtractNext_long(Line, &Pos, '|');
500 if (WCC->is_aide || flag) {
501 room->RAFlags |= UA_ADMINALLOWED;
504 room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
506 room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor
508 room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view
510 room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview
512 flag = StrBufExtractNext_long(Line, &Pos, '|');
514 room->RAFlags |= UA_ISTRASH; // wc_is_trash
516 room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2
518 /* find out, whether we are in a sub-room */
519 room->nRoomNameParts = StrBufNum_tokens(room->name, '\\');
520 if (room->nRoomNameParts > 1)
525 room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1));
526 memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1));
527 for (i=0; i < room->nRoomNameParts; i++)
529 room->RoomNameParts[i] = NewStrBuf();
530 StrBufExtract_NextToken(room->RoomNameParts[i],
531 room->name, &Pos, '\\');
535 /* Private mailboxes on the main floor get remapped to the personal folder */
536 if ((room->QRFlags & QR_MAILBOX) &&
537 (room->floorid == 0))
539 room->floorid = VIRTUAL_MY_FLOOR;
540 if ((room->nRoomNameParts == 1) &&
541 (StrLength(room->name) == 4) &&
542 (strcmp(ChrPtr(room->name), "Mail") == 0))
548 /* get a pointer to the floor we're on: */
549 if (WCC->Floors == NULL)
550 GetFloorListHash(NULL, NULL);
552 GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
553 room->Floor = (const Floor*) vFloor;
556 void LoadRoomAide(void)
561 if (WCC->CurRoom.RoomAideLoaded)
564 WCC->CurRoom.RoomAideLoaded = 1;
567 StrBuf_ServGetln(Buf);
568 if (GetServerStatus(Buf, NULL) != 2) {
569 FlushStrBuf(WCC->CurRoom.RoomAide);
570 AppendImportantMessage (ChrPtr(Buf) + 4,
575 Pos = ChrPtr(Buf) + 4;
577 FreeStrBuf(&WCC->CurRoom.RoomAide);
578 WCC->CurRoom.RoomAide = NewStrBufPlain (NULL, StrLength (Buf));
580 StrBufExtract_NextToken(WCC->CurRoom.RoomAide, Buf, &Pos, '|');
584 void tmplput_CurrentRoomFloorName(StrBuf *Target, WCTemplputParams *TP)
587 folder *Folder = &WCC->CurRoom;
588 const Floor *pFloor = Folder->Floor;
593 StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
596 void tmplput_CurrentRoomAide(StrBuf *Target, WCTemplputParams *TP)
602 StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
606 void LoadRoomXA (void)
611 if (WCC->CurRoom.XALoaded)
614 WCC->CurRoom.XALoaded = 1;
617 StrBuf_ServGetln(Buf);
618 if (GetServerStatus(Buf, NULL) != 2) {
619 FlushStrBuf(WCC->CurRoom.XAPass);
620 FlushStrBuf(WCC->CurRoom.Directory);
622 AppendImportantMessage (ChrPtr(Buf) + 4,
627 Pos = ChrPtr(Buf) + 4;
629 FreeStrBuf(&WCC->CurRoom.XAPass);
630 FreeStrBuf(&WCC->CurRoom.Directory);
632 WCC->CurRoom.XAPass = NewStrBufPlain (NULL, StrLength (Buf));
633 WCC->CurRoom.Directory = NewStrBufPlain (NULL, StrLength (Buf));
635 StrBufSkip_NTokenS(Buf, &Pos, '|', 1); /* The Name, we already know... */
636 StrBufExtract_NextToken(WCC->CurRoom.XAPass, Buf, &Pos, '|');
637 StrBufExtract_NextToken(WCC->CurRoom.Directory, Buf, &Pos, '|');
638 StrBufSkip_NTokenS(Buf, &Pos, '|', 2); /* QRFlags, FloorNum we already know... */
639 WCC->CurRoom.Order = StrBufExtractNext_long(Buf, &Pos, '|');
640 /* defview, we already know you. */
641 /* QR2Flags, we already know them... */
648 void LoadXRoomPic(void)
653 if (WCC->CurRoom.XHaveRoomPicLoaded)
656 WCC->CurRoom.XHaveRoomPicLoaded = 1;
658 serv_puts("OIMG _roompic_");
659 StrBuf_ServGetln(Buf);
660 if (GetServerStatus(Buf, NULL) != 2) {
661 WCC->CurRoom.XHaveRoomPic = 0;
663 WCC->CurRoom.XHaveRoomPic = 1;
666 StrBuf_ServGetln(Buf);
667 GetServerStatus(Buf, NULL);
671 int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
679 return WCC->CurRoom.XHaveRoomPic == 1;
682 void LoadXRoomInfoText(void)
688 if (WCC->CurRoom.XHaveInfoTextLoaded)
691 WCC->CurRoom.XHaveInfoTextLoaded = 1;
696 StrBuf_ServGetln(Buf);
697 if (GetServerStatus(Buf, NULL) == 1) {
698 WCC->CurRoom.XInfoText = NewStrBuf ();
700 while (!Done && StrBuf_ServGetln(Buf)>=0) {
701 if ( (StrLength(Buf)==3) &&
702 !strcmp(ChrPtr(Buf), "000"))
705 StrBufAppendBuf(WCC->CurRoom.XInfoText, Buf, 0);
712 int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
720 return (StrLength(WCC->CurRoom.XInfoText)>0);
723 void tmplput_CurrentRoomInfoText(StrBuf *Target, WCTemplputParams *TP)
729 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 1);
732 void LoadXRoomXCountFiles(void)
738 if (WCC->CurRoom.XHaveDownloadCount)
741 WCC->CurRoom.XHaveDownloadCount = 1;
745 StrBuf_ServGetln(Buf);
746 if (GetServerStatus(Buf, NULL) == 1) {
748 while (!Done && StrBuf_ServGetln(Buf)>=0) {
749 if ( (StrLength(Buf)==3) &&
750 !strcmp(ChrPtr(Buf), "000"))
753 WCC->CurRoom.XDownloadCount++;
760 void tmplput_CurrentRoomXNFiles(StrBuf *Target, WCTemplputParams *TP)
764 LoadXRoomXCountFiles();
766 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
769 void tmplput_CurrentRoomX_FileString(StrBuf *Target, WCTemplputParams *TP)
773 LoadXRoomXCountFiles();
775 if (WCC->CurRoom.XDownloadCount == 1)
776 StrBufAppendBufPlain(Target, _("file"), -1, 0);
778 StrBufAppendBufPlain(Target, _("files"), -1, 0);
781 void tmplput_CurrentRoomPass(StrBuf *Target, WCTemplputParams *TP)
787 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
789 void tmplput_CurrentRoomDirectory(StrBuf *Target, WCTemplputParams *TP)
795 StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
797 void tmplput_CurrentRoomOrder(StrBuf *Target, WCTemplputParams *TP)
803 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
805 void tmplput_CurrentRoomDefView(StrBuf *Target, WCTemplputParams *TP)
809 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.defview);
812 void tmplput_CurrentRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP)
818 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
821 void tmplput_CurrentRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP)
827 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
830 int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
840 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
841 return CheckThis == WCC->CurRoom.Order;
844 int ConditionalThisRoomDefView(StrBuf *Target, WCTemplputParams *TP)
852 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
853 return CheckThis == WCC->CurRoom.defview;
856 int ConditionalThisRoomCurrView(StrBuf *Target, WCTemplputParams *TP)
864 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
865 return CheckThis == WCC->CurRoom.view;
868 int ConditionalThisRoomHaveView(StrBuf *Target, WCTemplputParams *TP)
876 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
877 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
879 LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
880 "Roomview [%ld] not valid\n",
885 return exchangeable_views [WCC->CurRoom.defview][CheckThis] != VIEW_MAX;
888 void tmplput_CurrentRoomViewString(StrBuf *Target, WCTemplputParams *TP)
894 (WCC->CurRoom.defview >= VIEW_MAX) ||
895 (WCC->CurRoom.defview < VIEW_BBS))
897 LogTemplateError(Target, "Token", ERR_PARM2, TP,
898 "Roomview [%ld] not valid\n",
900 WCC->CurRoom.defview : -1);
904 Buf = NewStrBufPlain(_(viewdefs[WCC->CurRoom.defview]), -1);
905 StrBufAppendTemplate(Target, TP, Buf, 0);
909 void tmplput_RoomViewString(StrBuf *Target, WCTemplputParams *TP)
914 CheckThis = GetTemplateTokenNumber(Target, TP, 0, 0);
915 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
917 LogTemplateError(Target, "Token", ERR_PARM2, TP,
918 "Roomview [%ld] not valid\n",
923 Buf = NewStrBufPlain(_(viewdefs[CheckThis]), -1);
924 StrBufAppendTemplate(Target, TP, Buf, 0);
929 int ConditionalIsAllowedDefaultView(StrBuf *Target, WCTemplputParams *TP)
937 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
938 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
940 LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
941 "Roomview [%ld] not valid\n",
946 return allowed_default_views[CheckThis] != 0;
952 void smart_goto(const StrBuf *next_room) {
954 readloop(readnew, eUseDefault);
960 * mark all messages in current room as having been read
962 void slrp_highest(void)
966 serv_puts("SLRP HIGHEST");
967 serv_getln(buf, sizeof buf);
971 typedef struct __room_states {
986 * Set/clear/read the "self-service list subscribe" flag for a room
988 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
989 * returns the new value.
992 int self_service(int newval) {
993 int current_value = 0;
999 int flags, floor, order, view, flags2;
1002 serv_getln(buf, sizeof buf);
1003 if (buf[0] != '2') return(0);
1005 extract_token(name, &buf[4], 0, '|', sizeof name);
1006 extract_token(password, &buf[4], 1, '|', sizeof password);
1007 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1008 flags = extract_int(&buf[4], 3);
1009 floor = extract_int(&buf[4], 4);
1010 order = extract_int(&buf[4], 5);
1011 view = extract_int(&buf[4], 6);
1012 flags2 = extract_int(&buf[4], 7);
1014 if (flags2 & QR2_SELFLIST) {
1022 flags2 = flags2 | QR2_SELFLIST;
1024 else if (newval == 0) {
1025 flags2 = flags2 & ~QR2_SELFLIST;
1028 return(current_value);
1031 if (newval != current_value) {
1032 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1033 name, password, dirname, flags,
1034 floor, order, view, flags2);
1035 serv_getln(buf, sizeof buf);
1042 int is_selflist(room_states *RoomFlags)
1044 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1047 int is_publiclist(room_states *RoomFlags)
1049 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1052 int is_moderatedlist(room_states *RoomFlags)
1054 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1058 * Set/clear/read the "self-service list subscribe" flag for a room
1060 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1061 * returns the new value.
1064 int get_roomflags(room_states *RoomOps)
1069 serv_getln(buf, sizeof buf);
1070 if (buf[0] != '2') return(0);
1072 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1073 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1074 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1075 RoomOps->flags = extract_int(&buf[4], 3);
1076 RoomOps->floor = extract_int(&buf[4], 4);
1077 RoomOps->order = extract_int(&buf[4], 5);
1078 RoomOps->view = extract_int(&buf[4], 6);
1079 RoomOps->flags2 = extract_int(&buf[4], 7);
1083 int set_roomflags(room_states *RoomOps)
1087 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1096 serv_getln(buf, sizeof buf);
1106 * display the form for editing a room
1108 void display_editroom(void)
1113 char remote_room[128];
1116 char er_password[10];
1117 char er_dirname[15];
1118 char er_roomaide[26];
1125 char *not_shared_with = NULL;
1128 int floorpolicy = 0;
1130 char pop3_host[128];
1135 if (IsEmptyStr(tab)) tab = "admin";
1137 // Buf = NewStrBuf();
1138 // load_floorlist(Buf);
1139 // FreeStrBuf(&Buf);
1140 output_headers(1, 1, 1, 0, 0, 0);
1142 wc_printf("<div class=\"fix_scrollbar_bug\">");
1144 wc_printf("<br />\n");
1146 /* print the tabbed dialog */
1147 wc_printf("<div align=\"center\">");
1148 wc_printf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
1149 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1152 wc_printf("<td class=\"");
1153 if (!strcmp(tab, "admin")) {
1154 wc_printf(" tab_cell_label\">");
1155 wc_printf(_("Administration"));
1158 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1159 wc_printf(_("Administration"));
1162 wc_printf("</td>\n");
1163 wc_printf("<td> </td>\n");
1165 if ( ConditionalHaveRoomeditRights(NULL, NULL)) {
1167 wc_printf("<td class=\"");
1168 if (!strcmp(tab, "config")) {
1169 wc_printf(" tab_cell_label\">");
1170 wc_printf(_("Configuration"));
1173 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1174 wc_printf(_("Configuration"));
1177 wc_printf("</td>\n");
1178 wc_printf("<td> </td>\n");
1180 wc_printf("<td class=\"");
1181 if (!strcmp(tab, "expire")) {
1182 wc_printf(" tab_cell_label\">");
1183 wc_printf(_("Message expire policy"));
1186 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1187 wc_printf(_("Message expire policy"));
1190 wc_printf("</td>\n");
1191 wc_printf("<td> </td>\n");
1193 wc_printf("<td class=\"");
1194 if (!strcmp(tab, "access")) {
1195 wc_printf(" tab_cell_label\">");
1196 wc_printf(_("Access controls"));
1199 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1200 wc_printf(_("Access controls"));
1203 wc_printf("</td>\n");
1204 wc_printf("<td> </td>\n");
1206 wc_printf("<td class=\"");
1207 if (!strcmp(tab, "sharing")) {
1208 wc_printf(" tab_cell_label\">");
1209 wc_printf(_("Sharing"));
1212 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1213 wc_printf(_("Sharing"));
1216 wc_printf("</td>\n");
1217 wc_printf("<td> </td>\n");
1219 wc_printf("<td class=\"");
1220 if (!strcmp(tab, "listserv")) {
1221 wc_printf(" tab_cell_label\">");
1222 wc_printf(_("Mailing list service"));
1225 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1226 wc_printf(_("Mailing list service"));
1229 wc_printf("</td>\n");
1230 wc_printf("<td> </td>\n");
1234 wc_printf("<td class=\"");
1235 if (!strcmp(tab, "feeds")) {
1236 wc_printf(" tab_cell_label\">");
1237 wc_printf(_("Remote retrieval"));
1240 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1241 wc_printf(_("Remote retrieval"));
1244 wc_printf("</td>\n");
1245 wc_printf("<td> </td>\n");
1247 wc_printf("</tr></table>\n");
1248 wc_printf("</div>\n");
1249 /* end tabbed dialog */
1251 wc_printf("<script type=\"text/javascript\">"
1252 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1256 /* begin content of whatever tab is open now */
1258 if (!strcmp(tab, "admin")) {
1259 wc_printf("<div class=\"tabcontent\">");
1261 "<li><a href=\"delete_room\" "
1262 "onClick=\"return confirm('");
1263 wc_printf(_("Are you sure you want to delete this room?"));
1264 wc_printf("');\">\n");
1265 wc_printf(_("Delete this room"));
1267 "<li><a href=\"display_editroompic?which_room=");
1268 urlescputs(ChrPtr(WC->CurRoom.name));
1270 wc_printf(_("Set or change the icon for this room's banner"));
1272 "<li><a href=\"display_editinfo\">\n");
1273 wc_printf(_("Edit this room's Info file"));
1276 wc_printf("</div>");
1279 if (!strcmp(tab, "config")) {
1280 wc_printf("<div class=\"tabcontent\">");
1282 serv_getln(buf, sizeof buf);
1284 if (!strncmp(buf, "550", 3)) {
1285 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1286 _("Higher access is required to access this function.")
1289 else if (buf[0] != '2') {
1290 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1293 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1294 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1295 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1296 er_flags = extract_int(&buf[4], 3);
1297 er_floor = extract_int(&buf[4], 4);
1298 er_flags2 = extract_int(&buf[4], 7);
1300 wc_printf("<form method=\"POST\" action=\"editroom\">\n");
1301 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1303 wc_printf("<ul><li>");
1304 wc_printf(_("Name of room: "));
1305 wc_printf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\""ULONG_FMT"\">\n",
1311 wc_printf(_("Resides on floor: "));
1312 wc_printf("<select NAME=\"er_floor\" SIZE=\"1\"");
1313 if (er_flags & QR_MAILBOX)
1314 wc_printf("disabled >\n");
1315 for (i = 0; i < 128; ++i)
1316 if (!IsEmptyStr(floorlist[i])) {
1317 wc_printf("<OPTION ");
1319 wc_printf("SELECTED ");
1320 wc_printf("VALUE=\"%d\">", i);
1321 escputs(floorlist[i]);
1322 wc_printf("</OPTION>\n");
1324 wc_printf("</select>\n");
1327 wc_printf(_("Type of room:"));
1328 wc_printf("<ul>\n");
1330 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1331 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1332 wc_printf("CHECKED ");
1333 wc_printf("OnChange=\""
1334 " if (this.form.type[0].checked == true) { "
1335 " this.form.er_floor.disabled = false; "
1338 wc_printf(_("Public (automatically appears to everyone)"));
1341 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1342 if ((er_flags & QR_PRIVATE) &&
1343 (er_flags & QR_GUESSNAME))
1344 wc_printf("CHECKED ");
1345 wc_printf(" OnChange=\""
1346 " if (this.form.type[1].checked == true) { "
1347 " this.form.er_floor.disabled = false; "
1350 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
1352 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1353 if ((er_flags & QR_PRIVATE) &&
1354 (er_flags & QR_PASSWORDED))
1355 wc_printf("CHECKED ");
1356 wc_printf(" OnChange=\""
1357 " if (this.form.type[2].checked == true) { "
1358 " this.form.er_floor.disabled = false; "
1361 wc_printf(_("Private - require password: "));
1362 wc_printf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1365 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1366 if ((er_flags & QR_PRIVATE)
1367 && ((er_flags & QR_GUESSNAME) == 0)
1368 && ((er_flags & QR_PASSWORDED) == 0))
1369 wc_printf("CHECKED ");
1370 wc_printf(" OnChange=\""
1371 " if (this.form.type[3].checked == true) { "
1372 " this.form.er_floor.disabled = false; "
1375 wc_printf(_("Private - invitation only"));
1377 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1378 if (er_flags & QR_MAILBOX)
1379 wc_printf("CHECKED ");
1380 wc_printf (" OnChange=\""
1381 " if (this.form.type[4].checked == true) { "
1382 " this.form.er_floor.disabled = true; "
1385 wc_printf(_("Personal (mailbox for you only)"));
1387 wc_printf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1389 wc_printf(_("If private, cause current users to forget room"));
1391 wc_printf("\n</ul>\n");
1393 wc_printf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1394 if (er_flags & QR_PREFONLY)
1395 wc_printf("CHECKED ");
1397 wc_printf(_("Preferred users only"));
1399 wc_printf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1400 if (er_flags & QR_READONLY)
1401 wc_printf("CHECKED ");
1403 wc_printf(_("Read-only room"));
1405 wc_printf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1406 if (er_flags2 & QR2_COLLABDEL)
1407 wc_printf("CHECKED ");
1409 wc_printf(_("All users allowed to post may also delete messages"));
1411 /** directory stuff */
1412 wc_printf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1413 if (er_flags & QR_DIRECTORY)
1414 wc_printf("CHECKED ");
1416 wc_printf(_("File directory room"));
1418 wc_printf("\n<ul><li>");
1419 wc_printf(_("Directory name: "));
1420 wc_printf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1423 wc_printf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1424 if (er_flags & QR_UPLOAD)
1425 wc_printf("CHECKED ");
1427 wc_printf(_("Uploading allowed"));
1429 wc_printf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1430 if (er_flags & QR_DOWNLOAD)
1431 wc_printf("CHECKED ");
1433 wc_printf(_("Downloading allowed"));
1435 wc_printf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1436 if (er_flags & QR_VISDIR)
1437 wc_printf("CHECKED ");
1439 wc_printf(_("Visible directory"));
1440 wc_printf("</ul>\n");
1442 /** end of directory stuff */
1444 wc_printf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1445 if (er_flags & QR_NETWORK)
1446 wc_printf("CHECKED ");
1448 wc_printf(_("Network shared room"));
1450 wc_printf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1451 if (er_flags & QR_PERMANENT)
1452 wc_printf("CHECKED ");
1454 wc_printf(_("Permanent (does not auto-purge)"));
1456 wc_printf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1457 if (er_flags2 & QR2_SUBJECTREQ)
1458 wc_printf("CHECKED ");
1460 wc_printf(_("Subject Required (Force users to specify a message subject)"));
1462 /** start of anon options */
1464 wc_printf("\n<li>");
1465 wc_printf(_("Anonymous messages"));
1466 wc_printf("<ul>\n");
1468 wc_printf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1469 if (((er_flags & QR_ANONONLY) == 0)
1470 && ((er_flags & QR_ANONOPT) == 0))
1471 wc_printf("CHECKED ");
1473 wc_printf(_("No anonymous messages"));
1475 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1476 if (er_flags & QR_ANONONLY)
1477 wc_printf("CHECKED ");
1479 wc_printf(_("All messages are anonymous"));
1481 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1482 if (er_flags & QR_ANONOPT)
1483 wc_printf("CHECKED ");
1485 wc_printf(_("Prompt user when entering messages"));
1486 wc_printf("</ul>\n");
1488 /* end of anon options */
1491 wc_printf(_("Room aide: "));
1493 serv_getln(buf, sizeof buf);
1494 if (buf[0] != '2') {
1495 wc_printf("<em>%s</em>\n", &buf[4]);
1497 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1498 wc_printf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1501 wc_printf("</ul><CENTER>\n");
1502 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1503 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1505 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1511 wc_printf("</div>");
1515 /* Sharing the room with other Citadel nodes... */
1516 if (!strcmp(tab, "sharing")) {
1517 wc_printf("<div class=\"tabcontent\">");
1519 shared_with = strdup("");
1520 not_shared_with = strdup("");
1522 /** Learn the current configuration */
1523 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1524 serv_getln(buf, sizeof buf);
1525 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1526 extract_token(node, buf, 0, '|', sizeof node);
1527 not_shared_with = realloc(not_shared_with,
1528 strlen(not_shared_with) + 32);
1529 strcat(not_shared_with, node);
1530 strcat(not_shared_with, "\n");
1534 serv_getln(buf, sizeof buf);
1535 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1536 extract_token(cmd, buf, 0, '|', sizeof cmd);
1537 extract_token(node, buf, 1, '|', sizeof node);
1538 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1539 if (!strcasecmp(cmd, "ignet_push_share")) {
1540 shared_with = realloc(shared_with,
1541 strlen(shared_with) + 32);
1542 strcat(shared_with, node);
1543 if (!IsEmptyStr(remote_room)) {
1544 strcat(shared_with, "|");
1545 strcat(shared_with, remote_room);
1547 strcat(shared_with, "\n");
1551 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1552 extract_token(buf, shared_with, i, '\n', sizeof buf);
1553 extract_token(node, buf, 0, '|', sizeof node);
1554 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1555 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1556 if (!strcasecmp(node, cmd)) {
1557 remove_token(not_shared_with, j, '\n');
1562 /* Display the stuff */
1563 wc_printf("<CENTER><br />"
1564 "<table border=1 cellpadding=5><tr>"
1566 wc_printf(_("Shared with"));
1567 wc_printf("</I></B></td>"
1569 wc_printf(_("Not shared with"));
1570 wc_printf("</I></B></td></tr>\n"
1571 "<tr><td VALIGN=TOP>\n");
1573 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1574 wc_printf(_("Remote node name"));
1575 wc_printf("</td><td>");
1576 wc_printf(_("Remote room name"));
1577 wc_printf("</td><td>");
1578 wc_printf(_("Actions"));
1579 wc_printf("</td></tr>\n");
1581 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1582 extract_token(buf, shared_with, i, '\n', sizeof buf);
1583 extract_token(node, buf, 0, '|', sizeof node);
1584 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1585 if (!IsEmptyStr(node)) {
1586 wc_printf("<form method=\"POST\" action=\"netedit\">");
1587 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1588 wc_printf("<tr><td>%s</td>\n", node);
1591 if (!IsEmptyStr(remote_room)) {
1592 escputs(remote_room);
1598 wc_printf("<input type=\"hidden\" NAME=\"line\" "
1599 "VALUE=\"ignet_push_share|");
1601 if (!IsEmptyStr(remote_room)) {
1603 urlescputs(remote_room);
1606 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1607 wc_printf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1608 wc_printf("<input type=\"submit\" "
1609 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1610 wc_printf("</td></tr></form>\n");
1614 wc_printf("</table>\n");
1615 wc_printf("</td><td VALIGN=TOP>\n");
1616 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1617 wc_printf(_("Remote node name"));
1618 wc_printf("</td><td>");
1619 wc_printf(_("Remote room name"));
1620 wc_printf("</td><td>");
1621 wc_printf(_("Actions"));
1622 wc_printf("</td></tr>\n");
1624 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1625 extract_token(node, not_shared_with, i, '\n', sizeof node);
1626 if (!IsEmptyStr(node)) {
1627 wc_printf("<form method=\"POST\" action=\"netedit\">");
1628 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1629 wc_printf("<tr><td>");
1631 wc_printf("</td><td>"
1632 "<input type=\"INPUT\" "
1636 wc_printf("<input type=\"hidden\" "
1638 "VALUE=\"ignet_push_share|");
1641 wc_printf("<input type=\"hidden\" NAME=\"tab\" "
1642 "VALUE=\"sharing\">\n");
1643 wc_printf("<input type=\"hidden\" NAME=\"cmd\" "
1644 "VALUE=\"add\">\n");
1645 wc_printf("<input type=\"submit\" "
1646 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1647 wc_printf("</td></tr></form>\n");
1651 wc_printf("</table>\n");
1652 wc_printf("</td></tr>"
1653 "</table></CENTER><br />\n"
1654 "<I><B>%s</B><ul><li>", _("Notes:"));
1655 wc_printf(_("When sharing a room, "
1656 "it must be shared from both ends. Adding a node to "
1657 "the 'shared' list sends messages out, but in order to"
1658 " receive messages, the other nodes must be configured"
1659 " to send messages out to your system as well. "
1660 "<li>If the remote room name is blank, it is assumed "
1661 "that the room name is identical on the remote node."
1662 "<li>If the remote room name is different, the remote "
1663 "node must also configure the name of the room here."
1667 wc_printf("</div>");
1670 if (not_shared_with != NULL)
1671 free (not_shared_with);
1673 /* Mailing list management */
1674 if (!strcmp(tab, "listserv")) {
1675 room_states RoomFlags;
1676 wc_printf("<div class=\"tabcontent\">");
1678 wc_printf("<br /><center>"
1679 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1680 "<tr><td VALIGN=TOP>");
1682 wc_printf(_("<i>The contents of this room are being "
1683 "mailed <b>as individual messages</b> "
1684 "to the following list recipients:"
1685 "</i><br /><br />\n"));
1688 serv_getln(buf, sizeof buf);
1689 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1690 extract_token(cmd, buf, 0, '|', sizeof cmd);
1691 if (!strcasecmp(cmd, "listrecp")) {
1692 extract_token(recp, buf, 1, '|', sizeof recp);
1695 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line=listrecp|");
1698 wc_printf(_("(remove)"));
1699 wc_printf("</A><br />");
1702 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1703 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1704 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1705 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1706 wc_printf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1707 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1708 wc_printf("</form>\n");
1710 wc_printf("</td><td VALIGN=TOP>\n");
1712 wc_printf(_("<i>The contents of this room are being "
1713 "mailed <b>in digest form</b> "
1714 "to the following list recipients:"
1715 "</i><br /><br />\n"));
1718 serv_getln(buf, sizeof buf);
1719 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1720 extract_token(cmd, buf, 0, '|', sizeof cmd);
1721 if (!strcasecmp(cmd, "digestrecp")) {
1722 extract_token(recp, buf, 1, '|', sizeof recp);
1725 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line="
1729 wc_printf(_("(remove)"));
1730 wc_printf("</A><br />");
1733 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1734 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1735 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1736 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1737 wc_printf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1738 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1739 wc_printf("</form>\n");
1741 wc_printf("</td></tr></table>\n");
1743 /** Pop open an address book -- begin **/
1744 wc_printf("<div align=right>"
1745 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1747 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1752 _("Add recipients from Contacts or other address books"),
1753 _("Add recipients from Contacts or other address books")
1755 /* Pop open an address book -- end **/
1757 wc_printf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1759 get_roomflags (&RoomFlags);
1761 /* Self Service subscription? */
1762 wc_printf("<table><tr><td>\n");
1763 wc_printf(_("Allow self-service subscribe/unsubscribe requests."));
1764 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1765 " <tr><td colspan=\"2\">\n",
1766 (is_selflist(&RoomFlags))?"checked":"");
1767 wc_printf(_("The URL for subscribe/unsubscribe is: "));
1768 wc_printf("<TT>%s://%s/listsub</TT></td></tr>\n",
1769 (is_https ? "https" : "http"),
1770 ChrPtr(WC->Hdr->HR.http_host));
1771 /* Public posting? */
1772 wc_printf("<tr><td>");
1773 wc_printf(_("Allow non-subscribers to mail to this room."));
1774 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1775 (is_publiclist(&RoomFlags))?"checked":"");
1777 /* Moderated List? */
1778 wc_printf("<tr><td>");
1779 wc_printf(_("Room post publication needs Aide permission."));
1780 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1781 (is_moderatedlist(&RoomFlags))?"checked":"");
1784 wc_printf("<tr><td colspan=\"2\" align=\"center\">"
1785 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1786 wc_printf("</table></form>");
1789 wc_printf("</CENTER>\n");
1790 wc_printf("</div>");
1794 /* Configuration of The Dreaded Auto-Purger */
1795 if (!strcmp(tab, "expire")) {
1796 wc_printf("<div class=\"tabcontent\">");
1798 serv_puts("GPEX room");
1799 serv_getln(buf, sizeof buf);
1800 if (!strncmp(buf, "550", 3)) {
1801 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1802 _("Higher access is required to access this function.")
1805 else if (buf[0] != '2') {
1806 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1809 roompolicy = extract_int(&buf[4], 0);
1810 roomvalue = extract_int(&buf[4], 1);
1812 serv_puts("GPEX floor");
1813 serv_getln(buf, sizeof buf);
1814 if (buf[0] == '2') {
1815 floorpolicy = extract_int(&buf[4], 0);
1816 floorvalue = extract_int(&buf[4], 1);
1819 wc_printf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1820 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1821 wc_printf("<table border=0 cellspacing=5>\n");
1822 wc_printf("<tr><td>");
1823 wc_printf(_("Message expire policy for this room"));
1824 wc_printf("<br />(");
1825 escputs(ChrPtr(WC->CurRoom.name));
1826 wc_printf(")</td><td>");
1827 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1828 ((roompolicy == 0) ? "CHECKED" : "") );
1829 wc_printf(_("Use the default policy for this floor"));
1830 wc_printf("<br />\n");
1831 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1832 ((roompolicy == 1) ? "CHECKED" : "") );
1833 wc_printf(_("Never automatically expire messages"));
1834 wc_printf("<br />\n");
1835 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1836 ((roompolicy == 2) ? "CHECKED" : "") );
1837 wc_printf(_("Expire by message count"));
1838 wc_printf("<br />\n");
1839 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1840 ((roompolicy == 3) ? "CHECKED" : "") );
1841 wc_printf(_("Expire by message age"));
1842 wc_printf("<br />");
1843 wc_printf(_("Number of messages or days: "));
1844 wc_printf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1845 wc_printf("</td></tr>\n");
1847 if (WC->axlevel >= 6) {
1848 wc_printf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1849 wc_printf("<tr><td>");
1850 wc_printf(_("Message expire policy for this floor"));
1851 wc_printf("<br />(");
1852 escputs(floorlist[WC->CurRoom.floorid]);
1853 wc_printf(")</td><td>");
1854 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1855 ((floorpolicy == 0) ? "CHECKED" : "") );
1856 wc_printf(_("Use the system default"));
1857 wc_printf("<br />\n");
1858 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1859 ((floorpolicy == 1) ? "CHECKED" : "") );
1860 wc_printf(_("Never automatically expire messages"));
1861 wc_printf("<br />\n");
1862 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1863 ((floorpolicy == 2) ? "CHECKED" : "") );
1864 wc_printf(_("Expire by message count"));
1865 wc_printf("<br />\n");
1866 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1867 ((floorpolicy == 3) ? "CHECKED" : "") );
1868 wc_printf(_("Expire by message age"));
1869 wc_printf("<br />");
1870 wc_printf(_("Number of messages or days: "));
1871 wc_printf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1875 wc_printf("<CENTER>\n");
1876 wc_printf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1877 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1878 wc_printf(" ");
1879 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1880 wc_printf("</CENTER></td><tr>\n");
1882 wc_printf("</table>\n"
1883 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1888 wc_printf("</div>");
1891 /* Access controls */
1892 if (!strcmp(tab, "access")) {
1893 wc_printf("<div class=\"tabcontent\">");
1895 wc_printf("</div>");
1898 /* Fetch messages from remote locations */
1899 if (!strcmp(tab, "feeds")) {
1900 wc_printf("<div class=\"tabcontent\">");
1903 wc_printf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1904 wc_printf("</i><br />\n");
1906 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1907 "<tr class=\"even\"><th>");
1908 wc_printf(_("Remote host"));
1909 wc_printf("</th><th>");
1910 wc_printf(_("User name"));
1911 wc_printf("</th><th>");
1912 wc_printf(_("Password"));
1913 wc_printf("</th><th>");
1914 wc_printf(_("Keep messages on server?"));
1915 wc_printf("</th><th>");
1916 wc_printf(_("Interval"));
1917 wc_printf("</th><th> </th></tr>");
1920 serv_getln(buf, sizeof buf);
1922 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1923 extract_token(cmd, buf, 0, '|', sizeof cmd);
1924 if (!strcasecmp(cmd, "pop3client")) {
1925 safestrncpy(recp, &buf[11], sizeof recp);
1928 wc_printf("<tr class=\"%s\">",
1929 (bg ? "even" : "odd")
1933 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
1938 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
1942 wc_printf("<td>*****</td>"); /* Don't show the password */
1944 wc_printf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
1946 wc_printf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
1948 wc_printf("<td class=\"button_link\">");
1949 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=pop3client|");
1952 wc_printf(_("(remove)"));
1953 wc_printf("</a></td>");
1959 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
1961 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
1962 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
1963 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1965 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
1968 wc_printf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
1971 wc_printf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
1974 wc_printf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
1977 wc_printf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
1980 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1981 wc_printf("</td></tr>");
1982 wc_printf("</form></table>\n");
1984 wc_printf("<hr>\n");
1987 wc_printf(_("Fetch the following RSS feeds and store them in this room:"));
1988 wc_printf("</i><br />\n");
1990 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1991 "<tr class=\"even\"><th>");
1992 wc_printf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
1993 wc_printf(_("Feed URL"));
1994 wc_printf("</th><th>");
1995 wc_printf("</th></tr>");
1998 serv_getln(buf, sizeof buf);
2000 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2001 extract_token(cmd, buf, 0, '|', sizeof cmd);
2002 if (!strcasecmp(cmd, "rssclient")) {
2003 safestrncpy(recp, &buf[10], sizeof recp);
2006 wc_printf("<tr class=\"%s\">",
2007 (bg ? "even" : "odd")
2011 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2015 wc_printf("<td class=\"button_link\">");
2016 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=rssclient|");
2019 wc_printf(_("(remove)"));
2020 wc_printf("</a></td>");
2026 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
2028 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2029 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2030 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2032 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2033 "maxlength=\"256\" name=\"line_pop3host\">\n");
2036 wc_printf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2037 wc_printf("</td></tr>");
2038 wc_printf("</form></table>\n");
2040 wc_printf("</div>");
2044 /* end content of whatever tab is open now */
2045 wc_printf("</div>\n");
2047 address_book_popup();
2053 * Toggle self-service list subscription
2055 void toggle_self_service(void) {
2056 room_states RoomFlags;
2058 get_roomflags (&RoomFlags);
2060 if (yesbstr("QR2_SelfList"))
2061 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2063 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2065 if (yesbstr("QR2_SMTP_PUBLIC"))
2066 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2068 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2070 if (yesbstr("QR2_Moderated"))
2071 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2073 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2074 if (yesbstr("QR2_SubsOnly"))
2075 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2077 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2079 set_roomflags (&RoomFlags);
2081 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2087 * save new parameters for a room
2094 StrBuf *er_password;
2096 StrBuf *er_roomaide;
2099 int er_listingorder;
2105 if (!havebstr("ok_button")) {
2106 strcpy(WC->ImportantMessage,
2107 _("Cancelled. Changes were not saved."));
2108 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2113 StrBuf_ServGetln(Buf);
2114 if (GetServerStatus(Buf, NULL) != 2) {
2115 StrBufCutLeft(Buf, 4);
2116 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2117 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2122 er_name = NewStrBuf();
2123 er_password = NewStrBuf();
2124 er_dirname = NewStrBuf();
2125 er_roomaide = NewStrBuf();
2127 StrBufCutLeft(Buf, 4);
2128 StrBufExtract_token(er_name, Buf, 0, '|');
2129 StrBufExtract_token(er_password, Buf, 1, '|');
2130 StrBufExtract_token(er_dirname, Buf, 2, '|');
2131 er_flags = StrBufExtract_int(Buf, 3, '|');
2132 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2133 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2134 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2136 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2137 if (StrLength(er_roomaide) == 0) {
2139 StrBuf_ServGetln(Buf);
2140 if (GetServerStatus(Buf, NULL) != 2) {
2141 FlushStrBuf(er_roomaide);
2143 StrBufCutLeft(Buf, 4);
2144 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2147 Ptr = sbstr("er_name");
2148 if (StrLength(Ptr) > 0) {
2149 FlushStrBuf(er_name);
2150 StrBufAppendBuf(er_name, Ptr, 0);
2153 Ptr = sbstr("er_password");
2154 if (StrLength(Ptr) > 0) {
2155 FlushStrBuf(er_password);
2156 StrBufAppendBuf(er_password, Ptr, 0);
2160 Ptr = sbstr("er_dirname");
2161 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2162 FlushStrBuf(er_dirname);
2163 StrBufAppendBuf(er_dirname, Ptr, 0);
2167 Ptr = sbstr("type");
2168 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2170 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2171 er_flags |= (QR_PRIVATE);
2173 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2174 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2176 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2177 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2179 if (!strcmp(ChrPtr(Ptr), "personal")) {
2180 er_flags |= QR_MAILBOX;
2182 er_flags &= ~QR_MAILBOX;
2185 if (yesbstr("prefonly")) {
2186 er_flags |= QR_PREFONLY;
2188 er_flags &= ~QR_PREFONLY;
2191 if (yesbstr("readonly")) {
2192 er_flags |= QR_READONLY;
2194 er_flags &= ~QR_READONLY;
2198 if (yesbstr("collabdel")) {
2199 er_flags2 |= QR2_COLLABDEL;
2201 er_flags2 &= ~QR2_COLLABDEL;
2204 if (yesbstr("permanent")) {
2205 er_flags |= QR_PERMANENT;
2207 er_flags &= ~QR_PERMANENT;
2210 if (yesbstr("subjectreq")) {
2211 er_flags2 |= QR2_SUBJECTREQ;
2213 er_flags2 &= ~QR2_SUBJECTREQ;
2216 if (yesbstr("network")) {
2217 er_flags |= QR_NETWORK;
2219 er_flags &= ~QR_NETWORK;
2222 if (yesbstr("directory")) {
2223 er_flags |= QR_DIRECTORY;
2225 er_flags &= ~QR_DIRECTORY;
2228 if (yesbstr("ulallowed")) {
2229 er_flags |= QR_UPLOAD;
2231 er_flags &= ~QR_UPLOAD;
2234 if (yesbstr("dlallowed")) {
2235 er_flags |= QR_DOWNLOAD;
2237 er_flags &= ~QR_DOWNLOAD;
2240 if (yesbstr("visdir")) {
2241 er_flags |= QR_VISDIR;
2243 er_flags &= ~QR_VISDIR;
2246 Ptr = sbstr("anon");
2248 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2249 if (!strcmp(ChrPtr(Ptr), "anononly"))
2250 er_flags |= QR_ANONONLY;
2251 if (!strcmp(ChrPtr(Ptr), "anon2"))
2252 er_flags |= QR_ANONOPT;
2254 bump = yesbstr("bump");
2256 er_floor = ibstr("er_floor");
2258 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2260 ChrPtr(er_password),
2269 StrBuf_ServGetln(Buf);
2270 if (GetServerStatus(Buf, NULL) != 2) {
2271 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2272 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2274 FreeStrBuf(&er_name);
2275 FreeStrBuf(&er_password);
2276 FreeStrBuf(&er_dirname);
2277 FreeStrBuf(&er_roomaide);
2282 if (StrLength(er_roomaide) > 0) {
2283 serv_printf("SETA %s", ChrPtr(er_roomaide));
2284 StrBuf_ServGetln(Buf);
2285 if (GetServerStatus(Buf, NULL) != 2) {
2286 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2287 display_main_menu();
2289 FreeStrBuf(&er_name);
2290 FreeStrBuf(&er_password);
2291 FreeStrBuf(&er_dirname);
2292 FreeStrBuf(&er_roomaide);
2297 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2298 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2300 FreeStrBuf(&er_name);
2301 FreeStrBuf(&er_password);
2302 FreeStrBuf(&er_dirname);
2303 FreeStrBuf(&er_roomaide);
2309 * Display form for Invite, Kick, and show Who Knows a room
2311 void do_invt_kick(void) {
2312 char buf[SIZ], room[SIZ], username[SIZ];
2315 serv_getln(buf, sizeof buf);
2317 if (buf[0] != '2') {
2321 extract_token(room, &buf[4], 0, '|', sizeof room);
2323 strcpy(username, bstr("username"));
2325 if (havebstr("kick_button")) {
2326 sprintf(buf, "KICK %s", username);
2328 serv_getln(buf, sizeof buf);
2330 if (buf[0] != '2') {
2331 strcpy(WC->ImportantMessage, &buf[4]);
2333 sprintf(WC->ImportantMessage,
2334 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2339 if (havebstr("invite_button")) {
2340 sprintf(buf, "INVT %s", username);
2342 serv_getln(buf, sizeof buf);
2344 if (buf[0] != '2') {
2345 strcpy(WC->ImportantMessage, &buf[4]);
2347 sprintf(WC->ImportantMessage,
2348 _("<B><I>User %s invited to room %s.</I></B>\n"),
2353 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2359 * Display form for Invite, Kick, and show Who Knows a room
2361 void display_whok(void)
2363 char buf[SIZ], room[SIZ], username[SIZ];
2366 serv_getln(buf, sizeof buf);
2368 if (buf[0] != '2') {
2372 extract_token(room, &buf[4], 0, '|', sizeof room);
2375 wc_printf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2376 wc_printf(_("The users listed below have access to this room. "
2377 "To remove a user from the access list, select the user "
2378 "name from the list and click 'Kick'."));
2379 wc_printf("<br /><br />");
2381 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2382 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2383 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2384 wc_printf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2386 serv_getln(buf, sizeof buf);
2387 if (buf[0] == '1') {
2388 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2389 extract_token(username, buf, 0, '|', sizeof username);
2390 wc_printf("<OPTION>");
2395 wc_printf("</select><br />\n");
2397 wc_printf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2398 wc_printf("</form></CENTER>\n");
2400 wc_printf("</td><td>");
2401 wc_printf(_("To grant another user access to this room, enter the "
2402 "user name in the box below and click 'Invite'."));
2403 wc_printf("<br /><br />");
2405 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2406 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2407 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2408 wc_printf(_("Invite:"));
2410 wc_printf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2411 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2412 "<input type=\"submit\" value=\"%s\">"
2413 "</form></CENTER>\n", _("Invite"));
2414 /* Pop open an address book -- begin **/
2416 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2418 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2421 _("Users"), _("Users")
2423 /* Pop open an address book -- end **/
2425 wc_printf("</td></tr></table>\n");
2426 address_book_popup();
2431 * support function for entroom() -- sets the default view
2433 void er_set_default_view(int newview) {
2446 serv_getln(buf, sizeof buf);
2447 if (buf[0] != '2') return;
2449 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2450 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2451 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2452 rm_bits1 = extract_int(&buf[4], 3);
2453 rm_floor = extract_int(&buf[4], 4);
2454 rm_listorder = extract_int(&buf[4], 5);
2455 rm_bits2 = extract_int(&buf[4], 7);
2457 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2458 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2459 rm_listorder, newview, rm_bits2
2461 serv_getln(buf, sizeof buf);
2472 const StrBuf *er_name;
2473 const StrBuf *er_type;
2474 const StrBuf *er_password;
2478 wcsession *WCC = WC;
2480 if (!havebstr("ok_button")) {
2481 strcpy(WC->ImportantMessage,
2482 _("Cancelled. No new room was created."));
2483 display_main_menu();
2486 er_name = sbstr("er_name");
2487 er_type = sbstr("type");
2488 er_password = sbstr("er_password");
2489 er_floor = ibstr("er_floor");
2490 er_view = ibstr("er_view");
2493 if (!strcmp(ChrPtr(er_type), "hidden"))
2495 else if (!strcmp(ChrPtr(er_type), "passworded"))
2497 else if (!strcmp(ChrPtr(er_type), "invonly"))
2499 else if (!strcmp(ChrPtr(er_type), "personal"))
2502 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2505 ChrPtr(er_password),
2510 serv_getln(buf, sizeof buf);
2511 if (buf[0] != '2') {
2512 strcpy(WCC->ImportantMessage, &buf[4]);
2513 display_main_menu();
2516 /** TODO: Room created, now update the left hand icon bar for this user */
2517 burn_folder_cache(0); /* burn the old folder cache */
2521 serv_printf("VIEW %d", er_view);
2522 serv_getln(buf, sizeof buf);
2523 WCC->CurRoom.view = er_view;
2525 if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ) {
2526 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2528 do_change_view(er_view); /* Now go there */
2535 * \brief goto a private room
2537 void goto_private(void)
2542 if (!havebstr("ok_button")) {
2543 display_main_menu();
2547 strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
2548 serv_printf("GOTO %s|%s",
2551 serv_getln(buf, sizeof buf);
2553 if (buf[0] == '2') {
2554 smart_goto(sbstr("gr_name"));
2557 if (!strncmp(buf, "540", 3)) {
2558 DoTemplate(HKEY("room_display_private"), NULL, &NoCtx);
2561 output_headers(1, 1, 1, 0, 0, 0);
2562 wc_printf("%s\n", &buf[4]);
2575 StrBuf *final_destination;
2578 * If the forget-room routine fails for any reason, we fall back
2579 * to the current room; otherwise, we go to the Lobby
2581 final_destination = NewStrBufDup(WC->CurRoom.name);
2583 if (havebstr("ok_button")) {
2584 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
2585 serv_getln(buf, sizeof buf);
2586 if (buf[0] == '2') {
2588 serv_getln(buf, sizeof buf);
2589 if (buf[0] == '2') {
2590 FlushStrBuf(final_destination);
2591 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2596 smart_goto(final_destination);
2597 FreeStrBuf(&final_destination);
2603 * \brief Delete the current room
2605 void delete_room(void)
2610 serv_puts("KILL 1");
2611 serv_getln(buf, sizeof buf);
2612 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2614 if (buf[0] != '2') {
2615 strcpy(WC->ImportantMessage, &buf[4]);
2616 display_main_menu();
2621 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2630 * \brief Perform changes to a room's network configuration
2632 void netedit(void) {
2641 /*/ TODO: do line dynamic! */
2642 if (havebstr("line_pop3host")) {
2643 strcpy(line, bstr("prefix"));
2644 strcat(line, bstr("line_pop3host"));
2646 strcat(line, bstr("line_pop3user"));
2648 strcat(line, bstr("line_pop3pass"));
2650 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2652 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2653 strcat(line, bstr("suffix"));
2655 else if (havebstr("line")) {
2656 strcpy(line, bstr("prefix"));
2657 strcat(line, bstr("line"));
2658 strcat(line, bstr("suffix"));
2661 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2668 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2673 serv_getln(buf, sizeof buf);
2674 if (buf[0] != '1') {
2676 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2680 /** This loop works for add *or* remove. Spiffy, eh? */
2681 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2682 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2683 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2684 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2685 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2686 if ( (strcasecmp(cmpa0, cmpb0))
2687 || (strcasecmp(cmpa1, cmpb1)) ) {
2688 fprintf(fp, "%s\n", buf);
2694 serv_getln(buf, sizeof buf);
2695 if (buf[0] != '4') {
2697 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2701 while (fgets(buf, sizeof buf, fp) != NULL) {
2702 buf[strlen(buf)-1] = 0;
2706 if (havebstr("add_button")) {
2707 num_addrs = num_tokens(bstr("line"), ',');
2708 if (num_addrs < 2) {
2709 /* just adding one node or address */
2713 /* adding multiple addresses separated by commas */
2714 for (i=0; i<num_addrs; ++i) {
2715 strcpy(line, bstr("prefix"));
2716 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2719 strcat(line, bstr("suffix"));
2727 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2733 * \brief Convert a room name to a folder-ish-looking name.
2734 * \param folder the folderish name
2735 * \param room the room name
2736 * \param floor the floor name
2737 * \param is_mailbox is it a mailbox?
2739 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2744 * For mailboxes, just do it straight...
2747 sprintf(folder, "My folders|%s", room);
2751 * Otherwise, prefix the floor name as a "public folders" moniker
2754 if (floor > MAX_FLOORS) {
2756 sprintf(folder, "%%%%%%|%s", room);
2759 sprintf(folder, "%s|%s", floorlist[floor], room);
2764 * Replace "\" characters with "|" for pseudo-folder-delimiting
2766 len = strlen (folder);
2767 for (i=0; i<len; ++i) {
2768 if (folder[i] == '\\') folder[i] = '|';
2776 * \brief Back end for change_view()
2777 * \param newview set newview???
2779 void do_change_view(int newview) {
2782 serv_printf("VIEW %d", newview);
2783 serv_getln(buf, sizeof buf);
2784 WC->CurRoom.view = newview;
2785 smart_goto(WC->CurRoom.name);
2791 * \brief Change the view for this room
2793 void change_view(void) {
2796 view = lbstr("view");
2797 do_change_view(view);
2801 * \brief Burn the cached folder list.
2802 * \param age How old the cahce needs to be before we burn it.
2805 void burn_folder_cache(time_t age)
2807 /** If our cached folder list is very old, burn it. */
2808 if (WC->cache_fold != NULL) {
2809 if ((time(NULL) - WC->cache_timestamp) > age) {
2810 free(WC->cache_fold);
2811 WC->cache_fold = NULL;
2819 * \brief Do either a known rooms list or a folders list, depending on the
2824 StrBuf *ListView = NULL;
2826 /** Determine whether the user is trying to change views */
2827 if (havebstr("view")) {
2828 ListView = NewStrBufDup(SBSTR("view"));
2829 set_preference("roomlistview", ListView, 1);
2831 /** Sanitize the input so its safe */
2832 if((get_preference("roomlistview", &ListView) != 0)||
2833 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
2834 (strcasecmp(ChrPtr(ListView), "table") != 0)))
2836 if (ListView == NULL) {
2837 ListView = NewStrBufPlain(HKEY("rooms"));
2838 set_preference("roomlistview", ListView, 0);
2842 ListView = NewStrBufPlain(HKEY("rooms"));
2843 set_preference("roomlistview", ListView, 0);
2847 FreeStrBuf(&ListView);
2854 * \brief Set the message expire policy for this room and/or floor
2856 void set_room_policy(void) {
2859 if (!havebstr("ok_button")) {
2860 strcpy(WC->ImportantMessage,
2861 _("Cancelled. Changes were not saved."));
2862 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2866 serv_printf("SPEX room|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
2867 serv_getln(buf, sizeof buf);
2868 strcpy(WC->ImportantMessage, &buf[4]);
2870 if (WC->axlevel >= 6) {
2871 strcat(WC->ImportantMessage, "<br />\n");
2872 serv_printf("SPEX floor|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
2873 serv_getln(buf, sizeof buf);
2874 strcat(WC->ImportantMessage, &buf[4]);
2877 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2880 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
2882 StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
2885 void dotgoto(void) {
2886 if (!havebstr("room")) {
2887 readloop(readnew, eUseDefault);
2890 if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
2893 smart_goto(sbstr("room"));
2898 void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
2900 wcsession *WCC = WC;
2903 StrBufAppendTemplate(Target, TP,
2908 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
2910 wc_printf("<div id=\"banner\">\n");
2911 embed_room_banner();
2912 wc_printf("</div>\n");
2916 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
2918 wcsession *WCC = WC;
2921 (!IsEmptyStr(WCC->ugname)))
2922 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
2925 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
2927 wcsession *WCC = WC;
2928 return (WCC != NULL)?
2929 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
2932 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
2934 wcsession *WCC = WC;
2935 return (WCC == NULL)? 0 :
2936 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
2937 (WCC->CurRoom.is_inbox) ||
2938 (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
2941 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
2943 wcsession *WCC = WC;
2945 return ((WCC!=NULL) &&
2946 (!IsEmptyStr(WCC->ugname)) &&
2947 (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0));
2951 int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
2953 folder *Folder = (folder *)(TP->Context);
2956 UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
2957 if (UA_CheckFlag == 0)
2958 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
2959 "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
2961 return ((Folder->RAFlags & UA_CheckFlag) != 0);
2966 int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
2969 wcsession *WCC = WC;
2971 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
2972 if (QR_CheckFlag == 0)
2973 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
2974 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
2979 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
2980 (TP->Tokens->Params[2]->MaskBy == eNO))
2981 return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
2983 return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
2986 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
2989 folder *Folder = (folder *)(TP->Context);
2991 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
2992 if (QR_CheckFlag == 0)
2993 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
2994 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
2996 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
2997 (TP->Tokens->Params[2]->MaskBy == eNO))
2998 return (Folder->QRFlags & QR_CheckFlag) != 0;
3000 return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
3004 int ConditionalCurrentRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3007 wcsession *WCC = WC;
3009 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3010 if (QR2_CheckFlag == 0)
3011 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3012 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3018 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
3019 (TP->Tokens->Params[2]->MaskBy == eNO))
3020 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
3022 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
3025 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3028 folder *Folder = (folder *)(TP->Context);
3030 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3031 if (QR2_CheckFlag == 0)
3032 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3033 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3034 return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
3038 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3040 wcsession *WCC = WC;
3042 return ( (WCC!= NULL) &&
3043 ((WCC->axlevel >= 6) ||
3044 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
3045 (WCC->CurRoom.is_inbox) ));
3048 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
3050 wcsession *WCC = WC;
3052 if ((WCC == NULL) ||
3053 (TP->Tokens->nParameters < 3))
3055 return ((WCC->CurRoom.view < VIEW_BBS) ||
3056 (WCC->CurRoom.view > VIEW_MAX));
3059 return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
3063 HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP)
3065 wcsession *WCC = WC;
3069 HashList *Whok = NULL;
3075 StrBuf_ServGetln(Line);
3076 if (GetServerStatus(Line, &State) == 1)
3078 Whok = NewHash(1, Flathash);
3079 while(!Done && StrBuf_ServGetln(Line))
3080 if ( (StrLength(Line)==3) &&
3081 !strcmp(ChrPtr(Line), "000"))
3088 const char *Pos = NULL;
3089 Token = NewStrBufPlain (NULL, StrLength(Line));
3090 StrBufExtract_NextToken(Token, Line, &Pos, '|');
3098 else if (State == 550)
3099 StrBufAppendBufPlain(WCC->ImportantMsg,
3100 _("Higher access is required to access this function."), -1, 0);
3107 void _FlushRoomList(wcsession *WCC)
3109 free_march_list(WCC);
3110 DeleteHash(&WCC->Floors);
3111 DeleteHash(&WCC->Rooms);
3112 DeleteHash(&WCC->FloorsByName);
3115 void FlushRoomlist(void)
3117 wcsession *WCC = WC;
3118 _FlushRoomList(WCC);
3126 initialize_viewdefs();
3127 RegisterPreference("roomlistview",
3128 _("Room list view"),
3131 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
3133 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
3136 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
3137 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
3138 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
3140 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
3141 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
3142 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
3143 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
3144 WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0);
3145 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
3146 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
3147 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
3148 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
3149 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
3150 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
3151 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
3153 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
3154 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalCurrentRoomHas_QRFlag, CTX_NONE);
3155 RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
3157 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalCurrentRoomHas_QRFlag2, CTX_NONE);
3158 RegisterConditional(HKEY("COND:ROOM:FLAG:QR2"), 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
3159 RegisterConditional(HKEY("COND:ROOM:FLAG:UA"), 0, ConditionalRoomHas_UAFlag, CTX_ROOMS);
3161 RegisterIterator("ITERATE:THISROOM:WHO_KNOWS", 0, NULL, GetWhoKnowsHash, NULL, DeleteHash, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
3162 RegisterNamespace("THISROOM:MSGS:NEW", 0, 0, tmplput_CurrentRoom_nNewMessages, NULL, CTX_NONE);
3163 RegisterNamespace("THISROOM:MSGS:TOTAL", 0, 0, tmplput_CurrentRoom_nTotalMessages, NULL, CTX_NONE);
3165 RegisterNamespace("THISROOM:FLOOR:NAME", 0, 1, tmplput_CurrentRoomFloorName, NULL, CTX_NONE);
3166 RegisterNamespace("THISROOM:AIDE", 0, 1, tmplput_CurrentRoomAide, NULL, CTX_NONE);
3167 RegisterNamespace("THISROOM:PASS", 0, 1, tmplput_CurrentRoomPass, NULL, CTX_NONE);
3168 RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_CurrentRoomDirectory, NULL, CTX_NONE);
3169 RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_CurrentRoomOrder, NULL, CTX_NONE);
3170 RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE);
3171 RegisterConditional(HKEY("COND:THISROOM:HAVE_VIEW"), 0, ConditionalThisRoomHaveView, CTX_NONE);
3172 RegisterConditional(HKEY("COND:ALLOWED_DEFAULT_VIEW"), 0, ConditionalIsAllowedDefaultView, CTX_NONE);
3174 RegisterNamespace("THISROOM:VIEW_STRING", 0, 1, tmplput_CurrentRoomViewString, NULL, CTX_NONE);
3175 RegisterNamespace("ROOM:VIEW_STRING", 1, 2, tmplput_RoomViewString, NULL, CTX_NONE);
3177 RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_CurrentRoomInfoText, NULL, CTX_NONE);
3178 RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE);
3179 RegisterConditional(HKEY("COND:THISROOM:DEFAULT_VIEW"), 0, ConditionalThisRoomDefView, CTX_NONE);
3180 RegisterConditional(HKEY("COND:THISROOM:CURR_VIEW"), 0, ConditionalThisRoomCurrView, CTX_NONE);
3181 RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE);
3182 RegisterConditional(HKEY("COND:THISROOM:HAVE_INFOTEXT"), 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
3183 RegisterNamespace("THISROOM:FILES:N", 0, 1, tmplput_CurrentRoomXNFiles, NULL, CTX_NONE);
3184 RegisterNamespace("THISROOM:FILES:STR", 0, 1, tmplput_CurrentRoomX_FileString, NULL, CTX_NONE);
3186 REGISTERTokenParamDefine(QR_PERMANENT);
3187 REGISTERTokenParamDefine(QR_INUSE);
3188 REGISTERTokenParamDefine(QR_PRIVATE);
3189 REGISTERTokenParamDefine(QR_PASSWORDED);
3190 REGISTERTokenParamDefine(QR_GUESSNAME);
3191 REGISTERTokenParamDefine(QR_DIRECTORY);
3192 REGISTERTokenParamDefine(QR_UPLOAD);
3193 REGISTERTokenParamDefine(QR_DOWNLOAD);
3194 REGISTERTokenParamDefine(QR_VISDIR);
3195 REGISTERTokenParamDefine(QR_ANONONLY);
3196 REGISTERTokenParamDefine(QR_ANONOPT);
3197 REGISTERTokenParamDefine(QR_NETWORK);
3198 REGISTERTokenParamDefine(QR_PREFONLY);
3199 REGISTERTokenParamDefine(QR_READONLY);
3200 REGISTERTokenParamDefine(QR_MAILBOX);
3201 REGISTERTokenParamDefine(QR2_SYSTEM);
3202 REGISTERTokenParamDefine(QR2_SELFLIST);
3203 REGISTERTokenParamDefine(QR2_COLLABDEL);
3204 REGISTERTokenParamDefine(QR2_SUBJECTREQ);
3205 REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
3206 REGISTERTokenParamDefine(QR2_MODERATED);
3208 REGISTERTokenParamDefine(UA_KNOWN);
3209 REGISTERTokenParamDefine(UA_GOTOALLOWED);
3210 REGISTERTokenParamDefine(UA_HASNEWMSGS);
3211 REGISTERTokenParamDefine(UA_ZAPPED);
3212 REGISTERTokenParamDefine(UA_POSTALLOWED);
3213 REGISTERTokenParamDefine(UA_ADMINALLOWED);
3214 REGISTERTokenParamDefine(UA_DELETEALLOWED);
3215 REGISTERTokenParamDefine(UA_ISTRASH);
3217 REGISTERTokenParamDefine(US_NEEDVALID);
3218 REGISTERTokenParamDefine(US_PERM);
3219 REGISTERTokenParamDefine(US_LASTOLD);
3220 REGISTERTokenParamDefine(US_EXPERT);
3221 REGISTERTokenParamDefine(US_UNLISTED);
3222 REGISTERTokenParamDefine(US_NOPROMPT);
3223 REGISTERTokenParamDefine(US_PROMPTCTL);
3224 REGISTERTokenParamDefine(US_DISAPPEAR);
3225 REGISTERTokenParamDefine(US_REGIS);
3226 REGISTERTokenParamDefine(US_PAGINATOR);
3227 REGISTERTokenParamDefine(US_INTERNET);
3228 REGISTERTokenParamDefine(US_FLOORS);
3229 REGISTERTokenParamDefine(US_COLOR);
3230 REGISTERTokenParamDefine(US_USER_SET);
3232 REGISTERTokenParamDefine(VIEW_BBS);
3233 REGISTERTokenParamDefine(VIEW_MAILBOX);
3234 REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
3235 REGISTERTokenParamDefine(VIEW_CALENDAR);
3236 REGISTERTokenParamDefine(VIEW_TASKS);
3237 REGISTERTokenParamDefine(VIEW_NOTES);
3238 REGISTERTokenParamDefine(VIEW_WIKI);
3239 REGISTERTokenParamDefine(VIEW_CALBRIEF);
3240 REGISTERTokenParamDefine(VIEW_JOURNAL);
3241 REGISTERTokenParamDefine(VIEW_BLOG);
3244 REGISTERTokenParamDefine(ignet_push_share);
3245 { /* these are the parts of an IGNET push config */
3246 REGISTERTokenParamDefine(GNET_IGNET_NODE);
3247 REGISTERTokenParamDefine(GNET_IGNET_ROOM);
3249 REGISTERTokenParamDefine(listrecp);
3250 REGISTERTokenParamDefine(digestrecp);
3251 REGISTERTokenParamDefine(pop3client);
3252 { /* These are the parts of a pop3 client line... */
3253 REGISTERTokenParamDefine(GNET_POP3_HOST);
3254 REGISTERTokenParamDefine(GNET_POP3_USER);
3255 REGISTERTokenParamDefine(GNET_POP3_DONT_DELETE_REMOTE);
3256 REGISTERTokenParamDefine(GNET_POP3_INTERVAL);
3258 REGISTERTokenParamDefine(rssclient);
3259 REGISTERTokenParamDefine(participate);
3261 RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
3262 RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
3264 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
3265 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
3267 RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
3268 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
3269 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
3276 SessionDestroyModule_ROOMOPS
3279 FlushFolder(&sess->CurRoom);
3280 if (sess->cache_fold != NULL) {
3281 free(sess->cache_fold);
3284 _FlushRoomList (sess);