diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-28 13:20:55 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-28 13:20:55 +0300 |
commit | 9a63063543f450472a564be2df56f7c42f6b3327 (patch) | |
tree | b152f40fa45514adddcc1cb287c2f8ad2416d462 /protocols | |
parent | 1aaf3408c2d6a47e9778347c43bffc62db75da31 (diff) |
fixes #4154 (При выключенной опции "Remove contact from server too" контакт всё равно удаляется с сервера)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/ICQ-WIM/src/proto.cpp | 18 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 14 |
2 files changed, 18 insertions, 14 deletions
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<TD::int53> 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<TD::int53> ids; + ids.push_back(id); + SendQuery(new TD::removeContacts(std::move(ids))); + } return true; } |