From 08d6b880e0415783c3d94a3e9486d34cfcc38d57 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 17 Oct 2019 21:35:32 +0300 Subject: [PATCH] Send updateUsersNearby only if users_nearby_ really has changed. GitOrigin-RevId: cfa8800259ba03c0cfcad357ed4afe6a0bf5bb27 --- td/telegram/ContactsManager.cpp | 5 ++++- td/telegram/ContactsManager.h | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index aa95de79a..1ef10a96d 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -4664,6 +4664,7 @@ void ContactsManager::on_get_dialogs_nearby(Resultupdates_) { @@ -4676,9 +4677,11 @@ void ContactsManager::on_get_dialogs_nearby(Result(get_chats_nearby_object(users_nearby_), get_chats_nearby_object(channels_nearby_))); - send_update_users_nearby(); // for other clients connected to the same TDLib instance } void ContactsManager::on_update_peer_located(vector> &&peers, diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 4c53e08e5..e660b6e6d 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -813,6 +813,14 @@ class ContactsManager : public Actor { bool operator<(const DialogNearby &other) const { return distance < other.distance || (distance == other.distance && dialog_id.get() < other.dialog_id.get()); } + + bool operator==(const DialogNearby &other) const { + return distance == other.distance && dialog_id == other.dialog_id; + } + + bool operator!=(const DialogNearby &other) const { + return !(*this == other); + } }; class UserLogEvent;