Fixed a bug when parsing a mailbox with no explicit email address (should be recognized as an address).

This commit is contained in:
Vincent Richard 2004-10-07 11:24:34 +00:00
parent 27fb7a5b96
commit 84a7adf049

View File

@ -300,8 +300,18 @@ void mailbox::parse(const string& buffer, const string::size_type position,
}
}
// 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);