diff options
author | George Hazan <george.hazan@gmail.com> | 2024-06-17 12:17:44 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-06-17 12:17:44 +0300 |
commit | a228b0e44e9da5c5ef2f871f0cce63a4e8ae18ac (patch) | |
tree | 2a45928340873b2fbec55501ca4803ac36a45037 /protocols | |
parent | 9aee9deca972b405a09033456ec2f270eea96cd3 (diff) |
fixes #4466 (Telegram: при очистке истории канала нужно блокировать опции про удаление истории с сервера)
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 1 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 12 |
3 files changed, 13 insertions, 2 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index b1bc3b6c6f..f321758700 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -66,6 +66,7 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : CreateProtoService(PS_SETMYAVATAR, &CTelegramProto::SvcSetMyAvatar); CreateProtoService(PS_MENU_LOADHISTORY, &CTelegramProto::SvcLoadServerHistory); + CreateProtoService(PS_CAN_EMPTY_HISTORY, &CTelegramProto::SvcCanEmptyHistory); CreateProtoService(PS_EMPTY_SRV_HISTORY, &CTelegramProto::SvcEmptyServerHistory); HookProtoEvent(ME_OPT_INITIALISE, &CTelegramProto::OnOptionsInit); diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 8466083bae..2216a3dc2b 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -419,6 +419,8 @@ public: INT_PTR __cdecl SvcAddByPhone(WPARAM, LPARAM); INT_PTR __cdecl SvcOfflineFile(WPARAM, LPARAM); + + INT_PTR __cdecl SvcCanEmptyHistory(WPARAM, LPARAM); INT_PTR __cdecl SvcLoadServerHistory(WPARAM, LPARAM); INT_PTR __cdecl SvcEmptyServerHistory(WPARAM, LPARAM); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 0568151f6d..cee7b9b1c3 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -498,10 +498,18 @@ INT_PTR CTelegramProto::SvcLoadServerHistory(WPARAM hContact, LPARAM) ///////////////////////////////////////////////////////////////////////////////
-INT_PTR CTelegramProto::SvcEmptyServerHistory(WPARAM hContact, LPARAM lParam)
+INT_PTR CTelegramProto::SvcCanEmptyHistory(WPARAM hContact, LPARAM)
{
- debugLogW(L"SvcEmptyServerHistory was called for cc=%d (%s)", (int)hContact, Clist_GetContactDisplayName(hContact));
+ if (auto *pUser = FindUser(GetId(hContact))) {
+ TG_SUPER_GROUP tmp(pUser->id, 0);
+ return m_arSuperGroups.find(&tmp) == nullptr;
+ }
+ return 0;
+}
+
+INT_PTR CTelegramProto::SvcEmptyServerHistory(WPARAM hContact, LPARAM lParam)
+{
if (auto *pUser = FindUser(GetId(hContact)))
if (pUser->chatId != -1)
SendQuery(new TD::deleteChatHistory(pUser->chatId, false, (lParam & CDF_FOR_EVERYONE) != 0));
|