From 5c3ab50ab27ba9a517cf56d0626c641883e3fd39 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 4 Apr 2017 00:20:24 +0300 Subject: SRMM window list completely incapsulated into mir_app to avoid corrupting it by someone's dirty hands --- include/m_chat_int.h | 7 ++++++- libs/win32/mir_app.lib | Bin 118118 -> 118558 bytes libs/win64/mir_app.lib | Bin 113576 -> 113972 bytes plugins/Scriver/src/msgoptions.cpp | 12 ++++++------ plugins/Scriver/src/msgs.cpp | 28 ++++++++++++++-------------- plugins/Scriver/src/statusicon.cpp | 2 +- plugins/TabSRMM/src/chat_options.cpp | 2 +- plugins/TabSRMM/src/chat_window.cpp | 2 +- plugins/TabSRMM/src/container.cpp | 6 +++--- plugins/TabSRMM/src/generic_msghandlers.cpp | 6 +++--- plugins/TabSRMM/src/globals.cpp | 6 +++--- plugins/TabSRMM/src/hotkeyhandler.cpp | 10 +++++----- plugins/TabSRMM/src/infopanel.cpp | 6 +++--- plugins/TabSRMM/src/mim.cpp | 26 ++++---------------------- plugins/TabSRMM/src/mim.h | 16 ++++++---------- plugins/TabSRMM/src/msgdialog.cpp | 4 ++-- plugins/TabSRMM/src/msgdlgutils.cpp | 2 +- plugins/TabSRMM/src/msgoptions.cpp | 12 ++++++------ plugins/TabSRMM/src/msgs.cpp | 22 +++++++++++----------- plugins/TabSRMM/src/sendqueue.cpp | 2 +- plugins/TabSRMM/src/userprefs.cpp | 6 +++--- plugins/TabSRMM/src/utils.cpp | 2 +- src/core/stdmsg/src/globals.cpp | 8 ++++---- src/core/stdmsg/src/msgdialog.cpp | 2 +- src/core/stdmsg/src/msgoptions.cpp | 6 +++--- src/core/stdmsg/src/msgs.cpp | 26 +++++++++++++------------- src/core/stdmsg/src/msgtimedout.cpp | 4 ++-- src/core/stdmsg/src/statusicon.cpp | 4 ++-- src/core/stdmsg/src/tabs.cpp | 2 +- src/mir_app/src/chat.h | 1 + src/mir_app/src/chat_svc.cpp | 7 ++++--- src/mir_app/src/mir_app.def | 2 ++ src/mir_app/src/mir_app64.def | 2 ++ src/mir_app/src/srmm_base.cpp | 4 ++-- src/mir_app/src/srmm_toolbar.cpp | 17 +++++++++-------- src/mir_app/src/srmm_util.cpp | 11 ++++++++++- 36 files changed, 137 insertions(+), 138 deletions(-) diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 425e0c6573..13acfeb308 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -340,7 +340,6 @@ struct CHAT_MANAGER FONTINFO aFonts[OPTIONS_FONTCOUNT]; LIST &arSessions; char **pLogIconBmpBits; - MWindowList hWindowList; // user-defined custom callbacks void (*OnCreateModule)(MODULEINFO*); @@ -384,6 +383,12 @@ EXTERN_C MIR_APP_DLL(DWORD) CALLBACK Srmm_LogStreamCallback(DWORD_PTR dwCookie, // receives char** as the first parameter EXTERN_C MIR_APP_DLL(DWORD) CALLBACK Srmm_MessageStreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb); +// sends a message to all SRMM windows +EXTERN_C MIR_APP_DLL(void) Srmm_Broadcast(UINT, WPARAM, LPARAM); + +// finds a SRMM window using hContact +EXTERN_C MIR_APP_DLL(HWND) Srmm_FindWindow(MCONTACT hContact); + // updates options for all windows EXTERN_C MIR_APP_DLL(void) Chat_UpdateOptions(); diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index f5bf913b03..77a00dc0d4 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 2866872eab..597eeb93db 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 0e88757f6e..ab9309f5af 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -79,7 +79,7 @@ int FontServiceFontsChanged(WPARAM, LPARAM) { LoadMsgLogIcons(); LoadInfobarFonts(); - WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); return 0; } @@ -130,14 +130,14 @@ int IconsChanged(WPARAM, LPARAM) FreeMsgLogIcons(); LoadMsgLogIcons(); ChangeStatusIcons(); - WindowList_Broadcast(pci->hWindowList, DM_REMAKELOG, 0, 0); - WindowList_Broadcast(pci->hWindowList, DM_CHANGEICONS, 0, 1); + Srmm_Broadcast(DM_REMAKELOG, 0, 0); + Srmm_Broadcast(DM_CHANGEICONS, 0, 1); return 0; } int SmileySettingsChanged(WPARAM wParam, LPARAM) { - WindowList_Broadcast(pci->hWindowList, DM_REMAKELOG, wParam, 0); + Srmm_Broadcast(DM_REMAKELOG, wParam, 0); return 0; } @@ -237,7 +237,7 @@ static void ApplyChanges(int i) if (changed == 0) { ReloadGlobals(); WindowList_Broadcast(g_dat.hParentWindowList, DM_OPTIONSAPPLIED, 0, 0); - WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); Chat_UpdateOptions(); } } @@ -916,7 +916,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); db_set_b(0, SRMM_MODULE, SRMSGSET_SHOWTYPINGSWITCH, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPINGSWITCH)); ReloadGlobals(); - WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); } break; } diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 17101778c2..de7091340f 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -78,7 +78,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) CLISTEVENT *pcle = (CLISTEVENT*)lParam; MCONTACT hContact = db_mc_tryMeta(pcle->hContact); - HWND hwndExisting = WindowList_Find(pci->hWindowList, hContact); + HWND hwndExisting = Srmm_FindWindow(hContact); if (hwndExisting == nullptr) (new CSrmmWindow(hContact, false))->Show(); else @@ -94,9 +94,9 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ)) return 0; - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd == nullptr) - hwnd = WindowList_Find(pci->hWindowList, hContact = db_event_getContact(hDbEvent)); + hwnd = Srmm_FindWindow(hContact = db_event_getContact(hDbEvent)); if (hwnd) SendMessage(hwnd, HM_DBEVENTADDED, hContact, lParam); @@ -143,7 +143,7 @@ static INT_PTR SendMessageCommandWorker(MCONTACT hContact, wchar_t *pszMsg) if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) return 1; - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd != nullptr) { if (pszMsg) { HWND hEdit = GetDlgItem(hwnd, IDC_SRMM_MESSAGE); @@ -191,7 +191,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) SkinPlaySound((lParam) ? "TNStart" : "TNStop"); - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) { @@ -219,13 +219,13 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; char *szProto = GetContactProto(hContact); // szProto maybe nullptr if (!strcmp(cws->szModule, "CList") || !mir_strcmp(cws->szModule, szProto)) - WindowList_Broadcast(pci->hWindowList, DM_CLISTSETTINGSCHANGED, hContact, lParam); + Srmm_Broadcast(DM_CLISTSETTINGSCHANGED, hContact, lParam); return 0; } static int ContactDeleted(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(pci->hWindowList, wParam); + HWND hwnd = Srmm_FindWindow(wParam); if (hwnd) SendMessage(hwnd, WM_CLOSE, 0, 0); return 0; @@ -257,7 +257,7 @@ static void RestoreUnreadMessageAlerts(void) if ((dbei.flags & (DBEF_SENT | DBEF_READ)) || !DbEventIsMessageOrCustom(&dbei)) continue; - int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != nullptr; + int windowAlreadyExists = Srmm_FindWindow(hContact) != nullptr; if (windowAlreadyExists) continue; @@ -291,7 +291,7 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) if (st == nullptr) return 1; - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd == nullptr) return 1; @@ -327,9 +327,9 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) static int AvatarChanged(WPARAM wParam, LPARAM lParam) { if (wParam == 0) // protocol picture has changed... - WindowList_Broadcast(pci->hWindowList, DM_AVATARCHANGED, wParam, lParam); + Srmm_Broadcast(DM_AVATARCHANGED, wParam, lParam); else { - HWND hwnd = WindowList_Find(pci->hWindowList, wParam); + HWND hwnd = Srmm_FindWindow(wParam); SendMessage(hwnd, DM_AVATARCHANGED, wParam, lParam); } return 0; @@ -436,7 +436,7 @@ int StatusIconPressed(WPARAM wParam, LPARAM lParam) if (mir_strcmp(SRMM_MODULE, sicd->szModule)) return 0; - HWND hwnd = WindowList_Find(pci->hWindowList, wParam); + HWND hwnd = Srmm_FindWindow(wParam); if (hwnd != nullptr) SendMessage(hwnd, DM_SWITCHTYPING, 0, 0); return 0; @@ -569,7 +569,7 @@ static int ModuleLoad(WPARAM, LPARAM) static int MetaContactChanged(WPARAM hMeta, LPARAM) { if (hMeta) { - HWND hwnd = WindowList_Find(pci->hWindowList, hMeta); + HWND hwnd = Srmm_FindWindow(hMeta); if (hwnd != nullptr) SendMessage(hwnd, DM_GETAVATAR, 0, 0); } @@ -608,7 +608,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) int OnSystemPreshutdown(WPARAM, LPARAM) { - WindowList_Broadcast(pci->hWindowList, WM_CLOSE, 0, 0); + Srmm_Broadcast(WM_CLOSE, 0, 0); WindowList_Broadcast(g_dat.hParentWindowList, WM_CLOSE, 0, 0); DeinitStatusIcons(); return 0; diff --git a/plugins/Scriver/src/statusicon.cpp b/plugins/Scriver/src/statusicon.cpp index f59c9f8ede..b11d49cd1a 100644 --- a/plugins/Scriver/src/statusicon.cpp +++ b/plugins/Scriver/src/statusicon.cpp @@ -64,7 +64,7 @@ static int OnSrmmIconChanged(WPARAM hContact, LPARAM) if (hContact == 0) WindowList_Broadcast(g_dat.hParentWindowList, DM_STATUSICONCHANGE, 0, 0); else { - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd != nullptr) PostMessage(GetParent(hwnd), DM_STATUSICONCHANGE, 0, 0); } diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index b4d9224f01..24e66f19cf 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -647,7 +647,7 @@ int FontServiceFontsChanged(WPARAM, LPARAM) FreeTabConfig(); ReloadTabConfig(); Skin->setupAeroSkins(); - M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); return 0; } diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 8e97de36f9..8b24b7526c 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -2424,7 +2424,7 @@ void ShowRoom(SESSION_INFO *si) return; // smth went wrong, nothing to do here MCONTACT hContact = si->hContact; - if (M.FindWindow(hContact) != 0) + if (Srmm_FindWindow(hContact) != 0) return; if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->m_wszName, L"default", 6)) diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 91debd2d38..08a742babf 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -74,7 +74,7 @@ void TContainerData::UpdateTitle(MCONTACT hContact, CTabBaseDlg *pDlg) dat = (CTabBaseDlg*)GetWindowLongPtr(m_hwndActive, GWLP_USERDATA); } else { - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd != nullptr) dat = (CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA); } @@ -1030,12 +1030,12 @@ panel_found: case ID_VIEW_BOTTOMTOOLBAR: ApplyContainerSetting(pContainer, CNT_BOTTOMTOOLBAR, pContainer->dwFlags & CNT_BOTTOMTOOLBAR ? 0 : 1, false); - M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1); + Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1); return 0; case ID_VIEW_SHOWTOOLBAR: ApplyContainerSetting(pContainer, CNT_HIDETOOLBAR, pContainer->dwFlags & CNT_HIDETOOLBAR ? 0 : 1, false); - M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1); + Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1); return 0; case ID_VIEW_SHOWMENUBAR: diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index f507994631..0137a4ce52 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -322,7 +322,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar m_SendFormat = M.GetDword(m_hContact, "sendformat", PluginConfig.m_SendFormat); if (m_SendFormat == -1) // per contact override to disable it.. m_SendFormat = 0; - M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1); + Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1); } } break; @@ -1362,9 +1362,9 @@ static HANDLE hHookIconPressedEvt; static int OnSrmmIconChanged(WPARAM hContact, LPARAM) { if (hContact == 0) - M.BroadcastMessage(DM_STATUSICONCHANGE, 0, 0); + Srmm_Broadcast(DM_STATUSICONCHANGE, 0, 0); else { - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd) PostMessage(hwnd, DM_STATUSICONCHANGE, 0, 0); } diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 9fd2aa5151..11c85ec380 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -352,7 +352,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (hContact == 0) { if (!strcmp("Nick", setting)) - M.BroadcastMessage(DM_OWNNICKCHANGED, 0, (LPARAM)cws->szModule); + Srmm_Broadcast(DM_OWNNICKCHANGED, 0, (LPARAM)cws->szModule); return 0; } @@ -377,7 +377,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) if (!strcmp(setting, "Nick")) // filter out this setting to avoid infinite loops while trying to obtain the most online contact return 0; - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); bool fChanged = false, fExtendedStatusChange = false; if (!strcmp(cws->szSetting, "Status")) fChanged = c->updateStatus(cws->value.wVal); @@ -520,7 +520,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_MESSAGE) { - if (M.FindWindow(hContact) != nullptr) + if (Srmm_FindWindow(hContact) != nullptr) continue; arEvents.insert(new MSavedEvent(hContact, hDbEvent)); diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 226298640e..865f2a77af 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -94,7 +94,7 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact) if (hContact == 0) return; - HWND hWnd = M.FindWindow(hContact); + HWND hWnd = Srmm_FindWindow(hContact); if (hWnd && IsWindow(hWnd)) { TContainerData *pContainer = 0; SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer); @@ -178,7 +178,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; } else if (dis->CtlType == ODT_MENU) { - HWND hWnd = M.FindWindow((MCONTACT)dis->itemID); + HWND hWnd = Srmm_FindWindow((MCONTACT)dis->itemID); DWORD idle = 0; if (hWnd == nullptr) { @@ -354,7 +354,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case DM_DOCREATETAB: { - HWND hWnd = M.FindWindow(lParam); + HWND hWnd = Srmm_FindWindow(lParam); if (hWnd && IsWindow(hWnd)) { TContainerData *pContainer = 0; SendMessage(hWnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer); @@ -388,7 +388,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP HKL hkl = (HKL)lParam; MCONTACT hContact = wParam; - HWND hWnd = M.FindWindow(hContact); + HWND hWnd = Srmm_FindWindow(hContact); if (hWnd) { CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (dat) { @@ -430,7 +430,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP RedrawWindow(pCont->m_hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); } } - M.BroadcastMessage(WM_DWMCOMPOSITIONCHANGED, 0, 0); + Srmm_Broadcast(WM_DWMCOMPOSITIONCHANGED, 0, 0); break; // this message is fired when the user changes desktop color diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 83eeb5ebfd..2a37689a54 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -148,7 +148,7 @@ void CInfoPanel::setHeight(LONG newHeight, bool fBroadcast) if (fBroadcast) { if (!m_fPrivateHeight) { if (!m_dat->m_pContainer->settings->fPrivate) - M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)newHeight); + Srmm_Broadcast(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)newHeight); else ::BroadCastContainer(m_dat->m_pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)newHeight); } @@ -1194,13 +1194,13 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, IDC_NOSYNC)) { loadHeight(); if (!m_dat->m_pContainer->settings->fPrivate) - M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight); + Srmm_Broadcast(DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight); else ::BroadCastContainer(m_dat->m_pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, (LPARAM)m_defaultHeight); } else { if (!m_dat->m_pContainer->settings->fPrivate) - M.BroadcastMessage(DM_SETINFOPANEL, (WPARAM)m_dat, 0); + Srmm_Broadcast(DM_SETINFOPANEL, (WPARAM)m_dat, 0); else ::BroadCastContainer(m_dat->m_pContainer, DM_SETINFOPANEL, (WPARAM)m_dat, 0); } diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index f1c4e258e8..63e9975081 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -51,24 +51,6 @@ wchar_t CMimAPI::m_userDir[] = L"\0"; bool CMimAPI::m_haveBufferedPaint = false; -///////////////////////////////////////////////////////////////////////////////////////// -// window list functions - -void CMimAPI::BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam) -{ - WindowList_Broadcast(pci->hWindowList, msg, wParam, lParam); -} - -void CMimAPI::BroadcastMessageAsync(UINT msg, WPARAM wParam, LPARAM lParam) -{ - WindowList_BroadcastAsync(pci->hWindowList, msg, wParam, lParam); -} - -HWND CMimAPI::FindWindow(MCONTACT h) const -{ - return WindowList_Find(pci->hWindowList, h); -} - ///////////////////////////////////////////////////////////////////////////////////////// int CMimAPI::FoldersPathChanged(WPARAM, LPARAM) @@ -224,11 +206,11 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) int foundWin = 0, preTyping = 0; BOOL fShowOnClist = TRUE; - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); MCONTACT hMeta = db_mc_getMeta(hContact); if (hMeta) { if (!hwnd) - hwnd = M.FindWindow(hMeta); + hwnd = Srmm_FindWindow(hMeta); hContact = hMeta; } @@ -399,9 +381,9 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd == nullptr) - hwnd = M.FindWindow(db_event_getContact(hDbEvent)); + hwnd = Srmm_FindWindow(db_event_getContact(hDbEvent)); BOOL isCustomEvent = IsCustomEvent(dbei.eventType); BOOL isShownCustomEvent = DbEventIsForMsgWindow(&dbei); diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h index 183b96b6a6..a956fdd1ba 100644 --- a/plugins/TabSRMM/src/mim.h +++ b/plugins/TabSRMM/src/mim.h @@ -179,16 +179,12 @@ public: __forceinline bool isVSThemed() { return m_isVsThemed; } // window lists - void BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam); - void BroadcastMessageAsync(UINT msg, WPARAM wParam, LPARAM lParam); - HWND FindWindow(MCONTACT h) const; - - static int FoldersPathChanged(WPARAM wParam, LPARAM lParam); // hook subscriber for folders plugin - static int TypingMessage(WPARAM wParam, LPARAM lParam); - static int ProtoAck(WPARAM wParam, LPARAM lParam); - static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam); - static int DispatchNewEvent(WPARAM wParam, LPARAM lParam); - static int MessageEventAdded(WPARAM wParam, LPARAM lParam); + static int FoldersPathChanged(WPARAM wParam, LPARAM lParam); // hook subscriber for folders plugin + static int TypingMessage(WPARAM wParam, LPARAM lParam); + static int ProtoAck(WPARAM wParam, LPARAM lParam); + static int PrebuildContactMenu(WPARAM wParam, LPARAM lParam); + static int DispatchNewEvent(WPARAM wParam, LPARAM lParam); + static int MessageEventAdded(WPARAM wParam, LPARAM lParam); public: // various function pointers diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 55e362f9f8..da9531b32f 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -151,7 +151,7 @@ void CTabBaseDlg::ShowPopupMenu(const CCtrlBase &pCtrl, POINT pt) case ID_EDITOR_SHOWMESSAGELENGTHINDICATOR: PluginConfig.m_visualMessageSizeIndicator = !PluginConfig.m_visualMessageSizeIndicator; db_set_b(0, SRMSGMOD_T, "msgsizebar", (BYTE)PluginConfig.m_visualMessageSizeIndicator); - M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 0); + Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 0); SendMessage(m_hwnd, WM_SIZE, 0, 0); if (m_pContainer->hwndStatus) RedrawWindow(m_pContainer->hwndStatus, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW); @@ -550,7 +550,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM PluginConfig.lastSPlitterPos.off_chat = dwOff_CHAT; PluginConfig.lastSPlitterPos.off_im = dwOff_IM; SendMessage(dat->GetHwnd(), DM_SPLITTERGLOBALEVENT, 0, 0); - M.BroadcastMessage(DM_SPLITTERGLOBALEVENT, 0, 0); + Srmm_Broadcast(DM_SPLITTERGLOBALEVENT, 0, 0); } break; diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 0f2784c6a7..a00131b43c 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -354,7 +354,7 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) case ID_PICMENU_ALWAYSKEEPTHEBUTTONBARATFULLWIDTH: PluginConfig.m_bAlwaysFullToolbarWidth = !PluginConfig.m_bAlwaysFullToolbarWidth; db_set_b(0, SRMSGMOD_T, "alwaysfulltoolbar", (BYTE)PluginConfig.m_bAlwaysFullToolbarWidth); - M.BroadcastMessage(DM_CONFIGURETOOLBAR, 0, 1); + Srmm_Broadcast(DM_CONFIGURETOOLBAR, 0, 1); break; case ID_PICMENU_SAVETHISPICTUREAS: diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 88b7e23dd3..e0ce019d05 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -323,8 +323,8 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CacheMsgLogIcons(); PluginConfig.reloadSettings(); CSkin::setAeroEffect(-1); - M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0); - M.BroadcastMessage(DM_FORCEDREMAKELOG, 0, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); + Srmm_Broadcast(DM_FORCEDREMAKELOG, 0, 0); SendMessage(GetParent(hwndDlg), WM_COMMAND, IDCANCEL, 0); } } @@ -621,7 +621,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP // scan the tree view and obtain the options... TreeViewToDB(GetDlgItem(hwndDlg, IDC_WINDOWOPTIONS), CTranslator::TREE_MSG, SRMSGMOD_T, nullptr); PluginConfig.reloadSettings(); - M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); return TRUE; } break; @@ -826,7 +826,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, else db_set_dw(0, SRMSGMOD_T, "maxhist", 0); PluginConfig.reloadSettings(); - M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); return TRUE; } } @@ -1055,7 +1055,7 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar PluginConfig.m_EscapeCloses = (int)SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_GETCURSEL, 0, 0); db_set_b(0, SRMSGMOD_T, "escmode", (BYTE)PluginConfig.m_EscapeCloses); PluginConfig.reloadSettings(); - M.BroadcastMessage(DM_OPTIONSAPPLIED, 0, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); return TRUE; } } @@ -1592,7 +1592,7 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR break; } PluginConfig.reloadSettings(); - M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 1, 0); return TRUE; } } diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 57e6949b92..8efe5d6fe2 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -45,7 +45,7 @@ void CB_InitCustomButtons(); int IEViewOptionsChanged(WPARAM, LPARAM) { - M.BroadcastMessage(DM_IEVIEWOPTIONSCHANGED, 0, 0); + Srmm_Broadcast(DM_IEVIEWOPTIONSCHANGED, 0, 0); return 0; } @@ -54,7 +54,7 @@ int IEViewOptionsChanged(WPARAM, LPARAM) int SmileyAddOptionsChanged(WPARAM, LPARAM) { - M.BroadcastMessage(DM_SMILEYOPTIONSCHANGED, 0, 0); + Srmm_Broadcast(DM_SMILEYOPTIONSCHANGED, 0, 0); pci->SM_BroadcastMessage(nullptr, DM_SMILEYOPTIONSCHANGED, 0, 0, FALSE); return 0; } @@ -280,9 +280,9 @@ void CTabBaseDlg::NotifyDeliveryFailure() const static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) { - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd == nullptr) - hwnd = M.FindWindow(db_mc_getMeta(hContact)); + hwnd = Srmm_FindWindow(db_mc_getMeta(hContact)); if (hwnd == nullptr) return 0; @@ -344,7 +344,7 @@ int TSAPI MessageWindowOpened(MCONTACT hContact, HWND _hwnd) TContainerData *pContainer = nullptr; if (hContact) - hwnd = M.FindWindow(hContact); + hwnd = Srmm_FindWindow(hContact); else if (_hwnd) hwnd = _hwnd; else @@ -382,7 +382,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) { MCONTACT hContact = ((CLISTEVENT *)lParam)->hContact; - HWND hwndExisting = M.FindWindow(hContact); + HWND hwndExisting = Srmm_FindWindow(hContact); if (hwndExisting != 0) SendMessage(hwndExisting, DM_ACTIVATEME, 0, 0); else { @@ -422,7 +422,7 @@ INT_PTR SendMessageCommand_Worker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) return 0; - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd) { if (pszMsg) { HWND hEdit = GetDlgItem(hwnd, IDC_SRMM_MESSAGE); @@ -570,7 +570,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild) HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, bool bActivateTab, bool bPopupContainer, bool bWantPopup, MEVENT hdbEvent, bool bIsUnicode, const char *pszInitialText) { - if (M.FindWindow(hContact) != 0) { + if (Srmm_FindWindow(hContact) != 0) { _DebugPopup(hContact, L"Warning: trying to create duplicate window"); return 0; } @@ -946,7 +946,7 @@ static int TSAPI LoadFromIconLib() PluginConfig.g_iconClock = IcoLib_GetIcon("tabSRMM_clock_symbol"); CacheMsgLogIcons(); - M.BroadcastMessage(WM_CBD_LOADICONS, 0, 0); + Srmm_Broadcast(WM_CBD_LOADICONS, 0, 0); return 0; } @@ -993,8 +993,8 @@ int IconsChanged(WPARAM, LPARAM) { CreateImageList(FALSE); CacheMsgLogIcons(); - M.BroadcastMessage(DM_OPTIONSAPPLIED, 0, 0); - M.BroadcastMessage(DM_UPDATEWINICON, 0, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, 0, 0); + Srmm_Broadcast(DM_UPDATEWINICON, 0, 0); return 0; } diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index afaa5a663e..6e54e8d65e 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -509,7 +509,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND)) SkinPlaySound("SendMsg"); - M.BroadcastMessage(DM_APPENDMCEVENT, job.hContact, LPARAM(hNewEvent)); + Srmm_Broadcast(DM_APPENDMCEVENT, job.hContact, hNewEvent); job.iSendId = 0; job.iAcksNeeded--; diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index 256b74ccfa..a2e5f3c501 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -135,7 +135,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, CSrmmWindow *dat = 0; DWORD *pdwActionToTake = (DWORD *)lParam; unsigned int iOldIEView = 0; - HWND hWnd = M.FindWindow(hContact); + HWND hWnd = Srmm_FindWindow(hContact); BYTE bOldInfoPanel = M.GetByte(hContact, "infopanel", 0); if (hWnd) { @@ -340,7 +340,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA case WM_USER + 100: { int i = 0; LRESULT state; - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); DWORD *dwActionToTake = (DWORD *)lParam, dwMask = 0, dwFlags = 0, maskval; CSrmmWindow *dat = nullptr; @@ -466,7 +466,7 @@ INT_PTR CALLBACK DlgProcUserPrefsFrame(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDOK: DWORD dwActionToTake = 0; // child pages request which action to take - HWND hwnd = M.FindWindow(hContact); + HWND hwnd = Srmm_FindWindow(hContact); tci.mask = TCIF_PARAM; diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 48800498a7..1e66c60cc8 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -736,7 +736,7 @@ AVATARCACHEENTRY* Utils::loadAvatarFromAVS(const MCONTACT hContact) void Utils::sendContactMessage(MCONTACT hContact, UINT uMsg, WPARAM wParam, LPARAM lParam) { - HWND h = M.FindWindow(hContact); + HWND h = Srmm_FindWindow(hContact); if (h != nullptr) PostMessage(h, uMsg, wParam, lParam); } diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 73a5562008..4675677588 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -58,7 +58,7 @@ static int OnShutdown(WPARAM, LPARAM) static int OnMetaChanged(WPARAM hMeta, LPARAM) { if (hMeta) { - HWND hwnd = WindowList_Find(pci->hWindowList, hMeta); + HWND hwnd = Srmm_FindWindow(hMeta); if (hwnd != nullptr) SendMessage(hwnd, DM_GETAVATAR, 0, 0); } @@ -68,13 +68,13 @@ static int OnMetaChanged(WPARAM hMeta, LPARAM) static int dbaddedevent(WPARAM hContact, LPARAM hDbEvent) { if (hContact) { - HWND h = WindowList_Find(pci->hWindowList, hContact); + HWND h = Srmm_FindWindow(hContact); if (h) SendMessage(h, HM_DBEVENTADDED, hContact, hDbEvent); MCONTACT hEventContact = db_event_getContact(hDbEvent); if (hEventContact != hContact) - if ((h = WindowList_Find(pci->hWindowList, hEventContact)) != nullptr) + if ((h = Srmm_FindWindow(hEventContact)) != nullptr) SendMessage(h, HM_DBEVENTADDED, hEventContact, hDbEvent); } return 0; @@ -94,7 +94,7 @@ static int ackevent(WPARAM, LPARAM lParam) static int AvatarChanged(WPARAM hContact, LPARAM lParam) { - HWND h = WindowList_Find(pci->hWindowList, hContact); + HWND h = Srmm_FindWindow(hContact); if (h) SendMessage(h, HM_AVATARACK, hContact, lParam); return 0; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 8b6ae10ed8..4ae0a330dd 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -264,7 +264,7 @@ void CSrmmWindow::OnInitDialog() } if (!g_dat.bSavePerContact && g_dat.bCascade) - WindowList_Broadcast(pci->hWindowList, DM_CASCADENEWWINDOW, (WPARAM)m_hwnd, (LPARAM)&m_windowWasCascaded); + Srmm_Broadcast(DM_CASCADENEWWINDOW, (WPARAM)m_hwnd, (LPARAM)&m_windowWasCascaded); if (m_bNoActivate) { SetWindowPos(m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 83e4707513..de0f3dbe79 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -313,7 +313,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_dw(0, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout); ReloadGlobals(); - WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, TRUE, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, TRUE, 0); return TRUE; } } @@ -410,7 +410,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, FreeMsgLogIcons(); LoadMsgLogIcons(); ReloadGlobals(); - WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, TRUE, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, TRUE, 0); return TRUE; } break; @@ -539,7 +539,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam db_set_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); db_set_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); ReloadGlobals(); - WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, TRUE, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, TRUE, 0); } } break; diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 1af01ed518..f050209d20 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -61,7 +61,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) pcli->pfnRemoveEvent(hContact, 1); /* does a window for the contact exist? */ - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd) { if (!g_dat.bDoNotStealFocus) { ShowWindow(hwnd, SW_RESTORE); @@ -110,7 +110,7 @@ INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *pwszInitialText) hContact = db_mc_tryMeta(hContact); - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd) { if (pwszInitialText) { SendDlgItemMessage(hwnd, IDC_SRMM_MESSAGE, EM_SETSEL, -1, SendDlgItemMessage(hwnd, IDC_SRMM_MESSAGE, WM_GETTEXTLENGTH, 0, 0)); @@ -158,7 +158,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) SkinPlaySound((lParam) ? "TNStart" : "TNStop"); - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && g_dat.bShowTypingTray) { @@ -191,14 +191,14 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) return 0; if (!strcmp(cws->szModule, "CList")) - WindowList_Broadcast(pci->hWindowList, DM_UPDATETITLE, (WPARAM)cws, 0); + Srmm_Broadcast(DM_UPDATETITLE, (WPARAM)cws, 0); else if (hContact) { if (cws->szSetting && !strcmp(cws->szSetting, "Timezone")) - WindowList_Broadcast(pci->hWindowList, DM_NEWTIMEZONE, (WPARAM)cws, 0); + Srmm_Broadcast(DM_NEWTIMEZONE, (WPARAM)cws, 0); else { char *szProto = GetContactProto(hContact); if (szProto && !strcmp(cws->szModule, szProto)) - WindowList_Broadcast(pci->hWindowList, DM_UPDATETITLE, (WPARAM)cws, 0); + Srmm_Broadcast(DM_UPDATETITLE, (WPARAM)cws, 0); } } return 0; @@ -207,7 +207,7 @@ static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) // If a contact gets deleted, close its message window if there is any static int ContactDeleted(WPARAM wParam, LPARAM) { - HWND hwnd = WindowList_Find(pci->hWindowList, wParam); + HWND hwnd = Srmm_FindWindow(wParam); if (hwnd) SendMessage(hwnd, WM_CLOSE, 0, 0); @@ -240,7 +240,7 @@ static void RestoreUnreadMessageAlerts(void) dbei.cbBlob = 0; db_event_get(hDbEvent, &dbei); if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) { - int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != nullptr; + int windowAlreadyExists = Srmm_FindWindow(hContact) != nullptr; if (windowAlreadyExists) continue; @@ -415,7 +415,7 @@ void SetButtonsPos(HWND hwndDlg, bool bIsChat) static int FontsChanged(WPARAM, LPARAM) { - WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, TRUE, 0); + Srmm_Broadcast(DM_OPTIONSAPPLIED, TRUE, 0); return 0; } @@ -443,7 +443,7 @@ static int SplitmsgModulesLoaded(WPARAM, LPARAM) int PreshutdownSendRecv(WPARAM, LPARAM) { - WindowList_Broadcast(pci->hWindowList, WM_CLOSE, 0, 0); + Srmm_Broadcast(WM_CLOSE, 0, 0); DeinitStatusIcons(); return 0; @@ -455,8 +455,8 @@ static int IconsChanged(WPARAM, LPARAM) LoadMsgLogIcons(); // change all the icons - WindowList_Broadcast(pci->hWindowList, DM_REMAKELOG, 0, 0); - WindowList_Broadcast(pci->hWindowList, DM_UPDATEWINICON, 0, 0); + Srmm_Broadcast(DM_REMAKELOG, 0, 0); + Srmm_Broadcast(DM_UPDATEWINICON, 0, 0); return 0; } @@ -483,7 +483,7 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) if (st == nullptr) return 1; - HWND hwnd = WindowList_Find(pci->hWindowList, wParam); + HWND hwnd = Srmm_FindWindow(wParam); if (hwnd == nullptr) return 1; diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index d7bfb30d1b..7596198ce5 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -85,11 +85,11 @@ void MessageFailureProcess(TMsgQueue *item, const char* err) { MCONTACT hContact = db_mc_tryMeta(item->hContact); - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd == nullptr) { // If message window doesn't already exist, open a new one SendMessageCmd(item->hContact, nullptr); - hwnd = WindowList_Find(pci->hWindowList, hContact); + hwnd = Srmm_FindWindow(hContact); } else SendMessage(hwnd, DM_REMAKELOG, 0, 0); diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index c82669f941..057a544e41 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -27,9 +27,9 @@ HANDLE hHookIconPressedEvt; static int OnSrmmIconChanged(WPARAM hContact, LPARAM) { if (hContact == 0) - WindowList_Broadcast(pci->hWindowList, DM_STATUSICONCHANGE, 0, 0); + Srmm_Broadcast(DM_STATUSICONCHANGE, 0, 0); else { - HWND hwnd = WindowList_Find(pci->hWindowList, hContact); + HWND hwnd = Srmm_FindWindow(hContact); if (hwnd != nullptr) PostMessage(hwnd, DM_STATUSICONCHANGE, 0, 0); } diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index a7830b494f..2336e068ad 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -245,7 +245,7 @@ void CTabbedWindow::SetWindowPosition() } if (!g_dat.bSavePerContact && g_dat.bCascade) - WindowList_Broadcast(pci->hWindowList, DM_CASCADENEWWINDOW, (WPARAM)m_hwnd, (LPARAM)&m_windowWasCascaded); + Srmm_Broadcast(DM_CASCADENEWWINDOW, (WPARAM)m_hwnd, (LPARAM)&m_windowWasCascaded); } void CTabbedWindow::TabClicked() diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index 5f408fb215..fca1458400 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -42,6 +42,7 @@ extern HMENU g_hMenu; extern HCURSOR g_hCurHyperlinkHand; extern char* pLogIconBmpBits[14]; extern LIST g_arSessions; +extern MWindowList g_hWindowList; // log.c void LoadMsgLogBitmaps(void); diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 1dd20900a8..002742a66c 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -27,9 +27,10 @@ INT_PTR SvcGetChatManager(WPARAM, LPARAM); #include "chat.h" #include "resource.h" +mir_cs csChat; HMENU g_hMenu = nullptr; HGENMENU hJoinMenuItem, hLeaveMenuItem; -mir_cs csChat; +MWindowList g_hWindowList; static HANDLE hServiceRegister = nullptr, @@ -777,7 +778,7 @@ int LoadChatModule(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown); HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged); - chatApi.hWindowList = WindowList_Create(); + g_hWindowList = WindowList_Create(); chatApi.hSendEvent = CreateHookableEvent(ME_GC_EVENT); chatApi.hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU); hHookEvent = CreateHookableEvent(ME_GC_HOOK_EVENT); @@ -803,7 +804,7 @@ void UnloadChatModule(void) FreeMsgLogBitmaps(); OptionsUnInit(); - WindowList_Destroy(chatApi.hWindowList); + WindowList_Destroy(g_hWindowList); DestroyHookableEvent(chatApi.hSendEvent); DestroyHookableEvent(chatApi.hBuildMenuEvent); diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 67645af6f5..156ea679c2 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -446,3 +446,5 @@ _stubNicklistProc@16 @448 NONAME Chat_GetTextPixelSize @449 NONAME ?NotifyEvent@CSrmmBaseDialog@@IAEHH@Z @450 NONAME Srmm_GetWindowData @451 +Srmm_FindWindow @452 +Srmm_Broadcast @453 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 563b920ab4..11b740223e 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -446,3 +446,5 @@ stubNicklistProc @448 NONAME Chat_GetTextPixelSize @449 NONAME ?NotifyEvent@CSrmmBaseDialog@@IEAAHH@Z @450 NONAME Srmm_GetWindowData @451 +Srmm_FindWindow @452 +Srmm_Broadcast @453 diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 62d744f540..0bf810aa5f 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -577,7 +577,7 @@ LRESULT CSrmmBaseDialog::WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam void CSrmmBaseDialog::OnInitDialog() { - WindowList_Add(chatApi.hWindowList, m_hwnd, m_hContact); + WindowList_Add(g_hWindowList, m_hwnd, m_hContact); SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)this); SetWindowLongPtr(m_log.GetHwnd(), GWLP_USERDATA, LPARAM(this)); @@ -598,7 +598,7 @@ void CSrmmBaseDialog::OnInitDialog() void CSrmmBaseDialog::OnDestroy() { - WindowList_Remove(chatApi.hWindowList, m_hwnd); + WindowList_Remove(g_hWindowList, m_hwnd); SetWindowLongPtr(m_hwnd, GWLP_USERDATA, 0); mir_unsubclassWindow(m_log.GetHwnd(), stubLogProc); diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 8517637822..1469628d70 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "stdafx.h" +#include "chat.h" #define MODULENAME "SRMM_Toolbar" @@ -148,7 +149,7 @@ MIR_APP_DLL(int) Srmm_AddButton(const BBButton *bbdi, int _hLang) if (cbd->m_dwArrowCID == LastCID) LastCID++; - WindowList_Broadcast(chatApi.hWindowList, WM_CBD_UPDATED, 0, 0); + WindowList_Broadcast(g_hWindowList, WM_CBD_UPDATED, 0, 0); return 0; } @@ -190,7 +191,7 @@ MIR_APP_DLL(int) Srmm_SetButtonState(MCONTACT hContact, BBButton *bbdi) if (!tempCID) return 1; - HWND hwndDlg = WindowList_Find(chatApi.hWindowList, hContact); + HWND hwndDlg = WindowList_Find(g_hWindowList, hContact); if (hwndDlg == nullptr) return 1; @@ -231,7 +232,7 @@ MIR_APP_DLL(int) Srmm_RemoveButton(BBButton *bbdi) } if (pFound) { - WindowList_Broadcast(chatApi.hWindowList, WM_CBD_REMOVED, pFound->m_dwButtonCID, (LPARAM)pFound); + WindowList_Broadcast(g_hWindowList, WM_CBD_REMOVED, pFound->m_dwButtonCID, (LPARAM)pFound); delete pFound; } return 0; @@ -272,7 +273,7 @@ MIR_APP_DLL(int) Srmm_ModifyButton(BBButton *bbdi) } if (bFound) - WindowList_Broadcast(chatApi.hWindowList, WM_CBD_UPDATED, 0, (LPARAM)cbd); + WindowList_Broadcast(g_hWindowList, WM_CBD_UPDATED, 0, (LPARAM)cbd); return 0; } @@ -403,8 +404,8 @@ static void CB_ReInitCustomButtons() } qsort(arButtonsList.getArray(), arButtonsList.getCount(), sizeof(void*), sstSortButtons); - WindowList_Broadcast(chatApi.hWindowList, WM_CBD_UPDATED, 0, 0); - WindowList_Broadcast(chatApi.hWindowList, WM_CBD_LOADICONS, 0, 0); + WindowList_Broadcast(g_hWindowList, WM_CBD_UPDATED, 0, 0); + WindowList_Broadcast(g_hWindowList, WM_CBD_LOADICONS, 0, 0); } static void CB_WriteButtonSettings(MCONTACT hContact, CustomButtonData *cbd) @@ -618,7 +619,7 @@ public: WORD newGap = m_gap.GetPosition(); if (newGap != db_get_b(0, MODULENAME, "ButtonsBarGap", 1)) { - WindowList_BroadcastAsync(chatApi.hWindowList, WM_SIZE, 0, 0); + WindowList_BroadcastAsync(g_hWindowList, WM_SIZE, 0, 0); db_set_b(0, MODULENAME, "ButtonsBarGap", newGap); } @@ -638,7 +639,7 @@ public: void btnResetClicked(void*) { db_delete_module(0, MODULENAME); - WindowList_Broadcast(chatApi.hWindowList, WM_CBD_REMOVED, 0, 0); + WindowList_Broadcast(g_hWindowList, WM_CBD_REMOVED, 0, 0); Srmm_ResetToolbar(); NotifyEventHooks(hHookToolBarLoadedEvt, 0, 0); diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index 482e3c3fb0..864f8ca00f 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -78,7 +78,7 @@ MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd) if (hContact == 0) return 1; - HWND hwnd = WindowList_Find(chatApi.hWindowList, hContact); + HWND hwnd = WindowList_Find(g_hWindowList, hContact); if (hwnd == nullptr) return 1; @@ -94,3 +94,12 @@ MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd) return 0; } +MIR_APP_DLL(void) Srmm_Broadcast(UINT msg, WPARAM wParam, LPARAM lParam) +{ + WindowList_Broadcast(g_hWindowList, msg, wParam, lParam); +} + +MIR_APP_DLL(HWND) Srmm_FindWindow(MCONTACT hContact) +{ + return WindowList_Find(g_hWindowList, hContact); +} -- cgit v1.2.3