diff options
Diffstat (limited to 'protocols/Telegram/src/proto.cpp')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 14 |
1 files changed, 13 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)); |