server: don't encode addresses in contacts_handlers
Seems it doesn't always play nice with composer
This commit is contained in:
@ -41,7 +41,6 @@ needs_quoting(const std::string& name)
|
|||||||
std::string
|
std::string
|
||||||
Contact::display_name(bool quote) const
|
Contact::display_name(bool quote) const
|
||||||
{
|
{
|
||||||
|
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
return email;
|
return email;
|
||||||
else if (!quote || !needs_quoting(name))
|
else if (!quote || !needs_quoting(name))
|
||||||
|
|||||||
@ -142,8 +142,7 @@ ContactsCache::Private::deserialize(const std::string& serialized) const
|
|||||||
|
|
||||||
ContactsCache::ContactsCache(const std::string& serialized, const StringVec& personal)
|
ContactsCache::ContactsCache(const std::string& serialized, const StringVec& personal)
|
||||||
: priv_{std::make_unique<Private>(serialized, personal)}
|
: priv_{std::make_unique<Private>(serialized, personal)}
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
ContactsCache::~ContactsCache() = default;
|
ContactsCache::~ContactsCache() = default;
|
||||||
|
|
||||||
@ -208,7 +207,7 @@ ContactsCache::add(Contact&& contact)
|
|||||||
auto email{contact.email};
|
auto email{contact.email};
|
||||||
// return priv_->contacts_.emplace(ContactUMap::value_type(email, std::move(contact)))
|
// return priv_->contacts_.emplace(ContactUMap::value_type(email, std::move(contact)))
|
||||||
// .first->second;
|
// .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)));
|
priv_->contacts_.emplace(ContactUMap::value_type(email, std::move(contact)));
|
||||||
|
|
||||||
} else { // existing contact.
|
} else { // existing contact.
|
||||||
@ -222,6 +221,8 @@ ContactsCache::add(Contact&& contact)
|
|||||||
existing.tstamp = g_get_monotonic_time();
|
existing.tstamp = g_get_monotonic_time();
|
||||||
existing.message_date = contact.message_date;
|
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()
|
ContactLessThan()
|
||||||
: recently_{::time({}) - RecentOffset} {}
|
: 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.
|
// non-personal is less relevant.
|
||||||
if (ci1.personal != ci2.personal)
|
if (ci1.personal != ci2.personal)
|
||||||
return ci1.personal < ci2.personal;
|
return ci1.personal < ci2.personal;
|
||||||
|
|||||||
@ -533,7 +533,7 @@ Server::Private::contacts_handler(const Command& cmd)
|
|||||||
|
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
contacts.add(ci.display_name(true/*encode-if-needed*/));
|
contacts.add(ci.display_name());
|
||||||
return maxnum == 0 || n < maxnum;
|
return maxnum == 0 || n < maxnum;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user