final touches on dkim test harness
[citadel.git] / webcit / subst.h
index 30c3a6b66ff743379595473b03c1c7ae81ea891e..063f46d211e0883fe2be28a773943f4fd83b661a 100644 (file)
@@ -1,5 +1,15 @@
-/**
- * @defgroup subst Template processing functions
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * subst template processing functions
  */
 
 extern HashList *Conditionals;
@@ -170,7 +180,7 @@ typedef struct _ConditionalStruct {
 typedef void (*SubTemplFunc)(StrBuf *TemplBuffer, WCTemplputParams *TP);
 typedef HashList *(*RetrieveHashlistFunc)(StrBuf *Target, WCTemplputParams *TP);
 typedef void (*HashDestructorFunc) (HashList **KillMe);
-
+typedef int (*FilterByParamFunc)(const char* key, long len, void *Context, StrBuf *Target, WCTemplputParams *TP);
 
 extern WCTemplputParams NoCtx;
 
@@ -352,13 +362,16 @@ long GetTokenDefine(const char *Name,
 
 #define IT_NOFLAG 0
 #define IT_FLAG_DETECT_GROUPCHANGE (1<<0)
-#define RegisterIterator(a, b, c, d, e, f, g, h, i) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f, g, h, i)
+#define IT_ADDT_PARAM(n) 5 + n /* If you have AdditionalParams, use this macro to fetch them. */
+#define RegisterIterator(a, b, c, d, e, f, g, h, i) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f, NULL, g, h, i)
+#define RegisterFilteredIterator(a, b, c, d, e, f, g, h, i, j) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f, g, h, i, j)
 void RegisterITERATOR(const char *Name, long len, /* Our identifier */
-                     int AdditionalParams,       /* doe we use more parameters? */
+                     int AdditionalParams,       /* do we use more parameters? */
                      HashList *StaticList,       /* pointer to webcit lifetime hashlists */
                      RetrieveHashlistFunc GetHash, /* else retrieve the hashlist by calling this function */
                      SubTemplFunc DoSubTempl,       /* call this function on each iteration for svput & friends */
                      HashDestructorFunc Destructor, /* use this function to shut down the hash; NULL if its a reference */
+                     FilterByParamFunc Filter,      /* use this function if you want to skip items */
                      CtxType ContextType,               /* which context do we provide to the subtemplate? */
                      CtxType XPectContextType,          /* which context do we expct to be called in? */
                      int Flags);