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);
77 typedef void (*readloop_servcmd)(char *buf, long bufsize);
79 typedef struct _readloopstruct {
85 void readloop(long oper);
86 int read_message(StrBuf *Target,
87 const char *tmpl, long tmpllen,
89 const StrBuf *section,
90 const StrBuf **OutMime);
91 int load_message(message_summary *Msg,
98 typedef struct _SharedMessageStatus{
99 long load_seen; /** should read information be loaded */
100 long sortit; /** should we sort it using the standard sort API? */
101 long defaultsortorder; /** if we should sort it, which direction should be the default? */
103 long maxload; /** how many headers should we accept from the server? defaults to 10k */
104 long maxmsgs; /** how many message bodies do you want to load at most?*/
105 long reverse; /** should the load-range be reversed? */
107 long startmsg; /** which is the start message ????? */
108 long nummsgs; /** How many messages are available to your view? */
109 long num_displayed; /** counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
111 long lowest_found; /** smallest Message ID found; */
112 long highest_found; /** highest Message ID found; */
114 }SharedMessageStatus;
116 int load_msg_ptrs(const char *servcmd, SharedMessageStatus *Stat);
118 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
124 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
126 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
128 message_summary* Msg,
132 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
135 typedef int (*View_Cleanup_func)(void **ViewSpecific);
137 void RegisterReadLoopHandlerset(
139 * RoomType: which View definition are you going to be called for
144 * GetParamsGetServerCall should do the following:
145 * * allocate your private context structure
146 * * evaluate your commandline arguments, put results to your private struct.
147 * * fill cmd with the command to load the message pointer list:
148 * * might depend on bstr/oper depending on your needs
149 * * might stay empty if no list should loaded and LoadMsgFromServer
151 * * influence the behaviour by presetting values on SharedMessageStatus
153 GetParamsGetServerCall_func GetParamsGetServerCall,
156 * PrintViewHeader is here to print informations infront of your messages.
157 * The message list is already loaded & sorted (if) so you can evaluate
158 * its result on the SharedMessageStatus struct.
160 PrintViewHeader_func PrintViewHeader,
163 * LoadMsgFromServer is called for every message in the message list:
166 * * up to 'maxmsgs' after your 'startmsg'
167 * * it should load and parse messages from citserer.
168 * * depending on your needs you might want to print your message here...
169 * * if cmd was empty, its skipped alltogether.
171 LoadMsgFromServer_func LoadMsgFromServer,
174 * RenderView_or_Tail is called last;
175 * * if you used PrintViewHeader to print messages, you might want to print
176 * trailing information here
177 * * if you just pre-loaded your messages, put your render code here.
179 RenderView_or_Tail_func RenderView_or_Tail,
182 * ViewCleanup should just clear your private data so all your mem can go back to
184 * it also should release the content for delivery via end_burst() or wDumpContent(1);
186 View_Cleanup_func ViewCleanup
189 GetParamsGetServerCall