From 84a7adf049971de404e6539b308075d22eabfcf5 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 7 Oct 2004 11:24:34 +0000 Subject: [PATCH] Fixed a bug when parsing a mailbox with no explicit email address (should be recognized as an address). --- src/mailbox.cpp | 14 ++++++++++++-- 1 file 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);