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 --- 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 +- 7 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/core') 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() -- cgit v1.2.3