diff options
author | Vincent Richard <[email protected]> | 2012-12-12 13:47:15 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2012-12-12 13:47:15 +0000 |
commit | afec9aa66facbfac3812a5dcc3f43bf308beb274 (patch) | |
tree | 8c0c66c1f1f53b6b78bb91fa9f6a70ff5d30949f | |
parent | Fixed compilation issues in unit tests. (diff) | |
download | vmime-afec9aa66facbfac3812a5dcc3f43bf308beb274.tar.gz vmime-afec9aa66facbfac3812a5dcc3f43bf308beb274.zip |
Ignore empty modifiers (thanks to Mehmet Bozkurt).
-rw-r--r-- | src/disposition.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/disposition.cpp b/src/disposition.cpp index 24a45798..4edc61ce 100644 --- a/src/disposition.cpp +++ b/src/disposition.cpp @@ -300,13 +300,22 @@ void disposition::generateImpl(utility::outputStream& os, const string::size_typ if (m_modifiers.size() >= 1) { - os << "/" << m_modifiers[0]; - pos += 1 + m_modifiers[0].length(); - - for (std::vector <string>::size_type i = 1 ; i < m_modifiers.size() ; ++i) + for (std::vector <string>::size_type i = 1, n = 0 ; i < m_modifiers.size() ; ++i) { - os << "," << m_modifiers[i]; - pos += 1 + m_modifiers[i].length(); + const string mod = utility::stringUtils::trim(m_modifiers[i]); + + if (!mod.empty()) + { + if (n == 0) + os << "/"; + else + os << ","; + + os << mod; + pos += 1 + mod.length(); + + ++n; + } } } |