contact: fix quoting

Ensure that addresses with commas are quoted. Don't 2047-encode though.

Update tests.
This commit is contained in:
Dirk-Jan C. Binnema
2023-03-14 06:18:56 +02:00
parent 46746bacf8
commit 96e16034c7
4 changed files with 18 additions and 23 deletions

View File

@ -83,18 +83,15 @@ struct Contact {
{ cleanup_name();}
/**
* Get the "display name" for this contact; basically, if there's a
* non-empty name, it's
* Jane Doe <email@example.com>
* otherwise it's just the e-mail address.
* Get the "display name" for this contact:
*
* @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.
* If there's a non-empty name, it's Jane Doe <email@example.com>
* otherwise it's just the e-mail address. Names with commas are quoted
* (with the quotes escaped).
*
* @return the display name
*/
std::string display_name(bool quote_if_needed=false) const;
std::string display_name() const;
/**