2 extern HashList *MsgHeaderHandler;
3 extern HashList *MimeRenderHandler;
4 extern HashList *ReadLoopHandler;
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 {
9 } RenderMimeFuncStruct;
11 struct wc_mime_attachment {
20 size_t length; /* length of the mimeattachment */
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;
26 void DestroyMime(void *vMime);
29 typedef struct _message_summary {
30 time_t date; /* its creation date */
31 long msgnum; /* the message number on the citadel server */
34 StrBuf *from; /* the author */
35 StrBuf *to; /* the recipient */
36 StrBuf *subj; /* the title / subject */
37 StrBuf *reply_inreplyto;
38 StrBuf *reply_references;
46 const StrBuf *PartNum;
48 HashList *Attachments; /* list of attachments */
49 HashList *Submessages;
50 HashList *AttachLinks;
58 /* The mime part of the message */
59 wc_mime_attachment *MsgBody;
61 void DestroyMessageSummary(void *vMsg);
62 inline message_summary* GetMessagePtrAt(int n, HashList *Summ);
64 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
66 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
78 typedef void (*readloop_servcmd)(char *buf, long bufsize);
80 typedef struct _readloopstruct {
85 extern readloop_struct rlid[];
88 void readloop(long oper);
89 int read_message(StrBuf *Target,
90 const char *tmpl, long tmpllen,
92 const StrBuf *section,
93 const StrBuf **OutMime);
94 int load_message(message_summary *Msg,
101 typedef struct _SharedMessageStatus {
102 long load_seen; /* should read information be loaded */
103 long sortit; /* should we sort it using the standard sort API? */
104 long defaultsortorder; /* if we should sort it, which direction should be the default? */
106 long maxload; /* how many headers should we accept from the server? defaults to 10k */
107 long maxmsgs; /* how many message bodies do you want to load at most?*/
109 long startmsg; /* which is the start message? */
110 long nummsgs; /* How many messages are available to your view? */
111 long num_displayed; /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
113 long lowest_found; /* smallest Message ID found; */
114 long highest_found; /* highest Message ID found; */
116 } SharedMessageStatus;
118 int load_msg_ptrs(const char *servcmd, SharedMessageStatus *Stat);
120 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
126 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
128 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
130 message_summary* Msg,
134 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
137 typedef int (*View_Cleanup_func)(void **ViewSpecific);
139 void RegisterReadLoopHandlerset(
141 * RoomType: which View definition are you going to be called for
146 * GetParamsGetServerCall should do the following:
147 * * allocate your private context structure
148 * * evaluate your commandline arguments, put results to your private struct.
149 * * fill cmd with the command to load the message pointer list:
150 * * might depend on bstr/oper depending on your needs
151 * * might stay empty if no list should loaded and LoadMsgFromServer
153 * * influence the behaviour by presetting values on SharedMessageStatus
155 GetParamsGetServerCall_func GetParamsGetServerCall,
158 * PrintViewHeader is here to print informations infront of your messages.
159 * The message list is already loaded & sorted (if) so you can evaluate
160 * its result on the SharedMessageStatus struct.
162 PrintViewHeader_func PrintViewHeader,
165 * LoadMsgFromServer is called for every message in the message list:
168 * * up to 'maxmsgs' after your 'startmsg'
169 * * it should load and parse messages from citserer.
170 * * depending on your needs you might want to print your message here...
171 * * if cmd was empty, its skipped alltogether.
173 LoadMsgFromServer_func LoadMsgFromServer,
176 * RenderView_or_Tail is called last;
177 * * if you used PrintViewHeader to print messages, you might want to print
178 * trailing information here
179 * * if you just pre-loaded your messages, put your render code here.
181 RenderView_or_Tail_func RenderView_or_Tail,
184 * ViewCleanup should just clear your private data so all your mem can go back to
186 * it also should release the content for delivery via end_burst() or wDumpContent(1);
188 View_Cleanup_func ViewCleanup
191 GetParamsGetServerCall