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;
49 const StrBuf *PartNum;
51 HashList *Attachments; /* list of attachments */
52 HashList *Submessages;
53 HashList *AttachLinks;
60 /* The mime part of the message */
61 wc_mime_attachment *MsgBody;
63 void DestroyMessageSummary(void *vMsg);
67 static inline message_summary* GetMessagePtrAt(int n, HashList *Summ)
75 GetHashAt(Summ, n, &HKLen, &Key, &vMsg);
76 return (message_summary*) vMsg;
79 typedef void (*ExamineMsgHeaderFunc)(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset);
81 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime);
84 typedef enum _eCustomRoomRenderer {
85 eUseDefault = VIEW_JOURNAL + 100,
100 * @brief function to parse the | separated message headers list
101 * @param Line the raw line with your message data
102 * @param Msg put your parser results here...
103 * @param ConversionBuffer if you need some workbuffer, don't free me!
104 * @returns 0: failure, trash this message. 1: all right, store it
106 typedef int (*load_msg_ptrs_detailheaders) (StrBuf *Line,
108 message_summary *Msg,
109 StrBuf *ConversionBuffer);
111 typedef void (*readloop_servcmd)(char *buf, long bufsize);
113 typedef struct _readloopstruct {
115 readloop_servcmd cmd;
118 extern readloop_struct rlid[];
120 void readloop(long oper, eCustomRoomRenderer ForceRenderer);
121 int read_message(StrBuf *Target,
122 const char *tmpl, long tmpllen,
124 const StrBuf *section,
125 const StrBuf **OutMime);
126 int load_message(message_summary *Msg,
127 StrBuf *FoundCharset,
133 typedef struct _SharedMessageStatus {
134 long load_seen; /* should read information be loaded */
135 long sortit; /* should we sort it using the standard sort API? */
136 long defaultsortorder; /* if we should sort it, which direction should be the default? */
138 long maxload; /* how many headers should we accept from the server? defaults to 10k */
139 long maxmsgs; /* how many message bodies do you want to load at most?*/
141 long startmsg; /* which is the start message? */
142 long nummsgs; /* How many messages are available to your view? */
143 long num_displayed; /* counted up for LoadMsgFromServer */ /* TODO: unclear who should access this and why */
145 long lowest_found; /* smallest Message ID found; */
146 long highest_found; /* highest Message ID found; */
148 } SharedMessageStatus;
150 int load_msg_ptrs(const char *servcmd,
151 SharedMessageStatus *Stat,
152 load_msg_ptrs_detailheaders LH);
154 typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
160 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
162 typedef int (*LoadMsgFromServer_func)(SharedMessageStatus *Stat,
164 message_summary* Msg,
168 typedef int (*RenderView_or_Tail_func)(SharedMessageStatus *Stat,
171 typedef int (*View_Cleanup_func)(void **ViewSpecific);
173 void RegisterReadLoopHandlerset(
175 * RoomType: which View definition are you going to be called for
180 * GetParamsGetServerCall should do the following:
181 * * allocate your private context structure
182 * * evaluate your commandline arguments, put results to your private struct.
183 * * fill cmd with the command to load the message pointer list:
184 * * might depend on bstr/oper depending on your needs
185 * * might stay empty if no list should loaded and LoadMsgFromServer
187 * * influence the behaviour by presetting values on SharedMessageStatus
189 GetParamsGetServerCall_func GetParamsGetServerCall,
192 * PrintViewHeader is here to print informations infront of your messages.
193 * The message list is already loaded & sorted (if) so you can evaluate
194 * its result on the SharedMessageStatus struct.
196 PrintViewHeader_func PrintViewHeader,
199 * LH is the function, you specify if you want to load more than just message
200 * numbers from the server during the listing fetch operation.
202 load_msg_ptrs_detailheaders LH,
205 * LoadMsgFromServer is called for every message in the message list:
208 * * up to 'maxmsgs' after your 'startmsg'
209 * * it should load and parse messages from citserer.
210 * * depending on your needs you might want to print your message here...
211 * * if cmd was empty, its skipped alltogether.
213 LoadMsgFromServer_func LoadMsgFromServer,
216 * RenderView_or_Tail is called last;
217 * * if you used PrintViewHeader to print messages, you might want to print
218 * trailing information here
219 * * if you just pre-loaded your messages, put your render code here.
221 RenderView_or_Tail_func RenderView_or_Tail,
224 * ViewCleanup should just clear your private data so all your mem can go back to
226 * it also should release the content for delivery via end_burst() or wDumpContent(1);
228 View_Cleanup_func ViewCleanup
231 GetParamsGetServerCall
241 int ParseMessageListHeaders_Detail(StrBuf *Line,
243 message_summary *Msg,
244 StrBuf *ConversionBuffer);