X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fwebcit.h;h=2f3e17c1b007f887a99d34b87383b059127025fb;hb=81a67b38b8603e190afb77f1e8bd3bdcad39517a;hp=ce0be5daab2a10a80aafe72937c98f4cda7020f8;hpb=e05f1216dfd424d4a3eb4bb3db6f8100803d22ba;p=citadel.git diff --git a/webcit/webcit.h b/webcit/webcit.h index ce0be5daa..2f3e17c1b 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -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 109 /* min required libcitadel ver */ +#define LIBCITADEL_MIN 111 /* 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? */ }; /** @@ -383,7 +384,7 @@ 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 */ @@ -458,6 +459,7 @@ extern int setup_wizard; extern char wizard_filename[]; extern time_t if_modified_since; extern int follow_xff; +extern HashList *HandlerHash; void do_setup_wizard(void); @@ -501,7 +503,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 *); @@ -517,7 +545,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); @@ -655,6 +683,7 @@ void display_calendar(long msgnum, int unread); void display_task(long msgnum, int unread); void display_note(long msgnum, int unread); void updatenote(void); +void ajax_update_note(void); void do_calendar_view(void); void do_tasks_view(void); void free_calendar_buffer(void); @@ -731,7 +760,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); @@ -796,6 +825,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 ""