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;
51 const StrBuf *PartNum;
53 HashList *Attachments; /* list of attachments */
54 HashList *Submessages;
55 HashList *AttachLinks;
62 /* The mime part of the message */
63 wc_mime_attachment *MsgBody;
65 void DestroyMessageSummary(void *vMsg);
69 static inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
77 GetHashAt(Summ, n, &HKLen, &Key, &vMsg);
78 return (message_summary*) vMsg;
81 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
83 void evaluate_mime_part(StrBuf *Target, WCTemplputParams *TP);
86 typedef enum _eCustomRoomRenderer {
87 eUseDefault = VIEW_JOURNAL + 100,
102 * @brief function to parse the | separated message headers list
103 * @param Line the raw line with your message data
104 * @param Msg put your parser results here...
105 * @param ConversionBuffer if you need some workbuffer, don't free me!
106 * @returns 0: failure, trash this message. 1: all right, store it
108 typedef int (*load_msg_ptrs_detailheaders) (StrBuf *Line,
110 message_summary *Msg,
111 StrBuf *ConversionBuffer);
113 typedef void (*readloop_servcmd)(char *buf, long bufsize);
115 typedef struct _readloopstruct {
117 readloop_servcmd cmd;
120 extern readloop_struct rlid[];
122 void readloop(long oper, eCustomRoomRenderer ForceRenderer);
123 int read_message(StrBuf *Target,
124 const char *tmpl, long tmpllen,
126 const StrBuf *section,
127 const StrBuf **OutMime);
128 int load_message(message_summary *Msg,
129 StrBuf *FoundCharset,
135 typedef struct _SharedMessageStatus {
136 long load_seen; /* should read information be loaded */
137 long sortit; /* should we sort it using the standard sort API? */
138 long defaultsortorder; /* if we should sort it, which direction should be the default? */
140 long maxload; /* how many headers should we accept from the server? defaults to 10k */
141 long maxmsgs; /* how many message bodies do you want to load at most?*/
143 long startmsg; /* which is the start message? */
144 long nummsgs; /* How many messages are available to your view? */
145 long num_displayed; /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
147 long lowest_found; /* smallest Message ID found; */
148 long highest_found; /* highest Message ID found; */
150 } SharedMessageStatus;
152 int load_msg_ptrs(const char *servcmd,
154 SharedMessageStatus *Stat,
155 load_msg_ptrs_detailheaders LH);
157 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
165 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
167 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
169 message_summary* Msg,
173 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
176 typedef int (*View_Cleanup_func)(void **ViewSpecific);
178 void RegisterReadLoopHandlerset(
180 * RoomType: which View definition are you going to be called for
185 * GetParamsGetServerCall should do the following:
186 * * allocate your private context structure
187 * * evaluate your commandline arguments, put results to your private struct.
188 * * fill cmd with the command to load the message pointer list:
189 * * might depend on bstr/oper depending on your needs
190 * * might stay empty if no list should loaded and LoadMsgFromServer
192 * * influence the behaviour by presetting values on SharedMessageStatus
194 GetParamsGetServerCall_func GetParamsGetServerCall,
197 * PrintpageHeader prints the surrounding information like iconbar, header etc.
198 * by default, output_headers() is called.
201 PrintViewHeader_func PrintPageHeader,
204 * PrintViewHeader is here to print informations infront of your messages.
205 * The message list is already loaded & sorted (if) so you can evaluate
206 * its result on the SharedMessageStatus struct.
208 PrintViewHeader_func PrintViewHeader,
211 * LH is the function, you specify if you want to load more than just message
212 * numbers from the server during the listing fetch operation.
214 load_msg_ptrs_detailheaders LH,
217 * LoadMsgFromServer is called for every message in the message list:
220 * * up to 'maxmsgs' after your 'startmsg'
221 * * it should load and parse messages from citserer.
222 * * depending on your needs you might want to print your message here...
223 * * if cmd was empty, its skipped alltogether.
225 LoadMsgFromServer_func LoadMsgFromServer,
228 * RenderView_or_Tail is called last;
229 * * if you used PrintViewHeader to print messages, you might want to print
230 * trailing information here
231 * * if you just pre-loaded your messages, put your render code here.
233 RenderView_or_Tail_func RenderView_or_Tail,
236 * ViewCleanup should just clear your private data so all your mem can go back to
238 * it also should release the content for delivery via end_burst() or wDumpContent(1);
240 View_Cleanup_func ViewCleanup
243 GetParamsGetServerCall
253 int ParseMessageListHeaders_Detail(StrBuf *Line,
255 message_summary *Msg,
256 StrBuf *ConversionBuffer);
261 * @brief function to register the availability to render a specific message
262 * @param HeaderName Mimetype we know howto display
263 * @param HdrNLen length...
264 * @param InlineRenderable Should we announce to citserver that we want to receive these mimeparts immediately?
265 * @param Priority if multipart/alternative; which mimepart/Renderer should be prefered? (only applies if InlineRenderable)
267 void RegisterMimeRenderer(const char *HeaderName, long HdrNLen,
268 RenderMimeFunc MimeRenderer,
269 int InlineRenderable,