1 /*----------------------------------------------------------------------------*/
6 * message index functions
10 void DestroyMimeParts(wc_mime_attachment *Mime)
12 FreeStrBuf(&Mime->Name);
13 FreeStrBuf(&Mime->FileName);
14 FreeStrBuf(&Mime->PartNum);
15 FreeStrBuf(&Mime->Disposition);
16 FreeStrBuf(&Mime->ContentType);
17 FreeStrBuf(&Mime->Charset);
18 FreeStrBuf(&Mime->Data);
21 void DestroyMime(void *vMime)
23 wc_mime_attachment *Mime = (wc_mime_attachment*)vMime;
24 DestroyMimeParts(Mime);
28 void DestroyMessageSummary(void *vMsg)
30 message_summary *Msg = (message_summary*) vMsg;
32 FreeStrBuf(&Msg->from);
34 FreeStrBuf(&Msg->subj);
35 FreeStrBuf(&Msg->reply_inreplyto);
36 FreeStrBuf(&Msg->reply_references);
37 FreeStrBuf(&Msg->cccc);
38 FreeStrBuf(&Msg->hnod);
39 FreeStrBuf(&Msg->AllRcpt);
40 FreeStrBuf(&Msg->Room);
41 FreeStrBuf(&Msg->Rfca);
42 FreeStrBuf(&Msg->OtherNode);
44 FreeStrBuf(&Msg->reply_to);
46 DeleteHash(&Msg->Attachments); /**< list of Accachments */
47 DeleteHash(&Msg->Submessages);
48 DeleteHash(&Msg->AttachLinks);
49 DeleteHash(&Msg->AllAttach);
55 void RegisterMsgHdr(const char *HeaderName, long HdrNLen, ExamineMsgHeaderFunc evaluator, int type)
58 ev = (headereval*) malloc(sizeof(headereval));
59 ev->evaluator = evaluator;
61 Put(MsgHeaderHandler, HeaderName, HdrNLen, ev, NULL);
64 void RegisterMimeRenderer(const char *HeaderName, long HdrNLen, RenderMimeFunc MimeRenderer)
66 RenderMimeFuncStruct *f;
68 f = (RenderMimeFuncStruct*) malloc(sizeof(RenderMimeFuncStruct));
70 Put(MimeRenderHandler, HeaderName, HdrNLen, f, NULL);
74 /*----------------------------------------------------------------------------*/
77 * comparator for two longs in descending order.
79 int longcmp_r(const void *s1, const void *s2) {
83 l1 = *(long *)GetSearchPayload(s1);
84 l2 = *(long *)GetSearchPayload(s2);
86 if (l1 > l2) return(-1);
87 if (l1 < l2) return(+1);
92 * comparator for longs; descending order.
94 int qlongcmp_r(const void *s1, const void *s2) {
98 if (l1 > l2) return(-1);
99 if (l1 < l2) return(+1);
105 * comparator for message summary structs by ascending subject.
107 int summcmp_subj(const void *s1, const void *s2) {
108 message_summary *summ1;
109 message_summary *summ2;
111 summ1 = (message_summary *)GetSearchPayload(s1);
112 summ2 = (message_summary *)GetSearchPayload(s2);
113 return strcasecmp(ChrPtr(summ1->subj), ChrPtr(summ2->subj));
117 * comparator for message summary structs by descending subject.
119 int summcmp_rsubj(const void *s1, const void *s2) {
120 message_summary *summ1;
121 message_summary *summ2;
123 summ1 = (message_summary *)GetSearchPayload(s1);
124 summ2 = (message_summary *)GetSearchPayload(s2);
125 return strcasecmp(ChrPtr(summ2->subj), ChrPtr(summ1->subj));
128 * comparator for message summary structs by descending subject.
130 int groupchange_subj(const void *s1, const void *s2) {
131 message_summary *summ1;
132 message_summary *summ2;
134 summ1 = (message_summary *)s1;
135 summ2 = (message_summary *)s2;
136 return ChrPtr(summ2->subj)[0] != ChrPtr(summ1->subj)[0];
140 * comparator for message summary structs by ascending sender.
142 int summcmp_sender(const void *s1, const void *s2) {
143 message_summary *summ1;
144 message_summary *summ2;
146 summ1 = (message_summary *)GetSearchPayload(s1);
147 summ2 = (message_summary *)GetSearchPayload(s2);
148 return strcasecmp(ChrPtr(summ1->from), ChrPtr(summ2->from));
152 * comparator for message summary structs by descending sender.
154 int summcmp_rsender(const void *s1, const void *s2) {
155 message_summary *summ1;
156 message_summary *summ2;
158 summ1 = (message_summary *)GetSearchPayload(s1);
159 summ2 = (message_summary *)GetSearchPayload(s2);
160 return strcasecmp(ChrPtr(summ2->from), ChrPtr(summ1->from));
163 * comparator for message summary structs by descending sender.
165 int groupchange_sender(const void *s1, const void *s2) {
166 message_summary *summ1;
167 message_summary *summ2;
169 summ1 = (message_summary *)s1;
170 summ2 = (message_summary *)s2;
171 return strcasecmp(ChrPtr(summ2->from), ChrPtr(summ1->from)) != 0;
176 * comparator for message summary structs by ascending date.
178 int summcmp_date(const void *s1, const void *s2) {
179 message_summary *summ1;
180 message_summary *summ2;
182 summ1 = (message_summary *)GetSearchPayload(s1);
183 summ2 = (message_summary *)GetSearchPayload(s2);
185 if (summ1->date < summ2->date) return -1;
186 else if (summ1->date > summ2->date) return +1;
191 * comparator for message summary structs by descending date.
193 int summcmp_rdate(const void *s1, const void *s2) {
194 message_summary *summ1;
195 message_summary *summ2;
197 summ1 = (message_summary *)GetSearchPayload(s1);
198 summ2 = (message_summary *)GetSearchPayload(s2);
200 if (summ1->date < summ2->date) return +1;
201 else if (summ1->date > summ2->date) return -1;
206 * comparator for message summary structs by descending date.
208 const long DAYSECONDS = 24 * 60 * 60;
209 int groupchange_date(const void *s1, const void *s2) {
210 message_summary *summ1;
211 message_summary *summ2;
213 summ1 = (message_summary *)s1;
214 summ2 = (message_summary *)s2;
216 return (summ1->date % DAYSECONDS) != (summ2->date %DAYSECONDS);
220 /*----------------------------------------------------------------------------*/
221 /* Don't wanna know... or? */
222 void examine_pref(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) {return;}
223 void examine_suff(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) {return;}
224 void examine_path(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) {return;}
225 void examine_content_encoding(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
227 /* TODO: do we care? */
230 void examine_nhdr(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
233 if (!strncasecmp(ChrPtr(HdrLine), "yes", 8))
236 int Conditional_ANONYMOUS_MESSAGE(StrBuf *Target, WCTemplputParams *TP)
238 message_summary *Msg = (message_summary*) CTX;
239 return Msg->nhdr != 0;
242 void examine_type(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
244 Msg->format_type = StrToi(HdrLine);
248 void examine_from(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
250 FreeStrBuf(&Msg->from);
251 Msg->from = NewStrBufPlain(NULL, StrLength(HdrLine));
252 StrBuf_RFC822_to_Utf8(Msg->from, HdrLine, WC->DefaultCharset, FoundCharset);
254 void tmplput_MAIL_SUMM_FROM(StrBuf *Target, WCTemplputParams *TP)
256 message_summary *Msg = (message_summary*) CTX;
257 StrBufAppendTemplate(Target, TP, Msg->from, 0);
262 void examine_subj(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
264 FreeStrBuf(&Msg->subj);
265 Msg->subj = NewStrBufPlain(NULL, StrLength(HdrLine));
266 StrBuf_RFC822_to_Utf8(Msg->subj, HdrLine, WC->DefaultCharset, FoundCharset);
268 void tmplput_MAIL_SUMM_SUBJECT(StrBuf *Target, WCTemplputParams *TP)
269 {/*////TODO: Fwd: and RE: filter!!*/
271 message_summary *Msg = (message_summary*) CTX;
272 StrBufAppendTemplate(Target, TP, Msg->subj, 0);
274 int Conditional_MAIL_SUMM_SUBJECT(StrBuf *Target, WCTemplputParams *TP)
276 message_summary *Msg = (message_summary*) CTX;
277 return StrLength(Msg->subj) > 0;
281 void examine_msgn(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
283 FreeStrBuf(&Msg->reply_inreplyto);
284 Msg->reply_inreplyto = NewStrBufPlain(NULL, StrLength(HdrLine));
285 StrBuf_RFC822_to_Utf8(Msg->reply_inreplyto, HdrLine, WC->DefaultCharset, FoundCharset);
287 void tmplput_MAIL_SUMM_INREPLYTO(StrBuf *Target, WCTemplputParams *TP)
289 message_summary *Msg = (message_summary*) CTX;
290 StrBufAppendTemplate(Target, TP, Msg->reply_inreplyto, 0);
293 int Conditional_MAIL_SUMM_UNREAD(StrBuf *Target, WCTemplputParams *TP)
295 message_summary *Msg = (message_summary*) CTX;
296 return Msg->is_new != 0;
299 void examine_wefw(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
301 FreeStrBuf(&Msg->reply_references);
302 Msg->reply_references = NewStrBufPlain(NULL, StrLength(HdrLine));
303 StrBuf_RFC822_to_Utf8(Msg->reply_references, HdrLine, WC->DefaultCharset, FoundCharset);
305 void tmplput_MAIL_SUMM_REFIDS(StrBuf *Target, WCTemplputParams *TP)
307 message_summary *Msg = (message_summary*) CTX;
308 StrBufAppendTemplate(Target, TP, Msg->reply_references, 0);
312 void examine_cccc(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
314 FreeStrBuf(&Msg->cccc);
315 Msg->cccc = NewStrBufPlain(NULL, StrLength(HdrLine));
316 StrBuf_RFC822_to_Utf8(Msg->cccc, HdrLine, WC->DefaultCharset, FoundCharset);
317 if (Msg->AllRcpt == NULL)
318 Msg->AllRcpt = NewStrBufPlain(NULL, StrLength(HdrLine));
319 if (StrLength(Msg->AllRcpt) > 0) {
320 StrBufAppendBufPlain(Msg->AllRcpt, HKEY(", "), 0);
322 StrBufAppendBuf(Msg->AllRcpt, Msg->cccc, 0);
324 void tmplput_MAIL_SUMM_CCCC(StrBuf *Target, WCTemplputParams *TP)
326 message_summary *Msg = (message_summary*) CTX;
327 StrBufAppendTemplate(Target, TP, Msg->cccc, 0);
331 void examine_room(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
333 if ((StrLength(HdrLine) > 0) &&
334 (strcasecmp(ChrPtr(HdrLine), ChrPtr(WC->wc_roomname)))) {
335 FreeStrBuf(&Msg->Room);
336 Msg->Room = NewStrBufDup(HdrLine);
339 void tmplput_MAIL_SUMM_ORGROOM(StrBuf *Target, WCTemplputParams *TP)
341 message_summary *Msg = (message_summary*) CTX;
342 StrBufAppendTemplate(Target, TP, Msg->Room, 0);
346 void examine_rfca(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
348 FreeStrBuf(&Msg->Rfca);
349 Msg->Rfca = NewStrBufDup(HdrLine);
351 void tmplput_MAIL_SUMM_RFCA(StrBuf *Target, WCTemplputParams *TP)
353 message_summary *Msg = (message_summary*) CTX;
354 StrBufAppendTemplate(Target, TP, Msg->Rfca, 0);
356 int Conditional_MAIL_SUMM_RFCA(StrBuf *Target, WCTemplputParams *TP)
358 message_summary *Msg = (message_summary*) CTX;
359 return StrLength(Msg->Rfca) > 0;
361 int Conditional_MAIL_SUMM_CCCC(StrBuf *Target, WCTemplputParams *TP)
363 message_summary *Msg = (message_summary*) CTX;
364 return StrLength(Msg->cccc) > 0;
367 void examine_node(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
371 if ( (StrLength(HdrLine) > 0) &&
372 ((WC->room_flags & QR_NETWORK)
373 || ((strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_nodename))
374 && (strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_fqdn))))))) {
375 FreeStrBuf(&Msg->OtherNode);
376 Msg->OtherNode = NewStrBufDup(HdrLine);
379 void tmplput_MAIL_SUMM_OTHERNODE(StrBuf *Target, WCTemplputParams *TP)
381 message_summary *Msg = (message_summary*) CTX;
382 StrBufAppendTemplate(Target, TP, Msg->OtherNode, 0);
384 int Conditional_MAIL_SUMM_OTHERNODE(StrBuf *Target, WCTemplputParams *TP)
386 message_summary *Msg = (message_summary*) CTX;
387 return StrLength(Msg->OtherNode) > 0;
391 void examine_rcpt(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
393 FreeStrBuf(&Msg->to);
394 Msg->to = NewStrBufPlain(NULL, StrLength(HdrLine));
395 StrBuf_RFC822_to_Utf8(Msg->to, HdrLine, WC->DefaultCharset, FoundCharset);
396 if (Msg->AllRcpt == NULL)
397 Msg->AllRcpt = NewStrBufPlain(NULL, StrLength(HdrLine));
398 if (StrLength(Msg->AllRcpt) > 0) {
399 StrBufAppendBufPlain(Msg->AllRcpt, HKEY(", "), 0);
401 StrBufAppendBuf(Msg->AllRcpt, Msg->to, 0);
403 void tmplput_MAIL_SUMM_TO(StrBuf *Target, WCTemplputParams *TP)
405 message_summary *Msg = (message_summary*) CTX;
406 StrBufAppendTemplate(Target, TP, Msg->to, 0);
408 int Conditional_MAIL_SUMM_TO(StrBuf *Target, WCTemplputParams *TP)
410 message_summary *Msg = (message_summary*) CTX;
411 return StrLength(Msg->to) != 0;
413 int Conditional_MAIL_SUMM_SUBJ(StrBuf *Target, WCTemplputParams *TP)
415 message_summary *Msg = (message_summary*) CTX;
416 return StrLength(Msg->subj) != 0;
418 void tmplput_MAIL_SUMM_ALLRCPT(StrBuf *Target, WCTemplputParams *TP)
420 message_summary *Msg = (message_summary*) CTX;
421 StrBufAppendTemplate(Target, TP, Msg->AllRcpt, 0);
426 void tmplput_SUMM_COUNT(StrBuf *Target, WCTemplputParams *TP)
428 StrBufAppendPrintf(Target, "%d", GetCount( WC->summ));
431 HashList *iterate_get_mailsumm_All(StrBuf *Target, WCTemplputParams *TP)
435 void examine_time(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
437 Msg->date = StrTol(HdrLine);
440 void tmplput_MAIL_SUMM_DATE_BRIEF(StrBuf *Target, WCTemplputParams *TP)
443 message_summary *Msg = (message_summary*) CTX;
444 webcit_fmt_date(datebuf, 64, Msg->date, DATEFMT_BRIEF);
445 StrBufAppendBufPlain(Target, datebuf, -1, 0);
448 void tmplput_MAIL_SUMM_DATE_FULL(StrBuf *Target, WCTemplputParams *TP)
451 message_summary *Msg = (message_summary*) CTX;
452 webcit_fmt_date(datebuf, 64, Msg->date, DATEFMT_FULL);
453 StrBufAppendBufPlain(Target, datebuf, -1, 0);
455 void tmplput_MAIL_SUMM_DATE_NO(StrBuf *Target, WCTemplputParams *TP)
457 message_summary *Msg = (message_summary*) CTX;
458 StrBufAppendPrintf(Target, "%ld", Msg->date, 0);
463 void render_MAIL(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
465 const StrBuf *TemplateMime;
467 Mime->Data = NewStrBufPlain(NULL, Mime->length);
468 read_message(Mime->Data, HKEY("view_submessage"), Mime->msgnum, Mime->PartNum, &TemplateMime);
470 if ( (!IsEmptyStr(mime_submessages)) && (!section[0]) ) {
471 for (i=0; i<num_tokens(mime_submessages, '|'); ++i) {
472 extract_token(buf, mime_submessages, i, '|', sizeof buf);
473 / ** use printable_view to suppress buttons * /
474 wprintf("<blockquote>");
475 read_message(Mime->msgnum, 1, ChrPtr(Mime->Section));
476 wprintf("</blockquote>");
482 void render_MIME_VCard(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
486 if (StrLength(Mime->Data) > 0) {
489 /** If it's my vCard I can edit it */
490 if ( (!strcasecmp(ChrPtr(WCC->wc_roomname), USERCONFIGROOM))
491 || (!strcasecmp(&(ChrPtr(WCC->wc_roomname)[11]), USERCONFIGROOM))
492 || (WC->wc_view == VIEW_ADDRESSBOOK)
494 StrBufAppendPrintf(Buf, "<a href=\"edit_vcard?msgnum=%ld&partnum=%s\">",
495 Mime->msgnum, ChrPtr(Mime->PartNum));
496 StrBufAppendPrintf(Buf, "[%s]</a>", _("edit"));
499 /* In all cases, display the full card */
500 display_vcard(Buf, Mime->Data, 0, 1, NULL, Mime->msgnum);
501 FreeStrBuf(&Mime->Data);
507 void render_MIME_VNote(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
510 if (StrLength(Mime->Data) > 0) {
515 v = vnote_new_from_str(ChrPtr(Mime->Data));
519 memset(&TP, 0, sizeof(WCTemplputParams));
520 TP.Filter.ContextType = CTX_VNOTE;
522 DoTemplate(HKEY("mail_vnoteitem"),
527 FreeStrBuf(&Mime->Data);
531 FlushStrBuf(Mime->Data);
536 void render_MIME_ICS(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
538 if (StrLength(Mime->Data) == 0) {
541 if (StrLength(Mime->Data) > 0) {
542 cal_process_attachment(Mime);
548 void examine_mime_part(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
550 wc_mime_attachment *Mime;
553 Mime = (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment));
554 memset(Mime, 0, sizeof(wc_mime_attachment));
555 Mime->msgnum = Msg->msgnum;
558 Mime->Name = NewStrBuf();
559 StrBufExtract_token(Buf, HdrLine, 0, '|');
560 StrBuf_RFC822_to_Utf8(Mime->Name, Buf, WC->DefaultCharset, FoundCharset);
561 StrBufTrim(Mime->Name);
563 StrBufExtract_token(Buf, HdrLine, 1, '|');
564 Mime->FileName = NewStrBuf();
565 StrBuf_RFC822_to_Utf8(Mime->FileName, Buf, WC->DefaultCharset, FoundCharset);
566 StrBufTrim(Mime->FileName);
568 Mime->PartNum = NewStrBuf();
569 StrBufExtract_token(Mime->PartNum, HdrLine, 2, '|');
570 StrBufTrim(Mime->PartNum);
571 if (strchr(ChrPtr(Mime->PartNum), '.') != NULL)
576 Mime->Disposition = NewStrBuf();
577 StrBufExtract_token(Mime->Disposition, HdrLine, 3, '|');
579 Mime->ContentType = NewStrBuf();
580 StrBufExtract_token(Mime->ContentType, HdrLine, 4, '|');
581 StrBufTrim(Mime->ContentType);
582 StrBufLowerCase(Mime->ContentType);
584 if (!strcmp(ChrPtr(Mime->ContentType), "application/octet-stream")) {
585 StrBufPlain(Mime->ContentType,
586 GuessMimeByFilename(SKEY(Mime->FileName)), -1);
588 Mime->length = StrBufExtract_int(HdrLine, 5, '|');
590 if ( (StrLength(Mime->FileName) == 0) && (StrLength(Mime->Name) > 0) ) {
591 StrBufAppendBuf(Mime->FileName, Mime->Name, 0);
594 if (StrLength(Msg->PartNum) > 0) {
596 StrBufPrintf(Buf, "%s.%s", ChrPtr(Msg->PartNum), ChrPtr(Mime->PartNum));
602 if (Msg->AllAttach == NULL)
603 Msg->AllAttach = NewHash(1,NULL);
604 Put(Msg->AllAttach, SKEY(Mime->PartNum), Mime, DestroyMime);
609 void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime)
613 /* just print the root-node */
614 if ((Mime->level == 1) &&
615 GetHash(MimeRenderHandler, SKEY(Mime->ContentType), &vMimeRenderer) &&
616 vMimeRenderer != NULL)
618 Mime->Renderer = (RenderMimeFuncStruct*) vMimeRenderer;
619 if (Msg->Submessages == NULL)
620 Msg->Submessages = NewHash(1,NULL);
621 Put(Msg->Submessages, SKEY(Mime->PartNum), Mime, reference_free_handler);
623 else if ((Mime->level == 1) &&
624 (!strcasecmp(ChrPtr(Mime->Disposition), "inline"))
625 && (!strncasecmp(ChrPtr(Mime->ContentType), "image/", 6)) ){
626 if (Msg->AttachLinks == NULL)
627 Msg->AttachLinks = NewHash(1,NULL);
628 Put(Msg->AttachLinks, SKEY(Mime->PartNum), Mime, reference_free_handler);
630 else if ((Mime->level == 1) &&
631 (StrLength(Mime->ContentType) > 0) &&
632 ( (!strcasecmp(ChrPtr(Mime->Disposition), "attachment"))
633 || (!strcasecmp(ChrPtr(Mime->Disposition), "inline"))
634 || (!strcasecmp(ChrPtr(Mime->Disposition), ""))))
636 if (Msg->AttachLinks == NULL)
637 Msg->AttachLinks = NewHash(1,NULL);
638 Put(Msg->AttachLinks, SKEY(Mime->PartNum), Mime, reference_free_handler);
639 if ((strcasecmp(ChrPtr(Mime->ContentType), "application/octet-stream") == 0) &&
640 (StrLength(Mime->FileName) > 0)) {
641 FlushStrBuf(Mime->ContentType);
642 StrBufAppendBufPlain(Mime->ContentType,
643 GuessMimeByFilename(SKEY(Mime->FileName)),
649 void tmplput_MAIL_SUMM_NATTACH(StrBuf *Target, WCTemplputParams *TP)
651 message_summary *Msg = (message_summary*) CTX;
652 StrBufAppendPrintf(Target, "%ld", GetCount(Msg->Attachments));
656 void examine_hnod(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
658 FreeStrBuf(&Msg->hnod);
659 Msg->hnod = NewStrBufPlain(NULL, StrLength(HdrLine));
660 StrBuf_RFC822_to_Utf8(Msg->hnod, HdrLine, WC->DefaultCharset, FoundCharset);
662 void tmplput_MAIL_SUMM_H_NODE(StrBuf *Target, WCTemplputParams *TP)
664 message_summary *Msg = (message_summary*) CTX;
665 StrBufAppendTemplate(Target, TP, Msg->hnod, 0);
667 int Conditional_MAIL_SUMM_H_NODE(StrBuf *Target, WCTemplputParams *TP)
669 message_summary *Msg = (message_summary*) CTX;
670 return StrLength(Msg->hnod) > 0;
675 void examine_text(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
677 Msg->MsgBody->Data = NewStrBufPlain(NULL, SIZ);
680 void examine_msg4_partnum(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
682 Msg->MsgBody->PartNum = NewStrBufDup(HdrLine);
683 StrBufTrim(Msg->MsgBody->PartNum);
686 void examine_content_lengh(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
688 Msg->MsgBody->length = StrTol(HdrLine);
689 Msg->MsgBody->size_known = 1;
692 void examine_content_type(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
702 Msg->MsgBody->ContentType = NewStrBufDup(HdrLine);
703 sem = strchr(ChrPtr(HdrLine), ';');
706 Token = NewStrBufPlain(NULL, StrLength(HdrLine));
707 Value = NewStrBufPlain(NULL, StrLength(HdrLine));
708 len = sem - ChrPtr(HdrLine);
709 StrBufCutAt(Msg->MsgBody->ContentType, len, NULL);
710 while (sem != NULL) {
711 while (isspace(*(sem + 1)))
713 StrBufCutLeft(HdrLine, sem - ChrPtr(HdrLine));
714 sem = strchr(ChrPtr(HdrLine), ';');
716 len = sem - ChrPtr(HdrLine);
718 len = StrLength(HdrLine);
721 StrBufAppendBufPlain(Token, ChrPtr(HdrLine), len, 0);
722 eq = strchr(ChrPtr(Token), '=');
724 len = eq - ChrPtr(Token);
725 StrBufAppendBufPlain(Value, eq + 1, StrLength(Token) - len - 1, 0);
726 StrBufCutAt(Token, len, NULL);
731 if (GetHash(MsgHeaderHandler, SKEY(Token), &vHdr) &&
733 Hdr = (headereval*)vHdr;
734 Hdr->evaluator(Msg, Value, FoundCharset);
736 else lprintf(1, "don't know how to handle content type sub-header[%s]\n", ChrPtr(Token));
743 void tmplput_MAIL_SUMM_N(StrBuf *Target, WCTemplputParams *TP)
745 message_summary *Msg = (message_summary*) CTX;
746 StrBufAppendPrintf(Target, "%ld", Msg->msgnum);
751 int Conditional_MAIL_MIME_ALL(StrBuf *Target, WCTemplputParams *TP)
753 message_summary *Msg = (message_summary*) CTX;
754 return GetCount(Msg->Attachments) > 0;
757 int Conditional_MAIL_MIME_SUBMESSAGES(StrBuf *Target, WCTemplputParams *TP)
759 message_summary *Msg = (message_summary*) CTX;
760 return GetCount(Msg->Submessages) > 0;
763 int Conditional_MAIL_MIME_ATTACHLINKS(StrBuf *Target, WCTemplputParams *TP)
765 message_summary *Msg = (message_summary*) CTX;
766 return GetCount(Msg->AttachLinks) > 0;
769 int Conditional_MAIL_MIME_ATTACH(StrBuf *Target, WCTemplputParams *TP)
771 message_summary *Msg = (message_summary*) CTX;
772 return GetCount(Msg->AllAttach) > 0;
777 /*----------------------------------------------------------------------------*/
778 void tmplput_QUOTED_MAIL_BODY(StrBuf *Target, WCTemplputParams *TP)
784 MsgNum = LBstr(TKEY(0));
786 read_message(Buf, HKEY("view_message_replyquote"), MsgNum, NULL, &Mime);
787 StrBufAppendTemplate(Target, TP, Buf, 1);
791 void tmplput_EDIT_MAIL_BODY(StrBuf *Target, WCTemplputParams *TP)
797 MsgNum = LBstr(TKEY(0));
799 read_message(Buf, HKEY("view_message_edit"), MsgNum, NULL, &Mime);
800 StrBufAppendTemplate(Target, TP, Buf, 1);
804 void tmplput_MAIL_BODY(StrBuf *Target, WCTemplputParams *TP)
806 message_summary *Msg = (message_summary*) CTX;
807 StrBufAppendTemplate(Target, TP, Msg->MsgBody->Data, 0);
811 void render_MAIL_variformat(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
813 /* Messages in legacy Citadel variformat get handled thusly... */
814 StrBuf *Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
815 FmOut(Target, "JUSTIFY", Mime->Data);
816 FreeStrBuf(&Mime->Data);
820 void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
823 const char *ptr, *pte;
824 const char *BufPtr = NULL;
836 iconv_t ic = (iconv_t)(-1) ;
839 if ((StrLength(Mime->Data) == 0) && (Mime->length > 0)) {
840 FreeStrBuf(&Mime->Data);
844 /* Boring old 80-column fixed format text gets handled this way... */
845 if ((strcasecmp(ChrPtr(Mime->Charset), "us-ascii") == 0) &&
846 (strcasecmp(ChrPtr(Mime->Charset), "UTF-8") == 0))
851 if (StrLength(Mime->Charset) != 0)
853 else if (StrLength(FoundCharset) > 0)
855 else if (StrLength(WC->DefaultCharset) > 0)
856 cs = WC->DefaultCharset;
861 ctdl_iconv_open("UTF-8", ChrPtr(cs), &ic);
862 if (ic == (iconv_t)(-1) ) {
863 lprintf(5, "%s:%d iconv_open(UTF-8, %s) failed: %s\n",
864 __FILE__, __LINE__, ChrPtr(Mime->Charset), strerror(errno));
869 Line = NewStrBufPlain(NULL, SIZ);
870 Line1 = NewStrBufPlain(NULL, SIZ);
871 Line2 = NewStrBufPlain(NULL, SIZ);
872 Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
874 while ((n = StrBufSipLine(Line, Mime->Data, &BufPtr), n >= 0) && !done)
880 len = StrLength(Line);
883 while ((ptr < pte) &&
892 if (i > 0) StrBufCutLeft(Line, i);
894 if (StrLength(Line) == 0) {
895 StrBufAppendBufPlain(Target, HKEY("<tt></tt><br />\n"), 0);
899 for (i = bn; i < bq; i++)
900 StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
901 for (i = bq; i < bn; i++)
902 StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
904 if (ConvertIt == 1) {
905 StrBufConvert(Line, Line1, &ic);
908 StrBufAppendBufPlain(Target, HKEY("<tt>"), 0);
909 UrlizeText(Line1, Line, Line2);
911 StrEscAppend(Target, Line1, NULL, 0, 0);
912 StrBufAppendBufPlain(Target, HKEY("</tt><br />\n"), 0);
916 for (i = 0; i < bn; i++)
917 StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
919 StrBufAppendBufPlain(Target, HKEY("</i><br />"), 0);
921 if (ic != (iconv_t)(-1) ) {
926 FreeStrBuf(&Mime->Data);
928 FlushStrBuf(Mime->ContentType);
929 StrBufAppendBufPlain(Mime->ContentType, HKEY("text/html"), 0);
930 FlushStrBuf(Mime->Charset);
931 StrBufAppendBufPlain(Mime->Charset, HKEY("UTF-8"), 0);
937 void render_MAIL_html(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
941 if (StrLength(Mime->Data) == 0)
944 Buf = NewStrBufPlain(NULL, StrLength(Mime->Data));
946 /* HTML is fun, but we've got to strip it first */
947 output_html(ChrPtr(Mime->Charset),
948 (WC->wc_view == VIEW_WIKI ? 1 : 0),
951 FreeStrBuf(&Mime->Data);
955 void render_MAIL_UNKNOWN(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
957 /* Unknown weirdness */
958 FlushStrBuf(Mime->Data);
959 StrBufAppendBufPlain(Mime->Data, _("I don't know how to display "), -1, 0);
960 StrBufAppendBuf(Mime->Data, Mime->ContentType, 0);
961 StrBufAppendBufPlain(Mime->Data, HKEY("<br />\n"), 0);
969 HashList *iterate_get_mime_All(StrBuf *Target, WCTemplputParams *TP)
971 message_summary *Msg = (message_summary*) CTX;
972 return Msg->Attachments;
974 HashList *iterate_get_mime_Submessages(StrBuf *Target, WCTemplputParams *TP)
976 message_summary *Msg = (message_summary*) CTX;
977 return Msg->Submessages;
979 HashList *iterate_get_mime_AttachLinks(StrBuf *Target, WCTemplputParams *TP)
981 message_summary *Msg = (message_summary*) CTX;
982 return Msg->AttachLinks;
984 HashList *iterate_get_mime_Attachments(StrBuf *Target, WCTemplputParams *TP)
986 message_summary *Msg = (message_summary*) CTX;
987 return Msg->AllAttach;
990 void tmplput_MIME_Name(StrBuf *Target, WCTemplputParams *TP)
992 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
993 StrBufAppendTemplate(Target, TP, mime->Name, 0);
996 void tmplput_MIME_FileName(StrBuf *Target, WCTemplputParams *TP)
998 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
999 StrBufAppendTemplate(Target, TP, mime->FileName, 0);
1002 void tmplput_MIME_PartNum(StrBuf *Target, WCTemplputParams *TP)
1004 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1005 StrBufAppendTemplate(Target, TP, mime->PartNum, 0);
1008 void tmplput_MIME_MsgNum(StrBuf *Target, WCTemplputParams *TP)
1010 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1011 StrBufAppendPrintf(Target, "%ld", mime->msgnum);
1014 void tmplput_MIME_Disposition(StrBuf *Target, WCTemplputParams *TP)
1016 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1017 StrBufAppendTemplate(Target, TP, mime->Disposition, 0);
1020 void tmplput_MIME_ContentType(StrBuf *Target, WCTemplputParams *TP)
1022 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1023 StrBufAppendTemplate(Target, TP, mime->ContentType, 0);
1026 void examine_charset(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
1028 Msg->MsgBody->Charset = NewStrBufDup(HdrLine);
1031 void tmplput_MIME_Charset(StrBuf *Target, WCTemplputParams *TP)
1033 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1034 StrBufAppendTemplate(Target, TP, mime->Charset, 0);
1037 void tmplput_MIME_Data(StrBuf *Target, WCTemplputParams *TP)
1039 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1040 if (mime->Renderer != NULL)
1041 mime->Renderer->f(mime, NULL, NULL);
1042 StrBufAppendTemplate(Target, TP, mime->Data, 0);
1043 /* TODO: check whether we need to load it now? */
1046 void tmplput_MIME_LoadData(StrBuf *Target, WCTemplputParams *TP)
1048 wcsession *WCC = WC;
1049 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1050 wc_mime_attachment *att;
1052 if ( (!strcasecmp(ChrPtr(mime->Disposition), "inline"))||
1053 (!strcasecmp(ChrPtr(mime->Disposition), "attachment")) )
1058 /* steal this mime part... */
1059 att = malloc(sizeof(wc_mime_attachment));
1060 memcpy(att, mime, sizeof(wc_mime_attachment));
1061 memset(mime, 0, sizeof(wc_mime_attachment));
1063 if (att->Data == NULL)
1066 if (WCC->attachments == NULL)
1067 WCC->attachments = NewHash(1, NULL);
1068 /* And add it to the list. */
1069 n = snprintf(N, sizeof N, "%d", GetCount(WCC->attachments) + 1);
1070 Put(WCC->attachments, N, n, att, DestroyMime);
1074 void tmplput_MIME_Length(StrBuf *Target, WCTemplputParams *TP)
1076 wc_mime_attachment *mime = (wc_mime_attachment*) CTX;
1077 StrBufAppendPrintf(Target, "%ld", mime->length);
1080 HashList *iterate_get_registered_Attachments(StrBuf *Target, WCTemplputParams *TP)
1082 return WC->attachments;
1085 void servcmd_do_search(char *buf, long bufsize)
1087 snprintf(buf, bufsize, "MSGS SEARCH|%s", bstr("query"));
1090 void servcmd_headers(char *buf, long bufsize)
1092 snprintf(buf, bufsize, "MSGS ALL");
1095 void servcmd_readfwd(char *buf, long bufsize)
1097 snprintf(buf, bufsize, "MSGS ALL");
1100 void servcmd_readnew(char *buf, long bufsize)
1102 snprintf(buf, bufsize, "MSGS NEW");
1105 void servcmd_readold(char *buf, long bufsize)
1107 snprintf(buf, bufsize, "MSGS OLD");
1111 readloop_struct rlid[] = {
1112 { {HKEY("do_search")}, servcmd_do_search},
1113 { {HKEY("headers")}, servcmd_headers},
1114 { {HKEY("readfwd")}, servcmd_readfwd},
1115 { {HKEY("readnew")}, servcmd_readnew},
1116 { {HKEY("readold")}, servcmd_readold}
1121 void SetAccessCommand(long Oper)
1123 /* TODO: whats achieved by this?
1124 wcsession *WCC = WC;
1126 if (WCC->UrlFragment1 != NULL ) {
1127 FlushStrBuf(WCC->UrlFragment1);
1128 StrBufAppendBufPlain(WCC->UrlFragment1,
1129 rlid[Oper].name.Key, rlid[Oper].name.len, 0);
1132 WCC->UrlFragment1 = NewStrBufPlain(rlid[Oper].name.Key, rlid[Oper].name.len);
1141 InitModule_MSGRENDERERS
1144 RegisterSortFunc(HKEY("date"),
1150 RegisterSortFunc(HKEY("subject"),
1156 RegisterSortFunc(HKEY("sender"),
1163 RegisterNamespace("SUMM:COUNT", 0, 0, tmplput_SUMM_COUNT, CTX_NONE);
1164 /* iterate over all known mails in WC->summ */
1165 RegisterIterator("MAIL:SUMM:MSGS", 0, NULL, iterate_get_mailsumm_All,
1166 NULL,NULL, CTX_MAILSUM, CTX_NONE, IT_NOFLAG);
1168 RegisterNamespace("MAIL:SUMM:DATEBRIEF", 0, 0, tmplput_MAIL_SUMM_DATE_BRIEF, CTX_MAILSUM);
1169 RegisterNamespace("MAIL:SUMM:DATEFULL", 0, 0, tmplput_MAIL_SUMM_DATE_FULL, CTX_MAILSUM);
1170 RegisterNamespace("MAIL:SUMM:DATENO", 0, 0, tmplput_MAIL_SUMM_DATE_NO, CTX_MAILSUM);
1171 RegisterNamespace("MAIL:SUMM:N", 0, 0, tmplput_MAIL_SUMM_N, CTX_MAILSUM);
1172 RegisterNamespace("MAIL:SUMM:FROM", 0, 2, tmplput_MAIL_SUMM_FROM, CTX_MAILSUM);
1173 RegisterNamespace("MAIL:SUMM:TO", 0, 2, tmplput_MAIL_SUMM_TO, CTX_MAILSUM);
1174 RegisterNamespace("MAIL:SUMM:SUBJECT", 0, 4, tmplput_MAIL_SUMM_SUBJECT, CTX_MAILSUM);
1175 RegisterNamespace("MAIL:SUMM:NTATACH", 0, 0, tmplput_MAIL_SUMM_NATTACH, CTX_MAILSUM);
1176 RegisterNamespace("MAIL:SUMM:CCCC", 0, 2, tmplput_MAIL_SUMM_CCCC, CTX_MAILSUM);
1177 RegisterNamespace("MAIL:SUMM:H_NODE", 0, 2, tmplput_MAIL_SUMM_H_NODE, CTX_MAILSUM);
1178 RegisterNamespace("MAIL:SUMM:ALLRCPT", 0, 2, tmplput_MAIL_SUMM_ALLRCPT, CTX_MAILSUM);
1179 RegisterNamespace("MAIL:SUMM:ORGROOM", 0, 2, tmplput_MAIL_SUMM_ORGROOM, CTX_MAILSUM);
1180 RegisterNamespace("MAIL:SUMM:RFCA", 0, 2, tmplput_MAIL_SUMM_RFCA, CTX_MAILSUM);
1181 RegisterNamespace("MAIL:SUMM:OTHERNODE", 2, 0, tmplput_MAIL_SUMM_OTHERNODE, CTX_MAILSUM);
1182 RegisterNamespace("MAIL:SUMM:REFIDS", 0, 1, tmplput_MAIL_SUMM_REFIDS, CTX_MAILSUM);
1183 RegisterNamespace("MAIL:SUMM:INREPLYTO", 0, 2, tmplput_MAIL_SUMM_INREPLYTO, CTX_MAILSUM);
1184 RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY, CTX_MAILSUM);
1185 RegisterNamespace("MAIL:QUOTETEXT", 1, 2, tmplput_QUOTED_MAIL_BODY, CTX_NONE);
1186 RegisterNamespace("MAIL:EDITTEXT", 1, 2, tmplput_EDIT_MAIL_BODY, CTX_NONE);
1187 RegisterConditional(HKEY("COND:MAIL:SUMM:RFCA"), 0, Conditional_MAIL_SUMM_RFCA, CTX_MAILSUM);
1188 RegisterConditional(HKEY("COND:MAIL:SUMM:CCCC"), 0, Conditional_MAIL_SUMM_CCCC, CTX_MAILSUM);
1189 RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM);
1190 RegisterConditional(HKEY("COND:MAIL:SUMM:H_NODE"), 0, Conditional_MAIL_SUMM_H_NODE, CTX_MAILSUM);
1191 RegisterConditional(HKEY("COND:MAIL:SUMM:OTHERNODE"), 0, Conditional_MAIL_SUMM_OTHERNODE, CTX_MAILSUM);
1192 RegisterConditional(HKEY("COND:MAIL:SUMM:SUBJECT"), 0, Conditional_MAIL_SUMM_SUBJECT, CTX_MAILSUM);
1193 RegisterConditional(HKEY("COND:MAIL:ANON"), 0, Conditional_ANONYMOUS_MESSAGE, CTX_MAILSUM);
1194 RegisterConditional(HKEY("COND:MAIL:TO"), 0, Conditional_MAIL_SUMM_TO, CTX_MAILSUM);
1195 RegisterConditional(HKEY("COND:MAIL:SUBJ"), 0, Conditional_MAIL_SUMM_SUBJ, CTX_MAILSUM);
1197 /* do we have mimetypes to iterate over? */
1198 RegisterConditional(HKEY("COND:MAIL:MIME:ATTACH"), 0, Conditional_MAIL_MIME_ALL, CTX_MAILSUM);
1199 RegisterConditional(HKEY("COND:MAIL:MIME:ATTACH:SUBMESSAGES"), 0, Conditional_MAIL_MIME_SUBMESSAGES, CTX_MAILSUM);
1200 RegisterConditional(HKEY("COND:MAIL:MIME:ATTACH:LINKS"), 0, Conditional_MAIL_MIME_ATTACHLINKS, CTX_MAILSUM);
1201 RegisterConditional(HKEY("COND:MAIL:MIME:ATTACH:ATT"), 0, Conditional_MAIL_MIME_ATTACH, CTX_MAILSUM);
1202 RegisterIterator("MAIL:MIME:ATTACH", 0, NULL, iterate_get_mime_All,
1203 NULL, NULL, CTX_MIME_ATACH, CTX_MAILSUM, IT_NOFLAG);
1204 RegisterIterator("MAIL:MIME:ATTACH:SUBMESSAGES", 0, NULL, iterate_get_mime_Submessages,
1205 NULL, NULL, CTX_MIME_ATACH, CTX_MAILSUM, IT_NOFLAG);
1206 RegisterIterator("MAIL:MIME:ATTACH:LINKS", 0, NULL, iterate_get_mime_AttachLinks,
1207 NULL, NULL, CTX_MIME_ATACH, CTX_MAILSUM, IT_NOFLAG);
1208 RegisterIterator("MAIL:MIME:ATTACH:ATT", 0, NULL, iterate_get_mime_Attachments,
1209 NULL, NULL, CTX_MIME_ATACH, CTX_MAILSUM, IT_NOFLAG);
1211 /* Parts of a mime attachent */
1212 RegisterNamespace("MAIL:MIME:NAME", 0, 2, tmplput_MIME_Name, CTX_MIME_ATACH);
1213 RegisterNamespace("MAIL:MIME:FILENAME", 0, 2, tmplput_MIME_FileName, CTX_MIME_ATACH);
1214 RegisterNamespace("MAIL:MIME:PARTNUM", 0, 2, tmplput_MIME_PartNum, CTX_MIME_ATACH);
1215 RegisterNamespace("MAIL:MIME:MSGNUM", 0, 2, tmplput_MIME_MsgNum, CTX_MIME_ATACH);
1216 RegisterNamespace("MAIL:MIME:DISPOSITION", 0, 2, tmplput_MIME_Disposition, CTX_MIME_ATACH);
1217 RegisterNamespace("MAIL:MIME:CONTENTTYPE", 0, 2, tmplput_MIME_ContentType, CTX_MIME_ATACH);
1218 RegisterNamespace("MAIL:MIME:CHARSET", 0, 2, tmplput_MIME_Charset, CTX_MIME_ATACH);
1219 RegisterNamespace("MAIL:MIME:LENGTH", 0, 2, tmplput_MIME_Length, CTX_MIME_ATACH);
1220 RegisterNamespace("MAIL:MIME:DATA", 0, 2, tmplput_MIME_Data, CTX_MIME_ATACH);
1221 /* load the actual attachment into WC->attachments; no output!!! */
1222 RegisterNamespace("MAIL:MIME:LOADDATA", 0, 0, tmplput_MIME_LoadData, CTX_MIME_ATACH);
1224 /* iterate the WC->attachments; use the above tokens for their contents */
1225 RegisterIterator("MSG:ATTACHNAMES", 0, NULL, iterate_get_registered_Attachments,
1226 NULL, NULL, CTX_MIME_ATACH, CTX_NONE, IT_NOFLAG);
1228 /* mime renderers translate an attachment into webcit viewable html text */
1229 RegisterMimeRenderer(HKEY("message/rfc822"), render_MAIL);
1230 RegisterMimeRenderer(HKEY("text/vnote"), render_MIME_VNote);
1231 RegisterMimeRenderer(HKEY("text/x-vcard"), render_MIME_VCard);
1232 RegisterMimeRenderer(HKEY("text/vcard"), render_MIME_VCard);
1233 RegisterMimeRenderer(HKEY("text/calendar"), render_MIME_ICS);
1234 RegisterMimeRenderer(HKEY("application/ics"), render_MIME_ICS);
1235 RegisterMimeRenderer(HKEY("text/x-citadel-variformat"), render_MAIL_variformat);
1236 RegisterMimeRenderer(HKEY("text/plain"), render_MAIL_text_plain);
1237 RegisterMimeRenderer(HKEY("text"), render_MAIL_text_plain);
1238 RegisterMimeRenderer(HKEY("text/html"), render_MAIL_html);
1239 RegisterMimeRenderer(HKEY(""), render_MAIL_UNKNOWN);
1241 /* these headers are citserver replies to MSG4 and friends. one evaluator for each */
1242 RegisterMsgHdr(HKEY("nhdr"), examine_nhdr, 0);
1243 RegisterMsgHdr(HKEY("type"), examine_type, 0);
1244 RegisterMsgHdr(HKEY("from"), examine_from, 0);
1245 RegisterMsgHdr(HKEY("subj"), examine_subj, 0);
1246 RegisterMsgHdr(HKEY("msgn"), examine_msgn, 0);
1247 RegisterMsgHdr(HKEY("wefw"), examine_wefw, 0);
1248 RegisterMsgHdr(HKEY("cccc"), examine_cccc, 0);
1249 RegisterMsgHdr(HKEY("hnod"), examine_hnod, 0);
1250 RegisterMsgHdr(HKEY("room"), examine_room, 0);
1251 RegisterMsgHdr(HKEY("rfca"), examine_rfca, 0);
1252 RegisterMsgHdr(HKEY("node"), examine_node, 0);
1253 RegisterMsgHdr(HKEY("rcpt"), examine_rcpt, 0);
1254 RegisterMsgHdr(HKEY("time"), examine_time, 0);
1255 RegisterMsgHdr(HKEY("part"), examine_mime_part, 0);
1256 RegisterMsgHdr(HKEY("text"), examine_text, 1);
1257 /* these are the content-type headers we get infront of a message; put it into the same hash since it doesn't clash. */
1258 RegisterMsgHdr(HKEY("X-Citadel-MSG4-Partnum"), examine_msg4_partnum, 0);
1259 RegisterMsgHdr(HKEY("Content-type"), examine_content_type, 0);
1260 RegisterMsgHdr(HKEY("Content-length"), examine_content_lengh, 0);
1261 RegisterMsgHdr(HKEY("Content-transfer-encoding"), examine_content_encoding, 0); /* do we care? */
1262 RegisterMsgHdr(HKEY("charset"), examine_charset, 0);
1264 /* Don't care about these... */
1265 RegisterMsgHdr(HKEY("pref"), examine_pref, 0);
1266 RegisterMsgHdr(HKEY("suff"), examine_suff, 0);
1267 RegisterMsgHdr(HKEY("path"), examine_path, 0);
1271 ServerStartModule_MSGRENDERERS
1274 MsgHeaderHandler = NewHash(1, NULL);
1275 MimeRenderHandler = NewHash(1, NULL);
1279 ServerShutdownModule_MSGRENDERERS
1282 DeleteHash(&MsgHeaderHandler);
1283 DeleteHash(&MimeRenderHandler);
1289 SessionDestroyModule_MSGRENDERERS
1292 DeleteHash(&sess->attachments);