* Modified load_msg_pointers(), gave it the ability to return the lowest and highest...
[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 typedef struct _message_summary {
30         time_t date;            /* its creation date */
31         long msgnum;            /* the message number on the citadel server */
32         int nhdr;
33         int format_type;
34         StrBuf *from;           /* the author */
35         StrBuf *to;             /* the recipient */
36         StrBuf *subj;           /* the title / subject */
37         StrBuf *reply_inreplyto;
38         StrBuf *reply_references;
39         StrBuf *reply_to;
40         StrBuf *cccc;
41         StrBuf *hnod;
42         StrBuf *AllRcpt;
43         StrBuf *Room;
44         StrBuf *Rfca;
45         StrBuf *OtherNode;
46         const StrBuf *PartNum;
47
48         HashList *Attachments;  /* list of attachments */
49         HashList *Submessages;
50         HashList *AttachLinks;
51
52         HashList *AllAttach;
53
54         int is_new;
55         int hasattachments;
56
57
58         /* The mime part of the message */
59         wc_mime_attachment *MsgBody;
60 } message_summary;
61 void DestroyMessageSummary(void *vMsg);
62 inline message_summary* GetMessagePtrAt(int n, HashList *Summ);
63
64 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
65
66 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
67
68 enum {
69         do_search,
70         headers,
71         readfwd,
72         readnew,
73         readold,
74         readgt
75 };
76
77 typedef void (*readloop_servcmd)(char *buf, long bufsize);
78
79 typedef struct _readloopstruct {
80         ConstStr name;
81         readloop_servcmd cmd;
82 } readloop_struct;
83
84
85 void readloop(long oper);
86 int read_message(StrBuf *Target, 
87                  const char *tmpl, long tmpllen, 
88                  long msgnum, 
89                  const StrBuf *section, 
90                  const StrBuf **OutMime);
91 int load_message(message_summary *Msg, 
92                  StrBuf *FoundCharset,
93                  StrBuf **Error);
94
95
96 int load_msg_ptrs(const char *servcmd, int with_headers, long *lowest_found, long *highest_found);