X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fmsg_renderers.c;fp=webcit%2Fmsg_renderers.c;h=9c63236903813da9046d502827dc2c5930e4a8a4;hp=9fd7285dc9fe0f8b4dd4eadc0fb255b2c30e184c;hb=dda7d0d3dfaa0a7fede33155e2795f4379d492e7;hpb=7fe2f3119b5dd533fe65e84a291719cb2992db94 diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 9fd7285dc..9c6323690 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -877,6 +877,50 @@ void examine_content_type(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCh } } + +message_summary *ReadOneMessageSummary(StrBuf *RawMessage, const char *DefaultSubject, StrBuf *FoundCharset, long MsgNum) +{ + void *vHdr; + headereval *Hdr; + message_summary *Msg; + StrBuf *Buf; + const char *buf; + const char *ebuf; + int nBuf; + long len; + + Buf = NewStrBuf(); + + serv_printf("MSG0 %ld|1", MsgNum); /* ask for headers only */ + + StrBuf_ServGetln(Buf); + if (GetServerStatus(Buf, NULL) == 1) { + FreeStrBuf(&Buf); + return NULL; + } + + Msg = (message_summary*)malloc(sizeof(message_summary)); + memset(Msg, 0, sizeof(message_summary)); + while (len = StrBuf_ServGetln(Buf), + (len >= 0) && + ((len != 3) || + strcmp(ChrPtr(Buf), "000"))) + { + buf = ChrPtr(Buf); + ebuf = strchr(ChrPtr(Buf), '='); + nBuf = ebuf - buf; + + if (GetHash(MsgHeaderHandler, buf, nBuf, &vHdr) && + (vHdr != NULL)) { + Hdr = (headereval*)vHdr; + StrBufCutLeft(Buf, nBuf + 1); + Hdr->evaluator(Msg, Buf, FoundCharset); + } + else syslog(LOG_INFO, "Don't know how to handle Message Headerline [%s]", ChrPtr(Buf)); + } + return Msg; +} + void tmplput_MAIL_SUMM_N(StrBuf *Target, WCTemplputParams *TP) { message_summary *Msg = (message_summary*) CTX(CTX_MAILSUM);