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);
66 static inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
74 GetHashAt(Summ, n, &HKLen, &Key, &vMsg);
75 return (message_summary*) vMsg;
78 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
80 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
83 typedef enum _eCustomRoomRenderer {
84 eUseDefault = VIEW_JOURNAL + 100,
99 * @brief function to parse the | separated message headers list
100 * @param Line the raw line with your message data
101 * @param Msg put your parser results here...
102 * @param ConversionBuffer if you need some workbuffer, don't free me!
103 * @returns 0: failure, trash this message. 1: all right, store it
105 typedef int (*load_msg_ptrs_detailheaders) (StrBuf *Line,
107 message_summary *Msg,
108 StrBuf *ConversionBuffer);
110 typedef void (*readloop_servcmd)(char *buf, long bufsize);
112 typedef struct _readloopstruct {
114 readloop_servcmd cmd;
117 extern readloop_struct rlid[];
119 void readloop(long oper, eCustomRoomRenderer ForceRenderer);
120 int read_message(StrBuf *Target,
121 const char *tmpl, long tmpllen,
123 const StrBuf *section,
124 const StrBuf **OutMime);
125 int load_message(message_summary *Msg,
126 StrBuf *FoundCharset,
132 typedef struct _SharedMessageStatus {
133 long load_seen; /* should read information be loaded */
134 long sortit; /* should we sort it using the standard sort API? */
135 long defaultsortorder; /* if we should sort it, which direction should be the default? */
137 long maxload; /* how many headers should we accept from the server? defaults to 10k */
138 long maxmsgs; /* how many message bodies do you want to load at most?*/
140 long startmsg; /* which is the start message? */
141 long nummsgs; /* How many messages are available to your view? */
142 long num_displayed; /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
144 long lowest_found; /* smallest Message ID found; */
145 long highest_found; /* highest Message ID found; */
147 } SharedMessageStatus;
149 int load_msg_ptrs(const char *servcmd,
150 SharedMessageStatus *Stat,
151 load_msg_ptrs_detailheaders LH);
153 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
159 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
161 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
163 message_summary* Msg,
167 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
170 typedef int (*View_Cleanup_func)(void **ViewSpecific);
172 void RegisterReadLoopHandlerset(
174 * RoomType: which View definition are you going to be called for
179 * GetParamsGetServerCall should do the following:
180 * * allocate your private context structure
181 * * evaluate your commandline arguments, put results to your private struct.
182 * * fill cmd with the command to load the message pointer list:
183 * * might depend on bstr/oper depending on your needs
184 * * might stay empty if no list should loaded and LoadMsgFromServer
186 * * influence the behaviour by presetting values on SharedMessageStatus
188 GetParamsGetServerCall_func GetParamsGetServerCall,
191 * PrintViewHeader is here to print informations infront of your messages.
192 * The message list is already loaded & sorted (if) so you can evaluate
193 * its result on the SharedMessageStatus struct.
195 PrintViewHeader_func PrintViewHeader,
198 * LH is the function, you specify if you want to load more than just message
199 * numbers from the server during the listing fetch operation.
201 load_msg_ptrs_detailheaders LH,
204 * LoadMsgFromServer is called for every message in the message list:
207 * * up to 'maxmsgs' after your 'startmsg'
208 * * it should load and parse messages from citserer.
209 * * depending on your needs you might want to print your message here...
210 * * if cmd was empty, its skipped alltogether.
212 LoadMsgFromServer_func LoadMsgFromServer,
215 * RenderView_or_Tail is called last;
216 * * if you used PrintViewHeader to print messages, you might want to print
217 * trailing information here
218 * * if you just pre-loaded your messages, put your render code here.
220 RenderView_or_Tail_func RenderView_or_Tail,
223 * ViewCleanup should just clear your private data so all your mem can go back to
225 * it also should release the content for delivery via end_burst() or wDumpContent(1);
227 View_Cleanup_func ViewCleanup
230 GetParamsGetServerCall
240 int ParseMessageListHeaders_Detail(StrBuf *Line,
242 message_summary *Msg,
243 StrBuf *ConversionBuffer);