]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.h
* implement conditional switches; if true will skip to next "X" with the same value.
[citadel.git] / webcit / webcit.h
index bee4cf009d07ede55f1ad8d8ebcd625b27c29042..41485b8e872c2a7d71603652754e85dc8246cd62 100644 (file)
@@ -129,9 +129,6 @@ extern locale_t wc_locales[];
 #define        LIBCITADEL_MIN          738             /* min required libcitadel ver */
 #define DEFAULT_HOST           "localhost"     /* Default Citadel server */
 #define DEFAULT_PORT           "504"
-#define LB                     (1)             /* Internal escape chars */
-#define RB                     (2)
-#define QU                     (3)
 #define TARGET                 "webcit01"      /* Target for inline URL's */
 #define HOUSEKEEPING           15              /* Housekeeping frequency */
 #define MIN_WORKER_THREADS     5
@@ -288,6 +285,7 @@ typedef struct _wcsubst {
        int wcs_type;                       /**< which type of ??? */
        char wcs_key[32];                   /**< ??? what?*/
        void *wcs_value;                    /**< ???? what?*/
+       long lvalue;                        /**< type long? keep data here */
        void (*wcs_function)(void); /**< funcion hook ???*/
 } wcsubst;
 
@@ -306,7 +304,7 @@ typedef struct _TemplateToken {
        size_t TokenStart;
        size_t TokenEnd;
        const char *pTokenEnd;
-       int IsGettext;
+       int Flags;
 
        const char *pName;
        size_t NameEnd;
@@ -316,6 +314,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, 
@@ -324,6 +323,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);
@@ -332,16 +343,19 @@ void RegisterITERATOR(const char *Name, long len,
                      RetrieveHashlistFunc GetHash, 
                      SubTemplFunc DoSubTempl,
                      HashDestructorFunc Destructor);
-#define RegisterIterator(a, b, c, d) RegisterITERATOR(a, sizeof(a)-1, b, c, d)
+#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 */
+       WCS_LONG          /**< its an integer */
 };
 
 /**
@@ -353,6 +367,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... */
 };
 
 /**
@@ -520,6 +535,9 @@ extern HashList *TemplateCache;
 extern HashList *LocalTemplateCache;
 extern HashList *GlobalNS;
 extern HashList *Iterators;
+extern HashList *ZoneHash;
+extern HashList *Contitionals;
+
 
 void InitialiseSemaphores(void);
 void begin_critical_section(int which_one);
@@ -553,6 +571,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);
 
@@ -587,8 +606,14 @@ int YESBSTR(char *key);
 const char *BSTR(char *key);
 const char *Bstr(char *key, size_t keylen);
 
-void urlescputs(char *);
-void hurlescputs(char *);
+
+
+void UrlescPutStrBuf(const StrBuf *strbuf);
+void StrEscPuts(const StrBuf *strbuf);
+void StrEscputs1(const StrBuf *strbuf, int nbsp, int nolinebreaks);
+
+void urlescputs(const char *);
+void hurlescputs(const char *);
 void jsesc(char *, size_t, char *);
 void jsescputs(char *);
 void output_headers(    int do_httpheaders,
@@ -656,12 +681,17 @@ 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);
 void SVCallback(char *keyname, size_t keylen,  var_callback_fptr fcn_ptr);
 #define svcallback(a, b) SVCallback(a, sizeof(a) - 1, b)
 
+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);
 
@@ -815,7 +845,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