diff options
author | Vincent Richard <[email protected]> | 2014-06-08 17:12:26 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2014-06-08 17:12:26 +0000 |
commit | c8c5aa065f602bc50ebc4a5d5da18f9bff816877 (patch) | |
tree | 1006bb76bb25c0ecf96626b812de9871d4f049a7 | |
parent | Fixed issue #86: workaround for invalid response from Exchange server. (diff) | |
download | vmime-c8c5aa065f602bc50ebc4a5d5da18f9bff816877.tar.gz vmime-c8c5aa065f602bc50ebc4a5d5da18f9bff816877.zip |
Fixed decoding of '&-' in IMAP modified UTF-7 encoding.
-rw-r--r-- | src/vmime/net/imap/IMAPUtils.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/vmime/net/imap/IMAPUtils.cpp b/src/vmime/net/imap/IMAPUtils.cpp index 869b61aa..45545954 100644 --- a/src/vmime/net/imap/IMAPUtils.cpp +++ b/src/vmime/net/imap/IMAPUtils.cpp @@ -306,6 +306,7 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) out.reserve(text.length()); bool inB64sequence = false; + bool plusOutput = false; unsigned char prev = 0; for (string::const_iterator it = text.begin() ; it != text.end() ; ++it) @@ -320,7 +321,7 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) if (!inB64sequence) { inB64sequence = true; - out += '+'; + plusOutput = false; } else { @@ -332,7 +333,7 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) // End of Base64 sequence (or "&-" --> "&") case '-': { - if (inB64sequence && prev == '&') + if (inB64sequence && prev == '&') // special case "&-" --> "&" out += '&'; else out += '-'; @@ -343,11 +344,23 @@ const folder::path::component IMAPUtils::fromModifiedUTF7(const string& text) // ',' is used instead of '/' in modified Base64 case ',': { + if (inB64sequence && !plusOutput) + { + out += '+'; + plusOutput = true; + } + out += (inB64sequence ? '/' : ','); break; } default: { + if (inB64sequence && !plusOutput) + { + out += '+'; + plusOutput = true; + } + out += c; break; } |