]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.h
* migrate the WHO struct to strbuf
[citadel.git] / webcit / webcit.h
index 7ca5e3ff09eb40b914e996c64d51ec71335d0d4e..7f01648f66a656a81058aa6b4582e8b0f50153bf 100644 (file)
@@ -291,13 +291,59 @@ typedef struct _wcsubst {
        void (*wcs_function)(void); /**< funcion hook ???*/
 } wcsubst;
 
+#define TYPE_STR   1
+#define TYPE_LONG  2
+#define MAXPARAM  10
+typedef struct _TemplateParam {
+       const char *Start;
+       int Type;
+       long len;
+       long lvalue;
+} TemplateParam;
+
+typedef struct _TemplateToken {
+       const char *pTokenStart;
+       size_t TokenStart;
+       size_t TokenEnd;
+       const char *pTokenEnd;
+       int IsGettext;
+
+       const char *pName;
+       size_t NameEnd;
+
+       int HaveParameters;
+       int nParameters;
+       TemplateParam *Params[MAXPARAM];
+} WCTemplateToken;
+
+typedef void (*WCHandlerFunc)(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context);
+void RegisterNS(const char *NSName, long len, 
+               int nMinArgs, 
+               int nMaxArgs, 
+               WCHandlerFunc HandlerFunc);
+#define RegisterNamespace(a, b, c, d) RegisterNS(a, sizeof(a)-1, b, c, d)
+
+
+typedef void (*SubTemplFunc)(StrBuf *TemplBuffer, void *Context);
+typedef HashList *(*RetrieveHashlistFunc)(void);
+typedef void (*HashDestructorFunc) (HashList *KillMe);
+void RegisterITERATOR(const char *Name, long len, 
+                     HashList *StaticList, 
+                     RetrieveHashlistFunc GetHash, 
+                     SubTemplFunc DoSubTempl,
+                     HashDestructorFunc Destructor);
+#define RegisterIterator(a, b, c, d, e) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e)
+
+
 /**
  * \brief Values for wcs_type
  */
 enum {
-       WCS_STRING,   /**< its a string */
-       WCS_FUNCTION, /**< its a function callback */
-       WCS_SERVCMD   /**< its a command to send to the citadel server */
+       WCS_STRING,       /**< its a string */
+       WCS_FUNCTION,     /**< its a function callback */
+       WCS_SERVCMD,      /**< its a command to send to the citadel server */
+       WCS_STRBUF,       /**< its a strbuf we own */
+       WCS_STRBUF_REF    /**< its a strbuf we mustn't free */
 };
 
 /**
@@ -470,6 +516,15 @@ extern time_t if_modified_since;
 extern int follow_xff;
 extern HashList *HandlerHash;
 extern HashList *PreferenceHooks;
+extern HashList *WirelessTemplateCache;
+extern HashList *WirelessLocalTemplateCache;
+extern HashList *TemplateCache;
+extern HashList *LocalTemplateCache;
+extern HashList *GlobalNS;
+extern HashList *Iterators;
+extern HashList *ZoneHash;
+
+
 
 void InitialiseSemaphores(void);
 void begin_critical_section(int which_one);
@@ -503,6 +558,7 @@ void who(void);
 void who_inner_div(void);
 void ajax_mini_calendar(void);
 void fmout(char *align);
+void _fmout(StrBuf *Targt, char *align);
 void pullquote_fmout(void);
 void wDumpContent(int);
 
@@ -612,7 +668,11 @@ void SVCALLBACK(char *keyname, var_callback_fptr fcn_ptr);
 void SVCallback(char *keyname, size_t keylen,  var_callback_fptr fcn_ptr);
 #define svcallback(a, b) SVCallback(a, sizeof(a) - 1, b)
 
-void do_template(void *templatename);
+void SVPUTBuf(const char *keyname, int keylen, StrBuf *Buf, int ref);
+#define SVPutBuf(a, b, c); SVPUTBuf(a, sizeof(a) - 1, b, c)
+
+void DoTemplate(const char *templatename, long len, void *Context, StrBuf *Target);
+#define do_template(a, b) DoTemplate(a, sizeof(a) -1, b, NULL);
 
 
 int lingering_close(int fd);
@@ -711,6 +771,7 @@ int ical_ctdl_is_overlap(
 void initialize_locales(void);
 void ShutdownLocale(void);
 #endif
+void TmplGettext(StrBuf *Target, int nTokens, WCTemplateToken *Token);
 
 extern char *months[];
 extern char *days[];