1 extern CtxType CTX_MAILSUM;
2 extern CtxType CTX_MIME_ATACH;
3 extern HashList *MsgHeaderHandler;
4 extern HashList *MimeRenderHandler;
5 extern HashList *ReadLoopHandler;
6 typedef struct wc_mime_attachment wc_mime_attachment;
7 typedef void (*RenderMimeFunc)(StrBuf *Target, WCTemplputParams *TP, StrBuf *FoundCharset);
8 typedef struct _RenderMimeFuncStruct {
10 } RenderMimeFuncStruct;
12 struct wc_mime_attachment {
21 size_t length; /* length of the mimeattachment */
23 long lvalue; /* if we put a long... */
24 long msgnum; /* the message number on the citadel server derived from message_summary */
25 const RenderMimeFuncStruct *Renderer;
27 void DestroyMime(void *vMime);
29 #define MSGFLAG_READ (1<<0)
31 typedef struct _message_summary {
32 long msgnum; /* the message number on the citadel server */
35 time_t date; /* its creation date */
39 StrBuf *from; /* the author */
40 StrBuf *to; /* the recipient */
41 StrBuf *subj; /* the title / subject */
42 StrBuf *reply_inreplyto;
43 StrBuf *reply_references;
52 const StrBuf *PartNum;
54 HashList *Attachments; /* list of attachments */
55 HashList *Submessages;
56 HashList *AttachLinks;
63 /* The mime part of the message */
64 wc_mime_attachment *MsgBody;
66 void DestroyMessageSummary(void *vMsg);
70 static inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
78 GetHashAt(Summ, n, &HKLen, &Key, &vMsg);
79 return (message_summary*) vMsg;
82 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
84 void evaluate_mime_part(StrBuf *Target, WCTemplputParams *TP);
87 typedef enum _eCustomRoomRenderer {
88 eUseDefault = VIEW_JOURNAL + 100,
103 * @brief function to parse the | separated message headers list
104 * @param Line the raw line with your message data
105 * @param Msg put your parser results here...
106 * @param ConversionBuffer if you need some workbuffer, don't free me!
107 * @returns 0: failure, trash this message. 1: all right, store it
109 typedef int (*load_msg_ptrs_detailheaders) (StrBuf *Line,
111 message_summary *Msg,
112 StrBuf *ConversionBuffer);
114 typedef void (*readloop_servcmd)(char *buf, long bufsize);
116 typedef struct _readloopstruct {
118 readloop_servcmd cmd;
121 extern readloop_struct rlid[];
123 void readloop(long oper, eCustomRoomRenderer ForceRenderer);
124 int read_message(StrBuf *Target,
125 const char *tmpl, long tmpllen,
127 const StrBuf *section,
128 const StrBuf **OutMime);
129 int load_message(message_summary *Msg,
130 StrBuf *FoundCharset,
136 typedef struct _SharedMessageStatus {
137 long load_seen; /* should read information be loaded */
138 long sortit; /* should we sort it using the standard sort API? */
139 long defaultsortorder; /* if we should sort it, which direction should be the default? */
141 long maxload; /* how many headers should we accept from the server? defaults to 10k */
142 long maxmsgs; /* how many message bodies do you want to load at most?*/
144 long startmsg; /* which is the start message? */
145 long nummsgs; /* How many messages are available to your view? */
146 long num_displayed; /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
148 long lowest_found; /* smallest Message ID found; */
149 long highest_found; /* highest Message ID found; */
151 } SharedMessageStatus;
153 int load_msg_ptrs(const char *servcmd,
155 SharedMessageStatus *Stat,
156 load_msg_ptrs_detailheaders LH);
158 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
166 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
168 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
170 message_summary* Msg,
174 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
177 typedef int (*View_Cleanup_func)(void **ViewSpecific);
179 void RegisterReadLoopHandlerset(
181 * RoomType: which View definition are you going to be called for
186 * GetParamsGetServerCall should do the following:
187 * * allocate your private context structure
188 * * evaluate your commandline arguments, put results to your private struct.
189 * * fill cmd with the command to load the message pointer list:
190 * * might depend on bstr/oper depending on your needs
191 * * might stay empty if no list should loaded and LoadMsgFromServer
193 * * influence the behaviour by presetting values on SharedMessageStatus
195 GetParamsGetServerCall_func GetParamsGetServerCall,
198 * PrintpageHeader prints the surrounding information like iconbar, header etc.
199 * by default, output_headers() is called.
202 PrintViewHeader_func PrintPageHeader,
205 * PrintViewHeader is here to print informations infront of your messages.
206 * The message list is already loaded & sorted (if) so you can evaluate
207 * its result on the SharedMessageStatus struct.
209 PrintViewHeader_func PrintViewHeader,
212 * LH is the function, you specify if you want to load more than just message
213 * numbers from the server during the listing fetch operation.
215 load_msg_ptrs_detailheaders LH,
218 * LoadMsgFromServer is called for every message in the message list:
221 * * up to 'maxmsgs' after your 'startmsg'
222 * * it should load and parse messages from citserer.
223 * * depending on your needs you might want to print your message here...
224 * * if cmd was empty, its skipped alltogether.
226 LoadMsgFromServer_func LoadMsgFromServer,
229 * RenderView_or_Tail is called last;
230 * * if you used PrintViewHeader to print messages, you might want to print
231 * trailing information here
232 * * if you just pre-loaded your messages, put your render code here.
234 RenderView_or_Tail_func RenderView_or_Tail,
237 * ViewCleanup should just clear your private data so all your mem can go back to
239 * it also should release the content for delivery via end_burst() or wDumpContent(1);
241 View_Cleanup_func ViewCleanup
244 GetParamsGetServerCall
254 int ParseMessageListHeaders_Detail(StrBuf *Line,
256 message_summary *Msg,
257 StrBuf *ConversionBuffer);
262 * @brief function to register the availability to render a specific message
263 * @param HeaderName Mimetype we know howto display
264 * @param HdrNLen length...
265 * @param InlineRenderable Should we announce to citserver that we want to receive these mimeparts immediately?
266 * @param Priority if multipart/alternative; which mimepart/Renderer should be prefered? (only applies if InlineRenderable)
268 void RegisterMimeRenderer(const char *HeaderName, long HdrNLen,
269 RenderMimeFunc MimeRenderer,
270 int InlineRenderable,