-
-
-/**
- * \brief Set the message expire policy for this room and/or floor
- */
-void set_room_policy(void) {
- char buf[SIZ];
-
- if (!havebstr("ok_button")) {
- strcpy(WC->ImportantMessage,
- _("Cancelled. Changes were not saved."));
- http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
- return;
- }
-
- serv_printf("SPEX roompolicy|%d|%d", ibstr("roompolicy"), ibstr("roomvalue"));
- serv_getln(buf, sizeof buf);
- strcpy(WC->ImportantMessage, &buf[4]);
-
- if (WC->axlevel >= 6) {
- strcat(WC->ImportantMessage, "<br />\n");
- serv_printf("SPEX floorpolicy|%d|%d", ibstr("floorpolicy"), ibstr("floorvalue"));
- serv_getln(buf, sizeof buf);
- strcat(WC->ImportantMessage, &buf[4]);
- }
- ReloadCurrentRoom();
- http_transmit_thing(ChrPtr(do_template("room_edit", NULL)), 0);
-}
-
-void tmplput_RoomName(StrBuf *Target, WCTemplputParams *TP)
-{
- StrBufAppendTemplate(Target, TP, WC->CurRoom.name, 0);
-}
-
-void dotgoto(void) {
- if (!havebstr("room")) {
- readloop(readnew, eUseDefault);
- return;
- }
- if (WC->CurRoom.view != VIEW_MAILBOX) { /* dotgoto acts like dotskip when we're in a mailbox view */
- slrp_highest();
- }
- smart_goto(sbstr("room"));
-}
-
-
-
-void tmplput_current_room(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
-
- if (WCC != NULL)
- StrBufAppendTemplate(Target, TP,
- WCC->CurRoom.name,
- 0);
-}
-
-void tmplput_roombanner(StrBuf *Target, WCTemplputParams *TP)
-{
- wc_printf("<div id=\"banner\">\n");
- embed_room_banner();
- wc_printf("</div>\n");
-}
-
-
-void tmplput_ungoto(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
-
- if ((WCC!=NULL) &&
- (!IsEmptyStr(WCC->ugname)))
- StrBufAppendBufPlain(Target, WCC->ugname, -1, 0);
-}
-
-int ConditionalRoomAide(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- return (WCC != NULL)?
- ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) : 0;
-}
-
-int ConditionalRoomAcessDelete(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- return (WCC == NULL)? 0 :
- ( ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
- (WCC->CurRoom.is_inbox) ||
- (WCC->CurRoom.QRFlags2 & QR2_COLLABDEL) );
-}
-
-int ConditionalHaveUngoto(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
-
- return ((WCC!=NULL) &&
- (!IsEmptyStr(WCC->ugname)) &&
- (strcasecmp(WCC->ugname, ChrPtr(WCC->CurRoom.name)) == 0));
-}
-
-
-int ConditionalRoomHas_UAFlag(StrBuf *Target, WCTemplputParams *TP)
-{
- folder *Folder = (folder *)(TP->Context);
- long UA_CheckFlag;
-
- UA_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
- if (UA_CheckFlag == 0)
- LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
- "requires one of the #\"UA_*\"- defines or an integer flag 0 is invalid!");
-
- return ((Folder->RAFlags & UA_CheckFlag) != 0);
-}
-
-
-
-int ConditionalCurrentRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
-{
- long QR_CheckFlag;
- wcsession *WCC = WC;
-
- QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
- if (QR_CheckFlag == 0)
- LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
- "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
-
- if (WCC == NULL)
- return 0;
-
- if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
- (TP->Tokens->Params[2]->MaskBy == eNO))
- return (WCC->CurRoom.QRFlags & QR_CheckFlag) != 0;
- else
- return (WCC->CurRoom.QRFlags & QR_CheckFlag) == QR_CheckFlag;
-}
-
-int ConditionalRoomHas_QRFlag(StrBuf *Target, WCTemplputParams *TP)
-{
- long QR_CheckFlag;
- folder *Folder = (folder *)(TP->Context);
-
- QR_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
- if (QR_CheckFlag == 0)
- LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
- "requires one of the #\"QR*\"- defines or an integer flag 0 is invalid!");
-
- if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
- (TP->Tokens->Params[2]->MaskBy == eNO))
- return (Folder->QRFlags & QR_CheckFlag) != 0;
- else
- return (Folder->QRFlags & QR_CheckFlag) == QR_CheckFlag;
-}
-
-
-int ConditionalCurrentRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
-{
- long QR2_CheckFlag;
- wcsession *WCC = WC;
-
- QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
- if (QR2_CheckFlag == 0)
- LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
- "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
-
-
- if (WCC == NULL)
- return 0;
-
- if ((TP->Tokens->Params[2]->MaskBy == eOR) ||
- (TP->Tokens->Params[2]->MaskBy == eNO))
- return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) != 0;
- else
- return (WCC->CurRoom.QRFlags2 & QR2_CheckFlag) == QR2_CheckFlag;
-}
-
-int ConditionalRoomHas_QRFlag2(StrBuf *Target, WCTemplputParams *TP)
-{
- long QR2_CheckFlag;
- folder *Folder = (folder *)(TP->Context);
-
- QR2_CheckFlag = GetTemplateTokenNumber(Target, TP, 2, 0);
- if (QR2_CheckFlag == 0)
- LogTemplateError(Target, "Conditional", ERR_PARM1, TP,
- "requires one of the #\"QR2*\"- defines or an integer flag 0 is invalid!");
- return ((Folder->QRFlags2 & QR2_CheckFlag) != 0);
-}
-
-
-int ConditionalHaveRoomeditRights(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
-
- return ( (WCC!= NULL) &&
- ((WCC->axlevel >= 6) ||
- ((WCC->CurRoom.RAFlags & UA_ADMINALLOWED) != 0) ||
- (WCC->CurRoom.is_inbox) ));
-}
-
-int ConditionalIsRoomtype(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
-
- if ((WCC == NULL) ||
- (TP->Tokens->nParameters < 3))
- {
- return ((WCC->CurRoom.view < VIEW_BBS) ||
- (WCC->CurRoom.view > VIEW_MAX));
- }
-
- return WCC->CurRoom.view == GetTemplateTokenNumber(Target, TP, 2, VIEW_BBS);
-}
-
-
-HashList *GetWhoKnowsHash(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
- StrBuf *Line;
- StrBuf *Token;
- long State;
- HashList *Whok = NULL;
- int Done = 0;
- int n;
-
- serv_puts("WHOK");
- Line = NewStrBuf();
- StrBuf_ServGetln(Line);
- if (GetServerStatus(Line, &State) == 1)
- {
- Whok = NewHash(1, Flathash);
- while(!Done && StrBuf_ServGetln(Line))
- if ( (StrLength(Line)==3) &&
- !strcmp(ChrPtr(Line), "000"))
- {
- Done = 1;
- }
- else
- {
-
- const char *Pos = NULL;
- Token = NewStrBufPlain (NULL, StrLength(Line));
- StrBufExtract_NextToken(Token, Line, &Pos, '|');
-
- Put(Whok,
- IKEY(n),
- Token,
- HFreeStrBuf);
- n++;
- }
- }
- else if (State == 550)
- StrBufAppendBufPlain(WCC->ImportantMsg,
- _("Higher access is required to access this function."), -1, 0);
-
-
- FreeStrBuf(&Line);
- return Whok;
-}
-
-
-