* BIG shuffle:
[citadel.git] / webcit / webcit.h
index 4aa951252ea98f3a7b0f5f4876a553d8ea24cd84..51462a1a40d96f69bc489012e523caf40f4cad40 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)
@@ -260,7 +257,13 @@ struct roomlisting {
 
 #define TYPE_STR   1
 #define TYPE_LONG  2
+#define TYPE_PREFSTR 3
+#define TYPE_PREFINT 4
+#define TYPE_GETTEXT 5
+#define TYPE_BSTR 6
 #define MAXPARAM  20
+
+
 typedef struct _TemplateParam {
        const char *Start;
        int Type;
@@ -313,9 +316,9 @@ typedef struct _wcsubst {
 #define CTX_USERLIST 8
 #define CTX_MAILSUM 9
 #define CTX_MIME_ATACH 10
-#define CTX_ATT 11
-#define CTX_GVEA 12
-#define CTX_GVSN 13
+#define CTX_STRBUF 12
+#define CTX_LONGVECTOR 13
+
 
 void RegisterNS(const char *NSName, long len, 
                int nMinArgs, 
@@ -326,6 +329,7 @@ void RegisterNS(const char *NSName, long len,
 
 typedef int (*WCConditionalFunc)(WCTemplateToken *Token, void *Context, int ContextType);
 typedef struct _ConditionalStruct {
+       const char *PlainName;
        int nParams;
        int ContextRequired;
        WCConditionalFunc CondF;
@@ -350,6 +354,12 @@ void RegisterITERATOR(const char *Name, long len, /* Our identifier */
                      int XPectContextType);         /* which context do we expct to be called in? */
 #define RegisterIterator(a, b, c, d, e, f, g, h) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f, g, h)
 
+void GetTemplateTokenString(WCTemplateToken *Tokens,
+                           int N, 
+                           const char **Value, 
+                           long *len);
+
+
 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);
@@ -375,7 +385,13 @@ void StrBufAppendTemplate(StrBuf *Target,
                          WCTemplateToken *Tokens,
                          void *Context, int ContextType,
                          const StrBuf *Source, int FormatTypeIndex);
-
+CompareFunc RetrieveSort(long ContextType, const char *OtherPrefix, 
+                        const char *Default, long ldefault, long DefaultDirection);
+void RegisterSortFunc(const char *name, long len, 
+                     const char *prepend, long preplen,
+                     CompareFunc Forward, 
+                     CompareFunc Reverse, 
+                     long ContextType);
 
 
 /*
@@ -390,17 +406,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;
@@ -416,9 +421,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;
@@ -462,6 +464,7 @@ typedef struct _message_summary {
        wc_mime_attachment *MsgBody;
 } message_summary;
 void DestroyMessageSummary(void *vMsg);
+inline message_summary* GetMessagePtrAt(int n, HashList *Summ);
 
 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
 
@@ -567,7 +570,6 @@ struct wcsession {
        int killthis;                           /**< Nonzero == purge this session */
        struct march *march;                    /**< march mode room list */
        char reply_to[512];                     /**< reply-to address */
-       long msgarr[10000];                     /**< for read operations */
        HashList *summ;                         /**< list of messages for mailbox summary view */
        int is_mobile;                  /**< Client is a handheld browser */
        HashList *urlstrings;                   /**< variables passed to webcit in a URL */
@@ -597,6 +599,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 */
@@ -680,6 +683,7 @@ extern HashList *ZoneHash;
 extern HashList *Conditionals;
 extern HashList *MsgHeaderHandler;
 extern HashList *MimeRenderHandler;
+extern HashList *SortHash;
 
 void InitialiseSemaphores(void);
 void begin_critical_section(int which_one);
@@ -695,7 +699,7 @@ void cookie_to_stuff(StrBuf *cookie, int *session,
 void locate_host(char *, int);
 void become_logged_in(char *, char *, char *);
 void openid_manual_create(void);
-void display_login(char *mesg);
+void display_login();
 void display_openids(void);
 void do_welcome(void);
 void do_logout(void);
@@ -722,6 +726,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);
@@ -771,7 +784,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);
@@ -785,9 +798,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);
@@ -875,7 +904,6 @@ void offer_start_page(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *C
 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);