diff options
author | George Hazan <ghazan@miranda.im> | 2019-01-17 18:27:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-01-17 18:27:16 +0300 |
commit | db8d126a7b973b38c52f646748c866ba9fe32eb3 (patch) | |
tree | baeb00f90110db994d6a95a32460f4b4eab000e7 | |
parent | 288bda66073faeaa0f329d95b26482a9d2868c34 (diff) |
related to #1773 - messageState support for ICQ-WIM
-rw-r--r-- | protocols/ICQ-WIM/src/main.cpp | 5 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 17 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/stdafx.h | 4 |
3 files changed, 21 insertions, 5 deletions
diff --git a/protocols/ICQ-WIM/src/main.cpp b/protocols/ICQ-WIM/src/main.cpp index 0f1888952d..3de14ce81f 100644 --- a/protocols/ICQ-WIM/src/main.cpp +++ b/protocols/ICQ-WIM/src/main.cpp @@ -20,7 +20,7 @@ #include "stdafx.h" -bool g_bPopupService; +bool g_bPopupService, g_bMessageState; HWND g_hwndHeartbeat; @@ -57,6 +57,7 @@ CMPlugin g_plugin; int ModuleLoad(WPARAM, LPARAM) { g_bPopupService = ServiceExists(MS_POPUP_ADDPOPUPT); + g_bMessageState = ServiceExists(MS_MESSAGESTATE_UPDATE); return 0; } @@ -66,7 +67,7 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); - ModuleLoad(0, 0); + HookEvent(ME_SYSTEM_MODULESLOADED, ModuleLoad); return 0; }; diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index d77daf4075..73676491e2 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -755,7 +755,14 @@ void CIcqProto::ProcessHistData(const JSONNode &ev) else LoadChatInfo(si); } } - else hContact = CreateContact(_wtol(wszId), true); + else { + hContact = CreateContact(_wtol(wszId), true); + + if (g_bMessageState) { + MessageReadData data(time(0), MRD_TYPE_READTIME); + CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data); + } + } __int64 lastMsgId = getId(hContact, DB_KEY_LASTMSGID); __int64 srvLastId = _wtoi64(ev["lastMsgId"].as_mstring()); @@ -782,8 +789,14 @@ void CIcqProto::ProcessImState(const JSONNode &ev) CMStringA reqId(it["sendReqId"].as_mstring()); CMStringA msgId(it["histMsgId"].as_mstring()); MCONTACT hContact = CheckOwnMessage(reqId, msgId, false); - if (hContact) + if (hContact) { CheckLastId(hContact, ev); + + if (g_bMessageState) { + MessageReadData data(it["ts"].as_int(), MRD_TYPE_MESSAGETIME); + CallService(MS_MESSAGESTATE_UPDATE, hContact, (LPARAM)&data); + } + } } } diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index 929854990c..8351f37ef6 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -54,6 +54,7 @@ #include <m_json.h> #include <m_langpack.h> #include <m_message.h> +#include <m_messagestate.h> #include <m_netlib.h> #include <m_protocols.h> #include <m_protosvc.h> @@ -92,4 +93,5 @@ bool IsChat(const CMStringW &aimid); int StatusFromString(const CMStringW&); -extern HWND g_hwndHeartbeat;
\ No newline at end of file +extern HWND g_hwndHeartbeat; +extern bool g_bMessageState; |