mirror of https://github.com/djcb/mu.git
Mark display names with special characters as needs_quoting
Use the updated defitions for atom/phrase in RFC 5322 3.2.3 to
This commit is contained in:
parent
dc61f088c7
commit
f4678e04aa
|
@ -29,17 +29,16 @@
|
|||
|
||||
using namespace Mu;
|
||||
|
||||
const std::string rfc822SpecialCharacters = "()<>@,;:\\\".[]";
|
||||
const std::string rfc5322SpecialCharacters = "()<>@,;:\\\"[]";
|
||||
|
||||
std::string
|
||||
Contact::display_name() const
|
||||
{
|
||||
auto needs_quoting= [](const std::string& n) {
|
||||
for (auto& c: n){
|
||||
// RFC 822 3.3 and RFC 5322 3.2.3 defines special characters, Ascii
|
||||
// Control (CTL) characters (0-31), DEL (127), and space as requiring
|
||||
// quoting.
|
||||
if (c <=31 || c >= 127 || c == ' ' || rfc822SpecialCharacters.find(c) != std::string::npos){
|
||||
// RFC 5322 3.2.3 defines special characters, Ascii Control
|
||||
// (CTL) characters (0-31), DEL (127) as requiring quoting.
|
||||
if ((c >= 0 && c <=31) || c == 127 || rfc5322SpecialCharacters.find(c) != std::string::npos){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue