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/Twitter/src | |
parent | 2046bf33c966d9db3fbc98c1e067788408751104 (diff) |
ME_DB_EVENT_MARKED_READ: recursion prevention
Diffstat (limited to 'protocols/Twitter/src')
-rw-r--r-- | protocols/Twitter/src/contacts.cpp | 13 | ||||
-rw-r--r-- | protocols/Twitter/src/proto.cpp | 1 | ||||
-rw-r--r-- | protocols/Twitter/src/proto.h | 2 |
3 files changed, 2 insertions, 14 deletions
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index ce4795132b..09c8768582 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -169,24 +169,13 @@ void CTwitterProto::OnContactDeleted(MCONTACT hContact) }
}
-int CTwitterProto::OnMarkedRead(WPARAM, LPARAM hDbEvent)
+void CTwitterProto::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;
-
auto *pMark = (m_arChatMarks.find((CChatMark *)&hDbEvent));
if (pMark) {
mark_read(hContact, pMark->szId);
m_arChatMarks.remove(pMark);
}
-
- return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 0ee353ac67..aadfb416a2 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -36,7 +36,6 @@ CTwitterProto::CTwitterProto(const char *proto_name, const wchar_t *username) : CreateProtoService(PS_SETMYAVATAR, &CTwitterProto::SetAvatar);
HookProtoEvent(ME_OPT_INITIALISE, &CTwitterProto::OnOptionsInit);
- HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CTwitterProto::OnMarkedRead);
HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CTwitterProto::OnBuildStatusMenu);
// Initialize hotkeys
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index 7fe4922552..d545f409db 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -167,6 +167,7 @@ public: HANDLE GetAwayMsg(MCONTACT) override;
void OnContactDeleted(MCONTACT) override;
+ void OnMarkRead(MCONTACT, MEVENT) override;
void OnModulesLoaded() override;
void UpdateSettings();
@@ -190,7 +191,6 @@ public: int __cdecl OnBuildStatusMenu(WPARAM, LPARAM);
int __cdecl OnChatOutgoing(WPARAM, LPARAM);
- int __cdecl OnMarkedRead(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM,LPARAM);
int __cdecl OnPrebuildContactMenu(WPARAM,LPARAM);
|