diff --git a/lib/message/mu-contact.hh b/lib/message/mu-contact.hh index 90052938..5f7306e9 100644 --- a/lib/message/mu-contact.hh +++ b/lib/message/mu-contact.hh @@ -24,12 +24,12 @@ #include #include #include -#include #include #include #include #include +#include #include "mu-fields.hh" namespace Mu { @@ -47,9 +47,9 @@ struct Contact { * @param type contact field type * @param message_date data for the message for this contact */ - Contact(const std::string& email, const std::string& name = {}, + Contact(std::string email, std::string name = {}, Type type = {}, int64_t message_date ={}) - : email{email}, name{name}, type{type}, + : email{std::move(email)}, name{std::move(name)}, type{type}, message_date{message_date}, personal{}, frequency{1}, tstamp{} { cleanup_name(); } @@ -63,10 +63,10 @@ struct Contact { * @param freq how often was this contact seen? * @param tstamp timestamp for last change */ - Contact(const std::string& email, const std::string& name, + Contact(std::string email, std::string name, int64_t message_date, bool personal, size_t freq, int64_t tstamp) - : email{email}, name{name}, type{}, + : email{std::move(email)}, name{std::move(name)}, type{}, message_date{message_date}, personal{personal}, frequency{freq}, tstamp{tstamp} { cleanup_name(); } @@ -83,14 +83,6 @@ struct Contact { */ std::string display_name() const; - /** - * Does the contact contain a valid email address as per - * https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address - * ? - * @return true or false - */ - bool has_valid_email() const; - /** * Operator==; based on the e-mail address only * @@ -101,16 +93,6 @@ struct Contact { bool operator== (const Contact& rhs) const noexcept { return email == rhs.email; } - /** - * Operator!= - * - * @param rhs some other Contact - * - * @return true or false. - */ - bool operator!= (const Contact& rhs) const noexcept { - return !(*this == rhs); - } static constexpr int64_t RecentOffset{15 * 24 * 3600}; /**< Contacts seen after now - RecentOffset seconds are considered @@ -184,7 +166,7 @@ struct Contact { private: void cleanup_name() { // replace control characters by spaces. for (auto& c: name) - if (iscntrl(c)) + if (is_ascii_cntrl(c)) c = ' '; } diff --git a/lib/mu-contacts-cache.cc b/lib/mu-contacts-cache.cc index 66cb4d76..186639fe 100644 --- a/lib/mu-contacts-cache.cc +++ b/lib/mu-contacts-cache.cc @@ -119,7 +119,7 @@ ContactsCache::Private::deserialize(const std::string& serialized) const std::string line; while (std::getline(ss, line)) { - const auto parts = Mu::split(line, SepaChar2); + auto parts = Mu::split(line, SepaChar2); if (G_UNLIKELY(parts.size() != 5)) { mu_warning("error: '{}'", line); continue;