diff options
author | Vincent Richard <[email protected]> | 2013-06-24 13:32:40 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-06-24 13:32:40 +0000 |
commit | 895b07cae9741f44a1272b2f3875f8dd94763222 (patch) | |
tree | 6532de59e01676c78b423b5de5ebc1411c7da111 /src/utility/encoder/qpEncoder.cpp | |
parent | Return after sending message when sending is supported. (diff) | |
download | vmime-895b07cae9741f44a1272b2f3875f8dd94763222.tar.gz vmime-895b07cae9741f44a1272b2f3875f8dd94763222.zip |
Added support for SIZE SMTP extension (RFC-1870).
Diffstat (limited to 'src/utility/encoder/qpEncoder.cpp')
-rw-r--r-- | src/utility/encoder/qpEncoder.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp index d519de14..1768818c 100644 --- a/src/utility/encoder/qpEncoder.cpp +++ b/src/utility/encoder/qpEncoder.cpp @@ -532,6 +532,27 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in, } +utility::stream::size_type qpEncoder::getEncodedSize(const utility::stream::size_type n) const +{ + const string::size_type propMaxLineLength = + getProperties().getProperty <string::size_type>("maxlinelength", static_cast <string::size_type>(-1)); + + const bool cutLines = (propMaxLineLength != static_cast <string::size_type>(-1)); + const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast <string::size_type>(74)); + + // Worst cast: 1 byte of input provide 3 bytes of output + // Count CRLF (2 bytes) for each line. + return n * 3 + (cutLines ? (n / maxLineLength) * 2 : 0); +} + + +utility::stream::size_type qpEncoder::getDecodedSize(const utility::stream::size_type n) const +{ + // Worst case: 1 byte of input equals 1 byte of output + return n; +} + + } // encoder } // utility } // vmime |