diff options
author | George Hazan <george.hazan@gmail.com> | 2024-01-24 16:08:11 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-01-24 16:08:11 +0300 |
commit | cf30319150edb0d5b49b05078817725c629320ba (patch) | |
tree | 8d3fe712d532a4f2b3513fc316fd25fe0ba74806 /protocols/Telegram/src | |
parent | 660b4e02d4bef4f7ac953689ce00d727bf9bacbd (diff) |
PS_EMPTY_SRV_HISTORY implementation for Telegram
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 16 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 9 |
3 files changed, 14 insertions, 13 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 48bb212951..9b9b9bb4f5 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -64,9 +64,10 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : CreateProtoService(PS_GETAVATARINFO, &CTelegramProto::SvcGetAvatarInfo); CreateProtoService(PS_GETMYAVATAR, &CTelegramProto::SvcGetMyAvatar); CreateProtoService(PS_SETMYAVATAR, &CTelegramProto::SvcSetMyAvatar); + CreateProtoService(PS_MENU_LOADHISTORY, &CTelegramProto::SvcLoadServerHistory); + CreateProtoService(PS_EMPTY_SRV_HISTORY, &CTelegramProto::SvcEmptyServerHistory); - HookProtoEvent(ME_HISTORY_EMPTY, &CTelegramProto::OnEmptyHistory); HookProtoEvent(ME_OPT_INITIALISE, &CTelegramProto::OnOptionsInit); HookProtoEvent(ME_MSG_WINDOWEVENT, &CTelegramProto::OnWindowEvent); @@ -140,16 +141,6 @@ bool CTelegramProto::OnContactDeleted(MCONTACT hContact, uint32_t) return true; } -int CTelegramProto::OnEmptyHistory(WPARAM hContact, LPARAM) -{ - if (Proto_IsProtoOnContact(hContact, m_szModuleName)) { - if (auto *pUser = FindUser(GetId(hContact))) - SendQuery(new TD::deleteChatHistory(pUser->chatId, true, true)); - } - - return 0; -} - void CTelegramProto::OnModulesLoaded() { int iCompatLevel = getByte(DBKEY_COMPAT); @@ -340,7 +331,8 @@ INT_PTR CTelegramProto::GetCaps(int type, MCONTACT) return PF2_ONLINE | PF2_SHORTAWAY | PF2_LONGAWAY; case PFLAGNUM_4: - return PF4_NOCUSTOMAUTH | PF4_FORCEAUTH | PF4_OFFLINEFILES | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_SERVERMSGID | PF4_REPLY; + return PF4_NOCUSTOMAUTH | PF4_FORCEAUTH | PF4_OFFLINEFILES | PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS + | PF4_SERVERMSGID | PF4_DELETEFORALL | PF4_REPLY; case PFLAGNUM_5: return PF2_SHORTAWAY | PF2_LONGAWAY; diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 62b23d2f8e..800a718740 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -380,7 +380,6 @@ public: // Events //////////////////////////////////////////////////////////////////////////// - int __cdecl OnEmptyHistory(WPARAM, LPARAM); int __cdecl OnOptionsInit(WPARAM, LPARAM); int __cdecl OnWindowEvent(WPARAM, LPARAM); @@ -393,6 +392,7 @@ public: INT_PTR __cdecl SvcAddByPhone(WPARAM, LPARAM); INT_PTR __cdecl SvcOfflineFile(WPARAM, LPARAM); INT_PTR __cdecl SvcLoadServerHistory(WPARAM, LPARAM); + INT_PTR __cdecl SvcEmptyServerHistory(WPARAM, LPARAM); // Options /////////////////////////////////////////////////////////////////////////// diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 7a59341212..8fd72e3e59 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -438,6 +438,15 @@ INT_PTR CTelegramProto::SvcLoadServerHistory(WPARAM hContact, LPARAM) ///////////////////////////////////////////////////////////////////////////////
+INT_PTR CTelegramProto::SvcEmptyServerHistory(WPARAM hContact, LPARAM lParam)
+{
+ if (auto *pUser = FindUser(GetId(hContact)))
+ SendQuery(new TD::deleteChatHistory(pUser->chatId, false, (lParam & CDF_FOR_EVERYONE) != 0));
+ return 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
void CTelegramProto::ProcessChat(TD::updateNewChat *pObj)
{
int64_t userId;
|