diff options
author | Vincent Richard <[email protected]> | 2004-10-07 11:24:34 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2004-10-07 11:24:34 +0000 |
commit | 84a7adf049971de404e6539b308075d22eabfcf5 (patch) | |
tree | 29d16acb3761dea9d5fb038b2900edc5b35eac95 /src/mailbox.cpp | |
parent | New unit test system: Unit++. (diff) | |
download | vmime-84a7adf049971de404e6539b308075d22eabfcf5.tar.gz vmime-84a7adf049971de404e6539b308075d22eabfcf5.zip |
Fixed a bug when parsing a mailbox with no explicit email address (should be recognized as an address).
Diffstat (limited to 'src/mailbox.cpp')
-rw-r--r-- | src/mailbox.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mailbox.cpp b/src/mailbox.cpp index 6560296c..f5da6843 100644 --- a/src/mailbox.cpp +++ b/src/mailbox.cpp @@ -300,8 +300,18 @@ void mailbox::parse(const string& buffer, const string::size_type position, } } - decodeAndUnfoldText(name, m_name); - m_email = address; + // Swap name and address when no address was found + // (email address is mandatory, whereas name is optional). + if (address.empty() && !name.empty()) + { + m_email = name; + m_name.clear(); + } + else + { + decodeAndUnfoldText(name, m_name); + m_email = address; + } if (newPosition) *newPosition = position + (p - pstart); |