X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmsg_renderers.c;h=f6d31e90fb4c105f244d40bebaa7173f739b39ff;hb=a91d5e80ca1d7086fdf0c7d801ea32bd061b9c89;hp=c8f367627aaaeb326a8a739a5551c1d1ea9e3194;hpb=ae6b0558f64f5f15b05c79623f905be584c0d3ad;p=citadel.git diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index c8f367627..f6d31e90f 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -403,9 +403,33 @@ void tmplput_MAIL_SUMM_ALLRCPT(StrBuf *Target, WCTemplputParams *TP) HashList *iterate_get_mailsumm_All(StrBuf *Target, WCTemplputParams *TP) { - return WC->summ; + return WC->summ; +} +int Conditional_ROOM_DISPLAY_MSG(StrBuf *Target, WCTemplputParams *TP) { + //message_summary *Msg = (message_summary *) CTX; + wcsubst *subst; + wcsession *WCC = WC; + GetHash(WCC->vars, HKEY("ITERATE:N"), (void *)&subst); + long num_inset = subst->lvalue; + if ((num_inset >= WC->startmsg) && (WCC->num_displayed <= WCC->maxmsgs)) { + WCC->num_displayed = WCC->num_displayed+1; + return 1; // Pass GO, collect $200 + } + return 0; +} +int Conditional_MAIL_SUMM_LASTMSG(StrBuf *Target, WCTemplputParams *TP) { + wcsubst *nsubst, *n_dsubst; + long is_last_n; + + GetHash(WC->vars, HKEY("ITERATE:LASTN"), (void *)&nsubst); + is_last_n = nsubst->lvalue; + + //GetHash(WC->vars, HKEY("ITERATE:N"), (void *)&n_dsubst); + //num_inset = n_dsubst->lvalue; + + // Is the num_displayed higher than maxmsgs? OR last in iterator + return ((WC->num_displayed > WC->maxmsgs) || (is_last_n == 1)); } - void examine_time(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) { Msg->date = StrTol(HdrLine); @@ -622,7 +646,6 @@ void examine_msg4_partnum(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCh StrBufTrim(Msg->MsgBody->PartNum); } - void examine_content_lengh(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset) { Msg->MsgBody->length = StrTol(HdrLine); @@ -717,7 +740,7 @@ int Conditional_MAIL_MIME_ATTACH(StrBuf *Target, WCTemplputParams *TP) /*----------------------------------------------------------------------------*/ void tmplput_QUOTED_MAIL_BODY(StrBuf *Target, WCTemplputParams *TP) { - long MsgNum; + long MsgNum; StrBuf *Buf; MsgNum = LBstr(TKEY(0)); @@ -1083,7 +1106,6 @@ InitModule_MSGRENDERERS RegisterIterator("MAIL:SUMM:MSGS", 0, NULL, iterate_get_mailsumm_All, NULL,NULL, CTX_MAILSUM, CTX_NONE, IT_NOFLAG); - /* render parts of the message struct */ RegisterNamespace("MAIL:SUMM:DATEBRIEF", 0, 0, tmplput_MAIL_SUMM_DATE_BRIEF, CTX_MAILSUM); RegisterNamespace("MAIL:SUMM:DATEFULL", 0, 0, tmplput_MAIL_SUMM_DATE_FULL, CTX_MAILSUM); RegisterNamespace("MAIL:SUMM:DATENO", 0, 0, tmplput_MAIL_SUMM_DATE_NO, CTX_MAILSUM); @@ -1102,7 +1124,8 @@ InitModule_MSGRENDERERS RegisterNamespace("MAIL:SUMM:INREPLYTO", 0, 2, tmplput_MAIL_SUMM_INREPLYTO, CTX_MAILSUM); RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY, CTX_MAILSUM); RegisterNamespace("MAIL:QUOTETEXT", 1, 2, tmplput_QUOTED_MAIL_BODY, CTX_NONE); - + RegisterConditional(HKEY("COND:ROOM:DISPLAYMSG"), 0, Conditional_ROOM_DISPLAY_MSG, CTX_MAILSUM); + RegisterConditional(HKEY("COND:MAIL:SUMM:LASTMSG"), 0, Conditional_MAIL_SUMM_LASTMSG, CTX_MAILSUM); RegisterConditional(HKEY("COND:MAIL:SUMM:RFCA"), 0, Conditional_MAIL_SUMM_RFCA, CTX_MAILSUM); RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM); RegisterConditional(HKEY("COND:MAIL:SUMM:H_NODE"), 0, Conditional_MAIL_SUMM_H_NODE, CTX_MAILSUM);