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 ROOM_VIEWS 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")
273 "<li class=\"readallmess\">"
274 "<a href=\"readfwd\">"
275 "<img src=\"static/readallmess3_24x.gif\" "
276 "alt=\"\" width=\"24\" height=\"24\">"
277 "<span class=\"navbar_link\">"
279 "</span></a></li>\n", _("Read all messages")
282 "<li class=\"newmess\">"
283 "<a href=\"display_enter\">"
284 "<img src=\"static/newmess3_24x.gif\" "
285 "alt=\"\" width=\"24\" height=\"24\">"
286 "<span class=\"navbar_link\">"
288 "</span></a></li>\n", _("Write mail")
293 "<li class=\"readallmess\">"
294 "<a href=\"wiki?page=home\">"
295 "<img src=\"static/readallmess3_24x.gif\" "
296 "alt=\"\" width=\"24\" height=\"24\">"
297 "<span class=\"navbar_link\">"
299 "</span></a></li>\n", _("Wiki home")
301 safestrncpy(buf, bstr("page"), sizeof buf);
302 if (IsEmptyStr(buf)) {
303 safestrncpy(buf, "home", sizeof buf);
307 "<li class=\"newmess\">"
308 "<a href=\"display_enter?page=%s\">"
309 "<img src=\"static/newmess3_24x.gif\" "
310 "alt=\"\" width=\"24\" height=\"24\">"
311 "<span class=\"navbar_link\">"
313 "</span></a></li>\n", buf, _("Edit this page")
316 if (bmstrcasestr((char *)ChrPtr(WCC->Hdr->HR.ReqLine), "wiki_history")) {
317 /* already viewing history; display a link to the current page */
319 "<li class=\"newmess\">"
320 "<a href=\"wiki?page=%s\">"
321 "<img src=\"static/newmess3_24x.gif\" "
322 "alt=\"\" width=\"24\" height=\"24\">"
323 "<span class=\"navbar_link\">"
325 "</span></a></li>\n", buf, _("Current version")
329 /* display a link to the history */
331 "<li class=\"newmess\">"
332 "<a href=\"wiki_history?page=%s\">"
333 "<img src=\"static/newmess3_24x.gif\" "
334 "alt=\"\" width=\"24\" height=\"24\">"
335 "<span class=\"navbar_link\">"
337 "</span></a></li>\n", buf, _("History")
344 "<li class=\"readallmess\">"
345 "<a href=\"readfwd\">"
346 "<img src=\"static/readallmess3_24x.gif\" "
347 "alt=\"\" width=\"24\" height=\"24\">"
348 "<span class=\"navbar_link\">"
350 "</span></a></li>\n", _("Read all messages")
353 "<li class=\"newmess\">"
354 "<a href=\"display_enter\">"
355 "<img src=\"static/newmess3_24x.gif\" "
356 "alt=\"\" width=\"24\" height=\"24\">"
357 "<span class=\"navbar_link\">"
359 "</span></a></li>\n", _("Enter a message")
365 "<li class=\"skipthisroom\">"
368 "<img src=\"static/skipthisroom_24x.gif\" alt=\"\" "
369 "width=\"24\" height=\"24\">"
370 "<span class=\"navbar_link\">%s</span></a>"
372 _("Leave all messages marked as unread, go to next room with unread messages"),
377 "<li class=\"markngo\">"
378 "<a href=\"gotonext\" "
380 "<img src=\"static/markngo_24x.gif\" alt=\"\" "
381 "width=\"24\" height=\"24\">"
382 "<span class=\"navbar_link\">%s</span></a>"
384 _("Mark all messages as read, go to next room with unread messages"),
388 wc_printf("</ul></div>\n");
393 * back end routine to take the session to a new room
395 long gotoroom(const StrBuf *gname)
399 static long ls = (-1L);
402 /* store ungoto information */
403 if (StrLength(gname) > 0)
404 strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
408 /* move to the new room */
409 if (StrLength(gname) > 0)
410 serv_printf("GOTO %s", ChrPtr(gname));
411 else /* or just refresh the current state... */
412 serv_printf("GOTO 00000000000000000000");
413 StrBuf_ServGetln(Buf);
414 if (GetServerStatus(Buf, &err) != 2) {
415 serv_puts("GOTO _BASEROOM_");
416 StrBuf_ServGetln(Buf);
418 * well, we know that this is the fallback case,
419 * but we're interested that the first command
420 * didn't work out in first place.
422 if (GetServerStatus(Buf, NULL) != 2) {
427 FlushFolder(&WCC->CurRoom);
428 ParseGoto(&WCC->CurRoom, Buf);
430 if (StrLength(gname) > 0)
432 remove_march(WCC->CurRoom.name);
433 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
443 const char *QRFlagList[15] = {
447 strof(QR_PASSWORDED),
464 QRVec = NewStrBufPlain(NULL, 256);
468 if (StrLength(QRVec) > 0)
469 StrBufAppendBufPlain(QRVec, HKEY(" | "), 0);
470 StrBufAppendBufPlain(QRVec, QRFlagList[j], -1, 0);
475 lprintf(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec));
481 void DBG_QR2(long QR2)
483 const char *QR2FlagList[15] = {
486 strof(QR2_COLLABDEL),
487 strof(QR2_SUBJECTREQ),
488 strof(QR2_SMTP_PUBLIC),
489 strof(QR2_MODERATED),
504 QR2Vec = NewStrBufPlain(NULL, 256);
507 if ((QR2 & i) != 0) {
508 if (StrLength(QR2Vec) > 0)
509 StrBufAppendBufPlain(QR2Vec, HKEY(" | "), 0);
510 StrBufAppendBufPlain(QR2Vec, QR2FlagList[j], -1, 0);
515 lprintf(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec));
521 void ParseGoto(folder *room, StrBuf *Line)
529 if (StrLength(Line) < 4) {
533 /* ignore the commandstate... */
534 Pos = ChrPtr(Line) + 4;
536 if (room->RoomNameParts != NULL)
539 for (i=0; i < room->nRoomNameParts; i++)
540 FreeStrBuf(&room->RoomNameParts[i]);
541 free(room->RoomNameParts);
542 room->RoomNameParts = NULL;
547 pBuf = NewStrBufPlain(NULL, StrLength(Line));
550 memset(room, 0, sizeof(folder));
553 StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
555 room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|');
556 if (room->nNewMessages > 0)
557 room->RAFlags |= UA_HASNEWMSGS;
559 room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
561 room->ShowInfo = StrBufExtractNext_long(Line, &Pos, '|');
563 room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
565 DBG_QR(room->QRFlags);
567 room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
568 room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
570 room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
572 flag = StrBufExtractNext_long(Line, &Pos, '|');
573 if (WCC->is_aide || flag) {
574 room->RAFlags |= UA_ADMINALLOWED;
577 room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
579 room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor
581 room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view
583 room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview
585 flag = StrBufExtractNext_long(Line, &Pos, '|');
587 room->RAFlags |= UA_ISTRASH; // wc_is_trash
589 room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2
590 DBG_QR2(room->QRFlags2);
592 /* find out, whether we are in a sub-room */
593 room->nRoomNameParts = StrBufNum_tokens(room->name, '\\');
594 if (room->nRoomNameParts > 1)
599 room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1));
600 memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1));
601 for (i=0; i < room->nRoomNameParts; i++)
603 room->RoomNameParts[i] = NewStrBuf();
604 StrBufExtract_NextToken(room->RoomNameParts[i],
605 room->name, &Pos, '\\');
609 /* Private mailboxes on the main floor get remapped to the personal folder */
610 if ((room->QRFlags & QR_MAILBOX) &&
611 (room->floorid == 0))
613 room->floorid = VIRTUAL_MY_FLOOR;
614 if ((room->nRoomNameParts == 1) &&
615 (StrLength(room->name) == 4) &&
616 (strcmp(ChrPtr(room->name), "Mail") == 0))
622 /* get a pointer to the floor we're on: */
623 if (WCC->Floors == NULL)
624 GetFloorListHash(NULL, NULL);
626 GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
627 room->Floor = (const Floor*) vFloor;
630 void LoadRoomAide(void)
635 if (WCC->CurRoom.RoomAideLoaded)
638 WCC->CurRoom.RoomAideLoaded = 1;
641 StrBuf_ServGetln(Buf);
642 if (GetServerStatus(Buf, NULL) != 2) {
643 FlushStrBuf(WCC->CurRoom.RoomAide);
644 AppendImportantMessage (ChrPtr(Buf) + 4,
649 Pos = ChrPtr(Buf) + 4;
651 FreeStrBuf(&WCC->CurRoom.RoomAide);
652 WCC->CurRoom.RoomAide = NewStrBufPlain (NULL, StrLength (Buf));
654 StrBufExtract_NextToken(WCC->CurRoom.RoomAide, Buf, &Pos, '|');
658 void tmplput_CurrentRoomFloorName(StrBuf *Target, WCTemplputParams *TP)
661 folder *Folder = &WCC->CurRoom;
662 const Floor *pFloor = Folder->Floor;
667 StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
670 void tmplput_CurrentRoomAide(StrBuf *Target, WCTemplputParams *TP)
676 StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
680 void LoadRoomXA (void)
685 if (WCC->CurRoom.XALoaded)
688 WCC->CurRoom.XALoaded = 1;
691 StrBuf_ServGetln(Buf);
692 if (GetServerStatus(Buf, NULL) != 2) {
693 FlushStrBuf(WCC->CurRoom.XAPass);
694 FlushStrBuf(WCC->CurRoom.Directory);
696 AppendImportantMessage (ChrPtr(Buf) + 4,
701 Pos = ChrPtr(Buf) + 4;
703 FreeStrBuf(&WCC->CurRoom.XAPass);
704 FreeStrBuf(&WCC->CurRoom.Directory);
706 WCC->CurRoom.XAPass = NewStrBufPlain (NULL, StrLength (Buf));
707 WCC->CurRoom.Directory = NewStrBufPlain (NULL, StrLength (Buf));
709 StrBufSkip_NTokenS(Buf, &Pos, '|', 1); /* The Name, we already know... */
710 StrBufExtract_NextToken(WCC->CurRoom.XAPass, Buf, &Pos, '|');
711 StrBufExtract_NextToken(WCC->CurRoom.Directory, Buf, &Pos, '|');
712 StrBufSkip_NTokenS(Buf, &Pos, '|', 2); /* QRFlags, FloorNum we already know... */
713 WCC->CurRoom.Order = StrBufExtractNext_long(Buf, &Pos, '|');
714 /* defview, we already know you. */
715 /* QR2Flags, we already know them... */
722 void LoadXRoomPic(void)
727 if (WCC->CurRoom.XHaveRoomPicLoaded)
730 WCC->CurRoom.XHaveRoomPicLoaded = 1;
732 serv_puts("OIMG _roompic_");
733 StrBuf_ServGetln(Buf);
734 if (GetServerStatus(Buf, NULL) != 2) {
735 WCC->CurRoom.XHaveRoomPic = 0;
737 WCC->CurRoom.XHaveRoomPic = 1;
740 StrBuf_ServGetln(Buf);
741 GetServerStatus(Buf, NULL);
745 int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
753 return WCC->CurRoom.XHaveRoomPic == 1;
756 void LoadXRoomInfoText(void)
762 if (WCC->CurRoom.XHaveInfoTextLoaded)
765 WCC->CurRoom.XHaveInfoTextLoaded = 1;
770 StrBuf_ServGetln(Buf);
771 if (GetServerStatus(Buf, NULL) == 1) {
772 WCC->CurRoom.XInfoText = NewStrBuf ();
774 while (!Done && StrBuf_ServGetln(Buf)>=0) {
775 if ( (StrLength(Buf)==3) &&
776 !strcmp(ChrPtr(Buf), "000"))
779 StrBufAppendBuf(WCC->CurRoom.XInfoText, Buf, 0);
786 int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
794 return (StrLength(WCC->CurRoom.XInfoText)>0);
797 void tmplput_CurrentRoomInfoText(StrBuf *Target, WCTemplputParams *TP)
803 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 1);
806 void LoadXRoomXCountFiles(void)
812 if (WCC->CurRoom.XHaveDownloadCount)
815 WCC->CurRoom.XHaveDownloadCount = 1;
819 StrBuf_ServGetln(Buf);
820 if (GetServerStatus(Buf, NULL) == 1) {
822 while (!Done && StrBuf_ServGetln(Buf)>=0) {
823 if ( (StrLength(Buf)==3) &&
824 !strcmp(ChrPtr(Buf), "000"))
827 WCC->CurRoom.XDownloadCount++;
834 void tmplput_CurrentRoomXNFiles(StrBuf *Target, WCTemplputParams *TP)
838 LoadXRoomXCountFiles();
840 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
843 void tmplput_CurrentRoomX_FileString(StrBuf *Target, WCTemplputParams *TP)
847 LoadXRoomXCountFiles();
849 if (WCC->CurRoom.XDownloadCount == 1)
850 StrBufAppendBufPlain(Target, _("file"), -1, 0);
852 StrBufAppendBufPlain(Target, _("files"), -1, 0);
855 void tmplput_CurrentRoomPass(StrBuf *Target, WCTemplputParams *TP)
861 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
863 void tmplput_CurrentRoomDirectory(StrBuf *Target, WCTemplputParams *TP)
869 StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
871 void tmplput_CurrentRoomOrder(StrBuf *Target, WCTemplputParams *TP)
877 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
879 void tmplput_CurrentRoomDefView(StrBuf *Target, WCTemplputParams *TP)
883 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.defview);
886 void tmplput_CurrentRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP)
892 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
895 void tmplput_CurrentRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP)
901 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
904 int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
914 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
915 return CheckThis == WCC->CurRoom.Order;
918 int ConditionalThisRoomDefView(StrBuf *Target, WCTemplputParams *TP)
926 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
927 return CheckThis == WCC->CurRoom.defview;
930 int ConditionalThisRoomCurrView(StrBuf *Target, WCTemplputParams *TP)
938 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
939 return CheckThis == WCC->CurRoom.view;
942 int ConditionalThisRoomHaveView(StrBuf *Target, WCTemplputParams *TP)
950 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
951 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
953 LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
954 "Roomview [%ld] not valid\n",
959 return exchangeable_views [WCC->CurRoom.defview][CheckThis] != VIEW_MAX;
962 void tmplput_CurrentRoomViewString(StrBuf *Target, WCTemplputParams *TP)
968 (WCC->CurRoom.defview >= VIEW_MAX) ||
969 (WCC->CurRoom.defview < VIEW_BBS))
971 LogTemplateError(Target, "Token", ERR_PARM2, TP,
972 "Roomview [%ld] not valid\n",
974 WCC->CurRoom.defview : -1);
978 Buf = NewStrBufPlain(_(viewdefs[WCC->CurRoom.defview]), -1);
979 StrBufAppendTemplate(Target, TP, Buf, 0);
983 void tmplput_RoomViewString(StrBuf *Target, WCTemplputParams *TP)
988 CheckThis = GetTemplateTokenNumber(Target, TP, 0, 0);
989 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
991 LogTemplateError(Target, "Token", ERR_PARM2, TP,
992 "Roomview [%ld] not valid\n",
997 Buf = NewStrBufPlain(_(viewdefs[CheckThis]), -1);
998 StrBufAppendTemplate(Target, TP, Buf, 0);
1003 int ConditionalIsAllowedDefaultView(StrBuf *Target, WCTemplputParams *TP)
1005 wcsession *WCC = WC;
1011 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
1012 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
1014 LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
1015 "Roomview [%ld] not valid\n",
1020 return allowed_default_views[CheckThis] != 0;
1026 void smart_goto(const StrBuf *next_room) {
1027 gotoroom(next_room);
1028 readloop(readnew, eUseDefault);
1034 * mark all messages in current room as having been read
1036 void slrp_highest(void)
1040 serv_puts("SLRP HIGHEST");
1041 serv_getln(buf, sizeof buf);
1045 typedef struct __room_states {
1060 * Set/clear/read the "self-service list subscribe" flag for a room
1062 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1063 * returns the new value.
1066 int self_service(int newval) {
1067 int current_value = 0;
1073 int flags, floor, order, view, flags2;
1076 serv_getln(buf, sizeof buf);
1077 if (buf[0] != '2') return(0);
1079 extract_token(name, &buf[4], 0, '|', sizeof name);
1080 extract_token(password, &buf[4], 1, '|', sizeof password);
1081 extract_token(dirname, &buf[4], 2, '|', sizeof dirname);
1082 flags = extract_int(&buf[4], 3);
1083 floor = extract_int(&buf[4], 4);
1084 order = extract_int(&buf[4], 5);
1085 view = extract_int(&buf[4], 6);
1086 flags2 = extract_int(&buf[4], 7);
1088 if (flags2 & QR2_SELFLIST) {
1096 flags2 = flags2 | QR2_SELFLIST;
1098 else if (newval == 0) {
1099 flags2 = flags2 & ~QR2_SELFLIST;
1102 return(current_value);
1105 if (newval != current_value) {
1106 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1107 name, password, dirname, flags,
1108 floor, order, view, flags2);
1109 serv_getln(buf, sizeof buf);
1117 int is_selflist(room_states *RoomFlags)
1119 return ((RoomFlags->flags2 & QR2_SELFLIST) != 0);
1122 int is_publiclist(room_states *RoomFlags)
1124 return ((RoomFlags->flags2 & QR2_SMTP_PUBLIC) != 0);
1127 int is_moderatedlist(room_states *RoomFlags)
1129 return ((RoomFlags->flags2 & QR2_MODERATED) != 0);
1133 * Set/clear/read the "self-service list subscribe" flag for a room
1135 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
1136 * returns the new value.
1139 int get_roomflags(room_states *RoomOps)
1144 serv_getln(buf, sizeof buf);
1145 if (buf[0] != '2') return(0);
1147 extract_token(RoomOps->name, &buf[4], 0, '|', sizeof RoomOps->name);
1148 extract_token(RoomOps->password, &buf[4], 1, '|', sizeof RoomOps->password);
1149 extract_token(RoomOps->dirname, &buf[4], 2, '|', sizeof RoomOps->dirname);
1150 RoomOps->flags = extract_int(&buf[4], 3);
1151 RoomOps->floor = extract_int(&buf[4], 4);
1152 RoomOps->order = extract_int(&buf[4], 5);
1153 RoomOps->view = extract_int(&buf[4], 6);
1154 RoomOps->flags2 = extract_int(&buf[4], 7);
1158 int set_roomflags(room_states *RoomOps)
1162 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1171 serv_getln(buf, sizeof buf);
1183 * display the form for editing a room
1185 void display_editroom(void)
1190 char remote_room[128];
1193 char er_password[10];
1194 char er_dirname[15];
1195 char er_roomaide[26];
1202 char *not_shared_with = NULL;
1205 int floorpolicy = 0;
1207 char pop3_host[128];
1212 if (IsEmptyStr(tab)) tab = "admin";
1214 // Buf = NewStrBuf();
1215 // load_floorlist(Buf);
1216 // FreeStrBuf(&Buf);
1217 output_headers(1, 1, 1, 0, 0, 0);
1219 wc_printf("<div class=\"fix_scrollbar_bug\">");
1221 wc_printf("<br />\n");
1223 /* print the tabbed dialog */
1224 wc_printf("<div align=\"center\">");
1225 wc_printf("<table id=\"AdminTabs\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
1226 "<tr align=\"center\" style=\"cursor:pointer\"><td> </td>"
1229 wc_printf("<td class=\"");
1230 if (!strcmp(tab, "admin")) {
1231 wc_printf(" tab_cell_label\">");
1232 wc_printf(_("Administration"));
1235 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=admin\">");
1236 wc_printf(_("Administration"));
1239 wc_printf("</td>\n");
1240 wc_printf("<td> </td>\n");
1242 if ( ConditionalHaveRoomeditRights(NULL, NULL)) {
1244 wc_printf("<td class=\"");
1245 if (!strcmp(tab, "config")) {
1246 wc_printf(" tab_cell_label\">");
1247 wc_printf(_("Configuration"));
1250 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=config\">");
1251 wc_printf(_("Configuration"));
1254 wc_printf("</td>\n");
1255 wc_printf("<td> </td>\n");
1257 wc_printf("<td class=\"");
1258 if (!strcmp(tab, "expire")) {
1259 wc_printf(" tab_cell_label\">");
1260 wc_printf(_("Message expire policy"));
1263 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=expire\">");
1264 wc_printf(_("Message expire policy"));
1267 wc_printf("</td>\n");
1268 wc_printf("<td> </td>\n");
1270 wc_printf("<td class=\"");
1271 if (!strcmp(tab, "access")) {
1272 wc_printf(" tab_cell_label\">");
1273 wc_printf(_("Access controls"));
1276 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=access\">");
1277 wc_printf(_("Access controls"));
1280 wc_printf("</td>\n");
1281 wc_printf("<td> </td>\n");
1283 wc_printf("<td class=\"");
1284 if (!strcmp(tab, "sharing")) {
1285 wc_printf(" tab_cell_label\">");
1286 wc_printf(_("Sharing"));
1289 wc_printf(" tab_cell_edit\"><a href=\"display_editroom?tab=sharing\">");
1290 wc_printf(_("Sharing"));
1293 wc_printf("</td>\n");
1294 wc_printf("<td> </td>\n");
1296 wc_printf("<td class=\"");
1297 if (!strcmp(tab, "listserv")) {
1298 wc_printf(" tab_cell_label\">");
1299 wc_printf(_("Mailing list service"));
1302 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=listserv\">");
1303 wc_printf(_("Mailing list service"));
1306 wc_printf("</td>\n");
1307 wc_printf("<td> </td>\n");
1311 wc_printf("<td class=\"");
1312 if (!strcmp(tab, "feeds")) {
1313 wc_printf(" tab_cell_label\">");
1314 wc_printf(_("Remote retrieval"));
1317 wc_printf("< tab_cell_edit\"><a href=\"display_editroom?tab=feeds\">");
1318 wc_printf(_("Remote retrieval"));
1321 wc_printf("</td>\n");
1322 wc_printf("<td> </td>\n");
1324 wc_printf("</tr></table>\n");
1325 wc_printf("</div>\n");
1326 /* end tabbed dialog */
1328 wc_printf("<script type=\"text/javascript\">"
1329 " Nifty(\"table#AdminTabs td\", \"small transparent top\");"
1333 /* begin content of whatever tab is open now */
1335 if (!strcmp(tab, "admin")) {
1336 wc_printf("<div class=\"tabcontent\">");
1338 "<li><a href=\"delete_room\" "
1339 "onClick=\"return confirm('");
1340 wc_printf(_("Are you sure you want to delete this room?"));
1341 wc_printf("');\">\n");
1342 wc_printf(_("Delete this room"));
1344 "<li><a href=\"display_editroompic?which_room=");
1345 urlescputs(ChrPtr(WC->CurRoom.name));
1347 wc_printf(_("Set or change the icon for this room's banner"));
1349 "<li><a href=\"display_editinfo\">\n");
1350 wc_printf(_("Edit this room's Info file"));
1353 wc_printf("</div>");
1356 if (!strcmp(tab, "config")) {
1357 wc_printf("<div class=\"tabcontent\">");
1359 serv_getln(buf, sizeof buf);
1361 if (!strncmp(buf, "550", 3)) {
1362 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1363 _("Higher access is required to access this function.")
1366 else if (buf[0] != '2') {
1367 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1370 extract_token(er_name, &buf[4], 0, '|', sizeof er_name);
1371 extract_token(er_password, &buf[4], 1, '|', sizeof er_password);
1372 extract_token(er_dirname, &buf[4], 2, '|', sizeof er_dirname);
1373 er_flags = extract_int(&buf[4], 3);
1374 er_floor = extract_int(&buf[4], 4);
1375 er_flags2 = extract_int(&buf[4], 7);
1377 wc_printf("<form method=\"POST\" action=\"editroom\">\n");
1378 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1380 wc_printf("<ul><li>");
1381 wc_printf(_("Name of room: "));
1382 wc_printf("<input type=\"text\" NAME=\"er_name\" VALUE=\"%s\" MAXLENGTH=\""ULONG_FMT"\">\n",
1388 wc_printf(_("Resides on floor: "));
1389 wc_printf("<select NAME=\"er_floor\" SIZE=\"1\"");
1390 if (er_flags & QR_MAILBOX)
1391 wc_printf("disabled >\n");
1392 for (i = 0; i < 128; ++i)
1393 if (!IsEmptyStr(floorlist[i])) {
1394 wc_printf("<OPTION ");
1396 wc_printf("SELECTED ");
1397 wc_printf("VALUE=\"%d\">", i);
1398 escputs(floorlist[i]);
1399 wc_printf("</OPTION>\n");
1401 wc_printf("</select>\n");
1404 wc_printf(_("Type of room:"));
1405 wc_printf("<ul>\n");
1407 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"public\" ");
1408 if ((er_flags & (QR_PRIVATE + QR_MAILBOX)) == 0)
1409 wc_printf("CHECKED ");
1410 wc_printf("OnChange=\""
1411 " if (this.form.type[0].checked == true) { "
1412 " this.form.er_floor.disabled = false; "
1415 wc_printf(_("Public (automatically appears to everyone)"));
1418 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"hidden\" ");
1419 if ((er_flags & QR_PRIVATE) &&
1420 (er_flags & QR_GUESSNAME))
1421 wc_printf("CHECKED ");
1422 wc_printf(" OnChange=\""
1423 " if (this.form.type[1].checked == true) { "
1424 " this.form.er_floor.disabled = false; "
1427 wc_printf(_("Private - hidden (accessible to anyone who knows its name)"));
1429 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"passworded\" ");
1430 if ((er_flags & QR_PRIVATE) &&
1431 (er_flags & QR_PASSWORDED))
1432 wc_printf("CHECKED ");
1433 wc_printf(" OnChange=\""
1434 " if (this.form.type[2].checked == true) { "
1435 " this.form.er_floor.disabled = false; "
1438 wc_printf(_("Private - require password: "));
1439 wc_printf("\n<input type=\"text\" NAME=\"er_password\" VALUE=\"%s\" MAXLENGTH=\"9\">\n",
1442 wc_printf("<li><input type=\"radio\" NAME=\"type\" VALUE=\"invonly\" ");
1443 if ((er_flags & QR_PRIVATE)
1444 && ((er_flags & QR_GUESSNAME) == 0)
1445 && ((er_flags & QR_PASSWORDED) == 0))
1446 wc_printf("CHECKED ");
1447 wc_printf(" OnChange=\""
1448 " if (this.form.type[3].checked == true) { "
1449 " this.form.er_floor.disabled = false; "
1452 wc_printf(_("Private - invitation only"));
1454 wc_printf("\n<li><input type=\"radio\" NAME=\"type\" VALUE=\"personal\" ");
1455 if (er_flags & QR_MAILBOX)
1456 wc_printf("CHECKED ");
1457 wc_printf (" OnChange=\""
1458 " if (this.form.type[4].checked == true) { "
1459 " this.form.er_floor.disabled = true; "
1462 wc_printf(_("Personal (mailbox for you only)"));
1464 wc_printf("\n<li><input type=\"checkbox\" NAME=\"bump\" VALUE=\"yes\" ");
1466 wc_printf(_("If private, cause current users to forget room"));
1468 wc_printf("\n</ul>\n");
1470 wc_printf("<li><input type=\"checkbox\" NAME=\"prefonly\" VALUE=\"yes\" ");
1471 if (er_flags & QR_PREFONLY)
1472 wc_printf("CHECKED ");
1474 wc_printf(_("Preferred users only"));
1476 wc_printf("\n<li><input type=\"checkbox\" NAME=\"readonly\" VALUE=\"yes\" ");
1477 if (er_flags & QR_READONLY)
1478 wc_printf("CHECKED ");
1480 wc_printf(_("Read-only room"));
1482 wc_printf("\n<li><input type=\"checkbox\" NAME=\"collabdel\" VALUE=\"yes\" ");
1483 if (er_flags2 & QR2_COLLABDEL)
1484 wc_printf("CHECKED ");
1486 wc_printf(_("All users allowed to post may also delete messages"));
1488 /** directory stuff */
1489 wc_printf("\n<li><input type=\"checkbox\" NAME=\"directory\" VALUE=\"yes\" ");
1490 if (er_flags & QR_DIRECTORY)
1491 wc_printf("CHECKED ");
1493 wc_printf(_("File directory room"));
1495 wc_printf("\n<ul><li>");
1496 wc_printf(_("Directory name: "));
1497 wc_printf("<input type=\"text\" NAME=\"er_dirname\" VALUE=\"%s\" MAXLENGTH=\"14\">\n",
1500 wc_printf("<li><input type=\"checkbox\" NAME=\"ulallowed\" VALUE=\"yes\" ");
1501 if (er_flags & QR_UPLOAD)
1502 wc_printf("CHECKED ");
1504 wc_printf(_("Uploading allowed"));
1506 wc_printf("\n<li><input type=\"checkbox\" NAME=\"dlallowed\" VALUE=\"yes\" ");
1507 if (er_flags & QR_DOWNLOAD)
1508 wc_printf("CHECKED ");
1510 wc_printf(_("Downloading allowed"));
1512 wc_printf("\n<li><input type=\"checkbox\" NAME=\"visdir\" VALUE=\"yes\" ");
1513 if (er_flags & QR_VISDIR)
1514 wc_printf("CHECKED ");
1516 wc_printf(_("Visible directory"));
1517 wc_printf("</ul>\n");
1519 /** end of directory stuff */
1521 wc_printf("<li><input type=\"checkbox\" NAME=\"network\" VALUE=\"yes\" ");
1522 if (er_flags & QR_NETWORK)
1523 wc_printf("CHECKED ");
1525 wc_printf(_("Network shared room"));
1527 wc_printf("\n<li><input type=\"checkbox\" NAME=\"permanent\" VALUE=\"yes\" ");
1528 if (er_flags & QR_PERMANENT)
1529 wc_printf("CHECKED ");
1531 wc_printf(_("Permanent (does not auto-purge)"));
1533 wc_printf("\n<li><input type=\"checkbox\" NAME=\"subjectreq\" VALUE=\"yes\" ");
1534 if (er_flags2 & QR2_SUBJECTREQ)
1535 wc_printf("CHECKED ");
1537 wc_printf(_("Subject Required (Force users to specify a message subject)"));
1539 /** start of anon options */
1541 wc_printf("\n<li>");
1542 wc_printf(_("Anonymous messages"));
1543 wc_printf("<ul>\n");
1545 wc_printf("<li><input type=\"radio\" NAME=\"anon\" VALUE=\"no\" ");
1546 if (((er_flags & QR_ANONONLY) == 0)
1547 && ((er_flags & QR_ANONOPT) == 0))
1548 wc_printf("CHECKED ");
1550 wc_printf(_("No anonymous messages"));
1552 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anononly\" ");
1553 if (er_flags & QR_ANONONLY)
1554 wc_printf("CHECKED ");
1556 wc_printf(_("All messages are anonymous"));
1558 wc_printf("\n<li><input type=\"radio\" NAME=\"anon\" VALUE=\"anon2\" ");
1559 if (er_flags & QR_ANONOPT)
1560 wc_printf("CHECKED ");
1562 wc_printf(_("Prompt user when entering messages"));
1563 wc_printf("</ul>\n");
1565 /* end of anon options */
1568 wc_printf(_("Room aide: "));
1570 serv_getln(buf, sizeof buf);
1571 if (buf[0] != '2') {
1572 wc_printf("<em>%s</em>\n", &buf[4]);
1574 extract_token(er_roomaide, &buf[4], 0, '|', sizeof er_roomaide);
1575 wc_printf("<input type=\"text\" NAME=\"er_roomaide\" VALUE=\"%s\" MAXLENGTH=\"25\">\n", er_roomaide);
1578 wc_printf("</ul><CENTER>\n");
1579 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"config\">\n"
1580 "<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">"
1582 "<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">"
1588 wc_printf("</div>");
1592 /* Sharing the room with other Citadel nodes... */
1593 if (!strcmp(tab, "sharing")) {
1594 wc_printf("<div class=\"tabcontent\">");
1596 shared_with = strdup("");
1597 not_shared_with = strdup("");
1599 /** Learn the current configuration */
1600 serv_puts("CONF getsys|application/x-citadel-ignet-config");
1601 serv_getln(buf, sizeof buf);
1602 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1603 extract_token(node, buf, 0, '|', sizeof node);
1604 not_shared_with = realloc(not_shared_with,
1605 strlen(not_shared_with) + 32);
1606 strcat(not_shared_with, node);
1607 strcat(not_shared_with, "\n");
1611 serv_getln(buf, sizeof buf);
1612 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1613 extract_token(cmd, buf, 0, '|', sizeof cmd);
1614 extract_token(node, buf, 1, '|', sizeof node);
1615 extract_token(remote_room, buf, 2, '|', sizeof remote_room);
1616 if (!strcasecmp(cmd, "ignet_push_share")) {
1617 shared_with = realloc(shared_with,
1618 strlen(shared_with) + 32);
1619 strcat(shared_with, node);
1620 if (!IsEmptyStr(remote_room)) {
1621 strcat(shared_with, "|");
1622 strcat(shared_with, remote_room);
1624 strcat(shared_with, "\n");
1628 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1629 extract_token(buf, shared_with, i, '\n', sizeof buf);
1630 extract_token(node, buf, 0, '|', sizeof node);
1631 for (j=0; j<num_tokens(not_shared_with, '\n'); ++j) {
1632 extract_token(cmd, not_shared_with, j, '\n', sizeof cmd);
1633 if (!strcasecmp(node, cmd)) {
1634 remove_token(not_shared_with, j, '\n');
1639 /* Display the stuff */
1640 wc_printf("<CENTER><br />"
1641 "<table border=1 cellpadding=5><tr>"
1643 wc_printf(_("Shared with"));
1644 wc_printf("</I></B></td>"
1646 wc_printf(_("Not shared with"));
1647 wc_printf("</I></B></td></tr>\n"
1648 "<tr><td VALIGN=TOP>\n");
1650 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1651 wc_printf(_("Remote node name"));
1652 wc_printf("</td><td>");
1653 wc_printf(_("Remote room name"));
1654 wc_printf("</td><td>");
1655 wc_printf(_("Actions"));
1656 wc_printf("</td></tr>\n");
1658 for (i=0; i<num_tokens(shared_with, '\n'); ++i) {
1659 extract_token(buf, shared_with, i, '\n', sizeof buf);
1660 extract_token(node, buf, 0, '|', sizeof node);
1661 extract_token(remote_room, buf, 1, '|', sizeof remote_room);
1662 if (!IsEmptyStr(node)) {
1663 wc_printf("<form method=\"POST\" action=\"netedit\">");
1664 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1665 wc_printf("<tr><td>%s</td>\n", node);
1668 if (!IsEmptyStr(remote_room)) {
1669 escputs(remote_room);
1675 wc_printf("<input type=\"hidden\" NAME=\"line\" "
1676 "VALUE=\"ignet_push_share|");
1678 if (!IsEmptyStr(remote_room)) {
1680 urlescputs(remote_room);
1683 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"sharing\">\n");
1684 wc_printf("<input type=\"hidden\" NAME=\"cmd\" VALUE=\"remove\">\n");
1685 wc_printf("<input type=\"submit\" "
1686 "NAME=\"unshare_button\" VALUE=\"%s\">", _("Unshare"));
1687 wc_printf("</td></tr></form>\n");
1691 wc_printf("</table>\n");
1692 wc_printf("</td><td VALIGN=TOP>\n");
1693 wc_printf("<table border=0 cellpadding=5><tr class=\"tab_cell\"><td>");
1694 wc_printf(_("Remote node name"));
1695 wc_printf("</td><td>");
1696 wc_printf(_("Remote room name"));
1697 wc_printf("</td><td>");
1698 wc_printf(_("Actions"));
1699 wc_printf("</td></tr>\n");
1701 for (i=0; i<num_tokens(not_shared_with, '\n'); ++i) {
1702 extract_token(node, not_shared_with, i, '\n', sizeof node);
1703 if (!IsEmptyStr(node)) {
1704 wc_printf("<form method=\"POST\" action=\"netedit\">");
1705 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1706 wc_printf("<tr><td>");
1708 wc_printf("</td><td>"
1709 "<input type=\"INPUT\" "
1713 wc_printf("<input type=\"hidden\" "
1715 "VALUE=\"ignet_push_share|");
1718 wc_printf("<input type=\"hidden\" NAME=\"tab\" "
1719 "VALUE=\"sharing\">\n");
1720 wc_printf("<input type=\"hidden\" NAME=\"cmd\" "
1721 "VALUE=\"add\">\n");
1722 wc_printf("<input type=\"submit\" "
1723 "NAME=\"add_button\" VALUE=\"%s\">", _("Share"));
1724 wc_printf("</td></tr></form>\n");
1728 wc_printf("</table>\n");
1729 wc_printf("</td></tr>"
1730 "</table></CENTER><br />\n"
1731 "<I><B>%s</B><ul><li>", _("Notes:"));
1732 wc_printf(_("When sharing a room, "
1733 "it must be shared from both ends. Adding a node to "
1734 "the 'shared' list sends messages out, but in order to"
1735 " receive messages, the other nodes must be configured"
1736 " to send messages out to your system as well. "
1737 "<li>If the remote room name is blank, it is assumed "
1738 "that the room name is identical on the remote node."
1739 "<li>If the remote room name is different, the remote "
1740 "node must also configure the name of the room here."
1744 wc_printf("</div>");
1747 if (not_shared_with != NULL)
1748 free (not_shared_with);
1750 /* Mailing list management */
1751 if (!strcmp(tab, "listserv")) {
1752 room_states RoomFlags;
1753 wc_printf("<div class=\"tabcontent\">");
1755 wc_printf("<br /><center>"
1756 "<table BORDER=0 WIDTH=100%% CELLPADDING=5>"
1757 "<tr><td VALIGN=TOP>");
1759 wc_printf(_("<i>The contents of this room are being "
1760 "mailed <b>as individual messages</b> "
1761 "to the following list recipients:"
1762 "</i><br /><br />\n"));
1765 serv_getln(buf, sizeof buf);
1766 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1767 extract_token(cmd, buf, 0, '|', sizeof cmd);
1768 if (!strcasecmp(cmd, "listrecp")) {
1769 extract_token(recp, buf, 1, '|', sizeof recp);
1772 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line=listrecp|");
1775 wc_printf(_("(remove)"));
1776 wc_printf("</A><br />");
1779 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1780 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1781 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"listrecp|\">\n");
1782 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1783 wc_printf("<input type=\"text\" id=\"add_as_listrecp\" NAME=\"line\">\n");
1784 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1785 wc_printf("</form>\n");
1787 wc_printf("</td><td VALIGN=TOP>\n");
1789 wc_printf(_("<i>The contents of this room are being "
1790 "mailed <b>in digest form</b> "
1791 "to the following list recipients:"
1792 "</i><br /><br />\n"));
1795 serv_getln(buf, sizeof buf);
1796 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1797 extract_token(cmd, buf, 0, '|', sizeof cmd);
1798 if (!strcasecmp(cmd, "digestrecp")) {
1799 extract_token(recp, buf, 1, '|', sizeof recp);
1802 wc_printf(" <a href=\"netedit?cmd=remove?tab=listserv?line="
1806 wc_printf(_("(remove)"));
1807 wc_printf("</A><br />");
1810 wc_printf("<br /><form method=\"POST\" action=\"netedit\">\n"
1811 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"listserv\">\n"
1812 "<input type=\"hidden\" NAME=\"prefix\" VALUE=\"digestrecp|\">\n");
1813 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1814 wc_printf("<input type=\"text\" id=\"add_as_digestrecp\" NAME=\"line\">\n");
1815 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
1816 wc_printf("</form>\n");
1818 wc_printf("</td></tr></table>\n");
1820 /** Pop open an address book -- begin **/
1821 wc_printf("<div align=right>"
1822 "<a href=\"javascript:PopOpenAddressBook('add_as_listrecp|%s|add_as_digestrecp|%s');\" "
1824 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
1829 _("Add recipients from Contacts or other address books"),
1830 _("Add recipients from Contacts or other address books")
1832 /* Pop open an address book -- end **/
1834 wc_printf("<br />\n<form method=\"GET\" action=\"toggle_self_service\">\n");
1836 get_roomflags (&RoomFlags);
1838 /* Self Service subscription? */
1839 wc_printf("<table><tr><td>\n");
1840 wc_printf(_("Allow self-service subscribe/unsubscribe requests."));
1841 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SelfList\" value=\"yes\" %s></td></tr>\n"
1842 " <tr><td colspan=\"2\">\n",
1843 (is_selflist(&RoomFlags))?"checked":"");
1844 wc_printf(_("The URL for subscribe/unsubscribe is: "));
1845 wc_printf("<TT>%s://%s/listsub</TT></td></tr>\n",
1846 (is_https ? "https" : "http"),
1847 ChrPtr(WC->Hdr->HR.http_host));
1848 /* Public posting? */
1849 wc_printf("<tr><td>");
1850 wc_printf(_("Allow non-subscribers to mail to this room."));
1851 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_SubsOnly\" value=\"yes\" %s></td></tr>\n",
1852 (is_publiclist(&RoomFlags))?"checked":"");
1854 /* Moderated List? */
1855 wc_printf("<tr><td>");
1856 wc_printf(_("Room post publication needs Aide permission."));
1857 wc_printf("</td><td><input type=\"checkbox\" name=\"QR2_Moderated\" value=\"yes\" %s></td></tr>\n",
1858 (is_moderatedlist(&RoomFlags))?"checked":"");
1861 wc_printf("<tr><td colspan=\"2\" align=\"center\">"
1862 "<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\"></td></tr>", _("Save changes"));
1863 wc_printf("</table></form>");
1866 wc_printf("</CENTER>\n");
1867 wc_printf("</div>");
1871 /* Configuration of The Dreaded Auto-Purger */
1872 if (!strcmp(tab, "expire")) {
1873 wc_printf("<div class=\"tabcontent\">");
1875 serv_puts("GPEX room");
1876 serv_getln(buf, sizeof buf);
1877 if (!strncmp(buf, "550", 3)) {
1878 wc_printf("<br><br><div align=center>%s</div><br><br>\n",
1879 _("Higher access is required to access this function.")
1882 else if (buf[0] != '2') {
1883 wc_printf("<br><br><div align=center>%s</div><br><br>\n", &buf[4]);
1886 roompolicy = extract_int(&buf[4], 0);
1887 roomvalue = extract_int(&buf[4], 1);
1889 serv_puts("GPEX floor");
1890 serv_getln(buf, sizeof buf);
1891 if (buf[0] == '2') {
1892 floorpolicy = extract_int(&buf[4], 0);
1893 floorvalue = extract_int(&buf[4], 1);
1896 wc_printf("<br /><form method=\"POST\" action=\"set_room_policy\">\n");
1897 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
1898 wc_printf("<table border=0 cellspacing=5>\n");
1899 wc_printf("<tr><td>");
1900 wc_printf(_("Message expire policy for this room"));
1901 wc_printf("<br />(");
1902 escputs(ChrPtr(WC->CurRoom.name));
1903 wc_printf(")</td><td>");
1904 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"0\" %s>",
1905 ((roompolicy == 0) ? "CHECKED" : "") );
1906 wc_printf(_("Use the default policy for this floor"));
1907 wc_printf("<br />\n");
1908 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"1\" %s>",
1909 ((roompolicy == 1) ? "CHECKED" : "") );
1910 wc_printf(_("Never automatically expire messages"));
1911 wc_printf("<br />\n");
1912 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"2\" %s>",
1913 ((roompolicy == 2) ? "CHECKED" : "") );
1914 wc_printf(_("Expire by message count"));
1915 wc_printf("<br />\n");
1916 wc_printf("<input type=\"radio\" NAME=\"roompolicy\" VALUE=\"3\" %s>",
1917 ((roompolicy == 3) ? "CHECKED" : "") );
1918 wc_printf(_("Expire by message age"));
1919 wc_printf("<br />");
1920 wc_printf(_("Number of messages or days: "));
1921 wc_printf("<input type=\"text\" NAME=\"roomvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">", roomvalue);
1922 wc_printf("</td></tr>\n");
1924 if (WC->axlevel >= 6) {
1925 wc_printf("<tr><td COLSPAN=2><hr /></td></tr>\n");
1926 wc_printf("<tr><td>");
1927 wc_printf(_("Message expire policy for this floor"));
1928 wc_printf("<br />(");
1929 escputs(floorlist[WC->CurRoom.floorid]);
1930 wc_printf(")</td><td>");
1931 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"0\" %s>",
1932 ((floorpolicy == 0) ? "CHECKED" : "") );
1933 wc_printf(_("Use the system default"));
1934 wc_printf("<br />\n");
1935 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"1\" %s>",
1936 ((floorpolicy == 1) ? "CHECKED" : "") );
1937 wc_printf(_("Never automatically expire messages"));
1938 wc_printf("<br />\n");
1939 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"2\" %s>",
1940 ((floorpolicy == 2) ? "CHECKED" : "") );
1941 wc_printf(_("Expire by message count"));
1942 wc_printf("<br />\n");
1943 wc_printf("<input type=\"radio\" NAME=\"floorpolicy\" VALUE=\"3\" %s>",
1944 ((floorpolicy == 3) ? "CHECKED" : "") );
1945 wc_printf(_("Expire by message age"));
1946 wc_printf("<br />");
1947 wc_printf(_("Number of messages or days: "));
1948 wc_printf("<input type=\"text\" NAME=\"floorvalue\" MAXLENGTH=\"5\" VALUE=\"%d\">",
1952 wc_printf("<CENTER>\n");
1953 wc_printf("<tr><td COLSPAN=2><hr /><CENTER>\n");
1954 wc_printf("<input type=\"submit\" NAME=\"ok_button\" VALUE=\"%s\">", _("Save changes"));
1955 wc_printf(" ");
1956 wc_printf("<input type=\"submit\" NAME=\"cancel_button\" VALUE=\"%s\">", _("Cancel"));
1957 wc_printf("</CENTER></td><tr>\n");
1959 wc_printf("</table>\n"
1960 "<input type=\"hidden\" NAME=\"tab\" VALUE=\"expire\">\n"
1965 wc_printf("</div>");
1968 /* Access controls */
1969 if (!strcmp(tab, "access")) {
1970 wc_printf("<div class=\"tabcontent\">");
1972 wc_printf("</div>");
1975 /* Fetch messages from remote locations */
1976 if (!strcmp(tab, "feeds")) {
1977 wc_printf("<div class=\"tabcontent\">");
1980 wc_printf(_("Retrieve messages from these remote POP3 accounts and store them in this room:"));
1981 wc_printf("</i><br />\n");
1983 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
1984 "<tr class=\"even\"><th>");
1985 wc_printf(_("Remote host"));
1986 wc_printf("</th><th>");
1987 wc_printf(_("User name"));
1988 wc_printf("</th><th>");
1989 wc_printf(_("Password"));
1990 wc_printf("</th><th>");
1991 wc_printf(_("Keep messages on server?"));
1992 wc_printf("</th><th>");
1993 wc_printf(_("Interval"));
1994 wc_printf("</th><th> </th></tr>");
1997 serv_getln(buf, sizeof buf);
1999 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2000 extract_token(cmd, buf, 0, '|', sizeof cmd);
2001 if (!strcasecmp(cmd, "pop3client")) {
2002 safestrncpy(recp, &buf[11], sizeof recp);
2005 wc_printf("<tr class=\"%s\">",
2006 (bg ? "even" : "odd")
2010 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2015 extract_token(pop3_user, buf, 2, '|', sizeof pop3_user);
2019 wc_printf("<td>*****</td>"); /* Don't show the password */
2021 wc_printf("<td>%s</td>", extract_int(buf, 4) ? _("Yes") : _("No"));
2023 wc_printf("<td>%ld</td>", extract_long(buf, 5)); /* Fetching interval */
2025 wc_printf("<td class=\"button_link\">");
2026 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=pop3client|");
2029 wc_printf(_("(remove)"));
2030 wc_printf("</a></td>");
2036 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
2038 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2039 "<input type=\"hidden\" name=\"prefix\" value=\"pop3client|\">\n");
2040 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2042 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" NAME=\"line_pop3host\">\n");
2045 wc_printf("<input type=\"text\" id=\"add_as_pop3user\" NAME=\"line_pop3user\">\n");
2048 wc_printf("<input type=\"password\" id=\"add_as_pop3pass\" NAME=\"line_pop3pass\">\n");
2051 wc_printf("<input type=\"checkbox\" id=\"add_as_pop3keep\" NAME=\"line_pop3keep\" VALUE=\"1\">");
2054 wc_printf("<input type=\"text\" id=\"add_as_pop3int\" NAME=\"line_pop3int\" MAXLENGTH=\"5\">");
2057 wc_printf("<input type=\"submit\" NAME=\"add_button\" VALUE=\"%s\">", _("Add"));
2058 wc_printf("</td></tr>");
2059 wc_printf("</form></table>\n");
2061 wc_printf("<hr>\n");
2064 wc_printf(_("Fetch the following RSS feeds and store them in this room:"));
2065 wc_printf("</i><br />\n");
2067 wc_printf("<table class=\"altern\" border=0 cellpadding=5>"
2068 "<tr class=\"even\"><th>");
2069 wc_printf("<img src=\"static/rss_16x.png\" width=\"16\" height=\"16\" alt=\" \"> ");
2070 wc_printf(_("Feed URL"));
2071 wc_printf("</th><th>");
2072 wc_printf("</th></tr>");
2075 serv_getln(buf, sizeof buf);
2077 if (buf[0]=='1') while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2078 extract_token(cmd, buf, 0, '|', sizeof cmd);
2079 if (!strcasecmp(cmd, "rssclient")) {
2080 safestrncpy(recp, &buf[10], sizeof recp);
2083 wc_printf("<tr class=\"%s\">",
2084 (bg ? "even" : "odd")
2088 extract_token(pop3_host, buf, 1, '|', sizeof pop3_host);
2092 wc_printf("<td class=\"button_link\">");
2093 wc_printf(" <a href=\"netedit?cmd=remove?tab=feeds?line=rssclient|");
2096 wc_printf(_("(remove)"));
2097 wc_printf("</a></td>");
2103 wc_printf("<form method=\"POST\" action=\"netedit\">\n"
2105 "<input type=\"hidden\" name=\"tab\" value=\"feeds\">"
2106 "<input type=\"hidden\" name=\"prefix\" value=\"rssclient|\">\n");
2107 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2109 wc_printf("<input type=\"text\" id=\"add_as_pop3host\" size=\"72\" "
2110 "maxlength=\"256\" name=\"line_pop3host\">\n");
2113 wc_printf("<input type=\"submit\" name=\"add_button\" value=\"%s\">", _("Add"));
2114 wc_printf("</td></tr>");
2115 wc_printf("</form></table>\n");
2117 wc_printf("</div>");
2121 /* end content of whatever tab is open now */
2122 wc_printf("</div>\n");
2124 address_book_popup();
2130 * Toggle self-service list subscription
2132 void toggle_self_service(void) {
2133 room_states RoomFlags;
2135 get_roomflags (&RoomFlags);
2137 if (yesbstr("QR2_SelfList"))
2138 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SELFLIST;
2140 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SELFLIST;
2142 if (yesbstr("QR2_SMTP_PUBLIC"))
2143 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2145 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2147 if (yesbstr("QR2_Moderated"))
2148 RoomFlags.flags2 = RoomFlags.flags2 | QR2_MODERATED;
2150 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_MODERATED;
2151 if (yesbstr("QR2_SubsOnly"))
2152 RoomFlags.flags2 = RoomFlags.flags2 | QR2_SMTP_PUBLIC;
2154 RoomFlags.flags2 = RoomFlags.flags2 & ~QR2_SMTP_PUBLIC;
2156 set_roomflags (&RoomFlags);
2158 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2164 * save new parameters for a room
2171 StrBuf *er_password;
2173 StrBuf *er_roomaide;
2176 int er_listingorder;
2182 if (!havebstr("ok_button")) {
2183 strcpy(WC->ImportantMessage,
2184 _("Cancelled. Changes were not saved."));
2185 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2190 StrBuf_ServGetln(Buf);
2191 if (GetServerStatus(Buf, NULL) != 2) {
2192 StrBufCutLeft(Buf, 4);
2193 strcpy(WC->ImportantMessage, ChrPtr(Buf));
2194 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2201 er_name = NewStrBuf();
2202 er_password = NewStrBuf();
2203 er_dirname = NewStrBuf();
2204 er_roomaide = NewStrBuf();
2206 StrBufCutLeft(Buf, 4);
2207 StrBufExtract_token(er_name, Buf, 0, '|');
2208 StrBufExtract_token(er_password, Buf, 1, '|');
2209 StrBufExtract_token(er_dirname, Buf, 2, '|');
2210 er_flags = StrBufExtract_int(Buf, 3, '|');
2211 er_listingorder = StrBufExtract_int(Buf, 5, '|');
2212 er_defaultview = StrBufExtract_int(Buf, 6, '|');
2213 er_flags2 = StrBufExtract_int(Buf, 7, '|');
2215 er_roomaide = NewStrBufDup(sbstr("er_roomaide"));
2216 if (StrLength(er_roomaide) == 0) {
2218 StrBuf_ServGetln(Buf);
2219 if (GetServerStatus(Buf, NULL) != 2) {
2220 FlushStrBuf(er_roomaide);
2222 StrBufCutLeft(Buf, 4);
2223 StrBufExtract_token(er_roomaide, Buf, 0, '|');
2226 Ptr = sbstr("er_name");
2227 if (StrLength(Ptr) > 0) {
2228 FlushStrBuf(er_name);
2229 StrBufAppendBuf(er_name, Ptr, 0);
2232 Ptr = sbstr("er_password");
2233 if (StrLength(Ptr) > 0) {
2234 FlushStrBuf(er_password);
2235 StrBufAppendBuf(er_password, Ptr, 0);
2239 Ptr = sbstr("er_dirname");
2240 if (StrLength(Ptr) > 0) { /* todo: cut 15 */
2241 FlushStrBuf(er_dirname);
2242 StrBufAppendBuf(er_dirname, Ptr, 0);
2246 Ptr = sbstr("type");
2247 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
2249 if (!strcmp(ChrPtr(Ptr), "invonly")) {
2250 er_flags |= (QR_PRIVATE);
2252 if (!strcmp(ChrPtr(Ptr), "hidden")) {
2253 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
2255 if (!strcmp(ChrPtr(Ptr), "passworded")) {
2256 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
2258 if (!strcmp(ChrPtr(Ptr), "personal")) {
2259 er_flags |= QR_MAILBOX;
2261 er_flags &= ~QR_MAILBOX;
2264 if (yesbstr("prefonly")) {
2265 er_flags |= QR_PREFONLY;
2267 er_flags &= ~QR_PREFONLY;
2270 if (yesbstr("readonly")) {
2271 er_flags |= QR_READONLY;
2273 er_flags &= ~QR_READONLY;
2277 if (yesbstr("collabdel")) {
2278 er_flags2 |= QR2_COLLABDEL;
2280 er_flags2 &= ~QR2_COLLABDEL;
2283 if (yesbstr("permanent")) {
2284 er_flags |= QR_PERMANENT;
2286 er_flags &= ~QR_PERMANENT;
2289 if (yesbstr("subjectreq")) {
2290 er_flags2 |= QR2_SUBJECTREQ;
2292 er_flags2 &= ~QR2_SUBJECTREQ;
2295 if (yesbstr("network")) {
2296 er_flags |= QR_NETWORK;
2298 er_flags &= ~QR_NETWORK;
2301 if (yesbstr("directory")) {
2302 er_flags |= QR_DIRECTORY;
2304 er_flags &= ~QR_DIRECTORY;
2307 if (yesbstr("ulallowed")) {
2308 er_flags |= QR_UPLOAD;
2310 er_flags &= ~QR_UPLOAD;
2313 if (yesbstr("dlallowed")) {
2314 er_flags |= QR_DOWNLOAD;
2316 er_flags &= ~QR_DOWNLOAD;
2319 if (yesbstr("visdir")) {
2320 er_flags |= QR_VISDIR;
2322 er_flags &= ~QR_VISDIR;
2325 Ptr = sbstr("anon");
2327 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
2328 if (!strcmp(ChrPtr(Ptr), "anononly"))
2329 er_flags |= QR_ANONONLY;
2330 if (!strcmp(ChrPtr(Ptr), "anon2"))
2331 er_flags |= QR_ANONOPT;
2333 bump = yesbstr("bump");
2335 er_floor = ibstr("er_floor");
2337 StrBufPrintf(Buf, "SETR %s|%s|%s|%u|%d|%d|%d|%d|%u",
2339 ChrPtr(er_password),
2348 StrBuf_ServGetln(Buf);
2349 if (GetServerStatus(Buf, NULL) != 2) {
2350 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2351 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2353 FreeStrBuf(&er_name);
2354 FreeStrBuf(&er_password);
2355 FreeStrBuf(&er_dirname);
2356 FreeStrBuf(&er_roomaide);
2361 if (StrLength(er_roomaide) > 0) {
2362 serv_printf("SETA %s", ChrPtr(er_roomaide));
2363 StrBuf_ServGetln(Buf);
2364 if (GetServerStatus(Buf, NULL) != 2) {
2365 strcpy(WC->ImportantMessage, &ChrPtr(Buf)[4]);
2366 display_main_menu();
2368 FreeStrBuf(&er_name);
2369 FreeStrBuf(&er_password);
2370 FreeStrBuf(&er_dirname);
2371 FreeStrBuf(&er_roomaide);
2376 strcpy(WC->ImportantMessage, _("Your changes have been saved."));
2377 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2379 FreeStrBuf(&er_name);
2380 FreeStrBuf(&er_password);
2381 FreeStrBuf(&er_dirname);
2382 FreeStrBuf(&er_roomaide);
2388 * Display form for Invite, Kick, and show Who Knows a room
2390 void do_invt_kick(void) {
2391 char buf[SIZ], room[SIZ], username[SIZ];
2394 serv_getln(buf, sizeof buf);
2396 if (buf[0] != '2') {
2400 extract_token(room, &buf[4], 0, '|', sizeof room);
2402 strcpy(username, bstr("username"));
2404 if (havebstr("kick_button")) {
2405 sprintf(buf, "KICK %s", username);
2407 serv_getln(buf, sizeof buf);
2409 if (buf[0] != '2') {
2410 strcpy(WC->ImportantMessage, &buf[4]);
2412 sprintf(WC->ImportantMessage,
2413 _("<B><I>User %s kicked out of room %s.</I></B>\n"),
2418 if (havebstr("invite_button")) {
2419 sprintf(buf, "INVT %s", username);
2421 serv_getln(buf, sizeof buf);
2423 if (buf[0] != '2') {
2424 strcpy(WC->ImportantMessage, &buf[4]);
2426 sprintf(WC->ImportantMessage,
2427 _("<B><I>User %s invited to room %s.</I></B>\n"),
2432 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2438 * Display form for Invite, Kick, and show Who Knows a room
2440 void display_whok(void)
2442 char buf[SIZ], room[SIZ], username[SIZ];
2445 serv_getln(buf, sizeof buf);
2447 if (buf[0] != '2') {
2451 extract_token(room, &buf[4], 0, '|', sizeof room);
2454 wc_printf("<table border=0 CELLSPACING=10><tr VALIGN=TOP><td>");
2455 wc_printf(_("The users listed below have access to this room. "
2456 "To remove a user from the access list, select the user "
2457 "name from the list and click 'Kick'."));
2458 wc_printf("<br /><br />");
2460 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2461 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2462 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2463 wc_printf("<select NAME=\"username\" SIZE=\"10\" style=\"width:100%%\">\n");
2465 serv_getln(buf, sizeof buf);
2466 if (buf[0] == '1') {
2467 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2468 extract_token(username, buf, 0, '|', sizeof username);
2469 wc_printf("<OPTION>");
2474 wc_printf("</select><br />\n");
2476 wc_printf("<input type=\"submit\" name=\"kick_button\" value=\"%s\">", _("Kick"));
2477 wc_printf("</form></CENTER>\n");
2479 wc_printf("</td><td>");
2480 wc_printf(_("To grant another user access to this room, enter the "
2481 "user name in the box below and click 'Invite'."));
2482 wc_printf("<br /><br />");
2484 wc_printf("<CENTER><form method=\"POST\" action=\"do_invt_kick\">\n");
2485 wc_printf("<input type=\"hidden\" NAME=\"tab\" VALUE=\"access\">\n");
2486 wc_printf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
2487 wc_printf(_("Invite:"));
2489 wc_printf("<input type=\"text\" name=\"username\" id=\"username_id\" style=\"width:100%%\"><br />\n"
2490 "<input type=\"hidden\" name=\"invite_button\" value=\"Invite\">"
2491 "<input type=\"submit\" value=\"%s\">"
2492 "</form></CENTER>\n", _("Invite"));
2493 /* Pop open an address book -- begin **/
2495 "<a href=\"javascript:PopOpenAddressBook('username_id|%s');\" "
2497 "<img align=middle border=0 width=24 height=24 src=\"static/viewcontacts_24x.gif\">"
2500 _("Users"), _("Users")
2502 /* Pop open an address book -- end **/
2504 wc_printf("</td></tr></table>\n");
2505 address_book_popup();
2510 * support function for entroom() -- sets the default view
2512 void er_set_default_view(int newview) {
2525 serv_getln(buf, sizeof buf);
2526 if (buf[0] != '2') return;
2528 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
2529 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
2530 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
2531 rm_bits1 = extract_int(&buf[4], 3);
2532 rm_floor = extract_int(&buf[4], 4);
2533 rm_listorder = extract_int(&buf[4], 5);
2534 rm_bits2 = extract_int(&buf[4], 7);
2536 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
2537 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
2538 rm_listorder, newview, rm_bits2
2540 serv_getln(buf, sizeof buf);
2551 const StrBuf *er_name;
2552 const StrBuf *er_type;
2553 const StrBuf *er_password;
2557 wcsession *WCC = WC;
2559 if (!havebstr("ok_button")) {
2560 strcpy(WC->ImportantMessage,
2561 _("Cancelled. No new room was created."));
2562 display_main_menu();
2565 er_name = sbstr("er_name");
2566 er_type = sbstr("type");
2567 er_password = sbstr("er_password");
2568 er_floor = ibstr("er_floor");
2569 er_view = ibstr("er_view");
2572 if (!strcmp(ChrPtr(er_type), "hidden"))
2574 else if (!strcmp(ChrPtr(er_type), "passworded"))
2576 else if (!strcmp(ChrPtr(er_type), "invonly"))
2578 else if (!strcmp(ChrPtr(er_type), "personal"))
2581 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
2584 ChrPtr(er_password),
2589 serv_getln(buf, sizeof buf);
2590 if (buf[0] != '2') {
2591 strcpy(WCC->ImportantMessage, &buf[4]);
2592 display_main_menu();
2595 /** TODO: Room created, now update the left hand icon bar for this user */
2596 burn_folder_cache(0); /* burn the old folder cache */
2600 serv_printf("VIEW %d", er_view);
2601 serv_getln(buf, sizeof buf);
2602 WCC->CurRoom.view = er_view;
2604 if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ) {
2605 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2607 do_change_view(er_view); /* Now go there */
2614 * \brief goto a private room
2616 void goto_private(void)
2621 if (!havebstr("ok_button")) {
2622 display_main_menu();
2626 strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
2627 serv_printf("GOTO %s|%s",
2630 serv_getln(buf, sizeof buf);
2632 if (buf[0] == '2') {
2633 smart_goto(sbstr("gr_name"));
2636 if (!strncmp(buf, "540", 3)) {
2637 DoTemplate(HKEY("room_display_private"), NULL, &NoCtx);
2640 output_headers(1, 1, 1, 0, 0, 0);
2641 wc_printf("%s\n", &buf[4]);
2654 StrBuf *final_destination;
2657 * If the forget-room routine fails for any reason, we fall back
2658 * to the current room; otherwise, we go to the Lobby
2660 final_destination = NewStrBufDup(WC->CurRoom.name);
2662 if (havebstr("ok_button")) {
2663 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
2664 serv_getln(buf, sizeof buf);
2665 if (buf[0] == '2') {
2667 serv_getln(buf, sizeof buf);
2668 if (buf[0] == '2') {
2669 FlushStrBuf(final_destination);
2670 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
2675 smart_goto(final_destination);
2676 FreeStrBuf(&final_destination);
2682 * \brief Delete the current room
2684 void delete_room(void)
2689 serv_puts("KILL 1");
2690 serv_getln(buf, sizeof buf);
2691 burn_folder_cache(0); /* Burn the cahce of known rooms to update the icon bar */
2693 if (buf[0] != '2') {
2694 strcpy(WC->ImportantMessage, &buf[4]);
2695 display_main_menu();
2700 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
2709 * \brief Perform changes to a room's network configuration
2711 void netedit(void) {
2720 /*/ TODO: do line dynamic! */
2721 if (havebstr("line_pop3host")) {
2722 strcpy(line, bstr("prefix"));
2723 strcat(line, bstr("line_pop3host"));
2725 strcat(line, bstr("line_pop3user"));
2727 strcat(line, bstr("line_pop3pass"));
2729 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
2731 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
2732 strcat(line, bstr("suffix"));
2734 else if (havebstr("line")) {
2735 strcpy(line, bstr("prefix"));
2736 strcat(line, bstr("line"));
2737 strcat(line, bstr("suffix"));
2740 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2747 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2752 serv_getln(buf, sizeof buf);
2753 if (buf[0] != '1') {
2755 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2759 /** This loop works for add *or* remove. Spiffy, eh? */
2760 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
2761 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
2762 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
2763 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
2764 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
2765 if ( (strcasecmp(cmpa0, cmpb0))
2766 || (strcasecmp(cmpa1, cmpb1)) ) {
2767 fprintf(fp, "%s\n", buf);
2773 serv_getln(buf, sizeof buf);
2774 if (buf[0] != '4') {
2776 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2780 while (fgets(buf, sizeof buf, fp) != NULL) {
2781 buf[strlen(buf)-1] = 0;
2785 if (havebstr("add_button")) {
2786 num_addrs = num_tokens(bstr("line"), ',');
2787 if (num_addrs < 2) {
2788 /* just adding one node or address */
2792 /* adding multiple addresses separated by commas */
2793 for (i=0; i<num_addrs; ++i) {
2794 strcpy(line, bstr("prefix"));
2795 extract_token(buf, bstr("line"), i, ',', sizeof buf);
2798 strcat(line, bstr("suffix"));
2806 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2812 * \brief Convert a room name to a folder-ish-looking name.
2813 * \param folder the folderish name
2814 * \param room the room name
2815 * \param floor the floor name
2816 * \param is_mailbox is it a mailbox?
2818 void room_to_folder(char *folder, char *room, int floor, int is_mailbox)
2823 * For mailboxes, just do it straight...
2826 sprintf(folder, "My folders|%s", room);
2830 * Otherwise, prefix the floor name as a "public folders" moniker
2833 if (floor > MAX_FLOORS) {
2835 sprintf(folder, "%%%%%%|%s", room);
2838 sprintf(folder, "%s|%s", floorlist[floor], room);
2843 * Replace "\" characters with "|" for pseudo-folder-delimiting
2845 len = strlen (folder);
2846 for (i=0; i<len; ++i) {
2847 if (folder[i] == '\\') folder[i] = '|';
2855 * \brief Back end for change_view()
2856 * \param newview set newview???
2858 void do_change_view(int newview) {
2861 serv_printf("VIEW %d", newview);
2862 serv_getln(buf, sizeof buf);
2863 WC->CurRoom.view = newview;
2864 smart_goto(WC->CurRoom.name);
2870 * \brief Change the view for this room
2872 void change_view(void) {
2875 view = lbstr("view");
2876 do_change_view(view);
2880 * \brief Burn the cached folder list.
2881 * \param age How old the cahce needs to be before we burn it.
2884 void burn_folder_cache(time_t age)
2886 /** If our cached folder list is very old, burn it. */
2887 if (WC->cache_fold != NULL) {
2888 if ((time(NULL) - WC->cache_timestamp) > age) {
2889 free(WC->cache_fold);
2890 WC->cache_fold = NULL;
2898 * \brief Do either a known rooms list or a folders list, depending on the
2903 StrBuf *ListView = NULL;
2905 /** Determine whether the user is trying to change views */
2906 if (havebstr("view")) {
2907 ListView = NewStrBufDup(SBSTR("view"));
2908 set_preference("roomlistview", ListView, 1);
2910 /** Sanitize the input so its safe */
2911 if((get_preference("roomlistview", &ListView) != 0)||
2912 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
2913 (strcasecmp(ChrPtr(ListView), "table") != 0)))
2915 if (ListView == NULL) {
2916 ListView = NewStrBufPlain(HKEY("rooms"));
2917 set_preference("roomlistview", ListView, 0);
2921 ListView = NewStrBufPlain(HKEY("rooms"));
2922 set_preference("roomlistview", ListView, 0);
2926 FreeStrBuf(&ListView);
2933 * \brief Set the message expire policy for this room and/or floor
2935 void set_room_policy(void) {
2938 if (!havebstr("ok_button")) {
2939 strcpy(WC->ImportantMessage,
2940 _("Cancelled. Changes were not saved."));
2941 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2945 serv_printf("SPEX roompolicy|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
2946 serv_getln(buf, sizeof buf);
2947 strcpy(WC->ImportantMessage, &buf[4]);
2949 if (WC->axlevel >= 6) {
2950 strcat(WC->ImportantMessage, "<br />\n");
2951 serv_printf("SPEX floorpolicy|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
2952 serv_getln(buf, sizeof buf);
2953 strcat(WC->ImportantMessage, &buf[4]);
2956 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
2959 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
2961 StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
2964 void dotgoto(void) {
2965 if (!havebstr("room")) {
2966 readloop(readnew, eUseDefault);
2969 if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
2972 smart_goto(sbstr("room"));
2977 void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
2979 wcsession *WCC = WC;
2982 StrBufAppendTemplate(Target, TP,
2987 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
2989 wc_printf("<div id=\"banner\">\n");
2990 embed_room_banner();
2991 wc_printf("</div>\n");
2995 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
2997 wcsession *WCC = WC;
3000 (!IsEmptyStr(WCC->ugname)))
3001 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
3004 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
3006 wcsession *WCC = WC;
3007 return (WCC != NULL)?
3008 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
3011 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
3013 wcsession *WCC = WC;
3014 return (WCC == NULL)? 0 :
3015 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
3016 (WCC->CurRoom.is_inbox) ||
3017 (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
3020 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
3022 wcsession *WCC = WC;
3024 return ((WCC!=NULL) &&
3025 (!IsEmptyStr(WCC->ugname)) &&
3026 (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0));
3030 int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
3032 folder *Folder = (folder *)(TP->Context);
3035 UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3036 if (UA_CheckFlag == 0)
3037 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3038 "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
3040 return ((Folder->RAFlags & UA_CheckFlag) != 0);
3045 int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3048 wcsession *WCC = WC;
3050 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3051 if (QR_CheckFlag == 0)
3052 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3053 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3058 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
3059 (TP->Tokens->Params[2]->MaskBy == eNO))
3060 return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
3062 return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
3065 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
3068 folder *Folder = (folder *)(TP->Context);
3070 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3071 if (QR_CheckFlag == 0)
3072 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3073 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
3075 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
3076 (TP->Tokens->Params[2]->MaskBy == eNO))
3077 return (Folder->QRFlags & QR_CheckFlag) != 0;
3079 return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
3083 int ConditionalCurrentRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3086 wcsession *WCC = WC;
3088 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3089 if (QR2_CheckFlag == 0)
3090 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3091 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3097 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
3098 (TP->Tokens->Params[2]->MaskBy == eNO))
3099 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
3101 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
3104 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
3107 folder *Folder = (folder *)(TP->Context);
3109 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
3110 if (QR2_CheckFlag == 0)
3111 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
3112 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
3113 return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
3117 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
3119 wcsession *WCC = WC;
3121 return ( (WCC!= NULL) &&
3122 ((WCC->axlevel >= 6) ||
3123 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
3124 (WCC->CurRoom.is_inbox) ));
3127 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
3129 wcsession *WCC = WC;
3131 if ((WCC == NULL) ||
3132 (TP->Tokens->nParameters < 3))
3134 return ((WCC->CurRoom.view < VIEW_BBS) ||
3135 (WCC->CurRoom.view > VIEW_MAX));
3138 return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
3142 HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP)
3144 wcsession *WCC = WC;
3148 HashList *Whok = NULL;
3154 StrBuf_ServGetln(Line);
3155 if (GetServerStatus(Line, &State) == 1)
3157 Whok = NewHash(1, Flathash);
3158 while(!Done && StrBuf_ServGetln(Line))
3159 if ( (StrLength(Line)==3) &&
3160 !strcmp(ChrPtr(Line), "000"))
3167 const char *Pos = NULL;
3168 Token = NewStrBufPlain (NULL, StrLength(Line));
3169 StrBufExtract_NextToken(Token, Line, &Pos, '|');
3177 else if (State == 550)
3178 StrBufAppendBufPlain(WCC->ImportantMsg,
3179 _("Higher access is required to access this function."), -1, 0);
3186 void _FlushRoomList(wcsession *WCC)
3188 free_march_list(WCC);
3189 DeleteHash(&WCC->Floors);
3190 DeleteHash(&WCC->Rooms);
3191 DeleteHash(&WCC->FloorsByName);
3194 void FlushRoomlist(void)
3196 wcsession *WCC = WC;
3197 _FlushRoomList(WCC);
3205 initialize_viewdefs();
3206 RegisterPreference("roomlistview",
3207 _("Room list view"),
3210 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
3212 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
3215 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
3216 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
3217 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
3219 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
3220 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
3221 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
3222 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
3223 WebcitAddUrlHandler(HKEY("display_editroom"), "", 0, display_editroom, 0);
3224 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
3225 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
3226 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
3227 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
3228 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
3229 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
3230 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
3232 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
3233 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalCurrentRoomHas_QRFlag, CTX_NONE);
3234 RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
3236 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalCurrentRoomHas_QRFlag2, CTX_NONE);
3237 RegisterConditional(HKEY("COND:ROOM:FLAG:QR2"), 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
3238 RegisterConditional(HKEY("COND:ROOM:FLAG:UA"), 0, ConditionalRoomHas_UAFlag, CTX_ROOMS);
3240 RegisterIterator("ITERATE:THISROOM:WHO_KNOWS", 0, NULL, GetWhoKnowsHash, NULL, DeleteHash, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
3241 RegisterNamespace("THISROOM:MSGS:NEW", 0, 0, tmplput_CurrentRoom_nNewMessages, NULL, CTX_NONE);
3242 RegisterNamespace("THISROOM:MSGS:TOTAL", 0, 0, tmplput_CurrentRoom_nTotalMessages, NULL, CTX_NONE);
3244 RegisterNamespace("THISROOM:FLOOR:NAME", 0, 1, tmplput_CurrentRoomFloorName, NULL, CTX_NONE);
3245 RegisterNamespace("THISROOM:AIDE", 0, 1, tmplput_CurrentRoomAide, NULL, CTX_NONE);
3246 RegisterNamespace("THISROOM:PASS", 0, 1, tmplput_CurrentRoomPass, NULL, CTX_NONE);
3247 RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_CurrentRoomDirectory, NULL, CTX_NONE);
3248 RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_CurrentRoomOrder, NULL, CTX_NONE);
3249 RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE);
3250 RegisterConditional(HKEY("COND:THISROOM:HAVE_VIEW"), 0, ConditionalThisRoomHaveView, CTX_NONE);
3251 RegisterConditional(HKEY("COND:ALLOWED_DEFAULT_VIEW"), 0, ConditionalIsAllowedDefaultView, CTX_NONE);
3253 RegisterNamespace("THISROOM:VIEW_STRING", 0, 1, tmplput_CurrentRoomViewString, NULL, CTX_NONE);
3254 RegisterNamespace("ROOM:VIEW_STRING", 1, 2, tmplput_RoomViewString, NULL, CTX_NONE);
3256 RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_CurrentRoomInfoText, NULL, CTX_NONE);
3257 RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE);
3258 RegisterConditional(HKEY("COND:THISROOM:DEFAULT_VIEW"), 0, ConditionalThisRoomDefView, CTX_NONE);
3259 RegisterConditional(HKEY("COND:THISROOM:CURR_VIEW"), 0, ConditionalThisRoomCurrView, CTX_NONE);
3260 RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE);
3261 RegisterConditional(HKEY("COND:THISROOM:HAVE_INFOTEXT"), 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
3262 RegisterNamespace("THISROOM:FILES:N", 0, 1, tmplput_CurrentRoomXNFiles, NULL, CTX_NONE);
3263 RegisterNamespace("THISROOM:FILES:STR", 0, 1, tmplput_CurrentRoomX_FileString, NULL, CTX_NONE);
3265 REGISTERTokenParamDefine(QR_PERMANENT);
3266 REGISTERTokenParamDefine(QR_INUSE);
3267 REGISTERTokenParamDefine(QR_PRIVATE);
3268 REGISTERTokenParamDefine(QR_PASSWORDED);
3269 REGISTERTokenParamDefine(QR_GUESSNAME);
3270 REGISTERTokenParamDefine(QR_DIRECTORY);
3271 REGISTERTokenParamDefine(QR_UPLOAD);
3272 REGISTERTokenParamDefine(QR_DOWNLOAD);
3273 REGISTERTokenParamDefine(QR_VISDIR);
3274 REGISTERTokenParamDefine(QR_ANONONLY);
3275 REGISTERTokenParamDefine(QR_ANONOPT);
3276 REGISTERTokenParamDefine(QR_NETWORK);
3277 REGISTERTokenParamDefine(QR_PREFONLY);
3278 REGISTERTokenParamDefine(QR_READONLY);
3279 REGISTERTokenParamDefine(QR_MAILBOX);
3280 REGISTERTokenParamDefine(QR2_SYSTEM);
3281 REGISTERTokenParamDefine(QR2_SELFLIST);
3282 REGISTERTokenParamDefine(QR2_COLLABDEL);
3283 REGISTERTokenParamDefine(QR2_SUBJECTREQ);
3284 REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
3285 REGISTERTokenParamDefine(QR2_MODERATED);
3287 REGISTERTokenParamDefine(UA_KNOWN);
3288 REGISTERTokenParamDefine(UA_GOTOALLOWED);
3289 REGISTERTokenParamDefine(UA_HASNEWMSGS);
3290 REGISTERTokenParamDefine(UA_ZAPPED);
3291 REGISTERTokenParamDefine(UA_POSTALLOWED);
3292 REGISTERTokenParamDefine(UA_ADMINALLOWED);
3293 REGISTERTokenParamDefine(UA_DELETEALLOWED);
3294 REGISTERTokenParamDefine(UA_ISTRASH);
3296 REGISTERTokenParamDefine(US_NEEDVALID);
3297 REGISTERTokenParamDefine(US_PERM);
3298 REGISTERTokenParamDefine(US_LASTOLD);
3299 REGISTERTokenParamDefine(US_EXPERT);
3300 REGISTERTokenParamDefine(US_UNLISTED);
3301 REGISTERTokenParamDefine(US_NOPROMPT);
3302 REGISTERTokenParamDefine(US_PROMPTCTL);
3303 REGISTERTokenParamDefine(US_DISAPPEAR);
3304 REGISTERTokenParamDefine(US_REGIS);
3305 REGISTERTokenParamDefine(US_PAGINATOR);
3306 REGISTERTokenParamDefine(US_INTERNET);
3307 REGISTERTokenParamDefine(US_FLOORS);
3308 REGISTERTokenParamDefine(US_COLOR);
3309 REGISTERTokenParamDefine(US_USER_SET);
3311 REGISTERTokenParamDefine(VIEW_BBS);
3312 REGISTERTokenParamDefine(VIEW_MAILBOX);
3313 REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
3314 REGISTERTokenParamDefine(VIEW_CALENDAR);
3315 REGISTERTokenParamDefine(VIEW_TASKS);
3316 REGISTERTokenParamDefine(VIEW_NOTES);
3317 REGISTERTokenParamDefine(VIEW_WIKI);
3318 REGISTERTokenParamDefine(VIEW_CALBRIEF);
3319 REGISTERTokenParamDefine(VIEW_JOURNAL);
3320 REGISTERTokenParamDefine(VIEW_BLOG);
3323 REGISTERTokenParamDefine(ignet_push_share);
3324 { /* these are the parts of an IGNET push config */
3325 REGISTERTokenParamDefine(GNET_IGNET_NODE);
3326 REGISTERTokenParamDefine(GNET_IGNET_ROOM);
3328 REGISTERTokenParamDefine(listrecp);
3329 REGISTERTokenParamDefine(digestrecp);
3330 REGISTERTokenParamDefine(pop3client);
3331 { /* These are the parts of a pop3 client line... */
3332 REGISTERTokenParamDefine(GNET_POP3_HOST);
3333 REGISTERTokenParamDefine(GNET_POP3_USER);
3334 REGISTERTokenParamDefine(GNET_POP3_DONT_DELETE_REMOTE);
3335 REGISTERTokenParamDefine(GNET_POP3_INTERVAL);
3337 REGISTERTokenParamDefine(rssclient);
3338 REGISTERTokenParamDefine(participate);
3340 RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
3341 RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
3343 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
3344 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
3346 RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
3347 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
3348 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
3355 SessionDestroyModule_ROOMOPS
3358 FlushFolder(&sess->CurRoom);
3359 if (sess->cache_fold != NULL) {
3360 free(sess->cache_fold);
3363 _FlushRoomList (sess);