X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fmsg_renderers.c;h=c5af544928774e9e11be62961bc69f7df997caf3;hb=4b4dc864ede7c5d8d956febe4a0afb422b78e7c4;hp=5c029823e085dbed1162a10758f9a5b7cdcfd535;hpb=63cbcbf7992bdf6e0b0eb04db4b92476a609d543;p=citadel.git
diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c
index 5c029823e..c5af54492 100644
--- a/webcit/msg_renderers.c
+++ b/webcit/msg_renderers.c
@@ -1,6 +1,16 @@
#include "webcit.h"
#include "webserver.h"
-#include "groupdav.h"
+#include "dav.h"
+
+
+
+inline void CheckConvertBufs(struct wcsession *WCC)
+{
+ if (WCC->ConvertBuf1 == NULL)
+ WCC->ConvertBuf1 = NewStrBuf();
+ if (WCC->ConvertBuf2 == NULL)
+ WCC->ConvertBuf2 = NewStrBuf();
+}
/*
* message index functions
@@ -41,9 +51,7 @@ void DestroyMessageSummary(void *vMsg)
FreeStrBuf(&Msg->Rfca);
FreeStrBuf(&Msg->OtherNode);
- FreeStrBuf(&Msg->reply_to);
-
- DeleteHash(&Msg->Attachments); /**< list of Accachments */
+ DeleteHash(&Msg->Attachments); /* list of Attachments */
DeleteHash(&Msg->Submessages);
DeleteHash(&Msg->AttachLinks);
DeleteHash(&Msg->AllAttach);
@@ -251,9 +259,17 @@ void examine_type(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
void examine_from(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
FreeStrBuf(&Msg->from);
Msg->from = NewStrBufPlain(NULL, StrLength(HdrLine));
- StrBuf_RFC822_to_Utf8(Msg->from, HdrLine, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Msg->from,
+ HdrLine,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
}
void tmplput_MAIL_SUMM_FROM(StrBuf *Target, WCTemplputParams *TP)
{
@@ -261,32 +277,61 @@ void tmplput_MAIL_SUMM_FROM(StrBuf *Target, WCTemplputParams *TP)
StrBufAppendTemplate(Target, TP, Msg->from, 0);
}
-
-
void examine_subj(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
FreeStrBuf(&Msg->subj);
Msg->subj = NewStrBufPlain(NULL, StrLength(HdrLine));
- StrBuf_RFC822_to_Utf8(Msg->subj, HdrLine, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Msg->subj,
+ HdrLine,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
}
void tmplput_MAIL_SUMM_SUBJECT(StrBuf *Target, WCTemplputParams *TP)
-{/*////TODO: Fwd: and RE: filter!!*/
-
+{
message_summary *Msg = (message_summary*) CTX;
+
+ if (TP->Tokens->nParameters == 4)
+ {
+ const char *pch;
+ long len;
+
+ GetTemplateTokenString(Target, TP, 3, &pch, &len);
+ if ((len > 0)&&
+ (strstr(ChrPtr(Msg->subj), pch) == NULL))
+ {
+ GetTemplateTokenString(Target, TP, 2, &pch, &len);
+ StrBufAppendBufPlain(Target, pch, len, 0);
+ }
+ }
StrBufAppendTemplate(Target, TP, Msg->subj, 0);
}
int Conditional_MAIL_SUMM_SUBJECT(StrBuf *Target, WCTemplputParams *TP)
{
message_summary *Msg = (message_summary*) CTX;
+
+
return StrLength(Msg->subj) > 0;
}
void examine_msgn(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
FreeStrBuf(&Msg->reply_inreplyto);
Msg->reply_inreplyto = NewStrBufPlain(NULL, StrLength(HdrLine));
- StrBuf_RFC822_to_Utf8(Msg->reply_inreplyto, HdrLine, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Msg->reply_inreplyto,
+ HdrLine,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
}
void tmplput_MAIL_SUMM_INREPLYTO(StrBuf *Target, WCTemplputParams *TP)
{
@@ -297,14 +342,22 @@ void tmplput_MAIL_SUMM_INREPLYTO(StrBuf *Target, WCTemplputParams *TP)
int Conditional_MAIL_SUMM_UNREAD(StrBuf *Target, WCTemplputParams *TP)
{
message_summary *Msg = (message_summary*) CTX;
- return Msg->is_new != 0;
+ return (Msg->Flags & MSGFLAG_READ) != 0;
}
void examine_wefw(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
FreeStrBuf(&Msg->reply_references);
Msg->reply_references = NewStrBufPlain(NULL, StrLength(HdrLine));
- StrBuf_RFC822_to_Utf8(Msg->reply_references, HdrLine, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Msg->reply_references,
+ HdrLine,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
}
void tmplput_MAIL_SUMM_REFIDS(StrBuf *Target, WCTemplputParams *TP)
{
@@ -315,9 +368,17 @@ void tmplput_MAIL_SUMM_REFIDS(StrBuf *Target, WCTemplputParams *TP)
void examine_cccc(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
FreeStrBuf(&Msg->cccc);
Msg->cccc = NewStrBufPlain(NULL, StrLength(HdrLine));
- StrBuf_RFC822_to_Utf8(Msg->cccc, HdrLine, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Msg->cccc,
+ HdrLine,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
if (Msg->AllRcpt == NULL)
Msg->AllRcpt = NewStrBufPlain(NULL, StrLength(HdrLine));
if (StrLength(Msg->AllRcpt) > 0) {
@@ -335,7 +396,7 @@ void tmplput_MAIL_SUMM_CCCC(StrBuf *Target, WCTemplputParams *TP)
void examine_room(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
if ((StrLength(HdrLine) > 0) &&
- (strcasecmp(ChrPtr(HdrLine), ChrPtr(WC->wc_roomname)))) {
+ (strcasecmp(ChrPtr(HdrLine), ChrPtr(WC->CurRoom.name)))) {
FreeStrBuf(&Msg->Room);
Msg->Room = NewStrBufDup(HdrLine);
}
@@ -373,7 +434,7 @@ void examine_node(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
wcsession *WCC = WC;
if ( (StrLength(HdrLine) > 0) &&
- ((WC->room_flags & QR_NETWORK)
+ ((WC->CurRoom.QRFlags & QR_NETWORK)
|| ((strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_nodename))
&& (strcasecmp(ChrPtr(HdrLine), ChrPtr(WCC->serv_info->serv_fqdn))))))) {
FreeStrBuf(&Msg->OtherNode);
@@ -394,9 +455,17 @@ int Conditional_MAIL_SUMM_OTHERNODE(StrBuf *Target, WCTemplputParams *TP)
void examine_rcpt(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
FreeStrBuf(&Msg->to);
Msg->to = NewStrBufPlain(NULL, StrLength(HdrLine));
- StrBuf_RFC822_to_Utf8(Msg->to, HdrLine, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Msg->to,
+ HdrLine,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
if (Msg->AllRcpt == NULL)
Msg->AllRcpt = NewStrBufPlain(NULL, StrLength(HdrLine));
if (StrLength(Msg->AllRcpt) > 0) {
@@ -449,6 +518,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];
@@ -468,7 +543,10 @@ void render_MAIL(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset
{
const StrBuf *TemplateMime;
- Mime->Data = NewStrBufPlain(NULL, Mime->length);
+ if (Mime->Data == NULL)
+ Mime->Data = NewStrBufPlain(NULL, Mime->length);
+ else
+ FlushStrBuf(Mime->Data);
read_message(Mime->Data, HKEY("view_submessage"), Mime->msgnum, Mime->PartNum, &TemplateMime);
/*
if ( (!IsEmptyStr(mime_submessages)) && (!section[0]) ) {
@@ -486,22 +564,23 @@ void render_MAIL(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset
void render_MIME_VCard(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
{
wcsession *WCC = WC;
- MimeLoadData(Mime);
+ if (StrLength(Mime->Data) == 0)
+ MimeLoadData(Mime);
if (StrLength(Mime->Data) > 0) {
StrBuf *Buf;
Buf = NewStrBuf();
/** If it's my vCard I can edit it */
- if ( (!strcasecmp(ChrPtr(WCC->wc_roomname), USERCONFIGROOM))
- || (!strcasecmp(&(ChrPtr(WCC->wc_roomname)[11]), USERCONFIGROOM))
- || (WC->wc_view == VIEW_ADDRESSBOOK)
+ if ( (!strcasecmp(ChrPtr(WCC->CurRoom.name), USERCONFIGROOM))
+ || (!strcasecmp(&(ChrPtr(WCC->CurRoom.name)[11]), USERCONFIGROOM))
+ || (WC->CurRoom.view == VIEW_ADDRESSBOOK)
) {
- StrBufAppendPrintf(Buf, "",
+ StrBufAppendPrintf(Buf, "",
Mime->msgnum, ChrPtr(Mime->PartNum));
StrBufAppendPrintf(Buf, "[%s]", _("edit"));
}
/* In all cases, display the full card */
- display_vcard(Buf, Mime->Data, 0, 1, NULL, Mime->msgnum);
+ display_vcard(Buf, Mime, 0, 1, NULL, -1);
FreeStrBuf(&Mime->Data);
Mime->Data = Buf;
}
@@ -510,7 +589,8 @@ void render_MIME_VCard(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundC
void render_MIME_VNote(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
{
- MimeLoadData(Mime);
+ if (StrLength(Mime->Data) == 0)
+ MimeLoadData(Mime);
if (StrLength(Mime->Data) > 0) {
struct vnote *v;
StrBuf *Buf;
@@ -532,10 +612,13 @@ void render_MIME_VNote(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundC
vnote_free(v);
Mime->Data = Buf;
}
- else
- Mime->Data = NewStrBuf();
+ else {
+ if (Mime->Data == NULL)
+ Mime->Data = NewStrBuf();
+ else
+ FlushStrBuf(Mime->Data);
+ }
}
-
}
void render_MIME_ICS(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCharset)
@@ -552,26 +635,39 @@ void render_MIME_ICS(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *FoundCha
void examine_mime_part(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ const char *Ptr = NULL;
wc_mime_attachment *Mime;
StrBuf *Buf;
-
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
Mime = (wc_mime_attachment*) malloc(sizeof(wc_mime_attachment));
memset(Mime, 0, sizeof(wc_mime_attachment));
Mime->msgnum = Msg->msgnum;
Buf = NewStrBuf();
Mime->Name = NewStrBuf();
- StrBufExtract_token(Buf, HdrLine, 0, '|');
- StrBuf_RFC822_to_Utf8(Mime->Name, Buf, WC->DefaultCharset, FoundCharset);
+ StrBufExtract_NextToken(Buf, HdrLine, &Ptr, '|');
+ StrBuf_RFC822_2_Utf8(Mime->Name,
+ Buf,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
StrBufTrim(Mime->Name);
- StrBufExtract_token(Buf, HdrLine, 1, '|');
+ StrBufExtract_NextToken(Buf, HdrLine, &Ptr, '|');
Mime->FileName = NewStrBuf();
- StrBuf_RFC822_to_Utf8(Mime->FileName, Buf, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Mime->FileName,
+ Buf,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
StrBufTrim(Mime->FileName);
Mime->PartNum = NewStrBuf();
- StrBufExtract_token(Mime->PartNum, HdrLine, 2, '|');
+ StrBufExtract_NextToken(Mime->PartNum, HdrLine, &Ptr, '|');
StrBufTrim(Mime->PartNum);
if (strchr(ChrPtr(Mime->PartNum), '.') != NULL)
Mime->level = 2;
@@ -579,18 +675,24 @@ void examine_mime_part(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundChars
Mime->level = 1;
Mime->Disposition = NewStrBuf();
- StrBufExtract_token(Mime->Disposition, HdrLine, 3, '|');
+ StrBufExtract_NextToken(Mime->Disposition, HdrLine, &Ptr, '|');
Mime->ContentType = NewStrBuf();
- StrBufExtract_token(Mime->ContentType, HdrLine, 4, '|');
+ StrBufExtract_NextToken(Mime->ContentType, HdrLine, &Ptr, '|');
StrBufTrim(Mime->ContentType);
StrBufLowerCase(Mime->ContentType);
-
if (!strcmp(ChrPtr(Mime->ContentType), "application/octet-stream")) {
StrBufPlain(Mime->ContentType,
GuessMimeByFilename(SKEY(Mime->FileName)), -1);
}
- Mime->length = StrBufExtract_int(HdrLine, 5, '|');
+
+ Mime->length = StrBufExtractNext_int(HdrLine, &Ptr, '|');
+
+ StrBufSkip_NTokenS(HdrLine, &Ptr, '|', 1); /* cbid?? */
+
+ Mime->Charset = NewStrBuf();
+ StrBufExtract_NextToken(Mime->Charset, HdrLine, &Ptr, '|');
+
if ( (StrLength(Mime->FileName) == 0) && (StrLength(Mime->Name) > 0) ) {
StrBufAppendBuf(Mime->FileName, Mime->Name, 0);
@@ -616,7 +718,7 @@ void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime)
void *vMimeRenderer;
/* just print the root-node */
- if ((Mime->level == 1) &&
+ if ((Mime->level >= 1) &&
GetHash(MimeRenderHandler, SKEY(Mime->ContentType), &vMimeRenderer) &&
vMimeRenderer != NULL)
{
@@ -625,14 +727,14 @@ void evaluate_mime_part(message_summary *Msg, wc_mime_attachment *Mime)
Msg->Submessages = NewHash(1,NULL);
Put(Msg->Submessages, SKEY(Mime->PartNum), Mime, reference_free_handler);
}
- else if ((Mime->level == 1) &&
+ else if ((Mime->level >= 1) &&
(!strcasecmp(ChrPtr(Mime->Disposition), "inline"))
&& (!strncasecmp(ChrPtr(Mime->ContentType), "image/", 6)) ){
if (Msg->AttachLinks == NULL)
Msg->AttachLinks = NewHash(1,NULL);
Put(Msg->AttachLinks, SKEY(Mime->PartNum), Mime, reference_free_handler);
}
- else if ((Mime->level == 1) &&
+ else if ((Mime->level >= 1) &&
(StrLength(Mime->ContentType) > 0) &&
( (!strcasecmp(ChrPtr(Mime->Disposition), "attachment"))
|| (!strcasecmp(ChrPtr(Mime->Disposition), "inline"))
@@ -660,9 +762,17 @@ void tmplput_MAIL_SUMM_NATTACH(StrBuf *Target, WCTemplputParams *TP)
void examine_hnod(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
+ wcsession *WCC = WC;
+
+ CheckConvertBufs(WCC);
FreeStrBuf(&Msg->hnod);
Msg->hnod = NewStrBufPlain(NULL, StrLength(HdrLine));
- StrBuf_RFC822_to_Utf8(Msg->hnod, HdrLine, WC->DefaultCharset, FoundCharset);
+ StrBuf_RFC822_2_Utf8(Msg->hnod,
+ HdrLine,
+ WCC->DefaultCharset,
+ FoundCharset,
+ WCC->ConvertBuf1,
+ WCC->ConvertBuf2);
}
void tmplput_MAIL_SUMM_H_NODE(StrBuf *Target, WCTemplputParams *TP)
{
@@ -679,7 +789,10 @@ int Conditional_MAIL_SUMM_H_NODE(StrBuf *Target, WCTemplputParams *TP)
void examine_text(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
{
- Msg->MsgBody->Data = NewStrBufPlain(NULL, SIZ);
+ if (Msg->MsgBody->Data == NULL)
+ Msg->MsgBody->Data = NewStrBufPlain(NULL, SIZ);
+ else
+ FlushStrBuf(Msg->MsgBody->Data);
}
void examine_msg4_partnum(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCharset)
@@ -738,7 +851,7 @@ void examine_content_type(message_summary *Msg, StrBuf *HdrLine, StrBuf *FoundCh
Hdr = (headereval*)vHdr;
Hdr->evaluator(Msg, Value, FoundCharset);
}
- else lprintf(1, "don't know how to handle content type sub-header[%s]\n", ChrPtr(Token));
+ else syslog(1, "don't know how to handle content type sub-header[%s]\n", ChrPtr(Token));
}
FreeStrBuf(&Token);
FreeStrBuf(&Value);
@@ -752,6 +865,21 @@ void tmplput_MAIL_SUMM_N(StrBuf *Target, WCTemplputParams *TP)
}
+void tmplput_MAIL_SUMM_PERMALINK(StrBuf *Target, WCTemplputParams *TP)
+{
+ message_summary *Msg = (message_summary*) CTX;
+ char perma_link[1024];
+ char encoded_link[1024];
+
+ strcpy(perma_link, "/readfwd?go=");
+ urlesc(&perma_link[12], sizeof(perma_link) - 12, (char *)ChrPtr(WC->CurRoom.name) );
+ sprintf(&perma_link[strlen(perma_link)], "?start_reading_at=%ld#%ld", Msg->msgnum, Msg->msgnum);
+
+
+ CtdlEncodeBase64(encoded_link, perma_link, strlen(perma_link), 0);
+ StrBufAppendPrintf(Target, "/B64%s", encoded_link);
+}
+
int Conditional_MAIL_MIME_ALL(StrBuf *Target, WCTemplputParams *TP)
{
@@ -809,12 +937,18 @@ void tmplput_EDIT_WIKI_BODY(StrBuf *Target, WCTemplputParams *TP)
long msgnum;
StrBuf *Buf;
- msgnum = locate_message_by_uid(BSTR("page"));
- if (msgnum >= 0L) {
- Buf = NewStrBuf();
- read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime);
- StrBufAppendTemplate(Target, TP, Buf, 1);
- FreeStrBuf(&Buf);
+ /* Insert the existing content of the wiki page into the editor. But we only want
+ * to do this the first time -- if the user is uploading an attachment we don't want
+ * to do it again.
+ */
+ if (!havebstr("attach_button")) {
+ msgnum = locate_message_by_uid(BSTR("page"));
+ if (msgnum >= 0L) {
+ Buf = NewStrBuf();
+ read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime);
+ StrBufAppendTemplate(Target, TP, Buf, 1);
+ FreeStrBuf(&Buf);
+ }
}
}
@@ -842,7 +976,8 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
StrBuf *Line1;
StrBuf *Line2;
StrBuf *Target;
-
+ long Linecount;
+ long nEmptyLines;
int bn = 0;
int bq = 0;
int i;
@@ -878,7 +1013,7 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
else {
ctdl_iconv_open("UTF-8", ChrPtr(cs), &ic);
if (ic == (iconv_t)(-1) ) {
- lprintf(5, "%s:%d iconv_open(UTF-8, %s) failed: %s\n",
+ syslog(5, "%s:%d iconv_open(UTF-8, %s) failed: %s\n",
__FILE__, __LINE__, ChrPtr(Mime->Charset), strerror(errno));
}
}
@@ -888,7 +1023,8 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
Line1 = NewStrBufPlain(NULL, SIZ);
Line2 = NewStrBufPlain(NULL, SIZ);
Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
-
+ Linecount = 0;
+ nEmptyLines = 0;
if (StrLength(Mime->Data) > 0)
do
{
@@ -911,10 +1047,14 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
if (i > 0) StrBufCutLeft(Line, i);
if (StrLength(Line) == 0) {
- StrBufAppendBufPlain(Target, HKEY("
\n"), 0);
+ if (Linecount == 0)
+ continue;
+ StrBufAppendBufPlain(Target, HKEY("
\n"), 0);
+
+ nEmptyLines ++;
continue;
}
-
+ nEmptyLines = 0;
for (i = bn; i < bq; i++)
StrBufAppendBufPlain(Target, HKEY("
"), 0); for (i = bq; i < bn; i++) @@ -928,16 +1068,19 @@ void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F UrlizeText(Line1, Line, Line2); StrEscAppend(Target, Line1, NULL, 0, 0); - StrBufAppendBufPlain(Target, HKEY(""), 0); - StrBufAppendBufPlain(Target, HKEY("
\n"), 0); + StrBufAppendBufPlain(Target, HKEY("
\n"), 0); bn = bq; + Linecount ++; } while ((BufPtr != StrBufNOTNULL) && (BufPtr != NULL)); + if (nEmptyLines > 0) + StrBufCutRight(Target, nEmptyLines * (sizeof ("
\n") - 1)); for (i = 0; i < bn; i++) StrBufAppendBufPlain(Target, HKEY("