contacts: expose contact type

Instead of the Field::Id, keep a specific Contact::Type so we can distinguish
Sender, ReplyTo as well.

Update dependents.

Some cleanup.
This commit is contained in:
Dirk-Jan C. Binnema
2022-05-01 01:10:07 +03:00
parent 561593c194
commit 263e122a13
5 changed files with 149 additions and 213 deletions

View File

@ -914,21 +914,14 @@ public:
*/
static Result<MimeMessage> make_from_text (const std::string& text);
/**
* Address types
* Get the contacts of a given type, or None for _all_
*
* @param ctype contact type
*
* @return contacts
*/
enum struct AddressType {
Sender = GMIME_ADDRESS_TYPE_SENDER,
From = GMIME_ADDRESS_TYPE_FROM,
ReplyTo = GMIME_ADDRESS_TYPE_REPLY_TO,
To = GMIME_ADDRESS_TYPE_TO,
Cc = GMIME_ADDRESS_TYPE_CC,
Bcc = GMIME_ADDRESS_TYPE_BCC
};
Contacts addresses(AddressType atype) const noexcept;
Contacts contacts(Contact::Type ctype) const noexcept;
/**
* Gets the message-id if it exists, or nullopt otherwise.