Fix a test failure in pathTest::testGenerate (#312)
* Fix a test failure in testNewFromString
Fixes an oversight in d296c2d1
.
* Fix a test failure in pathTest::testGenerate
Partially revert v0.9.2-183-g9b65b4de.
As per RFC 5322 §3.4.1, an email address must always have a @.
As per RFC 5321 §4.1.2, a path is similar to an email address (always
@), with "" (<>) being the only other special value.
Fixes #294, #301.
This commit is contained in:
parent
aa60d00496
commit
beb238b5e7
@ -596,27 +596,15 @@ void emailAddress::generateImpl(
|
||||
}
|
||||
|
||||
|
||||
if (!domainPart.empty()) {
|
||||
os << localPart
|
||||
<< "@"
|
||||
<< domainPart;
|
||||
os << localPart
|
||||
<< "@"
|
||||
<< domainPart;
|
||||
|
||||
if (newLinePos) {
|
||||
*newLinePos = curLinePos
|
||||
+ localPart.length()
|
||||
+ 1 // @
|
||||
+ domainPart.length();
|
||||
}
|
||||
} else {
|
||||
// this should only be true if m_useMyHostname is false and an address without
|
||||
// an `@` is encountered
|
||||
|
||||
os << localPart;
|
||||
|
||||
if (newLinePos) {
|
||||
*newLinePos = curLinePos
|
||||
+ localPart.length();
|
||||
}
|
||||
if (newLinePos) {
|
||||
*newLinePos = curLinePos
|
||||
+ localPart.length()
|
||||
+ 1 // @
|
||||
+ domainPart.length();
|
||||
}
|
||||
}
|
||||
|
||||
@ -710,13 +698,8 @@ const text emailAddress::toText() const {
|
||||
|
||||
text txt;
|
||||
txt.appendWord(make_shared <vmime::word>(m_localName));
|
||||
|
||||
if (!m_domainName.isEmpty()) {
|
||||
// this should only be skipped if m_useMyHostname is false and an address without
|
||||
// an `@` is encountered
|
||||
txt.appendWord(make_shared <vmime::word>("@", vmime::charsets::US_ASCII));
|
||||
txt.appendWord(make_shared <vmime::word>(m_domainName));
|
||||
}
|
||||
txt.appendWord(make_shared <vmime::word>("@", vmime::charsets::US_ASCII));
|
||||
txt.appendWord(make_shared <vmime::word>(m_domainName));
|
||||
|
||||
return txt;
|
||||
}
|
||||
|
@ -192,16 +192,6 @@ void path::generateImpl(
|
||||
*newLinePos = curLinePos + 2;
|
||||
}
|
||||
|
||||
} else if (!m_localPart.empty() && m_domain.empty()) {
|
||||
// this should only be true if m_useMyHostname is false and an address without
|
||||
// an `@` is encountered
|
||||
|
||||
os << "<" << m_localPart << ">";
|
||||
|
||||
if (newLinePos) {
|
||||
*newLinePos = curLinePos + m_localPart.length() + 2;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
os << "<" << m_localPart << "@" << m_domain << ">";
|
||||
|
Loading…
Reference in New Issue
Block a user