* shortcut notation to tokens for hashkeys; TKEY(n) will make str,len for Hash access
[citadel.git] / webcit / webcit.h
index 1303daf8b732271c4ded77cb02cc94c31c2c0cf0..73dce523e2ba77c7d9e76bf402bd6b00d055ec1f 100644 (file)
@@ -55,9 +55,6 @@
 #endif
 #include <libintl.h>
 #include <locale.h>
-#ifdef HAVE_USELOCALE
-extern locale_t wc_locales[];
-#endif
 #define _(string)      gettext(string)
 #else
 #define _(string)      (string)
@@ -274,6 +271,8 @@ typedef struct _TemplateParam {
        long lvalue;
 } TemplateParam;
 
+/* make a template token a lookup key: */
+#define TKEY(a) Tokens->Params[a]->Start, Tokens->Params[a]->len
 typedef struct _TemplateToken {
        const StrBuf *FileName; /* Reference to print error messages; not to be freed */
        StrBuf *FlatToken;
@@ -319,7 +318,6 @@ typedef struct _wcsubst {
 #define CTX_USERLIST 8
 #define CTX_MAILSUM 9
 #define CTX_MIME_ATACH 10
-#define CTX_ATT 11
 #define CTX_STRBUF 12
 #define CTX_LONGVECTOR 13
 
@@ -410,17 +408,6 @@ enum {
        WCS_LONG          /* its an integer */
 };
 
-/*
- * \brief mail attachment ???
- */
-typedef struct _wc_attachment {
-       size_t length;                     /* length of the contenttype */
-       StrBuf *content_type;      /* the content itself ???*/
-       StrBuf *filename;                  /* the filename hooked to this content ??? */
-       char *data;                /* the data pool; aka this content */
-       long lvalue;               /* if we put a long... */
-} wc_attachment;
-void free_attachment(void *vattach);
 
 
 typedef struct wc_mime_attachment wc_mime_attachment;
@@ -436,9 +423,6 @@ struct wc_mime_attachment {
        StrBuf *Data;
        size_t length;                     /* length of the mimeatachment */
        long size_known;
-       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... */
        long msgnum;            /**< the message number on the citadel server derived from message_summary */
        RenderMimeFunc Renderer;
@@ -551,8 +535,9 @@ enum {
  * One of these is kept for each active Citadel session.
  * HTTP transactions are bound to one at a time.
  */
+typedef struct wcsession wcsession;
 struct wcsession {
-       struct wcsession *next;                 /**< Linked list */
+       wcsession *next;                        /**< Linked list */
        int wc_session;                         /**< WebCit session ID */
        char wc_username[128];                  /**< login name of current user */
        char wc_fullname[128];                  /**< Screen name of current user */
@@ -617,6 +602,7 @@ struct wcsession {
        int time_format_cache;                  /**< which timeformat does our user like? */
        StrBuf *UrlFragment1;                   /**< first urlfragment, if NEED_URL is specified by the handler*/
        StrBuf *UrlFragment2;                   /**< second urlfragment, if NEED_URL is specified by the handler*/
+       StrBuf *UrlFragment3;                   /**< third urlfragment, if NEED_URL is specified by the handler*/
        StrBuf *WBuf;                           /**< Our output buffer */
        StrBuf *HBuf;                           /**< Our HeaderBuffer */
        StrBuf *CLineBuf;                       /**< linebuffering client stuff */
@@ -743,6 +729,15 @@ void wDumpContent(int);
 int Flathash(const char *str, long len);
 
 
+
+/* URL / Mime Post parsing -> paramhandling.c */
+void upload_handler(char *name, char *filename, char *partnum, char *disp,
+                   void *content, char *cbtype, char *cbcharset,
+                   size_t length, char *encoding, char *cbid, void *userdata);
+
+void ParseURLParams(StrBuf *url);
+
+
 /* These may return NULL if not foud */
 #define sbstr(a) SBstr(a, sizeof(a) - 1)
 const StrBuf *SBSTR(const char *key);
@@ -772,6 +767,9 @@ int YESBSTR(const char *key);
 #define bstr(a) (char*) Bstr(a, sizeof(a) - 1)
 const char *BSTR(const char *key);
 const char *Bstr(const char *key, size_t keylen);
+/* if you want to ease some parts by just parametring yourself... */
+#define putbstr(a, b) PutBstr(a, sizeof(a) - 1, b)
+void PutBstr(const char *key, long keylen, StrBuf *Value);
 
 
 
@@ -792,7 +790,7 @@ void output_headers(    int do_httpheaders,
 void wprintf(const char *format,...)__attribute__((__format__(__printf__,1,2)));
 void hprintf(const char *format,...)__attribute__((__format__(__printf__,1,2)));
 void output_static(char *what);
-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);
@@ -806,9 +804,25 @@ void stripout(char *str, char leftboundary, char rightboundary);
 void dump_vars(void);
 void embed_main_menu(void);
 void serv_read(char *buf, int bytes);
-void readloop(char *oper);
+
+enum {
+       do_search,
+       headers,
+       readfwd,
+       readnew,
+       readold
+};
+
+typedef void (*readloop_servcmd)(char *buf, long bufsize);
+
+typedef struct _readloopstruct {
+       ConstStr name;
+       readloop_servcmd cmd;
+} readloop_struct;
+void readloop(long oper);
 int  read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, int printable_view, const StrBuf *section);
 void do_addrbook_view(addrbookent *addrbook, int num_ab);
+void fetch_ab_name(message_summary *Msg, char *namebuf);
 void display_vcard(StrBuf *Target, const char *vcard_source, char alpha, int full, char *storename, long msgnum);
 void text_to_server(char *ptr);
 void text_to_server_qp(char *ptr);
@@ -890,13 +904,11 @@ StrBuf *get_ROOM_PREFS(const char *key, size_t keylen);
 #define set_room_pref(a, b, c) set_ROOM_PREFS(a, sizeof(a) - 1, b, c)
 void set_ROOM_PREFS(const char *key, size_t keylen, StrBuf *value, int save_to_server);
 
-int is_msg_in_mset(char *mset, long msgnum);
 void display_addressbook(long msgnum, char alpha);
 void offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType);
 void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext);
 void output_html(const char *, int, int, StrBuf *, StrBuf *);
 void do_listsub(void);
-void toggle_self_service(void);
 ssize_t write(int fd, const void *buf, size_t count);
 void cal_process_attachment(wc_mime_attachment *Mime);
 void load_calendar_item(message_summary *Msg, int unread, struct calview *c);
@@ -909,8 +921,8 @@ void render_calendar_view(struct calview *c);
 void do_tasks_view(void);
 void calendar_summary_view(void);
 int load_msg_ptrs(char *servcmd, int with_headers);
-void free_attachments(struct wcsession *sess);
-void free_march_list(struct wcsession *wcf);
+void free_attachments(wcsession *sess);
+void free_march_list(wcsession *wcf);
 void display_rules_editor_inner_div(void);
 void generate_uuid(char *);
 void CtdlMakeTempFileName(char *, int);