5 static inline void CheckConvertBufs(struct wcsession *WCC) {
6 if (WCC->ConvertBuf1 == NULL)
7 WCC->ConvertBuf1 = NewStrBuf();
8 if (WCC->ConvertBuf2 == NULL)
9 WCC->ConvertBuf2 = NewStrBuf();
12 int ParseMessageListHeaders_Detail(StrBuf * Line,
13 const char **pos, message_summary * Msg, StrBuf * ConversionBuffer, void **ViewSpecific) {
18 CheckConvertBufs(WCC);
20 totallen = StrLength(Line);
21 Msg->from = NewStrBufPlain(NULL, totallen);
22 len = StrBufExtract_NextToken(ConversionBuffer, Line, pos, '|');
24 /* Handle senders with RFC2047 encoding */
25 StrBuf_RFC822_2_Utf8(Msg->from, ConversionBuffer, WCC->DefaultCharset, NULL, WCC->ConvertBuf1, WCC->ConvertBuf2);
29 len = StrBufExtract_NextToken(ConversionBuffer, Line, pos, '|');
30 if ((len > 0) && (((WCC->CurRoom.QRFlags & QR_NETWORK)
31 || ((strcasecmp(ChrPtr(ConversionBuffer), ChrPtr(WCC->serv_info->serv_nodename))
32 && (strcasecmp(ChrPtr(ConversionBuffer), ChrPtr(WCC->serv_info->serv_fqdn)))))))) {
33 StrBufAppendBufPlain(Msg->from, HKEY(" @ "), 0);
34 StrBufAppendBuf(Msg->from, ConversionBuffer, 0);
37 /* Internet address (not used)
38 * StrBufExtract_token(Msg->inetaddr, Line, 4, '|');
40 StrBufSkip_NTokenS(Line, pos, '|', 1);
41 Msg->subj = NewStrBufPlain(NULL, totallen);
43 FlushStrBuf(ConversionBuffer);
44 /* we assume the subject is the last parameter inside of the list;
45 * thus we don't use the tokenizer to fetch it, since it will hick up
46 * on tokenizer chars inside of the subjects
47 StrBufExtract_NextToken(ConversionBuffer, Line, pos, '|');
50 if (*pos != StrBufNOTNULL) {
51 len = totallen - (*pos - ChrPtr(Line));
52 StrBufPlain(ConversionBuffer, *pos, len);
54 if ((len > 0) && (*(ChrPtr(ConversionBuffer) + len - 1) == '|'))
55 StrBufCutRight(ConversionBuffer, 1);
59 StrBufAppendBufPlain(Msg->subj, _("(no subject)"), -1, 0);
61 StrBuf_RFC822_2_Utf8(Msg->subj, ConversionBuffer, WCC->DefaultCharset, NULL, WCC->ConvertBuf1, WCC->ConvertBuf2);
68 int mailview_GetParamsGetServerCall(SharedMessageStatus * Stat,
69 void **ViewSpecific, long oper, char *cmd, long len, char *filter, long flen) {
70 DoTemplate(HKEY("msg_listview"), NULL, &NoCtx);
75 int mailview_Cleanup(void **ViewSpecific) {
76 /* Note: wDumpContent() will output one additional </div> tag. */
77 /* We ought to move this out into template */
83 void InitModule_MAILVIEW_RENDERERS(void) {
84 RegisterCTX(CTX_MIME_ATACH);
85 RegisterReadLoopHandlerset(VIEW_MAILBOX, mailview_GetParamsGetServerCall, NULL, /* TODO: is this right? */
86 NULL, ParseMessageListHeaders_Detail, NULL, NULL, mailview_Cleanup, NULL);