]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.h
* clean some memleaks
[citadel.git] / webcit / webcit.h
index 2058b0e7b09231fb5045e4d52a63e207cf4cb01b..c71fa59ccf9f0bcbb1115d798abfc5e940ebad1e 100644 (file)
@@ -74,24 +74,7 @@ extern locale_t wc_locales[];
 #include <zlib.h>
 #endif
 
-
-/* Work around PACKAGE/VERSION defs that are (not supposed to be?) in ical.h */
-#ifdef PACKAGE
-# define CTDL_PACKAGE PACKAGE
-# undef PACKAGE
-#endif
-
-#ifdef PACKAGE_STRING
-# define CTDL_PACKAGE_STRING PACKAGE_STRING
-//# undef PACKAGE_STRING
-#endif
-
-#ifdef VERSION
-# define CTDL_VERSION VERSION
-# undef VERSION
-#endif
-
-#include <ical.h>
+#include <libical/ical.h>
 
 #undef PACKAGE
 #undef VERSION
@@ -282,9 +265,10 @@ struct roomlisting {
  * \brief Dynamic content for variable substitution in templates
  */
 typedef struct _wcsubst {
-       int wcs_type;                       /**< which type of ??? */
-       char wcs_key[32];                   /**< ??? what?*/
-       void *wcs_value;                    /**< ???? what?*/
+       int wcs_type;                       /**< which type of Substitution are we */
+       char wcs_key[32];                   /**< copy of our hashkey for debugging */
+       StrBuf *wcs_value;                  /**< if we're a string, keep it here */
+       long lvalue;                        /**< type long? keep data here */
        void (*wcs_function)(void); /**< funcion hook ???*/
 } wcsubst;
 
@@ -303,7 +287,7 @@ typedef struct _TemplateToken {
        size_t TokenStart;
        size_t TokenEnd;
        const char *pTokenEnd;
-       int IsGettext;
+       int Flags;
 
        const char *pName;
        size_t NameEnd;
@@ -313,6 +297,7 @@ typedef struct _TemplateToken {
        TemplateParam *Params[MAXPARAM];
 } WCTemplateToken;
 
+
 typedef void (*WCHandlerFunc)(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context);
 void RegisterNS(const char *NSName, long len, 
                int nMinArgs, 
@@ -321,6 +306,18 @@ void RegisterNS(const char *NSName, long len,
 #define RegisterNamespace(a, b, c, d) RegisterNS(a, sizeof(a)-1, b, c, d)
 
 
+
+typedef int (*WCConditionalFunc)(WCTemplateToken *Token, void *Context);
+typedef struct _ConditionalStruct {
+       int nParams;
+       WCConditionalFunc CondF;
+} ConditionalStruct;
+void RegisterConditional(const char *Name, long len, 
+                        int nParams,
+                        WCConditionalFunc CondF);
+
+
+
 typedef void (*SubTemplFunc)(StrBuf *TemplBuffer, void *Context);
 typedef HashList *(*RetrieveHashlistFunc)(void);
 typedef void (*HashDestructorFunc) (HashList *KillMe);
@@ -340,7 +337,8 @@ enum {
        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 */
+       WCS_STRBUF_REF,   /**< its a strbuf we mustn't free */
+       WCS_LONG          /**< its an integer */
 };
 
 /**
@@ -352,6 +350,7 @@ struct wc_attachment {
        char content_type[SIZ];    /**< the content itself ???*/
        char filename[SIZ];                /**< the filename hooked to this content ??? */
        char *data;                /**< the data pool; aka this content */
+       long lvalue;               /**< if we put a long... */
 };
 
 /**
@@ -460,7 +459,7 @@ struct wcsession {
        time_t cache_timestamp;                 /**< ??? todo */
        HashList *IconBarSetttings;             /**< which icons should be shown / not shown? */
        long current_iconbar;                   /**< What is currently in the iconbar? */
-       StrBuf *floordiv_expanded;              /**< which floordiv currently expanded */
+       const StrBuf *floordiv_expanded;        /**< which floordiv currently expanded */
        int selected_language;                  /**< Language selected by user */
        time_t last_pager_check;                /**< last time we polled for instant msgs */
        int nonce;                              /**< session nonce (to prevent session riding) */
@@ -520,7 +519,7 @@ extern HashList *LocalTemplateCache;
 extern HashList *GlobalNS;
 extern HashList *Iterators;
 extern HashList *ZoneHash;
-
+extern HashList *Contitionals;
 
 
 void InitialiseSemaphores(void);
@@ -559,7 +558,6 @@ void _fmout(StrBuf *Targt, char *align);
 void pullquote_fmout(void);
 void wDumpContent(int);
 
-
 /* These may return NULL if not foud */
 #define sbstr(a) SBstr(a, sizeof(a) - 1)
 const StrBuf *SBSTR(const char *key);
@@ -665,6 +663,8 @@ typedef void (*var_callback_fptr)();
 
 void SVPut(char *keyname, size_t keylen, int keytype, char *Data);
 #define svput(a, b, c) SVPut(a, sizeof(a) - 1, b, c)
+void SVPutLong(char *keyname, size_t keylen, long Data);
+#define svputlong(a, b) SVPutLong(a, sizeof(a) - 1, b)
 void svprintf(char *keyname, size_t keylen, int keytype, const char *format,...) __attribute__((__format__(__printf__,4,5)));
 void SVPRINTF(char *keyname, int keytype, const char *format,...) __attribute__((__format__(__printf__,3,4)));
 void SVCALLBACK(char *keyname, var_callback_fptr fcn_ptr);
@@ -676,6 +676,7 @@ void SVPUTBuf(const char *keyname, int keylen, StrBuf *Buf, int ref);
 
 void DoTemplate(const char *templatename, long len, void *Context, StrBuf *Target);
 #define do_template(a, b) DoTemplate(a, sizeof(a) -1, b, NULL);
+void url_do_template(void);
 
 
 int lingering_close(int fd);
@@ -827,7 +828,7 @@ void ssl_lock(int mode, int n, const char *file, int line);
 int starttls(int sock);
 extern SSL_CTX *ssl_ctx;  
 int client_read_ssl(char *buf, int bytes, int timeout);
-void client_write_ssl(const char *buf, int nbytes);
+void client_write_ssl(const StrBuf *Buf);
 #endif
 
 #ifdef HAVE_ZLIB