contacts: support encoding names with '"', ',' etc.

This commit is contained in:
Dirk-Jan C. Binnema
2022-05-06 09:03:11 +03:00
parent e0d047105b
commit ffce3dda21
3 changed files with 47 additions and 6 deletions

View File

@ -88,9 +88,13 @@ struct Contact {
* Jane Doe <email@example.com>
* otherwise it's just the e-mail address.
*
* @param quote_if_needed if true, handle quoting of the name-part as well. This
* is useful when the address is to be used directly in emails.
*
* @return the display name
*/
std::string display_name() const;
std::string display_name(bool quote_if_needed=false) const;
/**
* Operator==; based on the hash values (ie. lowercase e-mail address)
@ -160,7 +164,6 @@ private:
}
};
constexpr Option<Contact::Type>
contact_type_from_field_id(Field::Id id) noexcept {