From cf2cf9bc79a85b1f3749ae615b0ef0a511da4f21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Thu, 20 Nov 2008 23:40:23 +0000 Subject: [PATCH] * map room-flags into conditionals * more work on the central token escaping * finetune BSTR tokens... * finish message editing post/mail diversification * add RFCA to our message the Reply button --- webcit/messages.c | 2 + webcit/roomops.c | 140 +++++++++++++++++++++++++++++- webcit/static/t/edit_message.html | 20 ++++- webcit/static/t/view_message.html | 8 +- webcit/subst.c | 29 ++++++- webcit/webcit.c | 19 +++- webcit/webcit.h | 2 +- 7 files changed, 202 insertions(+), 18 deletions(-) diff --git a/webcit/messages.c b/webcit/messages.c index ffbfab310..1cc4fa7a8 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -2114,6 +2114,8 @@ void display_enter(void) goto DONE; } } + svputlong("RCPTREQUIRED", recipient_required); + svputlong("SUBJREQUIRED", recipient_required || subject_required); DoTemplate(HKEY("edit_message"), NULL, NULL, CTX_NONE); address_book_popup(); wDumpContent(1); diff --git a/webcit/roomops.c b/webcit/roomops.c index c87f4af0a..edbb48fd7 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -3689,7 +3689,74 @@ int ConditionalHaveUngoto(WCTemplateToken *Tokens, void *Context, int ContextTyp (strcasecmp(WCC->ugname, WCC->wc_roomname) == 0)); } -int ConditionalRoomHasQRVisidir(WCTemplateToken *Tokens, void *Context, int ContextType) + + + +int ConditionalRoomHas_QR_PERMANENT(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_PERMANENT) != 0)); +} + +int ConditionalRoomHas_QR_INUSE(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_INUSE) != 0)); +} + +int ConditionalRoomHas_QR_PRIVATE(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_PRIVATE) != 0)); +} + +int ConditionalRoomHas_QR_PASSWORDED(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_PASSWORDED) != 0)); +} + +int ConditionalRoomHas_QR_GUESSNAME(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_GUESSNAME) != 0)); +} + +int ConditionalRoomHas_QR_DIRECTORY(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_DIRECTORY) != 0)); +} + +int ConditionalRoomHas_QR_UPLOAD(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_UPLOAD) != 0)); +} + +int ConditionalRoomHas_QR_DOWNLOAD(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_DOWNLOAD) != 0)); +} + +int ConditionalRoomHas_QR_VISDIR(WCTemplateToken *Tokens, void *Context, int ContextType) { struct wcsession *WCC = WC; @@ -3697,6 +3764,59 @@ int ConditionalRoomHasQRVisidir(WCTemplateToken *Tokens, void *Context, int Cont ((WCC->room_flags & QR_VISDIR) != 0)); } +int ConditionalRoomHas_QR_ANONONLY(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_ANONONLY) != 0)); +} + +int ConditionalRoomHas_QR_ANONOPT(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_ANONOPT) != 0)); +} + +int ConditionalRoomHas_QR_NETWORK(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_NETWORK) != 0)); +} + +int ConditionalRoomHas_QR_PREFONLY(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_PREFONLY) != 0)); +} + +int ConditionalRoomHas_QR_READONLY(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_READONLY) != 0)); +} + +int ConditionalRoomHas_QR_MAILBOX(WCTemplateToken *Tokens, void *Context, int ContextType) +{ + struct wcsession *WCC = WC; + + return ((WCC!=NULL) && + ((WCC->room_flags & QR_MAILBOX) != 0)); +} + + + + + + int ConditionalHaveRoomeditRights(WCTemplateToken *Tokens, void *Context, int ContextType) { struct wcsession *WCC = WC; @@ -3736,7 +3856,23 @@ InitModule_ROOMOPS WebcitAddUrlHandler(HKEY("set_floordiv_expanded"), set_floordiv_expanded, NEED_URL|AJAX); WebcitAddUrlHandler(HKEY("changeview"), change_view, 0); RegisterNamespace("ROOMBANNER", 0, 0, tmplput_roombanner, 0); - RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHasQRVisidir, CTX_NONE); + + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_INUSE"), 0, ConditionalRoomHas_QR_INUSE, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PRIVATE"), 0, ConditionalRoomHas_QR_PRIVATE, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PASSWORDED"), 0, ConditionalRoomHas_QR_PASSWORDED, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_GUESSNAME"), 0, ConditionalRoomHas_QR_GUESSNAME, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DIRECTORY"), 0, ConditionalRoomHas_QR_DIRECTORY, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_UPLOAD"), 0, ConditionalRoomHas_QR_UPLOAD, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_DOWNLOAD"), 0, ConditionalRoomHas_QR_DOWNLOAD, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_VISIDIR"), 0, ConditionalRoomHas_QR_VISDIR, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONONLY"), 0, ConditionalRoomHas_QR_ANONONLY, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_ANONOPT"), 0, ConditionalRoomHas_QR_ANONOPT, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_NETWORK"), 0, ConditionalRoomHas_QR_NETWORK, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PREFONLY"), 0, ConditionalRoomHas_QR_PREFONLY, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_READONLY"), 0, ConditionalRoomHas_QR_READONLY, CTX_NONE); + RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_MAILBOX"), 0, ConditionalRoomHas_QR_MAILBOX, CTX_NONE); + RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE); RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE); diff --git a/webcit/static/t/edit_message.html b/webcit/static/t/edit_message.html index 67e96dd62..3c02d02cf 100644 --- a/webcit/static/t/edit_message.html +++ b/webcit/static/t/edit_message.html @@ -12,8 +12,9 @@ ">

- ">   - ">  TODO +"> +">">

@@ -22,11 +23,20 @@ + + + + + + " size=45 maxlength=1000 /> @@ -53,10 +63,12 @@ + + " size=45 maxlength=70> diff --git a/webcit/static/t/view_message.html b/webcit/static/t/view_message.html index 058816792..99fde203c 100644 --- a/webcit/static/t/view_message.html +++ b/webcit/static/t/view_message.html @@ -5,14 +5,14 @@ onMouseOut=document.getElementById("msg").style.visibility="hidden
- ">"" -<> - @ + +">""<> +"> @ ***