diff options
author | George Hazan <george.hazan@gmail.com> | 2024-10-15 20:00:52 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-10-15 20:00:52 +0300 |
commit | 47b79689fcbe77ab19eb577487ef70642fa291f7 (patch) | |
tree | 0a3b3c0679346ff1d49f6f7f898f71001459de47 /src/mir_app | |
parent | b210af86bcfb49c791ef8f74f0791ff6d36763bd (diff) |
fixes #4720 (NewStory: встроить функциональность MessageState)
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/srmm_main.cpp | 27 |
3 files changed, 29 insertions, 0 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 0aa5b1fe10..1f7e1d1728 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -990,3 +990,4 @@ _Proto_CanDeleteHistory@8 @1124 NONAME ?isCustom@EventInfo@DB@@QBE_NH@Z @1128 NONAME
?InsertBbcodeString@CSrmmBaseDialog@@IAEXPB_W@Z @1129 NONAME
?markRead@SESSION_INFO@@QAEX_N@Z @1130 NONAME
+?Srmm_NotifyRemoteRead@@YGXII@Z @1131 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a5f99bcaf3..ef42406121 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -990,3 +990,4 @@ Proto_CanDeleteHistory @1118 NONAME ?isCustom@EventInfo@DB@@QEBA_NH@Z @1122 NONAME
?InsertBbcodeString@CSrmmBaseDialog@@IEAAXPEB_W@Z @1123 NONAME
?markRead@SESSION_INFO@@QEAAX_N@Z @1124 NONAME
+?Srmm_NotifyRemoteRead@@YAXII@Z @1125 NONAME
diff --git a/src/mir_app/src/srmm_main.cpp b/src/mir_app/src/srmm_main.cpp index 7b07a9c790..b8c0a4cc3c 100644 --- a/src/mir_app/src/srmm_main.cpp +++ b/src/mir_app/src/srmm_main.cpp @@ -19,6 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" #include "chat.h" +#include <m_NewStory.h> +#include <m_messagestate.h> + HCURSOR g_hCurHyperlinkHand; HANDLE hHookIconsChanged, hHookIconPressedEvt, hHookSrmmEvent; @@ -28,6 +31,19 @@ void LoadSrmmToolbarModule(); void UnloadSrmmToolbarModule(); ///////////////////////////////////////////////////////////////////////////////////////// + +static bool g_bHasMessageState, g_bHasNewStory; + +MIR_APP_DLL(void) Srmm_NotifyRemoteRead(MCONTACT hContact, MEVENT hEvent) +{ + if (g_bHasMessageState) + CallService(MS_MESSAGESTATE_UPDATE, hContact, MRD_TYPE_READ); + + if (g_bHasNewStory) + NS_NotifyRemoteRead(hContact, hEvent); +} + +///////////////////////////////////////////////////////////////////////////////////////// // Empty history service for main menu class CEmptyHistoryDlg : public CDlgBase @@ -125,8 +141,19 @@ static int OnPrebuildContactMenu(WPARAM hContact, LPARAM) ///////////////////////////////////////////////////////////////////////////////////////// +static int OnModuleLoaded(WPARAM, LPARAM) +{ + g_bHasMessageState = ServiceExists(MS_MESSAGESTATE_UPDATE); + g_bHasNewStory = ServiceExists("NewStory/FileReady"); + return 0; +} + void SrmmModulesLoaded() { + HookEvent(ME_SYSTEM_MODULELOAD, OnModuleLoaded); + HookEvent(ME_SYSTEM_MODULEUNLOAD, OnModuleLoaded); + OnModuleLoaded(0, 0); + // menu item CMenuItem mi(&g_plugin); SET_UID(mi, 0x0d4306aa, 0xe31e, 0x46ee, 0x89, 0x88, 0x3a, 0x2e, 0x05, 0xa6, 0xf3, 0xbc); |