diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-03 19:10:33 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-03 19:10:33 +0300 |
commit | 1b5e5bbb9f7abc2d56cf0ef0ffe7cd281854c874 (patch) | |
tree | 45c59c30b55c117807a964b120ef6df253fa1296 /protocols/Discord/src/proto.cpp | |
parent | e8ccd6330c478c4196dd1cedeeddf14add597784 (diff) |
server history syncing support
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) { |