contact: implement to_string

Make it easy to get a string for a sequence of contacts.
This commit is contained in:
Dirk-Jan C. Binnema
2022-04-04 23:51:24 +03:00
parent 97c1725461
commit 187c3da408
2 changed files with 27 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "mu-contact.hh"
#include "mu-message.hh"
#include "utils/mu-utils.hh"
#include <gmime/gmime.h>
#include <glib.h>
@ -85,6 +86,21 @@ Mu::make_contacts(const std::string& addrs,
}
std::string
Mu::to_string(const Mu::Contacts& contacts)
{
std::string res;
seq_for_each(contacts, [&](auto&& contact) {
if (res.empty())
res = contact.display_name();
else
res += ", " + contact.display_name();
});
return res;
}
size_t
Mu::lowercase_hash(const std::string& s)
{