summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-09 20:07:29 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-09 20:07:29 +0300
commit3561655fab4f3c17882a5095b09b5eaebe3175d7 (patch)
treebf406ee5cef863f5d16058fd86539b21579177f0
parent7a0e4f4a10e80063ca5d7c1b32131e9fc506ac1f (diff)
fixes #3395 completely (Telegram: удаление сообщений по запросу собеседника)
-rw-r--r--protocols/Telegram/src/proto.cpp14
-rw-r--r--protocols/Telegram/src/proto.h1
2 files changed, 14 insertions, 1 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index 3ad822dc15..039bc6bcb9 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -59,8 +59,9 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) :
CreateProtoService(PS_GETMYAVATAR, &CTelegramProto::SvcGetMyAvatar);
CreateProtoService(PS_SETMYAVATAR, &CTelegramProto::SvcSetMyAvatar);
+ HookProtoEvent(ME_HISTORY_EMPTY, &CTelegramProto::OnEmptyHistory);
HookProtoEvent(ME_OPT_INITIALISE, &CTelegramProto::OnOptionsInit);
-
+
// avatar
CreateDirectoryTreeW(GetAvatarPath());
@@ -106,6 +107,17 @@ void CTelegramProto::OnContactDeleted(MCONTACT hContact)
}
}
+int CTelegramProto::OnEmptyHistory(WPARAM hContact, LPARAM)
+{
+ if (Proto_IsProtoOnContact(hContact, m_szModuleName)) {
+ TD::int53 id = _atoi64(getMStringA(hContact, DBKEY_ID));
+ if (auto *pUser = FindUser(id))
+ SendQuery(new TD::deleteChatHistory(pUser->chatId, true, true));
+ }
+
+ return 0;
+}
+
void CTelegramProto::OnModulesLoaded()
{
CMStringA szId(getMStringA(DBKEY_ID));
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index c80477e2cb..e975b8866a 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -289,6 +289,7 @@ public:
// Events ////////////////////////////////////////////////////////////////////////////
+ int __cdecl OnEmptyHistory(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM, LPARAM);
int __cdecl GcMenuHook(WPARAM, LPARAM);