summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-07 13:16:15 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-07 13:16:15 +0300
commitd9c93c40267f416ebef07fcd3f4f6c1677e7e857 (patch)
tree687748ccff78f7998d451df4a976c10760f3e80d /protocols
parentdf8f8c91e438c4862e04ef9b1589e6042c64817e (diff)
Telegram: clean hContact on contact deletion
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/src/proto.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index afe4cfe20f..b265ccea6c 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -91,11 +91,18 @@ CTelegramProto::~CTelegramProto()
void CTelegramProto::OnContactDeleted(MCONTACT hContact)
{
- CMStringA szId(getMStringA(hContact, DBKEY_ID));
- if (!szId.IsEmpty()) {
- TD::array<TD::int53> ids;
- ids.push_back(_atoi64(szId));
- SendQuery(new TD::removeContacts(std::move(ids)));
+ TD::int53 id = _atoi64(getMStringA(hContact, DBKEY_ID));
+ if (id == 0)
+ return;
+
+ TD::array<TD::int53> ids;
+ ids.push_back(id);
+ SendQuery(new TD::removeContacts(std::move(ids)));
+
+ if (auto *pUser = FindUser(id)) {
+ pUser->hContact = INVALID_CONTACT_ID;
+ pUser->wszFirstName = getMStringW(hContact, "FirstName");
+ pUser->wszLastName = getMStringW(hContact, "LastName");
}
}