X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmessages.c;h=dec8d66764cdb0e105c19bd10e414a287423adce;hb=6a40bef83342b4519b9231ce67ad92eaef537574;hp=e891539ce500dbf4e6da49da42bc55f65f38318e;hpb=89406b8ce58376969b5f11c4f88d77eb15d3b7d2;p=citadel.git diff --git a/webcit/messages.c b/webcit/messages.c index e891539ce..dec8d6676 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -188,9 +188,13 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, co void *vHdr; long len; const char *Key; + WCTemplputParams SuperTP; WCTemplputParams SubTP; StrBuf *Error = NULL; + memset(&SuperTP, 0, sizeof(WCTemplputParams)); + memset(&SubTP, 0, sizeof(WCTemplputParams)); + Buf = NewStrBuf(); FoundCharset = NewStrBuf(); Msg = (message_summary *)malloc(sizeof(message_summary)); @@ -211,38 +215,46 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, co StrBufTrim(Buf); StrBufLowerCase(Buf); - /* Locate a renderer capable of converting this MIME part into HTML */ - if (GetHash(MimeRenderHandler, SKEY(Buf), &vHdr) && - (vHdr != NULL)) { - RenderMimeFuncStruct *Render; - Render = (RenderMimeFuncStruct*)vHdr; - Render->f(Msg->MsgBody, NULL, FoundCharset); - } - - if (StrLength(Msg->reply_references)> 0) { - /* Trim down excessively long lists of thread references. We eliminate the - * second one in the list so that the thread root remains intact. - */ - int rrtok = num_tokens(ChrPtr(Msg->reply_references), '|'); - int rrlen = StrLength(Msg->reply_references); - if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) { - StrBufRemove_token(Msg->reply_references, 1, '|'); + StackContext(NULL, &SuperTP, Msg, CTX_MAILSUM, 0, NULL); + { + /* Locate a renderer capable of converting this MIME part into HTML */ + if (GetHash(MimeRenderHandler, SKEY(Buf), &vHdr) && + (vHdr != NULL)) { + RenderMimeFuncStruct *Render; + + StackContext(&SuperTP, &SubTP, Msg->MsgBody, CTX_MIME_ATACH, 0, NULL); + { + Render = (RenderMimeFuncStruct*)vHdr; + Render->f(Target, &SubTP, FoundCharset); + } + UnStackContext(&SubTP); + } + + if (StrLength(Msg->reply_references)> 0) { + /* Trim down excessively long lists of thread references. We eliminate the + * second one in the list so that the thread root remains intact. + */ + int rrtok = num_tokens(ChrPtr(Msg->reply_references), '|'); + int rrlen = StrLength(Msg->reply_references); + if ( ((rrtok >= 3) && (rrlen > 900)) || (rrtok > 10) ) { + StrBufRemove_token(Msg->reply_references, 1, '|'); + } } - } - /* now check if we need to translate some mimeparts, and remove the duplicate */ - it = GetNewHashPos(Msg->AllAttach, 0); - while (GetNextHashPos(Msg->AllAttach, it, &len, &Key, &vMime) && - (vMime != NULL)) { - wc_mime_attachment *Mime = (wc_mime_attachment*) vMime; - evaluate_mime_part(Msg, Mime); - } - DeleteHashPos(&it); - StackContext(NULL, &SubTP, Msg, CTX_MAILSUM, 0, NULL); - { - *OutMime = DoTemplate(tmpl, tmpllen, Target, &SubTP); + /* now check if we need to translate some mimeparts, and remove the duplicate */ + it = GetNewHashPos(Msg->AllAttach, 0); + while (GetNextHashPos(Msg->AllAttach, it, &len, &Key, &vMime) && + (vMime != NULL)) { + StackContext(&SuperTP, &SubTP, vMime, CTX_MIME_ATACH, 0, NULL); + { + evaluate_mime_part(Target, &SubTP); + } + UnStackContext(&SubTP); + } + DeleteHashPos(&it); + *OutMime = DoTemplate(tmpl, tmpllen, Target, &SuperTP); } - UnStackContext(&SubTP); + UnStackContext(&SuperTP); DestroyMessageSummary(Msg); FreeStrBuf(&FoundCharset); @@ -1323,10 +1335,11 @@ long l_cccc; long l_replyto; long l_node; long l_rfca; +long l_nvto; const char *ReplyToModeStrings [3] = { "reply", - "replyalle", + "replyall", "forward" }; typedef enum _eReplyToNodes { @@ -1442,6 +1455,7 @@ void display_enter(void) StrBuf *rcpt = NULL; StrBuf *cccc = NULL; StrBuf *replyto = NULL; + StrBuf *nvto = NULL; serv_printf("MSG0 %ld|1", replying_to); StrBuf_ServGetln(Line); @@ -1527,7 +1541,7 @@ void display_enter(void) } else if (which == l_replyto) { replyto = NewStrBufPlain(ChrPtr(Line) + 5, StrLength(Line) - 5); - } + } else if (which == l_rfca) { StrBuf *FlatRFCA; rfca = NewStrBufPlain(ChrPtr(Line) + 5, StrLength(Line) - 5); @@ -1536,6 +1550,10 @@ void display_enter(void) FreeStrBuf(&rfca); rfca = FlatRFCA; } + else if (which == l_nvto) { + nvto = NewStrBufPlain(ChrPtr(Line) + 5, StrLength(Line) - 5); + putbstr("nvto", nvto); + } } @@ -2059,6 +2077,7 @@ InitModule_MSG l_replyto = FourHash("rep2", 4); l_node = FourHash("node", 4); l_rfca = FourHash("rfca", 4); + l_nvto = FourHash("nvto", 4); return ; }