diff options
author | 2013-11-13 00:54:48 -0800 | |
---|---|---|
committer | 2013-11-13 00:54:48 -0800 | |
commit | ad387cce77cf788fbad2da27c987f78dac4db477 (patch) | |
tree | b48972ce664ef60838cfd118b293923dc829a11d /src/core/imap | |
parent | 257a7818f58ee67953e91e381dc3e28a41f14845 (diff) |
Fixed #260: added ability to render a message without stripping spaces
Diffstat (limited to 'src/core/imap')
-rwxr-xr-x | src/core/imap/MCIMAPSession.cc | 20 | ||||
-rwxr-xr-x | src/core/imap/MCIMAPSession.h | 4 |
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); |