-/**
- * \brief Back end for change_view()
- * \param newview set newview???
- */
-void do_change_view(int newview) {
- char buf[SIZ];
-
- serv_printf("VIEW %d", newview);
- serv_getln(buf, sizeof buf);
- WC->CurRoom.view = newview;
- smart_goto(WC->CurRoom.name);
-}
-
-
-
-/**
- * \brief Change the view for this room
- */
-void change_view(void) {
- int view;
-
- view = lbstr("view");
- do_change_view(view);
-}
-
-/**
- * \brief Do either a known rooms list or a folders list, depending on the
- * user's preference
- */
-void knrooms(void)
-{
- StrBuf *ListView = NULL;
-
- /** Determine whether the user is trying to change views */
- if (havebstr("view")) {
- ListView = NewStrBufDup(SBSTR("view"));
- set_preference("roomlistview", ListView, 1);
- }
- /** Sanitize the input so its safe */
- if((get_preference("roomlistview", &ListView) != 0)||
- ((strcasecmp(ChrPtr(ListView), "folders") != 0) &&
- (strcasecmp(ChrPtr(ListView), "table") != 0)))
- {
- if (ListView == NULL) {
- ListView = NewStrBufPlain(HKEY("rooms"));
- set_preference("roomlistview", ListView, 0);
- ListView = NULL;
- }
- else {
- ListView = NewStrBufPlain(HKEY("rooms"));
- set_preference("roomlistview", ListView, 0);
- ListView = NULL;
- }
- }
- FreeStrBuf(&ListView);
- url_do_template();
-}
-
-
-
-/**
- * \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)