]> code.citadel.org Git - citadel.git/blobdiff - webcit/webcit.h
* migrate message creation to templates (citing still missing)
[citadel.git] / webcit / webcit.h
index e5cc2e905c27a3f894a88c96e7218ed8e7c0850c..33fe47e2d588c29574916af9ff931ff2c328e692 100644 (file)
@@ -269,6 +269,7 @@ typedef struct _TemplateParam {
 } TemplateParam;
 
 typedef struct _TemplateToken {
+       const StrBuf *FileName; /* Reference to print error messages; not to be freed */
        StrBuf *FlatToken;
        long Line;
        const char *pTokenStart;
@@ -311,7 +312,10 @@ typedef struct _wcsubst {
 #define CTX_NODECONF 7
 #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
 
 void RegisterNS(const char *NSName, long len, 
                int nMinArgs, 
@@ -334,16 +338,17 @@ void RegisterConditional(const char *Name, long len,
 
 
 typedef void (*SubTemplFunc)(StrBuf *TemplBuffer, void *Context, WCTemplateToken *Token);
-typedef HashList *(*RetrieveHashlistFunc)(WCTemplateToken *Token);
+typedef HashList *(*RetrieveHashlistFunc)(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType);
 typedef void (*HashDestructorFunc) (HashList **KillMe);
-void RegisterITERATOR(const char *Name, long len,
-                     int AdditionalParams, 
-                     HashList *StaticList, 
-                     RetrieveHashlistFunc GetHash, 
-                     SubTemplFunc DoSubTempl,
-                     HashDestructorFunc Destructor,
-                     int ContextType);
-#define RegisterIterator(a, b, c, d, e, f, g) RegisterITERATOR(a, sizeof(a)-1, b, c, d, e, f, g)
+void RegisterITERATOR(const char *Name, long len, /* Our identifier */
+                     int AdditionalParams,       /* doe we use more parameters? */
+                     HashList *StaticList,       /* pointer to webcit lifetime hashlists */
+                     RetrieveHashlistFunc GetHash, /* else retrieve the hashlist by calling this function */
+                     SubTemplFunc DoSubTempl,       /* call this function on each iteration for svput & friends */
+                     HashDestructorFunc Destructor, /* use this function to shut down the hash; NULL if its a reference */
+                     int ContextType,               /* which context do we provide to the subtemplate? */
+                     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 SVPut(char *keyname, size_t keylen, int keytype, char *Data);
 #define svput(a, b, c) SVPut(a, sizeof(a) - 1, b, c)
@@ -383,16 +388,19 @@ enum {
 /*
  * \brief mail attachment ???
  */
-struct wc_attachment {
-       struct wc_attachment *next;/* pointer to next in list */
+typedef struct _wc_attachment {
        size_t length;                     /* length of the contenttype */
-       char content_type[SIZ];    /* the content itself ???*/
-       char filename[SIZ];                /* the filename hooked to this content ??? */
+       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 {
+typedef struct wc_mime_attachment wc_mime_attachment;
+typedef void (*RenderMimeFunc)(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset);
+struct wc_mime_attachment {
        StrBuf *Name;
        StrBuf *FileName;
        StrBuf *PartNum;
@@ -401,15 +409,16 @@ typedef struct _wc_mime_attachment {
        StrBuf *Charset;
        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 */
-}wc_mime_attachment;
-
+       RenderMimeFunc Renderer;
+};
+void DestroyMime(void *vMime);
 
-typedef void (*RenderMimeFunc)(wc_mime_attachment *Mime, StrBuf *RawData);
 
 /*
  * \brief message summary structure. ???
@@ -436,6 +445,8 @@ typedef struct _message_summary {
        HashList *Submessages;
        HashList *AttachLinks;
 
+       HashList *AllAttach;
+
        int is_new;         /**< is it yet read? */
        int hasattachments;     /* does it have atachments? */
 
@@ -448,8 +459,9 @@ typedef struct _message_summary {
        wc_mime_attachment *cal_partnum_ref;
        wc_mime_attachment *vcard_partnum_ref;
 } message_summary;
+void DestroyMessageSummary(void *vMsg);
 
-typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine);
+typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
 
 
 
@@ -482,6 +494,35 @@ typedef struct _disp_cal {
 } disp_cal;                                            
 
 
+
+/*
+ * Address book entry (keep it short and sweet, it's just a quickie lookup
+ * which we can use to get to the real meat and bones later)
+ */
+typedef struct _addrbookent {
+       char ab_name[64]; /**< name string */
+       long ab_msgnum;   /**< message number of address book entry */
+} addrbookent;
+
+
+typedef struct _headereval {
+       ExamineMsgHeaderFunc evaluator;
+       int Type;
+} headereval;
+
+
+struct attach_link {
+       char partnum[32];
+       char html[1024];
+};
+
+
+enum {
+       eUp,
+       eDown,
+       eNone
+};
+
 /*
  * One of these is kept for each active Citadel session.
  * HTTP transactions are bound to one at a time.
@@ -532,7 +573,7 @@ struct wcsession {
        char http_host[512];                    /**< HTTP Host: header */
        HashList *hash_prefs;                   /**< WebCit preferences for this user */
        HashList *disp_cal_items;               /**< sorted list of calendar items; startdate is the sort criteria. */
-       struct wc_attachment *first_attachment; /**< linked list of attachments for 'enter message' */
+       HashList *attachments;                  /**< list of attachments for 'enter message' */
        char last_chat_user[256];               /**< ??? todo */
        char ImportantMessage[SIZ];             /**< ??? todo */
        int ctdl_pid;                           /**< Session ID on the Citadel server */
@@ -671,6 +712,7 @@ void who_inner_div(void);
 void ajax_mini_calendar(void);
 void fmout(char *align);
 void _fmout(StrBuf *Targt, char *align);
+void FmOut(StrBuf *Target, char *align, StrBuf *Source);
 void pullquote_fmout(void);
 void wDumpContent(int);
 
@@ -741,7 +783,9 @@ void dump_vars(void);
 void embed_main_menu(void);
 void serv_read(char *buf, int bytes);
 void readloop(char *oper);
-void read_message(long msgnum, int printable_view, char *section);
+void read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, int printable_view, char *section);
+void do_addrbook_view(addrbookent *addrbook, int num_ab);
+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);
 void confirm_delete_msg(void);
@@ -786,6 +830,7 @@ char *memreadlinelen(char *start, char *buf, int maxlen, int *retlen);
 long extract_token(char *dest, const char *source, int parmnum, char separator, int maxlen);
 void remove_token(char *source, int parmnum, char separator);
 char *load_mimepart(long msgnum, char *partnum);
+void MimeLoadData(wc_mime_attachment *Mime);
 int pattern2(char *search, char *patn);
 void do_edit_vcard(long, char *, char *, char *);
 void striplt(char *);
@@ -829,7 +874,7 @@ 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(char *part_source, long msgnum, char *cal_partnum);
+void cal_process_attachment(wc_mime_attachment *Mime);
 void load_calendar_item(message_summary *Msg, int unread, struct calview *c);
 void display_calendar(message_summary *Msg, int unread);
 void display_task(message_summary *Msg, int unread);