From 358d851f0ef8dbee3ad77f56ebd1046af1b15fa5 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Mon, 2 May 2011 19:50:04 +0000 Subject: [PATCH] add new token MSG:NATTACH to output the number of currently uploaded attachments --- webcit/msg_renderers.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 60f569ad5..7d21cf7a1 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -1221,6 +1221,11 @@ HashList *iterate_get_registered_Attachments(StrBuf *Target, WCTemplputParams *T return WC->attachments; } +void get_registered_Attachments_Count(StrBuf *Target, WCTemplputParams *TP) +{ + StrBufAppendPrintf(Target, "%ld", GetCount (WC->attachments)); +} + void servcmd_do_search(char *buf, long bufsize) { snprintf(buf, bufsize, "MSGS SEARCH|%s", bstr("query")); @@ -1498,6 +1503,8 @@ InitModule_MSGRENDERERS RegisterIterator("MSG:ATTACHNAMES", 0, NULL, iterate_get_registered_Attachments, NULL, NULL, CTX_MIME_ATACH, CTX_NONE, IT_NOFLAG); + RegisterNamespace("MSG:NATTACH", 0, 0, get_registered_Attachments_Count, NULL, CTX_NONE); + /* mime renderers translate an attachment into webcit viewable html text */ RegisterMimeRenderer(HKEY("message/rfc822"), render_MAIL, 0, 150); RegisterMimeRenderer(HKEY("text/vnote"), render_MIME_VNote, 1, 300); -- 2.30.2