diff options
Diffstat (limited to 'protocols/Discord/src/proto.cpp')
-rw-r--r-- | protocols/Discord/src/proto.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 358f4e7bf6..41179a5a2d 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -40,6 +40,7 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : // Events HookProtoEvent(ME_OPT_INITIALISE, &CDiscordProto::OnOptionsInit); + HookProtoEvent(ME_MSG_WINDOWEVENT, &CDiscordProto::OnSrmmEvent); // Clist Clist_GroupCreate(NULL, m_wszDefaultGroup); @@ -267,6 +268,23 @@ int CDiscordProto::OnPreShutdown(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// +int CDiscordProto::OnSrmmEvent(WPARAM, LPARAM lParam) +{ + MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; + + if (MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact) { + SnowFlake oldid = getId(MWeventdata->hContact, DB_KEY_LASTMSGID); + if (oldid > 0) + RetrieveHistory(MWeventdata->hContact, MSG_AFTER, oldid, 99); + else + RetrieveHistory(MWeventdata->hContact, MSG_NOFILTER, 0, 99); + } + + return 0; +} + +///////////////////////////////////////////////////////////////////////////////////////// + int CDiscordProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam) { switch (event) { |