From 9a63063543f450472a564be2df56f7c42f6b3327 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 28 Jan 2024 13:20:55 +0300 Subject: =?UTF-8?q?fixes=20#4154=20(=D0=9F=D1=80=D0=B8=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=BD=D0=BE=D0=B9=20=D0=BE?= =?UTF-8?q?=D0=BF=D1=86=D0=B8=D0=B8=20"Remove=20contact=20from=20server=20?= =?UTF-8?q?too"=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=20=D0=B2?= =?UTF-8?q?=D1=81=D1=91=20=D1=80=D0=B0=D0=B2=D0=BD=D0=BE=20=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D0=BB=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20=D1=81=20=D1=81?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D0=B5=D1=80=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/ICQ-WIM/src/proto.cpp | 18 ++++++++++-------- protocols/Telegram/src/proto.cpp | 14 ++++++++------ 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'protocols') diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index ac144f2cdf..2dd9d96610 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -159,16 +159,18 @@ void CIcqProto::OnContactAdded(MCONTACT hContact) } } -bool CIcqProto::OnContactDeleted(MCONTACT hContact, uint32_t) +bool CIcqProto::OnContactDeleted(MCONTACT hContact, uint32_t flags) { - CMStringW szId(GetUserId(hContact)); - if (!isChatRoom(hContact)) { - mir_cslock lck(m_csCache); - m_arCache.remove(FindUser(szId)); - } + if (flags & CDF_FROM_SERVER) { + CMStringW szId(GetUserId(hContact)); + if (!isChatRoom(hContact)) { + mir_cslock lck(m_csCache); + m_arCache.remove(FindUser(szId)); + } - Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, "/buddylist/removeBuddy") - << AIMSID(this) << WCHAR_PARAM("buddy", szId) << INT_PARAM("allGroups", 1)); + Push(new AsyncHttpRequest(CONN_MAIN, REQUEST_GET, "/buddylist/removeBuddy") + << AIMSID(this) << WCHAR_PARAM("buddy", szId) << INT_PARAM("allGroups", 1)); + } return true; } diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index f1315dc56d..a473ffaee2 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -124,9 +124,6 @@ bool CTelegramProto::OnContactDeleted(MCONTACT hContact, uint32_t flags) return false; if (auto *pUser = FindUser(id)) { - if (flags & CDF_DEL_HISTORY) - SvcEmptyServerHistory(hContact, flags); - if (pUser->m_si) { SvcLeaveChat(hContact, 0); return false; @@ -138,9 +135,14 @@ bool CTelegramProto::OnContactDeleted(MCONTACT hContact, uint32_t flags) pUser->wszLastName = getMStringW(hContact, "LastName"); } - TD::array ids; - ids.push_back(id); - SendQuery(new TD::removeContacts(std::move(ids))); + if (flags & CDF_DEL_HISTORY) + SvcEmptyServerHistory(hContact, flags); + + if (flags & CDF_FROM_SERVER) { + TD::array ids; + ids.push_back(id); + SendQuery(new TD::removeContacts(std::move(ids))); + } return true; } -- cgit v1.2.3