X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Froomops.c;h=982dfd8879c8e4864fd9c793946603bd92fefe34;hb=5669e907fb3ae48d363283f55d69907422971bd2;hp=e49816b75e7607c848b13a4dc11ab64c53e39284;hpb=50ad219614464de0fd2a64d2f924ec276fc4820a;p=citadel.git
diff --git a/webcit/roomops.c b/webcit/roomops.c
index e49816b75..982dfd887 100644
--- a/webcit/roomops.c
+++ b/webcit/roomops.c
@@ -231,51 +231,6 @@ void zapped_list(void)
wDumpContent(1);
}
-
-/*
- * read this room's info file (set v to 1 for verbose mode)
- */
-void readinfo(StrBuf *Target, WCTemplputParams *TP)
-{
- char buf[256];
- char briefinfo[128];
- char fullinfo[8192];
- int fullinfo_len = 0;
-
- serv_puts("RINF");
- serv_getln(buf, sizeof buf);
- if (buf[0] == '1') {
-
- while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
- if (fullinfo_len < (sizeof fullinfo - sizeof buf)) {
- strcpy(&fullinfo[fullinfo_len], buf);
- fullinfo_len += strlen(buf);
- }
- }
-
- safestrncpy(briefinfo, fullinfo, sizeof briefinfo);
- strcpy(&briefinfo[50], "...");
-
- wc_printf("
"
- );
- escputs(briefinfo);
- wc_printf("
");
- wc_printf("
",
- _("Close window")
- );
- escputs(fullinfo);
- wc_printf("
");
- }
- else {
- wc_printf(" ");
- }
-}
-
-
/*
* Display the current view and offer an option to change it
*/
@@ -391,7 +346,6 @@ void embed_room_banner(char *got, int navbar_style) {
extract_int(&got[4], 2),
with_files
);
- svcallback("ROOMINFO", readinfo);
svcallback("VIEWOMATIC", embed_view_o_matic);
svcallback("START", offer_start_page);
@@ -948,6 +902,56 @@ int ConditionalThisRoomXHavePic(StrBuf *Target, WCTemplputParams *TP)
return WCC->CurRoom.XHaveRoomPic == 1;
}
+void LoadXRoomInfoText(void)
+{
+ wcsession *WCC = WC;
+ StrBuf *Buf;
+ int Done = 0;
+
+ if (WCC->CurRoom.XHaveInfoTextLoaded)
+ return;
+
+ WCC->CurRoom.XHaveInfoTextLoaded = 1;
+ Buf = NewStrBuf();
+
+ serv_puts("RINF");
+
+ StrBuf_ServGetln(Buf);
+ if (GetServerStatus(Buf, NULL) == 1) {
+ WCC->CurRoom.XInfoText = NewStrBuf ();
+
+ while (!Done && StrBuf_ServGetln(Buf)>=0) {
+ if ( (StrLength(Buf)==3) &&
+ !strcmp(ChrPtr(Buf), "000"))
+ Done = 1;
+ else
+ StrBufAppendBuf(WCC->CurRoom.XInfoText, Buf, 0);
+ }
+ }
+
+ FreeStrBuf (&Buf);
+}
+
+int ConditionalThisRoomXHaveInfoText(StrBuf *Target, WCTemplputParams *TP)
+{
+ wcsession *WCC = WC;
+
+ if (WCC == NULL)
+ return 0;
+
+ LoadXRoomInfoText();
+ return (StrLength(WCC->CurRoom.XInfoText)>0);
+}
+
+void tmplput_CurrentRoomInfoText(StrBuf *Target, WCTemplputParams *TP)
+{
+ wcsession *WCC = WC;
+
+ LoadXRoomInfoText();
+
+ StrBufAppendTemplate(Target, TP, WCC->CurRoom.XAPass, 1);
+}
+
void tmplput_CurrentRoomPass(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
@@ -3448,9 +3452,12 @@ InitModule_ROOMOPS
RegisterNamespace("THISROOM:DIRECTORY", 0, 1, tmplput_CurrentRoomDirectory, NULL, CTX_NONE);
RegisterNamespace("THISROOM:ORDER", 0, 0, tmplput_CurrentRoomOrder, NULL, CTX_NONE);
RegisterNamespace("THISROOM:DEFAULT_VIEW", 0, 0, tmplput_CurrentRoomDefView, NULL, CTX_NONE);
+ RegisterNamespace("THISROOM:INFOTEXT", 1, 2, tmplput_CurrentRoomInfoText, NULL, CTX_NONE);
RegisterConditional(HKEY("COND:THISROOM:ORDER"), 0, ConditionalThisRoomOrder, CTX_NONE);
RegisterConditional(HKEY("COND:THISROOM:DEFAULT_VIEW"), 0, ConditionalThisRoomDefView, CTX_NONE);
RegisterConditional(HKEY("COND:THISROOM:HAVE_PIC"), 0, ConditionalThisRoomXHavePic, CTX_NONE);
+ RegisterConditional(HKEY("COND:THISROOM:HAVE_INFOTEXT"), 0, ConditionalThisRoomXHaveInfoText, CTX_NONE);
+
REGISTERTokenParamDefine(QR_PERMANENT);
REGISTERTokenParamDefine(QR_INUSE);