aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailbox.cpp14
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);