projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1c1ce71
)
remove leading and trailing empty lines from mail output
author
Wilfried Goesgens
<dothebart@citadel.org>
Mon, 16 May 2011 17:49:34 +0000
(17:49 +0000)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 4 Sep 2011 20:43:43 +0000
(20:43 +0000)
webcit/msg_renderers.c
patch
|
blob
|
history
diff --git
a/webcit/msg_renderers.c
b/webcit/msg_renderers.c
index 7d21cf7a15f619a6da5493932fa2e40a55c03c20..74c34e5d69e7a98c5b11a860e6f12ea369c5535a 100644
(file)
--- a/
webcit/msg_renderers.c
+++ b/
webcit/msg_renderers.c
@@
-963,7
+963,8
@@
void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
StrBuf *Line1;
StrBuf *Line2;
StrBuf *Target;
StrBuf *Line1;
StrBuf *Line2;
StrBuf *Target;
-
+ long Linecount;
+ long nEmptyLines;
int bn = 0;
int bq = 0;
int i;
int bn = 0;
int bq = 0;
int i;
@@
-1009,7
+1010,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));
Line1 = NewStrBufPlain(NULL, SIZ);
Line2 = NewStrBufPlain(NULL, SIZ);
Target = NewStrBufPlain(NULL, StrLength(Mime->Data));
-
+ Linecount = 0;
+ nEmptyLines = 0;
if (StrLength(Mime->Data) > 0)
do
{
if (StrLength(Mime->Data) > 0)
do
{
@@
-1032,10
+1034,14
@@
void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
if (i > 0) StrBufCutLeft(Line, i);
if (StrLength(Line) == 0) {
if (i > 0) StrBufCutLeft(Line, i);
if (StrLength(Line) == 0) {
+ if (Linecount == 0)
+ continue;
StrBufAppendBufPlain(Target, HKEY("<tt></tt><br>\n"), 0);
StrBufAppendBufPlain(Target, HKEY("<tt></tt><br>\n"), 0);
+
+ nEmptyLines ++;
continue;
}
continue;
}
-
+ nEmptyLines = 0;
for (i = bn; i < bq; i++)
StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
for (i = bq; i < bn; i++)
for (i = bn; i < bq; i++)
StrBufAppendBufPlain(Target, HKEY("<blockquote>"), 0);
for (i = bq; i < bn; i++)
@@
-1051,10
+1057,13
@@
void render_MAIL_text_plain(wc_mime_attachment *Mime, StrBuf *RawData, StrBuf *F
StrEscAppend(Target, Line1, NULL, 0, 0);
StrBufAppendBufPlain(Target, HKEY("</tt><br>\n"), 0);
bn = bq;
StrEscAppend(Target, Line1, NULL, 0, 0);
StrBufAppendBufPlain(Target, HKEY("</tt><br>\n"), 0);
bn = bq;
+ Linecount ++;
}
while ((BufPtr != StrBufNOTNULL) &&
(BufPtr != NULL));
}
while ((BufPtr != StrBufNOTNULL) &&
(BufPtr != NULL));
+ if (nEmptyLines > 0)
+ StrBufCutRight(Target, nEmptyLines * (sizeof ("<tt></tt><br>\n") - 1));
for (i = 0; i < bn; i++)
StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);
for (i = 0; i < bn; i++)
StrBufAppendBufPlain(Target, HKEY("</blockquote>"), 0);