* Added new readloop command 'readgt' which will produce messages with numbers greate...
[citadel.git] / webcit / messages.h
1
2 extern HashList *MsgHeaderHandler;
3 extern HashList *MimeRenderHandler;
4
5 typedef struct wc_mime_attachment wc_mime_attachment;
6 typedef void (*RenderMimeFunc)(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset);
7 typedef struct _RenderMimeFuncStruct {
8         RenderMimeFunc f;
9 } RenderMimeFuncStruct;
10
11 struct wc_mime_attachment {
12         int level;
13         StrBuf *Name;
14         StrBuf *FileName;
15         StrBuf *PartNum;
16         StrBuf *Disposition;
17         StrBuf *ContentType;
18         StrBuf *Charset;
19         StrBuf *Data;
20         size_t length;                     /* length of the mimeattachment */
21         long size_known;
22         long lvalue;               /* if we put a long... */
23         long msgnum;            /**< the message number on the citadel server derived from message_summary */
24         const RenderMimeFuncStruct *Renderer;
25 };
26 void DestroyMime(void *vMime);
27
28
29 /*
30  * \brief message summary structure. ???
31  */
32 typedef struct _message_summary {
33         time_t date;        /**< its creation date */
34         long msgnum;            /**< the message number on the citadel server */
35         int nhdr;
36         int format_type;
37         StrBuf *from;           /**< the author */
38         StrBuf *to;             /**< the recipient */
39         StrBuf *subj;           /**< the title / subject */
40         StrBuf *reply_inreplyto;
41         StrBuf *reply_references;
42         StrBuf *reply_to;
43         StrBuf *cccc;
44         StrBuf *hnod;
45         StrBuf *AllRcpt;
46         StrBuf *Room;
47         StrBuf *Rfca;
48         StrBuf *OtherNode;
49         const StrBuf *PartNum;
50
51         HashList *Attachments;  /**< list of Attachments */
52         HashList *Submessages;
53         HashList *AttachLinks;
54
55         HashList *AllAttach;
56
57         int is_new;         /**< is it yet read? */
58         int hasattachments;     /* does it have attachments? */
59
60
61         /** The mime part of the message */
62         wc_mime_attachment *MsgBody;
63 } message_summary;
64 void DestroyMessageSummary(void *vMsg);
65 inline message_summary* GetMessagePtrAt(int n, HashList *Summ);
66
67 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
68
69 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
70
71 enum {
72         do_search,
73         headers,
74         readfwd,
75         readnew,
76         readold,
77         readgt
78 };
79
80 typedef void (*readloop_servcmd)(char *buf, long bufsize);
81
82 typedef struct _readloopstruct {
83         ConstStr name;
84         readloop_servcmd cmd;
85 } readloop_struct;
86
87
88 void readloop(long oper);
89 int read_message(StrBuf *Target, 
90                  const char *tmpl, long tmpllen, 
91                  long msgnum, 
92                  const StrBuf *section, 
93                  const StrBuf **OutMime);
94 int load_message(message_summary *Msg, 
95                  StrBuf *FoundCharset,
96                  StrBuf **Error);
97
98
99 int load_msg_ptrs(const char *servcmd, int with_headers);