* migrated to new hash create signature
[citadel.git] / webcit / webcit.h
index 96977c5670bae5b30ce2622e91bfc5facfb04c94..73dba3f86001b56c3a91854fafe81d9f6220e537 100644 (file)
@@ -124,9 +124,9 @@ extern locale_t wc_locales[];
 #define PORT_NUM               2000            /* port number to listen on */
 #define DEVELOPER_ID           0
 #define CLIENT_ID              4
-#define CLIENT_VERSION         734             /* This version of WebCit */
+#define CLIENT_VERSION         735             /* This version of WebCit */
 #define MINIMUM_CIT_VERSION    730             /* min required Citadel ver */
-#define        LIBCITADEL_MIN          108             /* min required libcitadel ver */
+#define        LIBCITADEL_MIN          110             /* min required libcitadel ver */
 #define DEFAULT_HOST           "localhost"     /* Default Citadel server */
 #define DEFAULT_PORT           "504"
 #define LB                     (1)             /* Internal escape chars */
@@ -225,10 +225,11 @@ struct httprequest {
 /**
  * \brief      Linked list of session variables encoded in an x-www-urlencoded content type
  */
+typedef struct urlcontent urlcontent;
 struct urlcontent {
-       struct urlcontent *next;   /**< the next variable in the list */ 
        char url_key[32];          /**< the variable name */
        char *url_data;            /**< its value */
+       size_t url_data_size;      /**< how big is it? */
 };
 
 /**
@@ -250,6 +251,7 @@ struct serv_info {
        char serv_default_cal_zone[128];/* Default timezone for unspecified calendar items */
        int serv_supports_sieve;        /* Does the server support Sieve mail filtering? */
        int serv_fulltext_enabled;      /* Does the server have the full text index enabled? */
+       char serv_svn_revision[256];    /* SVN revision of the server */
 };
 
 
@@ -318,7 +320,7 @@ struct message_summary {
        long msgnum;            /**< the message number on the citadel server */
        char from[128];         /**< the author */
        char to[128];           /**< the recipient */
-       char subj[128];         /**< the title / subject */
+       char subj[256];         /**< the title / subject */
        int hasattachments;     /**< does it have atachments? */
        int is_new;         /**< is it yet read? */
 };
@@ -382,13 +384,11 @@ struct wcsession {
        int num_summ;                           /**< number of messages in mailbox summary view */
        struct message_summary *summ;           /**< array of messages for mailbox summary view */
        int is_wap;                             /**< Client is a WAP gateway */
-       struct urlcontent *urlstrings;          /**< variables passed to webcit in a URL */
+       HashList *urlstrings;                   /**< variables passed to webcit in a URL */
        struct wcsubst *vars;                   /**< HTTP variable substitutions for this page */
        char this_page[512];                    /**< URL of current page */
        char http_host[512];                    /**< HTTP Host: header */
        HashList *hash_prefs;                   /**< WebCit preferences for this user */
-#ifdef WEBCIT_WITH_CALENDAR_SERVICE            
-       /** \brief ical???? */                          
        struct disp_cal {                                       
                icalcomponent *cal;             /**< cal items for display */
                long cal_msgnum;                /**< cal msgids for display */
@@ -396,7 +396,6 @@ struct wcsession {
                int unread;                     /**< already seen by the user? */
        } *disp_cal;                                            
        int num_cal;                            /**< number of calendar items for display */
-#endif                                                                                 
        struct wc_attachment *first_attachment; /**< linked list of attachments for 'enter message' */
        char last_chat_user[256];               /**< ??? todo */
        char ImportantMessage[SIZ];             /**< ??? todo */
@@ -503,7 +502,33 @@ void fmout(char *align);
 void pullquote_fmout(void);
 void wDumpContent(int);
 void serv_printf(const char *format,...);
-char *bstr(char *key);
+
+/* TODO: get rid of the non-const-typecast */
+#define bstr(a) (char*) Bstr(a, sizeof(a) - 1)
+const char *BSTR(char *key);
+const char *Bstr(char *key, size_t keylen);
+
+#define xbstr(a, b) (char*) XBstr(a, sizeof(a) - 1, b)
+const char *XBstr(char *key, size_t keylen, size_t *len);
+const char *XBSTR(char *key, size_t *len);
+
+#define lbstr(a) LBstr(a, sizeof(a) - 1)
+long LBstr(char *key, size_t keylen);
+long LBSTR(char *key);
+
+#define ibstr(a) IBstr(a, sizeof(a) - 1)
+int IBstr(char *key, size_t keylen);
+int IBSTR(char *key);
+
+#define havebstr(a) HaveBstr(a, sizeof(a) - 1)
+int HaveBstr(char *key, size_t keylen);
+int HAVEBSTR(char *key);
+
+#define yesbstr(a) YesBstr(a, sizeof(a) - 1)
+int YesBstr(char *key, size_t keylen);
+int YESBSTR(char *key);
+
+
 void urlescputs(char *);
 void jsesc(char *, size_t, char *);
 void jsescputs(char *);
@@ -519,7 +544,7 @@ void display_mime_icon(void);
 void print_menu_box(char* Title, char *Class, int nLines, ...);
 long stresc(char *target, long tSize, char *strbuf, int nbsp, int nolinebreaks);
 void escputs(char *strbuf);
-void url(char *buf);
+void url(char *buf, size_t bufsize);
 void escputs1(char *strbuf, int nbsp, int nolinebreaks);
 void msgesc(char *target, size_t tlen, char *strbuf);
 void msgescputs(char *strbuf);
@@ -697,7 +722,6 @@ void display_pictureview(void);
 void download_file(char *);
 void upload_file(void);
 
-#ifdef WEBCIT_WITH_CALENDAR_SERVICE
 void display_edit_task(void);
 void save_task(void);
 void display_edit_event(void);
@@ -720,7 +744,6 @@ int ical_ctdl_is_overlap(
                         struct icaltimetype t2start,
                         struct icaltimetype t2end
 );
-#endif
 
 #ifdef ENABLE_NLS
 void initialize_locales(void);
@@ -735,7 +758,7 @@ long locate_user_vcard(char *username, long usernum);
 void sleeeeeeeeeep(int);
 void http_transmit_thing(char *thing, size_t length, const char *content_type,
                         int is_static);
-void unescape_input(char *buf);
+long unescape_input(char *buf);
 void do_iconbar(void);
 void do_iconbar_roomlist(void);
 void do_selected_iconbar(void);
@@ -800,6 +823,15 @@ extern char *hourname[];   /**< Names of hours (12am, 1am, etc.) */
 void http_datestring(char *buf, size_t n, time_t xtime);
 
 
+typedef void (*WebcitHandlerFunc)(void);
+typedef struct  _WebcitHandler{
+       WebcitHandlerFunc F;
+       int IsAjax;
+} WebcitHandler;
+void WebcitAddUrlHandler(const char * UrlString, long UrlSLen, WebcitHandlerFunc F, int IsAjax);
+
+
+
 /* These should be empty, but we have them for testing */
 #define DEFAULT_HTTPAUTH_USER  ""
 #define DEFAULT_HTTPAUTH_PASS  ""