1
0
mirror of https://github.com/djcb/mu.git synced 2024-06-20 06:46:50 +02:00

server: don't encode addresses in contacts_handlers

Seems it doesn't always play nice with composer
This commit is contained in:
Dirk-Jan C. Binnema 2023-02-28 23:23:52 +02:00
parent b918690a2a
commit 413a2564b6
3 changed files with 6 additions and 8 deletions

View File

@ -41,7 +41,6 @@ needs_quoting(const std::string& name)
std::string
Contact::display_name(bool quote) const
{
if (name.empty())
return email;
else if (!quote || !needs_quoting(name))

View File

@ -142,8 +142,7 @@ ContactsCache::Private::deserialize(const std::string& serialized) const
ContactsCache::ContactsCache(const std::string& serialized, const StringVec& personal)
: priv_{std::make_unique<Private>(serialized, personal)}
{
}
{}
ContactsCache::~ContactsCache() = default;
@ -208,7 +207,7 @@ ContactsCache::add(Contact&& contact)
auto email{contact.email};
// return priv_->contacts_.emplace(ContactUMap::value_type(email, std::move(contact)))
// .first->second;
g_debug("adding contact %s <%s>", contact.name.c_str(), contact.email.c_str());
priv_->contacts_.emplace(ContactUMap::value_type(email, std::move(contact)));
} else { // existing contact.
@ -222,6 +221,8 @@ ContactsCache::add(Contact&& contact)
existing.tstamp = g_get_monotonic_time();
existing.message_date = contact.message_date;
}
g_debug("updating contact %s <%s> (%zu)",
contact.name.c_str(), contact.email.c_str(), existing.frequency);
}
}
@ -282,9 +283,7 @@ struct ContactLessThan {
ContactLessThan()
: recently_{::time({}) - RecentOffset} {}
bool operator()(const Mu::Contact& ci1, const Mu::Contact& ci2) const
{
bool operator()(const Mu::Contact& ci1, const Mu::Contact& ci2) const {
// non-personal is less relevant.
if (ci1.personal != ci2.personal)
return ci1.personal < ci2.personal;

View File

@ -533,7 +533,7 @@ Server::Private::contacts_handler(const Command& cmd)
n++;
contacts.add(ci.display_name(true/*encode-if-needed*/));
contacts.add(ci.display_name());
return maxnum == 0 || n < maxnum;
});