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);
28 #define MSGFLAG_READ (1<<0)
30 typedef struct _message_summary {
31 long msgnum; /* the message number on the citadel server */
34 time_t date; /* its creation date */
38 StrBuf *from; /* the author */
39 StrBuf *to; /* the recipient */
40 StrBuf *subj; /* the title / subject */
41 StrBuf *reply_inreplyto;
42 StrBuf *reply_references;
50 const StrBuf *PartNum;
52 HashList *Attachments; /* list of attachments */
53 HashList *Submessages;
54 HashList *AttachLinks;
61 /* The mime part of the message */
62 wc_mime_attachment *MsgBody;
64 void DestroyMessageSummary(void *vMsg);
68 static inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
76 GetHashAt(Summ, n, &HKLen, &Key, &vMsg);
77 return (message_summary*) vMsg;
80 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
82 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
85 typedef enum _eCustomRoomRenderer {
86 eUseDefault = VIEW_JOURNAL + 100,
101 * @brief function to parse the | separated message headers list
102 * @param Line the raw line with your message data
103 * @param Msg put your parser results here...
104 * @param ConversionBuffer if you need some workbuffer, don't free me!
105 * @returns 0: failure, trash this message. 1: all right, store it
107 typedef int (*load_msg_ptrs_detailheaders) (StrBuf *Line,
109 message_summary *Msg,
110 StrBuf *ConversionBuffer);
112 typedef void (*readloop_servcmd)(char *buf, long bufsize);
114 typedef struct _readloopstruct {
116 readloop_servcmd cmd;
119 extern readloop_struct rlid[];
121 void readloop(long oper, eCustomRoomRenderer ForceRenderer);
122 int read_message(StrBuf *Target,
123 const char *tmpl, long tmpllen,
125 const StrBuf *section,
126 const StrBuf **OutMime);
127 int load_message(message_summary *Msg,
128 StrBuf *FoundCharset,
134 typedef struct _SharedMessageStatus {
135 long load_seen; /* should read information be loaded */
136 long sortit; /* should we sort it using the standard sort API? */
137 long defaultsortorder; /* if we should sort it, which direction should be the default? */
139 long maxload; /* how many headers should we accept from the server? defaults to 10k */
140 long maxmsgs; /* how many message bodies do you want to load at most?*/
142 long startmsg; /* which is the start message? */
143 long nummsgs; /* How many messages are available to your view? */
144 long num_displayed; /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
146 long lowest_found; /* smallest Message ID found; */
147 long highest_found; /* highest Message ID found; */
149 } SharedMessageStatus;
151 int load_msg_ptrs(const char *servcmd,
153 SharedMessageStatus *Stat,
154 load_msg_ptrs_detailheaders LH);
156 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
164 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
166 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
168 message_summary* Msg,
172 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
175 typedef int (*View_Cleanup_func)(void **ViewSpecific);
177 void RegisterReadLoopHandlerset(
179 * RoomType: which View definition are you going to be called for
184 * GetParamsGetServerCall should do the following:
185 * * allocate your private context structure
186 * * evaluate your commandline arguments, put results to your private struct.
187 * * fill cmd with the command to load the message pointer list:
188 * * might depend on bstr/oper depending on your needs
189 * * might stay empty if no list should loaded and LoadMsgFromServer
191 * * influence the behaviour by presetting values on SharedMessageStatus
193 GetParamsGetServerCall_func GetParamsGetServerCall,
196 * PrintpageHeader prints the surrounding information like iconbar, header etc.
197 * by default, output_headers() is called.
200 PrintViewHeader_func PrintPageHeader,
203 * PrintViewHeader is here to print informations infront of your messages.
204 * The message list is already loaded & sorted (if) so you can evaluate
205 * its result on the SharedMessageStatus struct.
207 PrintViewHeader_func PrintViewHeader,
210 * LH is the function, you specify if you want to load more than just message
211 * numbers from the server during the listing fetch operation.
213 load_msg_ptrs_detailheaders LH,
216 * LoadMsgFromServer is called for every message in the message list:
219 * * up to 'maxmsgs' after your 'startmsg'
220 * * it should load and parse messages from citserer.
221 * * depending on your needs you might want to print your message here...
222 * * if cmd was empty, its skipped alltogether.
224 LoadMsgFromServer_func LoadMsgFromServer,
227 * RenderView_or_Tail is called last;
228 * * if you used PrintViewHeader to print messages, you might want to print
229 * trailing information here
230 * * if you just pre-loaded your messages, put your render code here.
232 RenderView_or_Tail_func RenderView_or_Tail,
235 * ViewCleanup should just clear your private data so all your mem can go back to
237 * it also should release the content for delivery via end_burst() or wDumpContent(1);
239 View_Cleanup_func ViewCleanup
242 GetParamsGetServerCall
252 int ParseMessageListHeaders_Detail(StrBuf *Line,
254 message_summary *Msg,
255 StrBuf *ConversionBuffer);
260 * @brief function to register the availability to render a specific message
261 * @param HeaderName Mimetype we know howto display
262 * @param HdrNLen length...
263 * @param InlineRenderable Should we announce to citserver that we want to receive these mimeparts immediately?
264 * @param Priority if multipart/alternative; which mimepart/Renderer should be prefered? (only applies if InlineRenderable)
266 void RegisterMimeRenderer(const char *HeaderName, long HdrNLen,
267 RenderMimeFunc MimeRenderer,
268 int InlineRenderable,