From 5b9736dec3d511d35fb4a86ff913afcf9d7a811c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Thu, 6 Nov 2008 19:28:19 +0000 Subject: [PATCH] * upgrade hash retriever function, it now takes the usual cloud of parameters as all the others. --- webcit/inetconf.c | 8 ++++---- webcit/messages.c | 24 +++++++++++++++++++----- webcit/netconf.c | 8 ++++---- webcit/subst.c | 2 +- webcit/useredit.c | 2 +- webcit/webcit.h | 2 +- webcit/who.c | 2 +- 7 files changed, 31 insertions(+), 17 deletions(-) diff --git a/webcit/inetconf.c b/webcit/inetconf.c index b19fc242a..126e4afae 100644 --- a/webcit/inetconf.c +++ b/webcit/inetconf.c @@ -396,7 +396,7 @@ void DeleteInetConfHash(StrBuf *Target, int nArgs, WCTemplateToken *Token, void } -HashList *GetInetConfHash(WCTemplateToken *Token) +HashList *GetInetConfHash(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) { struct wcsession *WCC = WC; void *vHash; @@ -404,10 +404,10 @@ HashList *GetInetConfHash(WCTemplateToken *Token) if (WCC->InetCfg == NULL) load_inetconf(); GetHash(WCC->InetCfg, - Token->Params[2]->Start, - Token->Params[2]->len, + Tokens->Params[2]->Start, + Tokens->Params[2]->len, &vHash); - svprintf(HKEY("SERVCFG:INET:TYPE"), WCS_STRING, Token->Params[2]->Start); + svprintf(HKEY("SERVCFG:INET:TYPE"), WCS_STRING, Tokens->Params[2]->Start); return vHash; } diff --git a/webcit/messages.c b/webcit/messages.c index e83f9649c..8480ce618 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -811,6 +811,19 @@ void render_MAIL_UNKNOWN(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *Foun +HashList *iterate_get_mime(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) +{ + return NULL; +} + + +void tmplput_MIME_ATTACH(StrBuf *TemplBuffer, void *Context, WCTemplateToken *Token) +{ +} + + + + /* * Look for URL's embedded in a buffer and make them linkable. We use a @@ -3878,6 +3891,12 @@ InitModule_MSG RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY, CTX_MAILSUM); + RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM); + RegisterConditional(HKEY("COND:MAIL:SUMM:H_NODE"), 0, Conditional_MAIL_SUMM_H_NODE, CTX_MAILSUM); + RegisterConditional(HKEY("COND:MAIL:SUMM:OTHERNODE"), 0, Conditional_MAIL_SUMM_OTHERNODE, CTX_MAILSUM); + + + RegisterIterator("MAIL:MIME:ATTACH", 0, NULL, iterate_get_mime, tmplput_MIME_ATTACH, NULL, CTX_MAILSUM); RegisterMimeRenderer(HKEY("text/x-citadel-variformat"), render_MAIL_variformat); RegisterMimeRenderer(HKEY("text/plain"), render_MAIL_text_plain); @@ -3885,11 +3904,6 @@ InitModule_MSG RegisterMimeRenderer(HKEY("text/html"), render_MAIL_html); RegisterMimeRenderer(HKEY(""), render_MAIL_UNKNOWN); - - RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM); - RegisterConditional(HKEY("COND:MAIL:SUMM:H_NODE"), 0, Conditional_MAIL_SUMM_H_NODE, CTX_MAILSUM); - RegisterConditional(HKEY("COND:MAIL:SUMM:OTHERNODE"), 0, Conditional_MAIL_SUMM_OTHERNODE, CTX_MAILSUM); - RegisterMsgHdr(HKEY("nhdr"), examine_nhdr, 0); RegisterMsgHdr(HKEY("type"), examine_type, 0); RegisterMsgHdr(HKEY("from"), examine_from, 0); diff --git a/webcit/netconf.c b/webcit/netconf.c index 521c765a7..dcdfe4316 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -81,7 +81,7 @@ void SerializeNode(NodeConf *Node, StrBuf *Buf) } -HashList *load_netconf(WCTemplateToken *Token) +HashList *load_netconf(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) { StrBuf *Buf; HashList *Hash; @@ -183,7 +183,7 @@ void edit_node(void) { return; } - NodeConfig = load_netconf(NULL); + NodeConfig = load_netconf(NULL, 0, NULL, NULL, CTX_NONE); Put(NodeConfig, ChrPtr(Index), StrLength(Index), NewNode, DeleteNodeConf); save_net_conf(NodeConfig); DeleteHash(&NodeConfig); @@ -282,7 +282,7 @@ void display_edit_node(void) return; } - NodeConfig = load_netconf(NULL); + NodeConfig = load_netconf(NULL, 0, NULL, NULL, CTX_NONE); if (!GetHash(NodeConfig, ChrPtr(Index), StrLength(Index), &vNode) || (vNode == NULL)) { sprintf(WC->ImportantMessage, _("Invalid Parameter")); @@ -477,7 +477,7 @@ void delete_node(void) return; } - NodeConfig = load_netconf(NULL); + NodeConfig = load_netconf(NULL, 0, NULL, NULL, CTX_NONE); if (!GetHash(NodeConfig, ChrPtr(Index), StrLength(Index), &vNode) || (vNode == NULL)) { sprintf(WC->ImportantMessage, _("Invalid Parameter")); diff --git a/webcit/subst.c b/webcit/subst.c index 6ede4a74c..cca998a40 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -1369,7 +1369,7 @@ void tmpl_iterate_subtmpl(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, vo } if (It->StaticList == NULL) - List = It->GetHash(Tokens); + List = It->GetHash(Target, nArgs, Tokens, Context, ContextType); else List = It->StaticList; diff --git a/webcit/useredit.c b/webcit/useredit.c index 1f6093bd5..77c98e667 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -273,7 +273,7 @@ int ComparenPostsRev(const void *vUser1, const void *vUser2) } -HashList *iterate_load_userlist(WCTemplateToken *Token) +HashList *iterate_load_userlist(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) { HashList *Hash; char buf[SIZ]; diff --git a/webcit/webcit.h b/webcit/webcit.h index a479f5f4c..59a361e8e 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -334,7 +334,7 @@ void RegisterConditional(const char *Name, long len, typedef void (*SubTemplFunc)(StrBuf *TemplBuffer, void *Context, WCTemplateToken *Token); -typedef HashList *(*RetrieveHashlistFunc)(WCTemplateToken *Token); +typedef HashList *(*RetrieveHashlistFunc)(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType); typedef void (*HashDestructorFunc) (HashList **KillMe); void RegisterITERATOR(const char *Name, long len, int AdditionalParams, diff --git a/webcit/who.c b/webcit/who.c index a2ecd9a3c..5b011690d 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -447,7 +447,7 @@ void _terminate_session(void) { terminate_session(); } -HashList *GetWholistHash(WCTemplateToken *Token) +HashList *GetWholistHash(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType) { HashList *List; char buf[SIZ]; -- 2.30.2