summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-09 18:42:17 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-09 18:42:17 +0300
commitfabe33ee70142ddadacedb205a38b2b902e7b2c4 (patch)
tree3852e02e1e64ed339f9e1c402069afc6514cf08d /protocols/Telegram/src/server.cpp
parenta7e8fb839f9e8eb92e7dc66b189faa93c37a9957 (diff)
for #3395 - remote message deletion
Diffstat (limited to 'protocols/Telegram/src/server.cpp')
-rw-r--r--protocols/Telegram/src/server.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index d3a5afcacd..8611c6f625 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -150,6 +150,10 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response)
ProcessMarkRead((TD::updateChatReadInbox *)response.object.get());
break;
+ case TD::updateDeleteMessages::ID:
+ ProcessDeleteMessage((TD::updateDeleteMessages*)response.object.get());
+ break;
+
case TD::updateFile::ID:
ProcessFile((TD::updateFile *)response.object.get());
break;
@@ -383,6 +387,25 @@ void CTelegramProto::ProcessChatPosition(TD::updateChatPosition *pObj)
}
}
+void CTelegramProto::ProcessDeleteMessage(TD::updateDeleteMessages *pObj)
+{
+ if (!pObj->is_permanent_)
+ return;
+
+ auto *pUser = FindChat(pObj->chat_id_);
+ if (pUser == nullptr || pUser->hContact == INVALID_CONTACT_ID) {
+ debugLogA("message from unknown chat, ignored");
+ return;
+ }
+
+ for (auto &it : pObj->message_ids_) {
+ char id[100];
+ _i64toa(it, id, 10);
+ if (MEVENT hEvent = db_event_getById(m_szModuleName, id))
+ db_event_delete(hEvent);
+ }
+}
+
void CTelegramProto::ProcessGroups(TD::updateChatFilters *pObj)
{
for (auto &grp : pObj->chat_filters_) {