- LoadRoomXA();
-
- StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nNewMessages);
-}
-
-void tmplput_CurrentRoom_nTotalMessages(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
-
- LoadRoomXA();
-
- StrBufAppendPrintf(Target, "%d", WCC->CurRoom.nTotalMessages);
-}
-
-int ConditionalThisRoomOrder(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- long CheckThis;
-
- if (WCC == NULL)
- return 0;
-
- LoadRoomXA();
-
- CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
- return CheckThis == WCC->CurRoom.Order;
-}
-
-int ConditionalThisRoomDefView(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- long CheckThis;
-
- if (WCC == NULL)
- return 0;
-
- CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
- return CheckThis == WCC->CurRoom.defview;
-}
-
-int ConditionalThisRoomCurrView(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- long CheckThis;
-
- if (WCC == NULL)
- return 0;
-
- CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
- return CheckThis == WCC->CurRoom.view;
-}
-
-int ConditionalThisRoomHaveView(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- long CheckThis;
-
- if (WCC == NULL)
- return 0;
-
- CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
- if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
- {
- LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
- "Roomview [%ld] not valid\n",
- CheckThis);
- return 0;
- }
-
- return exchangeable_views [WCC->CurRoom.defview][CheckThis] != VIEW_MAX;
-}
-
-void tmplput_CurrentRoomViewString(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- StrBuf *Buf;
-
- if ((WCC == NULL) ||
- (WCC->CurRoom.defview >= VIEW_MAX) ||
- (WCC->CurRoom.defview < VIEW_BBS))
- {
- LogTemplateError(Target, "Token", ERR_PARM2, TP,
- "Roomview [%ld] not valid\n",
- (WCC != NULL)?
- WCC->CurRoom.defview : -1);
- return;
- }
-
- Buf = NewStrBufPlain(_(viewdefs[WCC->CurRoom.defview]), -1);
- StrBufAppendTemplate(Target, TP, Buf, 0);
- FreeStrBuf(&Buf);
-}
-
-void tmplput_RoomViewString(StrBuf *Target, WCTemplputParams *TP)
-{
- long CheckThis;
- StrBuf *Buf;
-
- CheckThis = GetTemplateTokenNumber(Target, TP, 0, 0);
- if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
- {
- LogTemplateError(Target, "Token", ERR_PARM2, TP,
- "Roomview [%ld] not valid\n",
- CheckThis);
- return;
- }
-
- Buf = NewStrBufPlain(_(viewdefs[CheckThis]), -1);
- StrBufAppendTemplate(Target, TP, Buf, 0);
- FreeStrBuf(&Buf);
-}
-
-
-int ConditionalIsAllowedDefaultView(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- long CheckThis;
-
- if (WCC == NULL)
- return 0;
-
- CheckThis = GetTemplateTokenNumber(Target, TP, 2, 0);
- if ((CheckThis >= VIEW_MAX) || (CheckThis < VIEW_BBS))
- {
- LogTemplateError(Target, "Conditional", ERR_PARM2, TP,
- "Roomview [%ld] not valid\n",
- CheckThis);
- return 0;
- }
-
- return allowed_default_views[CheckThis] != 0;
-}
-
-/*
- * goto next room
- */
-void smart_goto(const StrBuf *next_room) {
- gotoroom(next_room);
- readloop(readnew, eUseDefault);
-}
-
-
-
-/*
- * mark all messages in current room as having been read
- */
-void slrp_highest(void)
-{
- char buf[256];
-
- serv_puts("SLRP HIGHEST");
- serv_getln(buf, sizeof buf);
-}
-
-
-
-/*
- * Set/clear/read the "self-service list subscribe" flag for a room
- *
- * set newval to 0 to clear, 1 to set, any other value to leave unchanged.
- * returns the new value.
- */
-
-int self_service(int newval) {
- int current_value = 0;
- wcsession *WCC = WC;
-
- if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
- {
- return 0;
- }
-
- if ((WCC->CurRoom.QRFlags2 & QR2_SELFLIST) != 0) {
- current_value = 1;
- }
- else {
- current_value = 0;
- }
-
- if (newval == 1) {
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST;
- }
- else if (newval == 0) {
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST;
- }
- else {
- return(current_value);
- }
-
- if (newval != current_value) {
- SetCurrentRoomFlags(&WCC->CurRoom);
- }
-
- return(newval);
-
-}
-
-
-
-/*
- * Toggle self-service list subscription
- */
-void toggle_self_service(void) {
- wcsession *WCC = WC;
-
- if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
- return;
-
- if (yesbstr("QR2_SelfList"))
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SELFLIST;
- else
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SELFLIST;
-
- if (yesbstr("QR2_SMTP_PUBLIC"))
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
- else
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
-
- if (yesbstr("QR2_Moderated"))
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_MODERATED;
- else
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_MODERATED;
- if (yesbstr("QR2_SubsOnly"))
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 | QR2_SMTP_PUBLIC;
- else
- WCC->CurRoom.QRFlags2 = WCC->CurRoom.QRFlags2 & ~QR2_SMTP_PUBLIC;
-
- SetCurrentRoomFlags (&WCC->CurRoom);
-
- http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
-}
-
-
-
-/*
- * save new parameters for a room
- */
-void editroom(void)
-{
- wcsession *WCC = WC;
- const StrBuf *Ptr;
- const StrBuf *er_name;
- const StrBuf *er_password;
- const StrBuf *er_dirname;
- const StrBuf *er_roomaide;
- unsigned er_flags;
- unsigned er_flags2;
- int succ1, succ2;
-
- if (!havebstr("ok_button")) {
- strcpy(WC->ImportantMessage,
- _("Cancelled. Changes were not saved."));
- http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
- return;
- }
- if (GetCurrentRoomFlags (&WCC->CurRoom) == 0)
- return;
-
- LoadRoomAide();
-
- er_flags = WCC->CurRoom.QRFlags;
- er_flags &= !(QR_PRIVATE | QR_PASSWORDED | QR_GUESSNAME);
-
- er_flags2 = WCC->CurRoom.QRFlags2;