3 * Lots of different room-related operations.
9 char *viewdefs[VIEW_MAX]; /* the different kinds of available views */
11 ROOM_VIEWS exchangeable_views[VIEW_MAX][VIEW_MAX] = { /* the different kinds of available views for a view */
12 {VIEW_BBS, VIEW_MAILBOX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX },
13 {VIEW_BBS, VIEW_MAILBOX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX },
14 {VIEW_MAX, VIEW_MAX, VIEW_ADDRESSBOOK, VIEW_CALENDAR, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX },
15 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_CALENDAR, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX /*VIEW_CALBRIEF*/, VIEW_MAX, VIEW_MAX },
16 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_TASKS, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, },
17 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_NOTES, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, },
18 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_WIKI, VIEW_MAX, VIEW_MAX, VIEW_MAX},
19 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_CALENDAR, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX/*VIEW_CALBRIEF*/, VIEW_MAX, VIEW_MAX},
20 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_JOURNAL, VIEW_MAX },
21 {VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_MAX, VIEW_BLOG },
23 /* the brief calendar view is disabled: VIEW_CALBRIEF */
25 ROOM_VIEWS allowed_default_views[VIEW_MAX] = {
26 1, /* VIEW_BBS Bulletin board view */
27 1, /* VIEW_MAILBOX Mailbox summary */
28 1, /* VIEW_ADDRESSBOOK Address book view */
29 1, /* VIEW_CALENDAR Calendar view */
30 1, /* VIEW_TASKS Tasks view */
31 1, /* VIEW_NOTES Notes view */
32 1, /* VIEW_WIKI Wiki view */
33 0, /* VIEW_CALBRIEF Brief Calendar view */
34 0, /* VIEW_JOURNAL Journal view */
35 0 /* VIEW_BLOG Blog view (not yet implemented) */
40 * Initialize the viewdefs with localized strings
42 void initialize_viewdefs(void) {
43 viewdefs[VIEW_BBS] = _("Bulletin Board");
44 viewdefs[VIEW_MAILBOX] = _("Mail Folder");
45 viewdefs[VIEW_ADDRESSBOOK] = _("Address Book");
46 viewdefs[VIEW_CALENDAR] = _("Calendar");
47 viewdefs[VIEW_TASKS] = _("Task List");
48 viewdefs[VIEW_NOTES] = _("Notes List");
49 viewdefs[VIEW_WIKI] = _("Wiki");
50 viewdefs[VIEW_CALBRIEF] = _("Calendar List");
51 viewdefs[VIEW_JOURNAL] = _("Journal");
52 viewdefs[VIEW_BLOG] = _("Blog");
55 ConstStr QRFlagList[] = {
56 {HKEY(strof(QR_PERMANENT))},
57 {HKEY(strof(QR_INUSE))},
58 {HKEY(strof(QR_PRIVATE))},
59 {HKEY(strof(QR_PASSWORDED))},
60 {HKEY(strof(QR_GUESSNAME))},
61 {HKEY(strof(QR_DIRECTORY))},
62 {HKEY(strof(QR_UPLOAD))},
63 {HKEY(strof(QR_DOWNLOAD))},
64 {HKEY(strof(QR_VISDIR))},
65 {HKEY(strof(QR_ANONONLY))},
66 {HKEY(strof(QR_ANONOPT))},
67 {HKEY(strof(QR_NETWORK))},
68 {HKEY(strof(QR_PREFONLY))},
69 {HKEY(strof(QR_READONLY))},
70 {HKEY(strof(QR_MAILBOX))}
72 ConstStr QR2FlagList[] = {
73 {HKEY(strof(QR2_SYSTEM))},
74 {HKEY(strof(QR2_SELFLIST))},
75 {HKEY(strof(QR2_COLLABDEL))},
76 {HKEY(strof(QR2_SUBJECTREQ))},
77 {HKEY(strof(QR2_SMTP_PUBLIC))},
78 {HKEY(strof(QR2_MODERATED))},
96 QRVec = NewStrBufPlain(NULL, 256);
100 if (StrLength(QRVec) > 0)
101 StrBufAppendBufPlain(QRVec, HKEY(" | "), 0);
102 StrBufAppendBufPlain(QRVec, CKEY(QRFlagList[j]), 0);
107 lprintf(9, "DBG: QR-Vec [%ld] [%s]\n", QR, ChrPtr(QRVec));
113 void DBG_QR2(long QR2)
119 QR2Vec = NewStrBufPlain(NULL, 256);
122 if ((QR2 & i) != 0) {
123 if (StrLength(QR2Vec) > 0)
124 StrBufAppendBufPlain(QR2Vec, HKEY(" | "), 0);
125 StrBufAppendBufPlain(QR2Vec, CKEY(QR2FlagList[j]), 0);
130 lprintf(9, "DBG: QR2-Vec [%ld] [%s]\n", QR2, ChrPtr(QR2Vec));
136 * Embed the room banner
138 * got The information returned from a GOTO server command
139 * navbar_style Determines which navigation buttons to display
143 void embed_room_banner(void)
148 /* refresh current room states... */
149 /* dosen't work??? gotoroom(NULL); */
151 /* The browser needs some information for its own use */
152 wc_printf("<script type=\"text/javascript\"> \n"
153 " room_is_trash = %d; \n"
155 ((WC->CurRoom.RAFlags & UA_ISTRASH) != 0)
159 * If the user happens to select the "make this my start page" link,
160 * we want it to remember the URL as a "/dotskip" one instead of
161 * a "skip" or "gotonext" or something like that.
163 if (WCC->Hdr->this_page == NULL) {
164 WCC->Hdr->this_page = NewStrBuf();
166 StrBufPrintf(WCC->Hdr->this_page,
168 ChrPtr(WC->CurRoom.name)
171 do_template("roombanner", NULL);
172 /* roombanner contains this for mobile */
176 do_template("navbar", NULL);
181 * back end routine to take the session to a new room
183 long gotoroom(const StrBuf *gname)
187 static long ls = (-1L);
190 /* store ungoto information */
191 if (StrLength(gname) > 0)
192 strcpy(WCC->ugname, ChrPtr(WCC->CurRoom.name));
196 /* move to the new room */
197 if (StrLength(gname) > 0)
198 serv_printf("GOTO %s", ChrPtr(gname));
199 else /* or just refresh the current state... */
200 serv_printf("GOTO 00000000000000000000");
201 StrBuf_ServGetln(Buf);
202 if (GetServerStatus(Buf, &err) != 2) {
203 serv_puts("GOTO _BASEROOM_");
204 StrBuf_ServGetln(Buf);
206 * well, we know that this is the fallback case,
207 * but we're interested that the first command
208 * didn't work out in first place.
210 if (GetServerStatus(Buf, NULL) != 2) {
215 FlushFolder(&WCC->CurRoom);
216 ParseGoto(&WCC->CurRoom, Buf);
218 if (StrLength(gname) > 0)
220 remove_march(WCC->CurRoom.name);
221 if (!strcasecmp(ChrPtr(gname), "_BASEROOM_"))
231 void ParseGoto(folder *room, StrBuf *Line)
239 if (StrLength(Line) < 4) {
243 /* ignore the commandstate... */
244 Pos = ChrPtr(Line) + 4;
246 if (room->RoomNameParts != NULL)
249 for (i=0; i < room->nRoomNameParts; i++)
250 FreeStrBuf(&room->RoomNameParts[i]);
251 free(room->RoomNameParts);
252 room->RoomNameParts = NULL;
257 pBuf = NewStrBufPlain(NULL, StrLength(Line));
260 memset(room, 0, sizeof(folder));
263 StrBufExtract_NextToken(room->name, Line, &Pos, '|'); // WC->CurRoom->name
265 room->nNewMessages = StrBufExtractNext_long(Line, &Pos, '|');
266 if (room->nNewMessages > 0)
267 room->RAFlags |= UA_HASNEWMSGS;
269 room->nTotalMessages = StrBufExtractNext_long(Line, &Pos, '|');
271 room->ShowInfo = StrBufExtractNext_long(Line, &Pos, '|');
273 room->QRFlags = StrBufExtractNext_long(Line, &Pos, '|'); //CurRoom->QRFlags
275 DBG_QR(room->QRFlags);
277 room->HighestRead = StrBufExtractNext_long(Line, &Pos, '|');
278 room->LastMessageRead = StrBufExtractNext_long(Line, &Pos, '|');
280 room->is_inbox = StrBufExtractNext_long(Line, &Pos, '|'); // is_mailbox
282 flag = StrBufExtractNext_long(Line, &Pos, '|');
283 if (WCC->is_aide || flag) {
284 room->RAFlags |= UA_ADMINALLOWED;
287 room->UsersNewMAilboxMessages = StrBufExtractNext_long(Line, &Pos, '|');
289 room->floorid = StrBufExtractNext_int(Line, &Pos, '|'); // wc_floor
291 room->view = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->view
293 room->defview = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->defview
295 flag = StrBufExtractNext_long(Line, &Pos, '|');
297 room->RAFlags |= UA_ISTRASH; // wc_is_trash
299 room->QRFlags2 = StrBufExtractNext_long(Line, &Pos, '|'); // CurRoom->QRFlags2
300 DBG_QR2(room->QRFlags2);
302 /* find out, whether we are in a sub-room */
303 room->nRoomNameParts = StrBufNum_tokens(room->name, '\\');
304 if (room->nRoomNameParts > 1)
309 room->RoomNameParts = malloc(sizeof(StrBuf*) * (room->nRoomNameParts + 1));
310 memset(room->RoomNameParts, 0, sizeof(StrBuf*) * (room->nRoomNameParts + 1));
311 for (i=0; i < room->nRoomNameParts; i++)
313 room->RoomNameParts[i] = NewStrBuf();
314 StrBufExtract_NextToken(room->RoomNameParts[i],
315 room->name, &Pos, '\\');
319 /* Private mailboxes on the main floor get remapped to the personal folder */
320 if ((room->QRFlags & QR_MAILBOX) &&
321 (room->floorid == 0))
323 room->floorid = VIRTUAL_MY_FLOOR;
324 if ((room->nRoomNameParts == 1) &&
325 (StrLength(room->name) == 4) &&
326 (strcmp(ChrPtr(room->name), "Mail") == 0))
332 /* get a pointer to the floor we're on: */
333 if (WCC->Floors == NULL)
334 GetFloorListHash(NULL, NULL);
336 GetHash(WCC->Floors, IKEY(room->floorid), &vFloor);
337 room->Floor = (const Floor*) vFloor;
340 void LoadRoomAide(void)
345 if (WCC->CurRoom.RoomAideLoaded)
348 WCC->CurRoom.RoomAideLoaded = 1;
351 StrBuf_ServGetln(Buf);
352 if (GetServerStatus(Buf, NULL) != 2) {
353 FlushStrBuf(WCC->CurRoom.RoomAide);
354 AppendImportantMessage (ChrPtr(Buf) + 4,
359 Pos = ChrPtr(Buf) + 4;
361 FreeStrBuf(&WCC->CurRoom.RoomAide);
362 WCC->CurRoom.RoomAide = NewStrBufPlain (NULL, StrLength (Buf));
364 StrBufExtract_NextToken(WCC->CurRoom.RoomAide, Buf, &Pos, '|');
369 int SaveRoomAide(folder *Room)
373 serv_printf("SETA %s", ChrPtr(Room->RoomAide));
374 StrBuf_ServGetln(Buf);
375 if (GetServerStatus(Buf, NULL) != 2) {
376 StrBufCutLeft(Buf, 4);
377 AppendImportantMessage (SKEY(Buf));
385 void tmplput_CurrentRoomFloorName(StrBuf *Target, WCTemplputParams *TP)
388 folder *Folder = &WCC->CurRoom;
394 pFloor = Folder->Floor;
398 StrBufAppendTemplate(Target, TP, pFloor->Name, 0);
401 void tmplput_CurrentRoomAide(StrBuf *Target, WCTemplputParams *TP)
407 StrBufAppendTemplate(Target, TP, WCC->CurRoom.RoomAide, 0);
410 int GetCurrentRoomFlags(folder *Room)
416 StrBuf_ServGetln(Buf);
417 if (GetServerStatus(Buf, NULL) != 2) {
418 FlushStrBuf(Room->XAPass);
419 FlushStrBuf(Room->Directory);
420 StrBufCutLeft(Buf, 4);
421 AppendImportantMessage (SKEY(Buf));
427 Pos = ChrPtr(Buf) + 4;
429 FreeStrBuf(&Room->XAPass);
430 FreeStrBuf(&Room->Directory);
432 Room->XAPass = NewStrBufPlain (NULL, StrLength (Buf));
433 Room->Directory = NewStrBufPlain (NULL, StrLength (Buf));
435 FreeStrBuf(&Room->name);
436 Room->name = NewStrBufPlain(NULL, StrLength(Buf));
437 StrBufExtract_NextToken(Room->name, Buf, &Pos, '|');
439 StrBufExtract_NextToken(Room->XAPass, Buf, &Pos, '|');
440 StrBufExtract_NextToken(Room->Directory, Buf, &Pos, '|');
442 Room->QRFlags = StrBufExtractNext_long(Buf, &Pos, '|');
443 Room->floorid = StrBufExtractNext_long(Buf, &Pos, '|');
444 Room->Order = StrBufExtractNext_long(Buf, &Pos, '|');
445 Room->defview = StrBufExtractNext_long(Buf, &Pos, '|');
446 Room->QRFlags2 = StrBufExtractNext_long(Buf, &Pos, '|');
454 int SetCurrentRoomFlags(folder *Room)
459 DBG_QR(Room->QRFlags);
460 DBG_QR2(Room->QRFlags2);
462 serv_printf("SETR %s|%s|%s|%ld|%d|%d|%ld|%ld|%ld",
464 ChrPtr(Room->XAPass),
465 ChrPtr(Room->Directory),
473 StrBuf_ServGetln(Buf);
474 if (GetServerStatus(Buf, NULL) != 2) {
475 StrBufCutLeft(Buf, 4);
476 AppendImportantMessage (SKEY(Buf));
485 void LoadRoomXA (void)
489 if (WCC->CurRoom.XALoaded)
492 GetCurrentRoomFlags(&WCC->CurRoom);
496 void LoadXRoomPic(void)
501 if (WCC->CurRoom.XHaveRoomPicLoaded)
504 WCC->CurRoom.XHaveRoomPicLoaded = 1;
506 serv_puts("OIMG _roompic_");
507 StrBuf_ServGetln(Buf);
508 if (GetServerStatus(Buf, NULL) != 2) {
509 WCC->CurRoom.XHaveRoomPic = 0;
511 WCC->CurRoom.XHaveRoomPic = 1;
514 StrBuf_ServGetln(Buf);
515 GetServerStatus(Buf, NULL);
519 int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
527 return WCC->CurRoom.XHaveRoomPic == 1;
530 void LoadXRoomInfoText(void)
536 if (WCC->CurRoom.XHaveInfoTextLoaded)
539 WCC->CurRoom.XHaveInfoTextLoaded = 1;
544 StrBuf_ServGetln(Buf);
545 if (GetServerStatus(Buf, NULL) == 1) {
546 WCC->CurRoom.XInfoText = NewStrBuf ();
548 while (!Done && StrBuf_ServGetln(Buf)>=0) {
549 if ( (StrLength(Buf)==3) &&
550 !strcmp(ChrPtr(Buf), "000"))
553 StrBufAppendBuf(WCC->CurRoom.XInfoText, Buf, 0);
560 int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
568 return (StrLength(WCC->CurRoom.XInfoText)>0);
571 void tmplput_CurrentRoomInfoText(StrBuf *Target, WCTemplputParams *TP)
577 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 1);
580 void LoadXRoomXCountFiles(void)
586 if (WCC->CurRoom.XHaveDownloadCount)
589 WCC->CurRoom.XHaveDownloadCount = 1;
593 StrBuf_ServGetln(Buf);
594 if (GetServerStatus(Buf, NULL) == 1) {
596 while (!Done && StrBuf_ServGetln(Buf)>=0) {
597 if ( (StrLength(Buf)==3) &&
598 !strcmp(ChrPtr(Buf), "000"))
601 WCC->CurRoom.XDownloadCount++;
608 void tmplput_CurrentRoomXNFiles(StrBuf *Target, WCTemplputParams *TP)
612 LoadXRoomXCountFiles();
614 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.XDownloadCount);
617 void tmplput_CurrentRoomX_FileString(StrBuf *Target, WCTemplputParams *TP)
621 LoadXRoomXCountFiles();
623 if (WCC->CurRoom.XDownloadCount == 1)
624 StrBufAppendBufPlain(Target, _("file"), -1, 0);
626 StrBufAppendBufPlain(Target, _("files"), -1, 0);
629 void tmplput_CurrentRoomPass(StrBuf *Target, WCTemplputParams *TP)
635 StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 0);
637 void tmplput_CurrentRoomDirectory(StrBuf *Target, WCTemplputParams *TP)
643 StrBufAppendTemplate(Target, TP, WCC->CurRoom.Directory, 0);
645 void tmplput_CurrentRoomOrder(StrBuf *Target, WCTemplputParams *TP)
651 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.Order);
653 void tmplput_CurrentRoomDefView(StrBuf *Target, WCTemplputParams *TP)
657 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.defview);
660 void tmplput_CurrentRoom_nNewMessages(StrBuf *Target, WCTemplputParams *TP)
666 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
669 void tmplput_CurrentRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP)
675 StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
678 int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
688 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
689 return CheckThis == WCC->CurRoom.Order;
692 int ConditionalThisRoomDefView(StrBuf *Target, WCTemplputParams *TP)
700 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
701 return CheckThis == WCC->CurRoom.defview;
704 int ConditionalThisRoomCurrView(StrBuf *Target, WCTemplputParams *TP)
712 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
713 return CheckThis == WCC->CurRoom.view;
716 int ConditionalThisRoomHaveView(StrBuf *Target, WCTemplputParams *TP)
724 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
725 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
727 LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
728 "Roomview [%ld] not valid\n",
733 return exchangeable_views [WCC->CurRoom.defview][CheckThis] != VIEW_MAX;
736 void tmplput_CurrentRoomViewString(StrBuf *Target, WCTemplputParams *TP)
742 (WCC->CurRoom.defview >= VIEW_MAX) ||
743 (WCC->CurRoom.defview < VIEW_BBS))
745 LogTemplateError(Target, "Token", ERR_PARM2, TP,
746 "Roomview [%ld] not valid\n",
748 WCC->CurRoom.defview : -1);
752 Buf = NewStrBufPlain(_(viewdefs[WCC->CurRoom.defview]), -1);
753 StrBufAppendTemplate(Target, TP, Buf, 0);
757 void tmplput_RoomViewString(StrBuf *Target, WCTemplputParams *TP)
762 CheckThis = GetTemplateTokenNumber(Target, TP, 0, 0);
763 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
765 LogTemplateError(Target, "Token", ERR_PARM2, TP,
766 "Roomview [%ld] not valid\n",
771 Buf = NewStrBufPlain(_(viewdefs[CheckThis]), -1);
772 StrBufAppendTemplate(Target, TP, Buf, 0);
777 int ConditionalIsAllowedDefaultView(StrBuf *Target, WCTemplputParams *TP)
785 CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
786 if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
788 LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
789 "Roomview [%ld] not valid\n",
794 return allowed_default_views[CheckThis] != 0;
800 void smart_goto(const StrBuf *next_room) {
802 readloop(readnew, eUseDefault);
808 * mark all messages in current room as having been read
810 void slrp_highest(void)
814 serv_puts("SLRP HIGHEST");
815 serv_getln(buf, sizeof buf);
821 * Set/clear/read the "self-service list subscribe" flag for a room
823 * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
824 * returns the new value.
827 int self_service(int newval) {
828 int current_value = 0;
831 if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
836 if ((WCC->CurRoom.QRFlags2 & QR2_SELFLIST) != 0) {
844 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST;
846 else if (newval == 0) {
847 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST;
850 return(current_value);
853 if (newval != current_value) {
854 SetCurrentRoomFlags(&WCC->CurRoom);
864 * Toggle self-service list subscription
866 void toggle_self_service(void) {
869 if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
872 if (yesbstr("QR2_SelfList"))
873 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST;
875 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST;
877 if (yesbstr("QR2_SMTP_PUBLIC"))
878 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
880 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
882 if (yesbstr("QR2_Moderated"))
883 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_MODERATED;
885 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_MODERATED;
886 if (yesbstr("QR2_SubsOnly"))
887 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
889 WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
891 SetCurrentRoomFlags (&WCC->CurRoom);
893 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
899 * save new parameters for a room
905 const StrBuf *er_name;
906 const StrBuf *er_password;
907 const StrBuf *er_dirname;
908 const StrBuf *er_roomaide;
913 if (!havebstr("ok_button")) {
914 strcpy(WC->ImportantMessage,
915 _("Cancelled. Changes were not saved."));
916 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
919 if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
924 er_flags = WCC->CurRoom.QRFlags;
925 er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
927 er_flags2 = WCC->CurRoom.QRFlags2;
930 if (!strcmp(ChrPtr(Ptr), "invonly")) {
931 er_flags |= (QR_PRIVATE);
933 if (!strcmp(ChrPtr(Ptr), "hidden")) {
934 er_flags |= (QR_PRIVATE | QR_GUESSNAME);
936 if (!strcmp(ChrPtr(Ptr), "passworded")) {
937 er_flags |= (QR_PRIVATE | QR_PASSWORDED);
939 if (!strcmp(ChrPtr(Ptr), "personal")) {
940 er_flags |= QR_MAILBOX;
942 er_flags &= ~QR_MAILBOX;
947 if (yesbstr("prefonly")) {
948 er_flags |= QR_PREFONLY;
950 er_flags &= ~QR_PREFONLY;
953 if (yesbstr("readonly")) {
954 er_flags |= QR_READONLY;
956 er_flags &= ~QR_READONLY;
960 if (yesbstr("collabdel")) {
961 er_flags2 |= QR2_COLLABDEL;
963 er_flags2 &= ~QR2_COLLABDEL;
966 if (yesbstr("permanent")) {
967 er_flags |= QR_PERMANENT;
969 er_flags &= ~QR_PERMANENT;
972 if (yesbstr("subjectreq")) {
973 er_flags2 |= QR2_SUBJECTREQ;
975 er_flags2 &= ~QR2_SUBJECTREQ;
978 if (yesbstr("network")) {
979 er_flags |= QR_NETWORK;
981 er_flags &= ~QR_NETWORK;
984 if (yesbstr("directory")) {
985 er_flags |= QR_DIRECTORY;
987 er_flags &= ~QR_DIRECTORY;
990 if (yesbstr("ulallowed")) {
991 er_flags |= QR_UPLOAD;
993 er_flags &= ~QR_UPLOAD;
996 if (yesbstr("dlallowed")) {
997 er_flags |= QR_DOWNLOAD;
999 er_flags &= ~QR_DOWNLOAD;
1002 if (yesbstr("visdir")) {
1003 er_flags |= QR_VISDIR;
1005 er_flags &= ~QR_VISDIR;
1009 Ptr = sbstr("anon");
1011 er_flags &= ~(QR_ANONONLY | QR_ANONOPT);
1012 if (!strcmp(ChrPtr(Ptr), "anononly"))
1013 er_flags |= QR_ANONONLY;
1014 if (!strcmp(ChrPtr(Ptr), "anon2"))
1015 er_flags |= QR_ANONOPT;
1017 er_name = sbstr("er_name");
1018 er_dirname = sbstr("er_dirname");
1019 er_roomaide = sbstr("er_roomaide");
1020 er_password = sbstr("er_password");
1022 FlushStrBuf(WCC->CurRoom.name);
1023 StrBufAppendBuf(WCC->CurRoom.name, er_name, 0);
1025 FlushStrBuf(WCC->CurRoom.Directory);
1026 StrBufAppendBuf(WCC->CurRoom.Directory, er_dirname, 0);
1028 FlushStrBuf(WCC->CurRoom.RoomAide);
1029 StrBufAppendBuf(WCC->CurRoom.RoomAide, er_roomaide, 0);
1031 FlushStrBuf(WCC->CurRoom.XAPass);
1032 StrBufAppendBuf(WCC->CurRoom.XAPass, er_password, 0);
1034 WCC->CurRoom.BumpUsers = yesbstr("bump");
1036 WCC->CurRoom.floorid = ibstr("er_floor");
1038 succ1 = SetCurrentRoomFlags(&WCC->CurRoom);
1040 succ2 = SaveRoomAide (&WCC->CurRoom);
1042 if (succ1 + succ2 == 0)
1043 AppendImportantMessage (_("Your changes have been saved."), -1);
1044 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1050 * Display form for Invite, Kick, and show Who Knows a room
1052 void do_invt_kick(void)
1055 const StrBuf *UserNames;
1057 wcsession *WCC = WC;
1060 if (GetCurrentRoomFlags(&WCC->CurRoom) == 1)
1063 UserNames = sbstr("username");
1064 Kick = havebstr("kick_button");
1065 Invite = havebstr("invite_button");
1067 User = NewStrBufPlain(NULL, StrLength(UserNames));
1070 Pos = ChrPtr(UserNames);
1071 while (Pos != StrBufNOTNULL)
1073 StrBufExtract_NextToken(User, UserNames, &Pos, ',');
1075 if ((StrLength(User) > 0) && (Kick))
1077 serv_printf("KICK %s", ChrPtr(User));
1078 StrBuf_ServGetln(Buf);
1079 if (GetServerStatus(Buf, NULL) != 2) {
1080 StrBufCutLeft(Buf, 4);
1081 AppendImportantMessage(SKEY(Buf));
1084 _("User '%s' kicked out of room '%s'."),
1086 ChrPtr(WCC->CurRoom.name)
1088 AppendImportantMessage(SKEY(Buf));
1091 else if ((StrLength(User) > 0) && (Invite))
1093 serv_printf("INVT %s", ChrPtr(User));
1094 StrBuf_ServGetln(Buf);
1095 if (GetServerStatus(Buf, NULL) != 2) {
1096 StrBufCutLeft(Buf, 4);
1097 AppendImportantMessage(SKEY(Buf));
1100 _("User '%s' invited to room '%s'."),
1102 ChrPtr(WCC->CurRoom.name)
1104 AppendImportantMessage(SKEY(Buf));
1110 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1114 * support function for entroom() -- sets the default view
1116 void er_set_default_view(int newview) {
1129 serv_getln(buf, sizeof buf);
1130 if (buf[0] != '2') return;
1132 extract_token(rm_name, &buf[4], 0, '|', sizeof rm_name);
1133 extract_token(rm_pass, &buf[4], 1, '|', sizeof rm_pass);
1134 extract_token(rm_dir, &buf[4], 2, '|', sizeof rm_dir);
1135 rm_bits1 = extract_int(&buf[4], 3);
1136 rm_floor = extract_int(&buf[4], 4);
1137 rm_listorder = extract_int(&buf[4], 5);
1138 rm_bits2 = extract_int(&buf[4], 7);
1140 serv_printf("SETR %s|%s|%s|%d|0|%d|%d|%d|%d",
1141 rm_name, rm_pass, rm_dir, rm_bits1, rm_floor,
1142 rm_listorder, newview, rm_bits2
1144 serv_getln(buf, sizeof buf);
1155 const StrBuf *er_name;
1156 const StrBuf *er_type;
1157 const StrBuf *er_password;
1161 wcsession *WCC = WC;
1163 if (!havebstr("ok_button")) {
1164 strcpy(WC->ImportantMessage,
1165 _("Cancelled. No new room was created."));
1166 display_main_menu();
1169 er_name = sbstr("er_name");
1170 er_type = sbstr("type");
1171 er_password = sbstr("er_password");
1172 er_floor = ibstr("er_floor");
1173 er_view = ibstr("er_view");
1176 if (!strcmp(ChrPtr(er_type), "hidden"))
1178 else if (!strcmp(ChrPtr(er_type), "passworded"))
1180 else if (!strcmp(ChrPtr(er_type), "invonly"))
1182 else if (!strcmp(ChrPtr(er_type), "personal"))
1185 serv_printf("CRE8 1|%s|%d|%s|%d|%d|%d",
1188 ChrPtr(er_password),
1193 serv_getln(buf, sizeof buf);
1194 if (buf[0] != '2') {
1195 strcpy(WCC->ImportantMessage, &buf[4]);
1196 display_main_menu();
1199 /** TODO: Room created, now update the left hand icon bar for this user */
1202 serv_printf("VIEW %d", er_view);
1203 serv_getln(buf, sizeof buf);
1204 WCC->CurRoom.view = er_view;
1206 if ( (WCC != NULL) && ( (WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ) {
1207 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1209 do_change_view(er_view); /* Now go there */
1216 * \brief goto a private room
1218 void goto_private(void)
1222 const StrBuf *gr_name;
1225 if (!havebstr("ok_button")) {
1226 display_main_menu();
1229 gr_name = sbstr("gr_name");
1231 strcpy(hold_rm, ChrPtr(WC->CurRoom.name));
1232 serv_printf("GOTO %s|%s",
1235 StrBuf_ServGetln(Buf);
1236 if (GetServerStatus(Buf, &err) == 2) {
1238 smart_goto(gr_name);
1243 DoTemplate(HKEY("room_display_private"), NULL, &NoCtx);
1247 StrBufCutLeft(Buf, 4);
1248 AppendImportantMessage (SKEY(Buf));
1249 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
1263 StrBuf *final_destination;
1266 * If the forget-room routine fails for any reason, we fall back
1267 * to the current room; otherwise, we go to the Lobby
1269 final_destination = NewStrBufDup(WC->CurRoom.name);
1271 if (havebstr("ok_button")) {
1272 serv_printf("GOTO %s", ChrPtr(WC->CurRoom.name));
1273 serv_getln(buf, sizeof buf);
1274 if (buf[0] == '2') {
1276 serv_getln(buf, sizeof buf);
1277 if (buf[0] == '2') {
1278 FlushStrBuf(final_destination);
1279 StrBufAppendBufPlain(final_destination, HKEY("_BASEROOM_"), 0);
1284 smart_goto(final_destination);
1285 FreeStrBuf(&final_destination);
1291 * \brief Delete the current room
1293 void delete_room(void)
1298 serv_puts("KILL 1");
1299 serv_getln(buf, sizeof buf);
1301 if (buf[0] != '2') {
1302 strcpy(WC->ImportantMessage, &buf[4]);
1303 display_main_menu();
1309 Buf = NewStrBufPlain(HKEY("_BASEROOM_"));
1318 * \brief Perform changes to a room's network configuration
1320 void netedit(void) {
1329 /*/ TODO: do line dynamic! */
1330 if (havebstr("line_pop3host")) {
1331 strcpy(line, bstr("prefix"));
1332 strcat(line, bstr("line_pop3host"));
1334 strcat(line, bstr("line_pop3user"));
1336 strcat(line, bstr("line_pop3pass"));
1338 strcat(line, ibstr("line_pop3keep") ? "1" : "0" );
1340 sprintf(&line[strlen(line)],"%ld", lbstr("line_pop3int"));
1341 strcat(line, bstr("suffix"));
1343 else if (havebstr("line")) {
1344 strcpy(line, bstr("prefix"));
1345 strcat(line, bstr("line"));
1346 strcat(line, bstr("suffix"));
1349 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1356 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1361 serv_getln(buf, sizeof buf);
1362 if (buf[0] != '1') {
1364 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1368 /** This loop works for add *or* remove. Spiffy, eh? */
1369 while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
1370 extract_token(cmpa0, buf, 0, '|', sizeof cmpa0);
1371 extract_token(cmpa1, buf, 1, '|', sizeof cmpa1);
1372 extract_token(cmpb0, line, 0, '|', sizeof cmpb0);
1373 extract_token(cmpb1, line, 1, '|', sizeof cmpb1);
1374 if ( (strcasecmp(cmpa0, cmpb0))
1375 || (strcasecmp(cmpa1, cmpb1)) ) {
1376 fprintf(fp, "%s\n", buf);
1382 serv_getln(buf, sizeof buf);
1383 if (buf[0] != '4') {
1385 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1389 while (fgets(buf, sizeof buf, fp) != NULL) {
1390 buf[strlen(buf)-1] = 0;
1394 if (havebstr("add_button")) {
1395 num_addrs = num_tokens(bstr("line"), ',');
1396 if (num_addrs < 2) {
1397 /* just adding one node or address */
1401 /* adding multiple addresses separated by commas */
1402 for (i=0; i<num_addrs; ++i) {
1403 strcpy(line, bstr("prefix"));
1404 extract_token(buf, bstr("line"), i, ',', sizeof buf);
1407 strcat(line, bstr("suffix"));
1415 FlushIgnetCfgs(&WC->CurRoom);
1417 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1421 * delete the actual floor
1423 void delete_floor(void) {
1428 floornum = ibstr("floornum");
1430 serv_printf("KFLR %d|1", floornum);
1432 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err);
1434 if (GetServerStatus(Buf, NULL) == 2) {
1435 StrBufPlain(Buf, _("Floor has been deleted."),-1);
1438 StrBufCutLeft(Buf, 4);
1440 AppendImportantMessage (SKEY(Buf));
1443 http_transmit_thing(ChrPtr(do_template("floors", NULL)), 0);
1448 * start creating a new floor
1450 void create_floor(void) {
1455 serv_printf("CFLR %s|1", bstr("floorname"));
1456 StrBufTCP_read_line(Buf, &WC->serv_sock, 0, &Err);
1458 if (GetServerStatus(Buf, NULL) == 2) {
1459 StrBufPlain(Buf, _("New floor has been created."),-1);
1462 StrBufCutLeft(Buf, 4);
1464 AppendImportantMessage (SKEY(Buf));
1466 http_transmit_thing(ChrPtr(do_template("floors", NULL)), 0);
1474 void rename_floor(void) {
1480 serv_printf("EFLR %d|%s", ibstr("floornum"), bstr("floorname"));
1481 StrBuf_ServGetln(Buf);
1483 StrBufCutLeft(Buf, 4);
1484 AppendImportantMessage (SKEY(Buf));
1486 http_transmit_thing(ChrPtr(do_template("floors", NULL)), 0);
1493 * \brief Back end for change_view()
1494 * \param newview set newview???
1496 void do_change_view(int newview) {
1499 serv_printf("VIEW %d", newview);
1500 serv_getln(buf, sizeof buf);
1501 WC->CurRoom.view = newview;
1502 smart_goto(WC->CurRoom.name);
1508 * \brief Change the view for this room
1510 void change_view(void) {
1513 view = lbstr("view");
1514 do_change_view(view);
1518 * \brief Do either a known rooms list or a folders list, depending on the
1523 StrBuf *ListView = NULL;
1525 /** Determine whether the user is trying to change views */
1526 if (havebstr("view")) {
1527 ListView = NewStrBufDup(SBSTR("view"));
1528 set_preference("roomlistview", ListView, 1);
1530 /** Sanitize the input so its safe */
1531 if((get_preference("roomlistview", &ListView) != 0)||
1532 ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
1533 (strcasecmp(ChrPtr(ListView), "table") != 0)))
1535 if (ListView == NULL) {
1536 ListView = NewStrBufPlain(HKEY("rooms"));
1537 set_preference("roomlistview", ListView, 0);
1541 ListView = NewStrBufPlain(HKEY("rooms"));
1542 set_preference("roomlistview", ListView, 0);
1546 FreeStrBuf(&ListView);
1553 * \brief Set the message expire policy for this room and/or floor
1555 void set_room_policy(void) {
1558 if (!havebstr("ok_button")) {
1559 strcpy(WC->ImportantMessage,
1560 _("Cancelled. Changes were not saved."));
1561 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1565 serv_printf("SPEX roompolicy|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
1566 serv_getln(buf, sizeof buf);
1567 strcpy(WC->ImportantMessage, &buf[4]);
1569 if (WC->axlevel >= 6) {
1570 strcat(WC->ImportantMessage, "<br />\n");
1571 serv_printf("SPEX floorpolicy|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
1572 serv_getln(buf, sizeof buf);
1573 strcat(WC->ImportantMessage, &buf[4]);
1575 ReloadCurrentRoom();
1576 http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
1579 void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
1581 StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
1584 void dotgoto(void) {
1585 if (!havebstr("room")) {
1586 readloop(readnew, eUseDefault);
1589 if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
1592 smart_goto(sbstr("room"));
1597 void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
1599 wcsession *WCC = WC;
1602 StrBufAppendTemplate(Target, TP,
1607 void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
1609 wc_printf("<div id=\"banner\">\n");
1610 embed_room_banner();
1611 wc_printf("</div>\n");
1615 void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
1617 wcsession *WCC = WC;
1620 (!IsEmptyStr(WCC->ugname)))
1621 StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
1624 int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
1626 wcsession *WCC = WC;
1627 return (WCC != NULL)?
1628 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
1631 int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
1633 wcsession *WCC = WC;
1634 return (WCC == NULL)? 0 :
1635 ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
1636 (WCC->CurRoom.is_inbox) ||
1637 (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
1640 int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
1642 wcsession *WCC = WC;
1644 return ((WCC!=NULL) &&
1645 (!IsEmptyStr(WCC->ugname)) &&
1646 (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0));
1650 int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
1652 folder *Folder = (folder *)(TP->Context);
1655 UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
1656 if (UA_CheckFlag == 0)
1657 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
1658 "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
1660 return ((Folder->RAFlags & UA_CheckFlag) != 0);
1665 int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
1668 wcsession *WCC = WC;
1670 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
1671 if (QR_CheckFlag == 0)
1672 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
1673 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
1678 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
1679 (TP->Tokens->Params[2]->MaskBy == eNO))
1680 return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
1682 return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
1685 int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
1688 folder *Folder = (folder *)(TP->Context);
1690 QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
1691 if (QR_CheckFlag == 0)
1692 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
1693 "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
1695 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
1696 (TP->Tokens->Params[2]->MaskBy == eNO))
1697 return (Folder->QRFlags & QR_CheckFlag) != 0;
1699 return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
1703 int ConditionalCurrentRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
1706 wcsession *WCC = WC;
1708 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
1709 if (QR2_CheckFlag == 0)
1710 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
1711 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
1717 if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
1718 (TP->Tokens->Params[2]->MaskBy == eNO))
1719 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
1721 return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
1724 int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
1727 folder *Folder = (folder *)(TP->Context);
1729 QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
1730 if (QR2_CheckFlag == 0)
1731 LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
1732 "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
1733 return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
1737 int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
1739 wcsession *WCC = WC;
1741 return ( (WCC!= NULL) &&
1742 ((WCC->axlevel >= 6) ||
1743 ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
1744 (WCC->CurRoom.is_inbox) ));
1747 int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
1749 wcsession *WCC = WC;
1751 if ((WCC == NULL) ||
1752 (TP->Tokens->nParameters < 3))
1754 return ((WCC->CurRoom.view < VIEW_BBS) ||
1755 (WCC->CurRoom.view > VIEW_MAX));
1758 return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
1762 HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP)
1764 wcsession *WCC = WC;
1768 HashList *Whok = NULL;
1774 StrBuf_ServGetln(Line);
1775 if (GetServerStatus(Line, &State) == 1)
1777 Whok = NewHash(1, Flathash);
1778 while(!Done && StrBuf_ServGetln(Line))
1779 if ( (StrLength(Line)==3) &&
1780 !strcmp(ChrPtr(Line), "000"))
1787 const char *Pos = NULL;
1788 Token = NewStrBufPlain (NULL, StrLength(Line));
1789 StrBufExtract_NextToken(Token, Line, &Pos, '|');
1798 else if (State == 550)
1799 StrBufAppendBufPlain(WCC->ImportantMsg,
1800 _("Higher access is required to access this function."), -1, 0);
1809 void _FlushRoomList(wcsession *WCC)
1811 free_march_list(WCC);
1812 DeleteHash(&WCC->Floors);
1813 DeleteHash(&WCC->Rooms);
1814 DeleteHash(&WCC->FloorsByName);
1815 FlushFolder(&WCC->CurRoom);
1818 void ReloadCurrentRoom(void)
1820 wcsession *WCC = WC;
1823 CurRoom = WCC->CurRoom.name;
1824 WCC->CurRoom.name = NULL;
1825 _FlushRoomList(WCC);
1827 FreeStrBuf(&CurRoom);
1830 void FlushRoomlist(void)
1832 wcsession *WCC = WC;
1833 _FlushRoomList(WCC);
1841 initialize_viewdefs();
1842 RegisterPreference("roomlistview",
1843 _("Room list view"),
1846 RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
1848 RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
1851 WebcitAddUrlHandler(HKEY("delete_floor"), "", 0, delete_floor, 0);
1852 WebcitAddUrlHandler(HKEY("rename_floor"), "", 0, rename_floor, 0);
1853 WebcitAddUrlHandler(HKEY("create_floor"), "", 0, create_floor, 0);
1855 WebcitAddUrlHandler(HKEY("knrooms"), "", 0, knrooms, 0);
1856 WebcitAddUrlHandler(HKEY("dotgoto"), "", 0, dotgoto, NEED_URL);
1857 WebcitAddUrlHandler(HKEY("dotskip"), "", 0, dotskip, NEED_URL);
1859 WebcitAddUrlHandler(HKEY("goto_private"), "", 0, goto_private, NEED_URL);
1860 WebcitAddUrlHandler(HKEY("zap"), "", 0, zap, 0);
1861 WebcitAddUrlHandler(HKEY("entroom"), "", 0, entroom, 0);
1862 WebcitAddUrlHandler(HKEY("do_invt_kick"), "", 0, do_invt_kick, 0);
1864 WebcitAddUrlHandler(HKEY("netedit"), "", 0, netedit, 0);
1865 WebcitAddUrlHandler(HKEY("editroom"), "", 0, editroom, 0);
1866 WebcitAddUrlHandler(HKEY("delete_room"), "", 0, delete_room, 0);
1867 WebcitAddUrlHandler(HKEY("set_room_policy"), "", 0, set_room_policy, 0);
1868 WebcitAddUrlHandler(HKEY("changeview"), "", 0, change_view, 0);
1869 WebcitAddUrlHandler(HKEY("toggle_self_service"), "", 0, toggle_self_service, 0);
1870 RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
1872 RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
1873 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR"), 0, ConditionalCurrentRoomHas_QRFlag, CTX_NONE);
1874 RegisterConditional(HKEY("COND:ROOM:FLAG:QR"), 0, ConditionalRoomHas_QRFlag, CTX_ROOMS);
1876 RegisterConditional(HKEY("COND:THISROOM:FLAG:QR2"), 0, ConditionalCurrentRoomHas_QRFlag2, CTX_NONE);
1877 RegisterConditional(HKEY("COND:ROOM:FLAG:QR2"), 0, ConditionalRoomHas_QRFlag2, CTX_ROOMS);
1878 RegisterConditional(HKEY("COND:ROOM:FLAG:UA"), 0, ConditionalRoomHas_UAFlag, CTX_ROOMS);
1880 RegisterIterator("ITERATE:THISROOM:WHO_KNOWS", 0, NULL, GetWhoKnowsHash, NULL, DeleteHash, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
1881 RegisterNamespace("THISROOM:MSGS:NEW", 0, 0, tmplput_CurrentRoom_nNewMessages, NULL, CTX_NONE);
1882 RegisterNamespace("THISROOM:MSGS:TOTAL", 0, 0, tmplput_CurrentRoom_nTotalMessages, NULL, CTX_NONE);
1884 RegisterNamespace("THISROOM:FLOOR:NAME", 0, 1, tmplput_CurrentRoomFloorName, NULL, CTX_NONE);
1885 RegisterNamespace("THISROOM:AIDE", 0, 1, tmplput_CurrentRoomAide, NULL, CTX_NONE);
1886 RegisterNamespace("THISROOM:PASS", 0, 1, tmplput_CurrentRoomPass, NULL, CTX_NONE);
1887 RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_CurrentRoomDirectory, NULL, CTX_NONE);
1888 RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_CurrentRoomOrder, NULL, CTX_NONE);
1889 RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE);
1890 RegisterConditional(HKEY("COND:THISROOM:HAVE_VIEW"), 0, ConditionalThisRoomHaveView, CTX_NONE);
1891 RegisterConditional(HKEY("COND:ALLOWED_DEFAULT_VIEW"), 0, ConditionalIsAllowedDefaultView, CTX_NONE);
1893 RegisterNamespace("THISROOM:VIEW_STRING", 0, 1, tmplput_CurrentRoomViewString, NULL, CTX_NONE);
1894 RegisterNamespace("ROOM:VIEW_STRING", 1, 2, tmplput_RoomViewString, NULL, CTX_NONE);
1896 RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_CurrentRoomInfoText, NULL, CTX_NONE);
1897 RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE);
1898 RegisterConditional(HKEY("COND:THISROOM:DEFAULT_VIEW"), 0, ConditionalThisRoomDefView, CTX_NONE);
1899 RegisterConditional(HKEY("COND:THISROOM:CURR_VIEW"), 0, ConditionalThisRoomCurrView, CTX_NONE);
1900 RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE);
1901 RegisterConditional(HKEY("COND:THISROOM:HAVE_INFOTEXT"), 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
1902 RegisterNamespace("THISROOM:FILES:N", 0, 1, tmplput_CurrentRoomXNFiles, NULL, CTX_NONE);
1903 RegisterNamespace("THISROOM:FILES:STR", 0, 1, tmplput_CurrentRoomX_FileString, NULL, CTX_NONE);
1905 REGISTERTokenParamDefine(QR_PERMANENT);
1906 REGISTERTokenParamDefine(QR_INUSE);
1907 REGISTERTokenParamDefine(QR_PRIVATE);
1908 REGISTERTokenParamDefine(QR_PASSWORDED);
1909 REGISTERTokenParamDefine(QR_GUESSNAME);
1910 REGISTERTokenParamDefine(QR_DIRECTORY);
1911 REGISTERTokenParamDefine(QR_UPLOAD);
1912 REGISTERTokenParamDefine(QR_DOWNLOAD);
1913 REGISTERTokenParamDefine(QR_VISDIR);
1914 REGISTERTokenParamDefine(QR_ANONONLY);
1915 REGISTERTokenParamDefine(QR_ANONOPT);
1916 REGISTERTokenParamDefine(QR_NETWORK);
1917 REGISTERTokenParamDefine(QR_PREFONLY);
1918 REGISTERTokenParamDefine(QR_READONLY);
1919 REGISTERTokenParamDefine(QR_MAILBOX);
1920 REGISTERTokenParamDefine(QR2_SYSTEM);
1921 REGISTERTokenParamDefine(QR2_SELFLIST);
1922 REGISTERTokenParamDefine(QR2_COLLABDEL);
1923 REGISTERTokenParamDefine(QR2_SUBJECTREQ);
1924 REGISTERTokenParamDefine(QR2_SMTP_PUBLIC);
1925 REGISTERTokenParamDefine(QR2_MODERATED);
1927 REGISTERTokenParamDefine(UA_KNOWN);
1928 REGISTERTokenParamDefine(UA_GOTOALLOWED);
1929 REGISTERTokenParamDefine(UA_HASNEWMSGS);
1930 REGISTERTokenParamDefine(UA_ZAPPED);
1931 REGISTERTokenParamDefine(UA_POSTALLOWED);
1932 REGISTERTokenParamDefine(UA_ADMINALLOWED);
1933 REGISTERTokenParamDefine(UA_DELETEALLOWED);
1934 REGISTERTokenParamDefine(UA_ISTRASH);
1936 REGISTERTokenParamDefine(US_NEEDVALID);
1937 REGISTERTokenParamDefine(US_PERM);
1938 REGISTERTokenParamDefine(US_LASTOLD);
1939 REGISTERTokenParamDefine(US_EXPERT);
1940 REGISTERTokenParamDefine(US_UNLISTED);
1941 REGISTERTokenParamDefine(US_NOPROMPT);
1942 REGISTERTokenParamDefine(US_PROMPTCTL);
1943 REGISTERTokenParamDefine(US_DISAPPEAR);
1944 REGISTERTokenParamDefine(US_REGIS);
1945 REGISTERTokenParamDefine(US_PAGINATOR);
1946 REGISTERTokenParamDefine(US_INTERNET);
1947 REGISTERTokenParamDefine(US_FLOORS);
1948 REGISTERTokenParamDefine(US_COLOR);
1949 REGISTERTokenParamDefine(US_USER_SET);
1951 REGISTERTokenParamDefine(VIEW_BBS);
1952 REGISTERTokenParamDefine(VIEW_MAILBOX);
1953 REGISTERTokenParamDefine(VIEW_ADDRESSBOOK);
1954 REGISTERTokenParamDefine(VIEW_CALENDAR);
1955 REGISTERTokenParamDefine(VIEW_TASKS);
1956 REGISTERTokenParamDefine(VIEW_NOTES);
1957 REGISTERTokenParamDefine(VIEW_WIKI);
1958 REGISTERTokenParamDefine(VIEW_CALBRIEF);
1959 REGISTERTokenParamDefine(VIEW_JOURNAL);
1960 REGISTERTokenParamDefine(VIEW_BLOG);
1963 /* server internal, we need to know but ignore them. */
1964 REGISTERTokenParamDefine(subpending);
1965 REGISTERTokenParamDefine(unsubpending);
1966 REGISTERTokenParamDefine(lastsent);
1968 REGISTERTokenParamDefine(ignet_push_share);
1969 { /* these are the parts of an IGNET push config */
1970 REGISTERTokenParamDefine(GNET_IGNET_NODE);
1971 REGISTERTokenParamDefine(GNET_IGNET_ROOM);
1973 REGISTERTokenParamDefine(listrecp);
1974 REGISTERTokenParamDefine(digestrecp);
1975 REGISTERTokenParamDefine(pop3client);
1976 { /* These are the parts of a pop3 client line... */
1977 REGISTERTokenParamDefine(GNET_POP3_HOST);
1978 REGISTERTokenParamDefine(GNET_POP3_USER);
1979 REGISTERTokenParamDefine(GNET_POP3_DONT_DELETE_REMOTE);
1980 REGISTERTokenParamDefine(GNET_POP3_INTERVAL);
1982 REGISTERTokenParamDefine(rssclient);
1983 REGISTERTokenParamDefine(participate);
1985 RegisterConditional(HKEY("COND:ROOMAIDE"), 2, ConditionalRoomAide, CTX_NONE);
1986 RegisterConditional(HKEY("COND:ACCESS:DELETE"), 2, ConditionalRoomAcessDelete, CTX_NONE);
1988 RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
1989 RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
1991 RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
1992 RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
1993 RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
2000 SessionDestroyModule_ROOMOPS
2003 _FlushRoomList (sess);