From a7bf177e6e4aedcaafca186b50e6666788e45f98 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Feb 2023 19:46:31 +0300 Subject: ME_DB_EVENT_MARKED_READ: recursion prevention --- protocols/SkypeWeb/src/main.cpp | 6 +++--- protocols/SkypeWeb/src/skype_messages.cpp | 5 ++--- protocols/SkypeWeb/src/skype_proto.cpp | 1 - protocols/SkypeWeb/src/skype_proto.h | 8 +++----- 4 files changed, 8 insertions(+), 12 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index b1e3ddfb5b..1f7818b72a 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -51,10 +51,10 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC ///////////////////////////////////////////////////////////////////////////////////////// -int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) +static int OnModulesLoaded(WPARAM, LPARAM) { if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { - CreateServiceFunction(MODULE "/ParseUri", CSkypeProto::GlobalParseSkypeUriService); + CreateServiceFunction(MODULE "/ParseUri", &CSkypeProto::GlobalParseSkypeUriService); AssocMgr_AddNewUrlTypeW("skype:", TranslateT("Skype Link Protocol"), g_plugin.getInst(), IDI_SKYPE, MODULE "/ParseUri", 0); } return 0; @@ -73,7 +73,7 @@ int CMPlugin::Load() g_hCallEvent = CreateHookableEvent(MODULE "/IncomingCall"); - HookEvent(ME_SYSTEM_MODULESLOADED, &CSkypeProto::OnModulesLoaded); + HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); return 0; } diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 01a0235caa..59980fe873 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -172,11 +172,10 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) } } -int CSkypeProto::OnDbEventRead(WPARAM hContact, LPARAM hDbEvent) +void CSkypeProto::OnMarkRead(MCONTACT hContact, MEVENT hDbEvent) { - if (IsOnline() && !isChatRoom(hContact) && !mir_strcmp(Proto_GetBaseAccountName(hContact), m_szModuleName)) + if (IsOnline() && !isChatRoom(hContact)) MarkMessagesRead(hContact, hDbEvent); - return 0; } void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent) diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 5288ea81ac..5a70b171a8 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -49,7 +49,6 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : CreateProtoService(PS_MENU_LOADHISTORY, &CSkypeProto::GetContactHistory); HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit); - HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CSkypeProto::OnDbEventRead); CreateDirectoryTreeW(GetAvatarPath()); diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 4977bb71d3..f2d9c467ac 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -69,6 +69,7 @@ public: void OnBuildProtoMenu(void) override; void OnContactDeleted(MCONTACT) override; + void OnMarkRead(MCONTACT, MEVENT) override; void OnModulesLoaded() override; void OnShutdown() override; @@ -85,10 +86,6 @@ public: // languages static void InitLanguages(); - // events - static int OnModulesLoaded(WPARAM, LPARAM); - int __cdecl OnDbEventRead(WPARAM, LPARAM); - // search void __cdecl SearchBasicThread(void* id); @@ -163,6 +160,8 @@ public: bool CheckOauth(const char *szResponse); void LoadProfile(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest); + static INT_PTR __cdecl GlobalParseSkypeUriService(WPARAM, LPARAM lParam); + private: bool m_bHistorySynced; @@ -357,7 +356,6 @@ private: INT_PTR __cdecl GetContactHistory(WPARAM hContact, LPARAM lParam); INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM); INT_PTR __cdecl ParseSkypeUriService(WPARAM, LPARAM lParam); - static INT_PTR __cdecl GlobalParseSkypeUriService(WPARAM, LPARAM lParam); template static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam) -- cgit v1.2.3