X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmsg_renderers.c;h=f8fc38e67edd66e52cab11c98c584f6a09965a49;hb=1a9e08616fa839db9a46a4f2c6d9e34420150b81;hp=459f8e9554e926c0b7e590a472e331c6ba77b934;hpb=6634b8a4dcccacc37535df860f613727b5b2b883;p=citadel.git diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 459f8e955..f8fc38e67 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -449,6 +449,12 @@ void tmplput_MAIL_SUMM_DATE_BRIEF(StrBuf *Target, WCTemplputParams *TP) StrBufAppendBufPlain(Target, datebuf, -1, 0); } +void tmplput_MAIL_SUMM_EUID(StrBuf *Target, WCTemplputParams *TP) +{ + message_summary *Msg = (message_summary*) CTX; + StrBufAppendTemplate(Target, TP, Msg->euid, 0); +} + void tmplput_MAIL_SUMM_DATE_FULL(StrBuf *Target, WCTemplputParams *TP) { char datebuf[64]; @@ -1155,6 +1161,57 @@ readloop_struct rlid[] = { { {HKEY("readlt")}, servcmd_readlt } }; + +int ParseMessageListHeaders_Detail(StrBuf *Line, + const char **pos, + message_summary *Msg, + StrBuf *ConversionBuffer) +{ + wcsession *WCC = WC; + + Msg->from = NewStrBufPlain(NULL, StrLength(Line)); + StrBufExtract_NextToken(ConversionBuffer, Line, pos, '|'); + if (StrLength(ConversionBuffer) != 0) { + /* Handle senders with RFC2047 encoding */ + StrBuf_RFC822_to_Utf8(Msg->from, ConversionBuffer, WCC->DefaultCharset, NULL); + } + + /* node name */ + StrBufExtract_NextToken(ConversionBuffer, Line, pos, '|'); + if ((StrLength(ConversionBuffer) !=0 ) && + ( ((WCC->CurRoom.QRFlags & QR_NETWORK) + || ((strcasecmp(ChrPtr(ConversionBuffer), ChrPtr(WCC->serv_info->serv_nodename)) + && (strcasecmp(ChrPtr(ConversionBuffer), ChrPtr(WCC->serv_info->serv_fqdn)))))))) + { + StrBufAppendBufPlain(Msg->from, HKEY(" @ "), 0); + StrBufAppendBuf(Msg->from, ConversionBuffer, 0); + } + + /* Internet address (not used) + * StrBufExtract_token(Msg->inetaddr, Line, 4, '|'); + */ + StrBufSkip_NTokenS(Line, pos, '|', 1); + Msg->subj = NewStrBufPlain(NULL, StrLength(Line)); + StrBufExtract_NextToken(ConversionBuffer, Line, pos, '|'); + if (StrLength(ConversionBuffer) == 0) + StrBufAppendBufPlain(Msg->subj, _("(no subject)"), -1,0); + else { + StrBuf_RFC822_to_Utf8(Msg->subj, ConversionBuffer, WCC->DefaultCharset, NULL); + if ((StrLength(Msg->subj) > 75) && + (StrBuf_Utf8StrLen(Msg->subj) > 75)) { + StrBuf_Utf8StrCut(Msg->subj, 72); + StrBufAppendBufPlain(Msg->subj, HKEY("..."), 0); + } + } + + if ((StrLength(Msg->from) > 25) && + (StrBuf_Utf8StrLen(Msg->from) > 25)) { + StrBuf_Utf8StrCut(Msg->from, 23); + StrBufAppendBufPlain(Msg->from, HKEY("..."), 0); + } + return 1; +} + /* Spit out the new summary view. This is basically a static page, so clients can cache the layout, all the dirty work is javascript :) */ void new_summary_view(void) { DoTemplate(HKEY("msg_listview"),NULL,&NoCtx); @@ -1222,6 +1279,7 @@ InitModule_MSGRENDERERS VIEW_MAILBOX, mailview_GetParamsGetServerCall, NULL, /// TODO: is this right? + ParseMessageListHeaders_Detail, NULL, //// "" mailview_RenderView_or_Tail, mailview_Cleanup); @@ -1250,6 +1308,7 @@ InitModule_MSGRENDERERS RegisterIterator("MAIL:SUMM:MSGS", 0, NULL, iterate_get_mailsumm_All, NULL,NULL, CTX_MAILSUM, CTX_NONE, IT_NOFLAG); + RegisterNamespace("MAIL:SUMM:EUID", 0, 1, tmplput_MAIL_SUMM_EUID, NULL, CTX_MAILSUM); RegisterNamespace("MAIL:SUMM:DATEBRIEF", 0, 0, tmplput_MAIL_SUMM_DATE_BRIEF, NULL, CTX_MAILSUM); RegisterNamespace("MAIL:SUMM:DATEFULL", 0, 0, tmplput_MAIL_SUMM_DATE_FULL, NULL, CTX_MAILSUM); RegisterNamespace("MAIL:SUMM:DATENO", 0, 0, tmplput_MAIL_SUMM_DATE_NO, NULL, CTX_MAILSUM);