summaryrefslogtreecommitdiff
path: root/protocols/Discord
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-02-10 19:46:31 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-02-10 19:46:31 +0300
commita7bf177e6e4aedcaafca186b50e6666788e45f98 (patch)
tree98b5d4a37a93b5f93eb2399ed38d696dea3c65bd /protocols/Discord
parent2046bf33c966d9db3fbc98c1e067788408751104 (diff)
ME_DB_EVENT_MARKED_READ: recursion prevention
Diffstat (limited to 'protocols/Discord')
-rw-r--r--protocols/Discord/src/proto.cpp13
-rw-r--r--protocols/Discord/src/proto.h2
2 files changed, 2 insertions, 13 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 8e89312050..f984595ff4 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -70,7 +70,6 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) :
// Events
HookProtoEvent(ME_OPT_INITIALISE, &CDiscordProto::OnOptionsInit);
- HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CDiscordProto::OnDbEventRead);
HookProtoEvent(ME_PROTO_ACCLISTCHANGED, &CDiscordProto::OnAccountChanged);
HookProtoEvent(PE_VOICE_CALL_STATE, &CDiscordProto::OnVoiceState);
@@ -598,17 +597,8 @@ void CDiscordProto::SendMarkRead()
}
}
-int CDiscordProto::OnDbEventRead(WPARAM, LPARAM hDbEvent)
+void CDiscordProto::OnMarkRead(MCONTACT hContact, MEVENT hDbEvent)
{
- MCONTACT hContact = db_event_getContact(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;
-
if (m_bOnline) {
m_impl.m_markRead.Start(200);
@@ -619,7 +609,6 @@ int CDiscordProto::OnDbEventRead(WPARAM, LPARAM hDbEvent)
arMarkReadQueue.insert(pUser);
}
}
- return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 04645185d2..2c0bd0709a 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -377,6 +377,7 @@ public:
void OnBuildProtoMenu() override;
void OnContactDeleted(MCONTACT) override;
+ void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
void OnShutdown() override;
@@ -398,7 +399,6 @@ public:
int __cdecl OnOptionsInit(WPARAM, LPARAM);
int __cdecl OnAccountChanged(WPARAM, LPARAM);
- int __cdecl OnDbEventRead(WPARAM, LPARAM);
int __cdecl OnVoiceState(WPARAM, LPARAM);