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 */
35 StrBuf *from; /* the author */
36 StrBuf *to; /* the recipient */
37 StrBuf *subj; /* the title / subject */
38 StrBuf *reply_inreplyto;
39 StrBuf *reply_references;
47 const StrBuf *PartNum;
49 HashList *Attachments; /* list of attachments */
50 HashList *Submessages;
51 HashList *AttachLinks;
59 /* The mime part of the message */
60 wc_mime_attachment *MsgBody;
62 void DestroyMessageSummary(void *vMsg);
63 inline message_summary* GetMessagePtrAt(int n, HashList *Summ);
65 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
67 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
70 typedef enum _eCustomRoomRenderer {
71 eUseDefault = VIEW_JOURNAL + 100,
86 * @brief function to parse the | separated message headers list
87 * @param Line the raw line with your message data
88 * @param Msg put your parser results here...
89 * @param ConversionBuffer if you need some workbuffer, don't free me!
90 * @returns 0: failure, trash this message. 1: all right, store it
92 typedef int (*load_msg_ptrs_detailheaders) (StrBuf *Line,
95 StrBuf *ConversionBuffer);
97 typedef void (*readloop_servcmd)(char *buf, long bufsize);
99 typedef struct _readloopstruct {
101 readloop_servcmd cmd;
104 extern readloop_struct rlid[];
106 void readloop(long oper, eCustomRoomRenderer ForceRenderer);
107 int read_message(StrBuf *Target,
108 const char *tmpl, long tmpllen,
110 const StrBuf *section,
111 const StrBuf **OutMime);
112 int load_message(message_summary *Msg,
113 StrBuf *FoundCharset,
119 typedef struct _SharedMessageStatus {
120 long load_seen; /* should read information be loaded */
121 long sortit; /* should we sort it using the standard sort API? */
122 long defaultsortorder; /* if we should sort it, which direction should be the default? */
124 long maxload; /* how many headers should we accept from the server? defaults to 10k */
125 long maxmsgs; /* how many message bodies do you want to load at most?*/
127 long startmsg; /* which is the start message? */
128 long nummsgs; /* How many messages are available to your view? */
129 long num_displayed; /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
131 long lowest_found; /* smallest Message ID found; */
132 long highest_found; /* highest Message ID found; */
134 } SharedMessageStatus;
136 int load_msg_ptrs(const char *servcmd,
137 SharedMessageStatus *Stat,
138 load_msg_ptrs_detailheaders LH);
140 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
146 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
148 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
150 message_summary* Msg,
154 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
157 typedef int (*View_Cleanup_func)(void **ViewSpecific);
159 void RegisterReadLoopHandlerset(
161 * RoomType: which View definition are you going to be called for
166 * GetParamsGetServerCall should do the following:
167 * * allocate your private context structure
168 * * evaluate your commandline arguments, put results to your private struct.
169 * * fill cmd with the command to load the message pointer list:
170 * * might depend on bstr/oper depending on your needs
171 * * might stay empty if no list should loaded and LoadMsgFromServer
173 * * influence the behaviour by presetting values on SharedMessageStatus
175 GetParamsGetServerCall_func GetParamsGetServerCall,
178 * PrintViewHeader is here to print informations infront of your messages.
179 * The message list is already loaded & sorted (if) so you can evaluate
180 * its result on the SharedMessageStatus struct.
182 PrintViewHeader_func PrintViewHeader,
185 * LH is the function, you specify if you want to load more than just message
186 * numbers from the server during the listing fetch operation.
188 load_msg_ptrs_detailheaders LH,
191 * LoadMsgFromServer is called for every message in the message list:
194 * * up to 'maxmsgs' after your 'startmsg'
195 * * it should load and parse messages from citserer.
196 * * depending on your needs you might want to print your message here...
197 * * if cmd was empty, its skipped alltogether.
199 LoadMsgFromServer_func LoadMsgFromServer,
202 * RenderView_or_Tail is called last;
203 * * if you used PrintViewHeader to print messages, you might want to print
204 * trailing information here
205 * * if you just pre-loaded your messages, put your render code here.
207 RenderView_or_Tail_func RenderView_or_Tail,
210 * ViewCleanup should just clear your private data so all your mem can go back to
212 * it also should release the content for delivery via end_burst() or wDumpContent(1);
214 View_Cleanup_func ViewCleanup
217 GetParamsGetServerCall
227 int ParseMessageListHeaders_Detail(StrBuf *Line,
229 message_summary *Msg,
230 StrBuf *ConversionBuffer);