From f52b5cc86d9eff2494902157c8fc0a4e019a3c95 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 15 Aug 2017 13:49:37 +0300 Subject: fixes #799 (Crash on receiving msg in FB group chat) --- plugins/Scriver/src/msgs.cpp | 26 +++++++------------------- plugins/Scriver/src/msgs.h | 1 + 2 files changed, 8 insertions(+), 19 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 58d97fbf1e..a335489ee8 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -284,25 +284,13 @@ static void RestoreUnreadMessageAlerts(void) } } -static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) +void CScriverWindow::SetStatusText(const wchar_t *wszText, HICON hIcon) { - StatusTextData *st = (StatusTextData*)lParam; - if (st == nullptr) - return 1; - - HWND hwnd = Srmm_FindWindow(hContact); - if (hwnd == nullptr) - return 1; - - CScriverWindow *dat = (CScriverWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (dat == nullptr || dat->m_pParent == nullptr) - return 1; - - ParentWindowData *pdat = dat->m_pParent; - - SendMessage(pdat->hwndStatus, SB_SETICON, 0, (LPARAM)(st == nullptr ? 0 : st->hIcon)); - SendMessage(pdat->hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == nullptr ? L"" : st->tszText)); - return 0; + ParentWindowData *pDat = m_pParent; + if (pDat != nullptr) { + SendMessage(pDat->hwndStatus, SB_SETICON, 0, (LPARAM)hIcon); + SendMessage(pDat->hwndStatus, SB_SETTEXT, 0, (LPARAM)wszText); + } } static int PrebuildContactMenu(WPARAM hContact, LPARAM) @@ -656,7 +644,7 @@ int OnLoadModule(void) CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand); CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommandW); - CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText); + CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand); CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand); diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index ff758a3416..86de8bf663 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -97,6 +97,7 @@ protected: public: virtual void CloseTab() override; virtual void LoadSettings() override; + virtual void SetStatusText(const wchar_t*, HICON) override; void Reattach(HWND hwndContainer); -- cgit v1.2.3