diff options
author | George Hazan <ghazan@miranda.im> | 2023-02-10 19:46:31 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-02-10 19:46:31 +0300 |
commit | a7bf177e6e4aedcaafca186b50e6666788e45f98 (patch) | |
tree | 98b5d4a37a93b5f93eb2399ed38d696dea3c65bd /protocols/Telegram/src | |
parent | 2046bf33c966d9db3fbc98c1e067788408751104 (diff) |
ME_DB_EVENT_MARKED_READ: recursion prevention
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 12 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 2 |
3 files changed, 4 insertions, 12 deletions
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 1a353da02a..2ed51339d7 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -56,7 +56,6 @@ CTelegramProto::CTelegramProto(const char* protoName, const wchar_t* userName) : CreateProtoService(PS_SETMYAVATAR, &CTelegramProto::SvcSetMyAvatar); HookProtoEvent(ME_OPT_INITIALISE, &CTelegramProto::OnOptionsInit); - HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CTelegramProto::OnDbMarkedRead); // avatar CreateDirectoryTreeW(GetAvatarPath()); @@ -141,15 +140,10 @@ void CTelegramProto::OnErase() DeleteDirectoryTreeW(GetProtoFolder(), false); } -int CTelegramProto::OnDbMarkedRead(WPARAM hContact, LPARAM hDbEvent) +void CTelegramProto::OnMarkRead(MCONTACT hContact, MEVENT hDbEvent) { if (!hContact) - return 0; - - // filter out only events of my protocol - const char *szProto = Proto_GetBaseAccountName(hContact); - if (mir_strcmp(szProto, m_szModuleName)) - return 0; + return; ptrA userId(getStringA(hContact, DBKEY_ID)); if (userId) { @@ -169,8 +163,6 @@ int CTelegramProto::OnDbMarkedRead(WPARAM hContact, LPARAM hDbEvent) m_impl.m_markRead.Start(500); } } - - return 0; } INT_PTR CTelegramProto::GetCaps(int type, MCONTACT) diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index d57f873bc3..1585f9d62d 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -242,6 +242,7 @@ public: int SetStatus(int iNewStatus) override; void OnContactDeleted(MCONTACT hContact) override; + void OnMarkRead(MCONTACT, MEVENT) override; void OnModulesLoaded() override; void OnShutdown() override; void OnErase() override; @@ -253,7 +254,6 @@ public: // Events //////////////////////////////////////////////////////////////////////////// int __cdecl OnOptionsInit(WPARAM, LPARAM); - int __cdecl OnDbMarkedRead(WPARAM, LPARAM); int __cdecl GcMenuHook(WPARAM, LPARAM); int __cdecl GcEventHook(WPARAM, LPARAM); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index bbe86146e7..34c8ff5936 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -385,7 +385,7 @@ void CTelegramProto::ProcessMarkRead(TD::updateChatReadInbox *pObj) continue;
if (!dbei.markedRead())
- db_event_markRead(pUser->hContact, hEvent);
+ db_event_markRead(pUser->hContact, hEvent, true);
}
}
|