contact: implement to_string
Make it easy to get a string for a sequence of contacts.
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user