aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/imap
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-11-13 00:54:48 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2013-11-13 00:54:48 -0800
commitad387cce77cf788fbad2da27c987f78dac4db477 (patch)
treeb48972ce664ef60838cfd118b293923dc829a11d /src/core/imap
parent257a7818f58ee67953e91e381dc3e28a41f14845 (diff)
Fixed #260: added ability to render a message without stripping spaces
Diffstat (limited to 'src/core/imap')
-rwxr-xr-xsrc/core/imap/MCIMAPSession.cc20
-rwxr-xr-xsrc/core/imap/MCIMAPSession.h4
2 files changed, 13 insertions, 11 deletions
diff --git a/src/core/imap/MCIMAPSession.cc b/src/core/imap/MCIMAPSession.cc
index 95662f3b..6c553e65 100755
--- a/src/core/imap/MCIMAPSession.cc
+++ b/src/core/imap/MCIMAPSession.cc
@@ -3417,7 +3417,7 @@ String * IMAPSession::plainTextRendering(IMAPMessage * message, String * folder,
return plainTextString;
}
-String * IMAPSession::plainTextBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError)
+String * IMAPSession::plainTextBodyRendering(IMAPMessage * message, String * folder, bool stripWhitespace, ErrorCode * pError)
{
String * htmlBodyString = htmlBodyRendering(message, folder, pError);
@@ -3427,14 +3427,16 @@ String * IMAPSession::plainTextBodyRendering(IMAPMessage * message, String * fol
String * plainTextBodyString = htmlBodyString->flattenHTML();
- plainTextBodyString->replaceOccurrencesOfString(MCSTR("\t"), MCSTR(" "));
- plainTextBodyString->replaceOccurrencesOfString(MCSTR("\n"), MCSTR(" "));
- plainTextBodyString->replaceOccurrencesOfString(MCSTR("\v"), MCSTR(" "));
- plainTextBodyString->replaceOccurrencesOfString(MCSTR("\f"), MCSTR(" "));
- plainTextBodyString->replaceOccurrencesOfString(MCSTR("\r"), MCSTR(" "));
-
- while (plainTextBodyString->replaceOccurrencesOfString(MCSTR(" "), MCSTR(" ")) > 0) {
- /* do nothing */
+ if (stripWhitespace) {
+ plainTextBodyString->replaceOccurrencesOfString(MCSTR("\t"), MCSTR(" "));
+ plainTextBodyString->replaceOccurrencesOfString(MCSTR("\n"), MCSTR(" "));
+ plainTextBodyString->replaceOccurrencesOfString(MCSTR("\v"), MCSTR(" "));
+ plainTextBodyString->replaceOccurrencesOfString(MCSTR("\f"), MCSTR(" "));
+ plainTextBodyString->replaceOccurrencesOfString(MCSTR("\r"), MCSTR(" "));
+
+ while (plainTextBodyString->replaceOccurrencesOfString(MCSTR(" "), MCSTR(" ")) > 0) {
+ /* do nothing */
+ }
}
return plainTextBodyString;
diff --git a/src/core/imap/MCIMAPSession.h b/src/core/imap/MCIMAPSession.h
index 3c819616..a8a7279b 100755
--- a/src/core/imap/MCIMAPSession.h
+++ b/src/core/imap/MCIMAPSession.h
@@ -175,9 +175,9 @@ namespace mailcore {
/** Text rendering of the message.*/
virtual String * plainTextRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
- /** Text rendering of the body of the message. All end of line will be removed and white spaces cleaned up.
+ /** Text rendering of the body of the message. All end of line will be removed and white spaces cleaned up if requested.
This method can be used to generate the summary of the message.*/
- virtual String * plainTextBodyRendering(IMAPMessage * message, String * folder, ErrorCode * pError);
+ virtual String * plainTextBodyRendering(IMAPMessage * message, String * folder, bool stripWhitespace, ErrorCode * pError);
/** Enable automatic query of the capabilities of the IMAP server when set to true. */
virtual void setAutomaticConfigurationEnabled(bool enabled);