summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
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");
}
}