diff options
author | Vincent Richard <[email protected]> | 2013-02-24 15:28:13 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2013-02-24 15:28:13 +0000 |
commit | 0c5d4a10e6f616f5a63787b8fbda86ec9fc487a9 (patch) | |
tree | c04b535bffeeba3e95adae01b961740bdc3a938e /src/mailboxGroup.cpp | |
parent | Fixed filename case. (diff) | |
download | vmime-0c5d4a10e6f616f5a63787b8fbda86ec9fc487a9.tar.gz vmime-0c5d4a10e6f616f5a63787b8fbda86ec9fc487a9.zip |
Message generation/parsing context. Charset conversion options. Preliminary implementation of RFC-6532.
Diffstat (limited to 'src/mailboxGroup.cpp')
-rw-r--r-- | src/mailboxGroup.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp index 251f920b..65611b33 100644 --- a/src/mailboxGroup.cpp +++ b/src/mailboxGroup.cpp @@ -54,8 +54,9 @@ mailboxGroup::~mailboxGroup() } -void mailboxGroup::parseImpl(const string& buffer, const string::size_type position, - const string::size_type end, string::size_type* newPosition) +void mailboxGroup::parseImpl + (const parsingContext& ctx, const string& buffer, const string::size_type position, + const string::size_type end, string::size_type* newPosition) { const string::value_type* const pend = buffer.data() + end; const string::value_type* const pstart = buffer.data() + position; @@ -80,7 +81,7 @@ void mailboxGroup::parseImpl(const string& buffer, const string::size_type posit while (pos < end) { - ref <address> parsedAddress = address::parseNext(buffer, pos, end, &pos); + ref <address> parsedAddress = address::parseNext(ctx, buffer, pos, end, &pos); if (parsedAddress) { @@ -102,7 +103,7 @@ void mailboxGroup::parseImpl(const string& buffer, const string::size_type posit } } - text::decodeAndUnfold(name, &m_name); + text::decodeAndUnfold(ctx, name, &m_name); setParsedBounds(position, end); @@ -111,8 +112,9 @@ void mailboxGroup::parseImpl(const string& buffer, const string::size_type posit } -void mailboxGroup::generateImpl(utility::outputStream& os, const string::size_type maxLineLength, - const string::size_type curLinePos, string::size_type* newLinePos) const +void mailboxGroup::generateImpl + (const generationContext& ctx, utility::outputStream& os, + const string::size_type curLinePos, string::size_type* newLinePos) const { // We have to encode the name: // - if it contains characters in a charset different from "US-ASCII", @@ -156,7 +158,10 @@ void mailboxGroup::generateImpl(utility::outputStream& os, const string::size_ty string::size_type pos = curLinePos; - m_name.encodeAndFold(os, maxLineLength - 2, pos, &pos, + generationContext tmpCtx(ctx); + tmpCtx.setMaxLineLength(ctx.getMaxLineLength() - 2); + + m_name.encodeAndFold(ctx, os, pos, &pos, forceEncode ? text::FORCE_ENCODING : 0); os << ":"; @@ -176,7 +181,7 @@ void mailboxGroup::generateImpl(utility::outputStream& os, const string::size_ty ++pos; } - (*it)->generate(os, maxLineLength - 2, pos, &pos); + (*it)->generate(tmpCtx, os, pos, &pos); } os << ";"; |