From: Wilfried Goesgens Date: Mon, 2 May 2011 19:50:04 +0000 (+0000) Subject: add new token MSG:NATTACH to output the number of currently uploaded attachments X-Git-Tag: v8.11~773 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=358d851f0ef8dbee3ad77f56ebd1046af1b15fa5 add new token MSG:NATTACH to output the number of currently uploaded attachments --- 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);