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
|
||||||
os << localPart
|
<< "@"
|
||||||
<< "@"
|
<< domainPart;
|
||||||
<< domainPart;
|
|
||||||
|
|
||||||
if (newLinePos) {
|
if (newLinePos) {
|
||||||
*newLinePos = curLinePos
|
*newLinePos = curLinePos
|
||||||
+ localPart.length()
|
+ localPart.length()
|
||||||
+ 1 // @
|
+ 1 // @
|
||||||
+ domainPart.length();
|
+ 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -710,13 +698,8 @@ const text emailAddress::toText() const {
|
|||||||
|
|
||||||
text txt;
|
text txt;
|
||||||
txt.appendWord(make_shared <vmime::word>(m_localName));
|
txt.appendWord(make_shared <vmime::word>(m_localName));
|
||||||
|
txt.appendWord(make_shared <vmime::word>("@", vmime::charsets::US_ASCII));
|
||||||
if (!m_domainName.isEmpty()) {
|
txt.appendWord(make_shared <vmime::word>(m_domainName));
|
||||||
// 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));
|
|
||||||
}
|
|
||||||
|
|
||||||
return txt;
|
return txt;
|
||||||
}
|
}
|
||||||
|
@ -192,16 +192,6 @@ void path::generateImpl(
|
|||||||
*newLinePos = curLinePos + 2;
|
*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 {
|
} else {
|
||||||
|
|
||||||
os << "<" << m_localPart << "@" << m_domain << ">";
|
os << "<" << m_localPart << "@" << m_domain << ">";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user