From c9b740a178828eae5cc4be7ab054e5f26d3a27e7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 21 Sep 2023 14:34:07 +0300 Subject: MessageWindowEventData: useless structure removed --- plugins/AsSingleWindow/src/AsSingleWindow.cpp | 11 ++---- plugins/CountryFlags/src/extraimg.cpp | 17 ++++---- plugins/FavContacts/src/services.cpp | 20 +++++----- plugins/FingerprintNG/src/fingerprint.cpp | 20 +++++----- .../src/historysweeperlight.cpp | 15 +++---- plugins/MagneticWindows/src/MagneticWindows.cpp | 11 +++--- plugins/MenuItemEx/src/main.cpp | 8 ++-- plugins/MessageState/src/messagestate.cpp | 9 +++-- plugins/MirLua/src/Modules/m_message.cpp | 4 -- plugins/MirOTR/src/dbfilter.cpp | 13 +++--- plugins/MirandaG15/src/CAppletManager.cpp | 11 +++--- plugins/NewXstatusNotify/src/xstatus.cpp | 23 +++++------ plugins/New_GPG/src/srmm.cpp | 11 +++--- plugins/NoHistory/src/dllmain.cpp | 8 ++-- plugins/Nudge/src/main.cpp | 9 +++-- plugins/PasteIt/src/PasteIt.cpp | 16 ++++---- plugins/Popup/src/srmm_menu.cpp | 14 +++---- plugins/RecentContacts/src/RecentContacts.cpp | 9 +++-- plugins/SecureIM/src/svcs_srmm.cpp | 8 ++-- plugins/Sessions/Src/Main.cpp | 17 ++++---- plugins/SmileyAdd/src/dlgboxsubclass.cpp | 46 +++++++++++----------- plugins/SpellChecker/src/utils.cpp | 14 +++---- plugins/TabSRMM/src/stdafx.h | 1 + plugins/UserInfoEx/src/Flags/svc_flags.cpp | 15 +++---- 24 files changed, 166 insertions(+), 164 deletions(-) (limited to 'plugins') diff --git a/plugins/AsSingleWindow/src/AsSingleWindow.cpp b/plugins/AsSingleWindow/src/AsSingleWindow.cpp index f34e862cef..fbcdb36b6b 100644 --- a/plugins/AsSingleWindow/src/AsSingleWindow.cpp +++ b/plugins/AsSingleWindow/src/AsSingleWindow.cpp @@ -28,18 +28,15 @@ CMPlugin::CMPlugin() : ///////////////////////////////////////////////////////////////////////////////////////// -static int MsgWindowEvent(WPARAM, LPARAM lParam) +static int MsgWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData* data = (MessageWindowEventData*)lParam; + auto *pDlg = (CSrmmBaseDialog *)lParam; - if (data == nullptr) - return 0; - - switch (data->uType) { + switch (uType) { case MSG_WINDOW_EVT_OPEN: // Здесь можно отлавливать только открытие окна, // т.к. закрытие может быть закрытием вкладки - windowAdd(data->hwndWindow, false); + windowAdd(pDlg->GetHwnd(), false); break; } diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index 54e32b3c75..e3a8918d12 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -96,22 +96,23 @@ static void __fastcall SetStatusIcon(MCONTACT hContact, int countryNumber) Srmm_SetIconFlags(hContact, MODULENAME, 0, MBF_HIDDEN); } -static int MsgWndEvent(WPARAM, LPARAM lParam) +static int MsgWndEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *msgwe = (MessageWindowEventData*)lParam; - switch (msgwe->uType) { + auto *pDlg = (CSrmmBaseDialog *)lParam; + + switch (uType) { case MSG_WINDOW_EVT_OPENING: case MSG_WINDOW_EVT_CLOSE: if (bShowStatusIcon) { - int countryNumber = ServiceDetectContactOriginCountry((WPARAM)msgwe->hContact, 0); - if (msgwe->uType == MSG_WINDOW_EVT_OPENING && countryNumber != 0xFFFF) - SetStatusIcon(msgwe->hContact, countryNumber); + int countryNumber = ServiceDetectContactOriginCountry(pDlg->m_hContact, 0); + if (uType == MSG_WINDOW_EVT_OPENING && countryNumber != 0xFFFF) + SetStatusIcon(pDlg->m_hContact, countryNumber); else - Srmm_SetIconFlags(msgwe->hContact, MODULENAME, 0, MBF_HIDDEN); + Srmm_SetIconFlags(pDlg->m_hContact, MODULENAME, 0, MBF_HIDDEN); } // ensure it is hidden, RemoveStatusIcons() only enums currently opened ones else - Srmm_SetIconFlags(msgwe->hContact, MODULENAME, 0, MBF_HIDDEN); + Srmm_SetIconFlags(pDlg->m_hContact, MODULENAME, 0, MBF_HIDDEN); } return 0; } diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index 4d0efee903..b3956b84b5 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -42,20 +42,20 @@ INT_PTR svcOpenContact(WPARAM wParam, LPARAM) return 0; } -int ProcessSrmmEvent(WPARAM, LPARAM lParam) +int ProcessSrmmEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *event = (MessageWindowEventData *)lParam; + auto *pDlg = (CSrmmBaseDialog *)lParam; - if (event->uType == MSG_WINDOW_EVT_OPEN) { + if (uType == MSG_WINDOW_EVT_OPEN) { if (!hDialogsList) hDialogsList = WindowList_Create(); - WindowList_Add(hDialogsList, event->hwndWindow, event->hContact); + WindowList_Add(hDialogsList, pDlg->GetHwnd(), pDlg->m_hContact); - uint8_t fav = g_plugin.getByte(event->hContact, "IsFavourite"); - Srmm_SetIconFlags(event->hContact, MODULENAME, 0, fav ? 0 : MBF_DISABLED); + uint8_t fav = g_plugin.getByte(pDlg->m_hContact, "IsFavourite"); + Srmm_SetIconFlags(pDlg->m_hContact, MODULENAME, 0, fav ? 0 : MBF_DISABLED); - if (event->hContact == hContactToActivate) { - HWND hwndRoot = event->hwndWindow; + if (pDlg->m_hContact == hContactToActivate) { + HWND hwndRoot = pDlg->GetHwnd(); while (HWND hwndParent = GetParent(hwndRoot)) hwndRoot = hwndParent; @@ -68,9 +68,9 @@ int ProcessSrmmEvent(WPARAM, LPARAM lParam) hContactToActivate = NULL; } - else if (event->uType == MSG_WINDOW_EVT_CLOSING) { + else if (uType == MSG_WINDOW_EVT_CLOSING) { if (hDialogsList) - WindowList_Remove(hDialogsList, event->hwndWindow); + WindowList_Remove(hDialogsList, pDlg->GetHwnd()); } return 0; diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 4e9dc63a4e..31f41b9a8b 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -726,25 +726,23 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) * Monitors SRMM window's creation to draw a statusbar icon */ -static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) +static int OnSrmmWindowEvent(WPARAM uType, LPARAM lParam) { if (!g_plugin.getByte("StatusBarIcon", 1)) return 0; - MessageWindowEventData *event = (MessageWindowEventData *)lParam; - if (event == nullptr) - return 0; + auto *pDlg = (CSrmmBaseDialog *)lParam; - if (event->uType == MSG_WINDOW_EVT_OPEN) { + if (uType == MSG_WINDOW_EVT_OPEN) { ptrW ptszMirVer; - char *szProto = Proto_GetBaseAccountName(event->hContact); + char *szProto = Proto_GetBaseAccountName(pDlg->m_hContact); if (szProto != nullptr) - ptszMirVer = db_get_wsa(event->hContact, szProto, "MirVer"); - SetSrmmIcon(event->hContact, ptszMirVer); - arMonitoredWindows.insert((HANDLE)event->hContact); + ptszMirVer = db_get_wsa(pDlg->m_hContact, szProto, "MirVer"); + SetSrmmIcon(pDlg->m_hContact, ptszMirVer); + arMonitoredWindows.insert((HANDLE)pDlg->m_hContact); } - else if (event->uType == MSG_WINDOW_EVT_CLOSE) - arMonitoredWindows.remove((HANDLE)event->hContact); + else if (uType == MSG_WINDOW_EVT_CLOSE) + arMonitoredWindows.remove((HANDLE)pDlg->m_hContact); return 0; } diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 183b41be60..5ed98ea385 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -203,13 +203,14 @@ void ShutdownAction(void) SweepHistoryFromContact(hContact, Criteria, TRUE); // sweep contact history, keepunread==1 } -int OnWindowEvent(WPARAM, LPARAM lParam) +int OnWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *msgEvData = (MessageWindowEventData*)lParam; - switch (msgEvData->uType) { + auto *pDlg = (CSrmmBaseDialog *)lParam; + + switch (uType) { case MSG_WINDOW_EVT_OPENING: - g_hWindows.insert(PVOID(msgEvData->hContact)); - SetSrmmIcon(msgEvData->hContact); + g_hWindows.insert(PVOID(pDlg->m_hContact)); + SetSrmmIcon(pDlg->m_hContact); break; case MSG_WINDOW_EVT_CLOSE: @@ -219,11 +220,11 @@ int OnWindowEvent(WPARAM, LPARAM lParam) Criteria.keep = KeepCriteria(g_plugin.getByte("StartupShutdownKeep")); Criteria.time = BuildCriteria(g_plugin.getByte("StartupShutdownOlder")); - SweepHistoryFromContact(msgEvData->hContact, Criteria, TRUE); + SweepHistoryFromContact(pDlg->m_hContact, Criteria, TRUE); } for (auto &it : g_hWindows.rev_iter()) - if (it == PVOID(msgEvData->hContact)) + if (it == PVOID(pDlg->m_hContact)) g_hWindows.removeItem(&it); break; } diff --git a/plugins/MagneticWindows/src/MagneticWindows.cpp b/plugins/MagneticWindows/src/MagneticWindows.cpp index 9256fee2b7..0c35fa1451 100644 --- a/plugins/MagneticWindows/src/MagneticWindows.cpp +++ b/plugins/MagneticWindows/src/MagneticWindows.cpp @@ -39,7 +39,6 @@ CMPlugin::CMPlugin() : // Plugin Functions /////////////////////////////////////////////////////////////////////////////////////////////////// - //For other Plugins to start snapping for other Windows INT_PTR SnapPluginWindowStart(WPARAM wParam, LPARAM) { @@ -54,14 +53,14 @@ INT_PTR SnapPluginWindowStop(WPARAM wParam, LPARAM) return 0; } -int PluginMessageWindowEvent(WPARAM, LPARAM lParam) +int PluginMessageWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *Data = (MessageWindowEventData*)lParam; + auto *pDlg = (CSrmmBaseDialog *)lParam; - switch (Data->uType) { + switch (uType) { case MSG_WINDOW_EVT_OPEN: { - HWND hWnd = Data->hwndWindow; + HWND hWnd = pDlg->GetHwnd(); HWND hWndParent = GetParent(hWnd); while ((hWndParent != 0) && (hWndParent != GetDesktopWindow()) && (IsWindowVisible(hWndParent))) { hWnd = hWndParent; @@ -73,7 +72,7 @@ int PluginMessageWindowEvent(WPARAM, LPARAM lParam) break; case MSG_WINDOW_EVT_CLOSING: - WindowClose(Data->hwndWindow); + WindowClose(pDlg->GetHwnd()); break; } diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index f30a2b9f97..3684defb91 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -778,12 +778,12 @@ static void TabsrmmButtonsModify(MCONTACT hContact) } } -static int ContactWindowOpen(WPARAM, LPARAM lParam) +static int ContactWindowOpen(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; + auto *pDlg = (CSrmmBaseDialog *)lParam; - if (MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact) - TabsrmmButtonsModify(MWeventdata->hContact); + if (uType == MSG_WINDOW_EVT_OPENING && pDlg->m_hContact) + TabsrmmButtonsModify(pDlg->m_hContact); return 0; } diff --git a/plugins/MessageState/src/messagestate.cpp b/plugins/MessageState/src/messagestate.cpp index 42063a2a00..f5981729c2 100644 --- a/plugins/MessageState/src/messagestate.cpp +++ b/plugins/MessageState/src/messagestate.cpp @@ -91,11 +91,12 @@ static int OnEventFilterAdd(WPARAM hContact, LPARAM lParam) return 0; } -static int OnSrmmWindowOpened(WPARAM, LPARAM lParam) +static int OnSrmmWindowOpened(WPARAM uType, LPARAM lParam) { - auto *pEvent = (MessageWindowEventData*)lParam; - if (pEvent->uType == MSG_WINDOW_EVT_OPENING) - IconsUpdate(pEvent->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (uType == MSG_WINDOW_EVT_OPENING) + IconsUpdate(pDlg->m_hContact); return 0; } diff --git a/plugins/MirLua/src/Modules/m_message.cpp b/plugins/MirLua/src/Modules/m_message.cpp index 0bc9142dad..a9f026ec89 100644 --- a/plugins/MirLua/src/Modules/m_message.cpp +++ b/plugins/MirLua/src/Modules/m_message.cpp @@ -64,9 +64,5 @@ LUAMOD_API int luaopen_m_message(lua_State *L) { luaL_newlib(L, messageApi); - MT(L, "MessageWindowEventData") - .Field(&MessageWindowEventData::uType, "Type", LUA_TINTEGER) - .Field(&MessageWindowEventData::hContact, "hContact", LUA_TINTEGER); - return 1; } diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index ef9d7d0d93..d6420f1cea 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -163,18 +163,19 @@ void FinishSession(MCONTACT hContact) return; } -int WindowEvent(WPARAM, LPARAM lParam) +int WindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; - if (mwd->uType == MSG_WINDOW_EVT_CLOSE && options.end_window_close) { - FinishSession(mwd->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (uType == MSG_WINDOW_EVT_CLOSE && options.end_window_close) { + FinishSession(pDlg->m_hContact); return 0; } - if (mwd->uType != MSG_WINDOW_EVT_OPEN) + if (uType != MSG_WINDOW_EVT_OPEN) return 0; - MCONTACT hContact = mwd->hContact, hTemp; + MCONTACT hContact = pDlg->m_hContact, hTemp; if ((hTemp = db_mc_getMostOnline(hContact)) != 0) hContact = hTemp; diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 446bccb3bc..c3d47bbb48 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -1319,17 +1319,16 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) //************************************************************************ // message window event hook function //************************************************************************ -int CAppletManager::HookMessageWindowEvent(WPARAM, LPARAM lParam) +int CAppletManager::HookMessageWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwed = (MessageWindowEventData*)lParam; - CEvent Event; + auto *pDlg = (CSrmmBaseDialog *)lParam; + CEvent Event; Event.eType = EVENT_MESSAGEWINDOW; - Event.hContact = mwed->hContact; - Event.iValue = mwed->uType; + Event.hContact = pDlg->m_hContact; + Event.iValue = uType; CAppletManager::GetInstance()->HandleEvent(&Event); - return 0; } diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 7b32997456..9be1a1176e 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -506,25 +506,26 @@ void AddSMsgEventThread(void *arg) mir_free(smi.newstatusmsg); } -int OnWindowEvent(WPARAM, LPARAM lParam) +int OnWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwed = (MessageWindowEventData *)lParam; - if (mwed->uType == MSG_WINDOW_EVT_CLOSE) { + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (uType == MSG_WINDOW_EVT_CLOSE) { if (opt.XLogToDB && opt.XLogToDB_WinOpen && opt.XLogToDB_Remove) - RemoveLoggedEventsXStatus(mwed->hContact); + RemoveLoggedEventsXStatus(pDlg->m_hContact); if (opt.LogToDB && opt.LogToDB_WinOpen && opt.LogToDB_Remove) - RemoveLoggedEventsStatus(mwed->hContact); + RemoveLoggedEventsStatus(pDlg->m_hContact); if (opt.SMsgLogToDB && opt.SMsgLogToDB_WinOpen && opt.SMsgLogToDB_Remove) - RemoveLoggedEventsSMsg(mwed->hContact); + RemoveLoggedEventsSMsg(pDlg->m_hContact); } - else if (mwed->uType == MSG_WINDOW_EVT_OPEN) { - if (opt.XLogToDB && (templates.LogXFlags & NOTIFY_OPENING_ML) && g_plugin.getByte(mwed->hContact, "EnableXLogging", 1)) - mir_forkthread(AddXStatusEventThread, (void *)mwed->hContact); + else if (uType == MSG_WINDOW_EVT_OPEN) { + if (opt.XLogToDB && (templates.LogXFlags & NOTIFY_OPENING_ML) && g_plugin.getByte(pDlg->m_hContact, "EnableXLogging", 1)) + mir_forkthread(AddXStatusEventThread, (void *)pDlg->m_hContact); - if (opt.SMsgLogToDB && (templates.LogSMsgFlags & NOTIFY_OPENING_ML) && g_plugin.getByte(mwed->hContact, "EnableSMsgLogging", 1)) - mir_forkthread(AddSMsgEventThread, (void *)mwed->hContact); + if (opt.SMsgLogToDB && (templates.LogSMsgFlags & NOTIFY_OPENING_ML) && g_plugin.getByte(pDlg->m_hContact, "EnableSMsgLogging", 1)) + mir_forkthread(AddSMsgEventThread, (void *)pDlg->m_hContact); } return 0; } diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp index ee575c4947..35bdf9ca79 100644 --- a/plugins/New_GPG/src/srmm.cpp +++ b/plugins/New_GPG/src/srmm.cpp @@ -53,12 +53,13 @@ static void ToggleIcon(MCONTACT hContact) } } -int __cdecl onWindowEvent(WPARAM, LPARAM lParam) +int __cdecl onWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; - if (mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING) - if (isContactHaveKey(mwd->hContact)) - setSrmmIcon(mwd->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (uType == MSG_WINDOW_EVT_OPEN || uType == MSG_WINDOW_EVT_OPENING) + if (isContactHaveKey(pDlg->m_hContact)) + setSrmmIcon(pDlg->m_hContact); return 0; } diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index fb9a4af38f..f1cc4bf493 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -163,12 +163,12 @@ INT_PTR ServiceToggle(WPARAM hContact, LPARAM) return 0; } -int WindowEvent(WPARAM, LPARAM lParam) +int WindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; - MCONTACT hContact = mwd->hContact; + auto *pDlg = (CSrmmBaseDialog *)lParam; + MCONTACT hContact = pDlg->m_hContact; - switch(mwd->uType) { + switch(uType) { case MSG_WINDOW_EVT_CLOSE: RemoveReadEvents(hContact); break; diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 62ad9d2084..7506888879 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -401,11 +401,12 @@ void HideNudgeButton(MCONTACT hContact) } } -static int ContactWindowOpen(WPARAM, LPARAM lParam) +static int ContactWindowOpen(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; - if (MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact) - HideNudgeButton(MWeventdata->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (uType == MSG_WINDOW_EVT_OPENING && pDlg->m_hContact) + HideNudgeButton(pDlg->m_hContact); return 0; } diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index ee1393169e..7091b635b1 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -297,18 +297,20 @@ static void InitTabsrmmButton() hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); } -static int WindowEvent(WPARAM, MessageWindowEventData* lParam) +static int WindowEvent(WPARAM uType, LPARAM lParam) { - if (lParam->uType == MSG_WINDOW_EVT_OPEN) { - char *szProto = Proto_GetBaseAccountName(lParam->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (uType == MSG_WINDOW_EVT_OPEN) { + char *szProto = Proto_GetBaseAccountName(pDlg->m_hContact); if (szProto && (INT_PTR)szProto != CALLSERVICE_NOTFOUND) { - if (Contact::IsGroupChat(lParam->hContact, szProto)) { - (*contactWindows)[lParam->hContact] = lParam->hwndInput; + if (Contact::IsGroupChat(pDlg->m_hContact, szProto)) { + (*contactWindows)[pDlg->m_hContact] = pDlg->GetInput(); } } } - else if (lParam->uType == MSG_WINDOW_EVT_CLOSE) { - std::map::iterator it = contactWindows->find(lParam->hContact); + else if (uType == MSG_WINDOW_EVT_CLOSE) { + std::map::iterator it = contactWindows->find(pDlg->m_hContact); if (it != contactWindows->end()) { contactWindows->erase(it); } diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index cf52439b79..ea23d5303a 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -42,20 +42,20 @@ static void SrmmMenu_UpdateIcon(MCONTACT hContact) Srmm_SetIconFlags(hContact, MODULENAME, i, (i == mode) ? 0 : MBF_HIDDEN); } -static int SrmmMenu_ProcessEvent(WPARAM, LPARAM lParam) +static int SrmmMenu_ProcessEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwevent = (MessageWindowEventData *)lParam; + auto *pDlg = (CSrmmBaseDialog *)lParam; - if (mwevent->uType == MSG_WINDOW_EVT_OPEN) { + if (uType == MSG_WINDOW_EVT_OPEN) { if (!hDialogsList) hDialogsList = WindowList_Create(); - WindowList_Add(hDialogsList, mwevent->hwndWindow, mwevent->hContact); - SrmmMenu_UpdateIcon(mwevent->hContact); + WindowList_Add(hDialogsList, pDlg->GetHwnd(), pDlg->m_hContact); + SrmmMenu_UpdateIcon(pDlg->m_hContact); } - else if (mwevent->uType == MSG_WINDOW_EVT_CLOSING) { + else if (uType == MSG_WINDOW_EVT_CLOSING) { if (hDialogsList) - WindowList_Remove(hDialogsList, mwevent->hwndWindow); + WindowList_Remove(hDialogsList, pDlg->GetHwnd()); } return 0; diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 8787936cc9..0120c0b046 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -477,11 +477,12 @@ static int OnGCOutEvent(WPARAM, LPARAM lParam) return 0; } -static int OnMsgEvent(WPARAM, LPARAM lParam) +static int OnMsgEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *ed = (MessageWindowEventData *)lParam; - if (ed->hContact != 0 && ed->uType == MSG_WINDOW_EVT_OPEN) - SaveLastUsedTimeStamp(ed->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (pDlg->m_hContact != 0 && uType == MSG_WINDOW_EVT_OPEN) + SaveLastUsedTimeStamp(pDlg->m_hContact); return 0; } diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index 09323c5cd4..e0e3ccbef6 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -1,11 +1,11 @@ #include "commonheaders.h" -int __cdecl onWindowEvent(WPARAM, LPARAM lParam) +int __cdecl onWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; - if (mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING) - ShowStatusIcon(mwd->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + if (uType == MSG_WINDOW_EVT_OPEN || uType == MSG_WINDOW_EVT_OPENING) + ShowStatusIcon(pDlg->m_hContact); return 0; } diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 4489df8646..ad71d5306f 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -205,19 +205,20 @@ static void DelFromCurSession(MCONTACT hContact) } } -static int OnSrmmWindowEvent(WPARAM, LPARAM lParam) +static int OnSrmmWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; - if (MWeventdata->uType == MSG_WINDOW_EVT_OPEN) { - AddToCurSession(MWeventdata->hContact); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + if (uType == MSG_WINDOW_EVT_OPEN) { + AddToCurSession(pDlg->m_hContact); if (g_bCrashRecovery) - g_plugin.setByte(MWeventdata->hContact, "wasInLastSession", 1); + g_plugin.setByte(pDlg->m_hContact, "wasInLastSession", 1); } - else if (MWeventdata->uType == MSG_WINDOW_EVT_CLOSE) { + else if (uType == MSG_WINDOW_EVT_CLOSE) { if (!DONT) - DelFromCurSession(MWeventdata->hContact); + DelFromCurSession(pDlg->m_hContact); if (g_bCrashRecovery) - g_plugin.setByte(MWeventdata->hContact, "wasInLastSession", 0); + g_plugin.setByte(pDlg->m_hContact, "wasInLastSession", 0); } return 0; diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index 6d37f6e936..b8e7440350 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -150,17 +150,19 @@ int SmileyButtonPressed(WPARAM, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // window hook -static int MsgDlgHook(WPARAM, LPARAM lParam) +static int MsgDlgHook(WPARAM uType, LPARAM lParam) { - const MessageWindowEventData *wndEvtData = (MessageWindowEventData*)lParam; - switch (wndEvtData->uType) { + auto *pDlg = (CSrmmBaseDialog *)lParam; + auto hwndLog = pDlg->log()->GetHwnd(); + + switch (uType) { case MSG_WINDOW_EVT_OPENING: { MsgWndData *msgwnd = new MsgWndData(); - msgwnd->hwnd = wndEvtData->hwndWindow; - msgwnd->hContact = wndEvtData->hContact; - msgwnd->hwndLog = wndEvtData->hwndLog; - msgwnd->hwndInput = wndEvtData->hwndInput; + msgwnd->hwnd = pDlg->GetHwnd(); + msgwnd->hContact = pDlg->m_hContact; + msgwnd->hwndLog = hwndLog; + msgwnd->hwndInput = pDlg->GetInput(); // Get the protocol for this contact to display correct smileys. char *protonam = Proto_GetBaseAccountName(DecodeMetaContact(msgwnd->hContact)); @@ -174,30 +176,30 @@ static int MsgDlgHook(WPARAM, LPARAM lParam) g_MsgWndList.insert(msgwnd); } - SetRichOwnerCallback(wndEvtData->hwndWindow, wndEvtData->hwndInput, wndEvtData->hwndLog); + SetRichOwnerCallback(pDlg->GetHwnd(), pDlg->GetInput(), hwndLog); - if (wndEvtData->hwndLog) - SetRichCallback(wndEvtData->hwndLog, wndEvtData->hContact, false, false); - if (wndEvtData->hwndInput) - SetRichCallback(wndEvtData->hwndInput, wndEvtData->hContact, false, false); + if (hwndLog) + SetRichCallback(hwndLog, pDlg->m_hContact, false, false); + if (pDlg->GetInput()) + SetRichCallback(pDlg->GetInput(), pDlg->m_hContact, false, false); break; case MSG_WINDOW_EVT_OPEN: - SetRichOwnerCallback(wndEvtData->hwndWindow, wndEvtData->hwndInput, wndEvtData->hwndLog); - if (wndEvtData->hwndLog) - SetRichCallback(wndEvtData->hwndLog, wndEvtData->hContact, true, true); - if (wndEvtData->hwndInput) { - SetRichCallback(wndEvtData->hwndInput, wndEvtData->hContact, true, true); - SendMessage(wndEvtData->hwndInput, WM_REMAKERICH, 0, 0); + SetRichOwnerCallback(pDlg->GetHwnd(), pDlg->GetInput(), hwndLog); + if (hwndLog) + SetRichCallback(hwndLog, pDlg->m_hContact, true, true); + if (pDlg->GetInput()) { + SetRichCallback(pDlg->GetInput(), pDlg->m_hContact, true, true); + SendMessage(pDlg->GetInput(), WM_REMAKERICH, 0, 0); } break; case MSG_WINDOW_EVT_CLOSE: - if (wndEvtData->hwndLog) { - CloseRichCallback(wndEvtData->hwndLog); - CloseRichOwnerCallback(wndEvtData->hwndWindow); + if (hwndLog) { + CloseRichCallback(hwndLog); + CloseRichOwnerCallback(pDlg->GetHwnd()); } - mir_unsubclassWindow(wndEvtData->hwndWindow, MessageDlgSubclass); + mir_unsubclassWindow(pDlg->GetHwnd(), MessageDlgSubclass); break; } return 0; diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 82e7d73de3..0c3e490112 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -1307,16 +1307,14 @@ int ShowPopupMenu(HWND hwnd, HMENU hMenu, POINT pt, HWND hwndOwner) return selection; } -int MsgWindowEvent(WPARAM, LPARAM lParam) +int MsgWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *event = (MessageWindowEventData *)lParam; - if (event == nullptr) - return 0; + auto *pDlg = (CSrmmBaseDialog *)lParam; - if (event->uType == MSG_WINDOW_EVT_OPEN) - AddContactTextBox(event->hContact, event->hwndInput, "DefaultSRMM", TRUE, event->hwndWindow); - else if (event->uType == MSG_WINDOW_EVT_CLOSING) - RemoveContactTextBox(event->hwndInput); + if (uType == MSG_WINDOW_EVT_OPEN) + AddContactTextBox(pDlg->m_hContact, pDlg->GetInput(), "DefaultSRMM", TRUE, pDlg->GetHwnd()); + else if (uType == MSG_WINDOW_EVT_CLOSING) + RemoveContactTextBox(pDlg->GetInput()); return 0; } diff --git a/plugins/TabSRMM/src/stdafx.h b/plugins/TabSRMM/src/stdafx.h index 4c87b4c428..a964742088 100644 --- a/plugins/TabSRMM/src/stdafx.h +++ b/plugins/TabSRMM/src/stdafx.h @@ -50,6 +50,7 @@ #include #include +#include #include #include #include diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 590a95d6a3..193020cb32 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -113,25 +113,26 @@ void UpdateStatusIcons() } //hookProc ME_MSG_WINDOWEVENT -static int OnMsgWndEvent(WPARAM, LPARAM lParam) +static int OnMsgWndEvent(WPARAM uType, LPARAM lParam) { + auto *pDlg = (CSrmmBaseDialog *)lParam; + MsgWndData *msgwnd; - MessageWindowEventData *msgwe = (MessageWindowEventData*)lParam; /* sanity check */ - if (msgwe->hContact == NULL) + if (pDlg->m_hContact == NULL) return 0; - switch (msgwe->uType) { + switch (uType) { case MSG_WINDOW_EVT_OPENING: - msgwnd = gMsgWndList.find((MsgWndData*)&msgwe->hContact); + msgwnd = gMsgWndList.find((MsgWndData*)&pDlg->m_hContact); if (msgwnd == nullptr) { - msgwnd = new MsgWndData(msgwe->hwndWindow, msgwe->hContact); + msgwnd = new MsgWndData(pDlg->GetHwnd(), pDlg->m_hContact); gMsgWndList.insert(msgwnd); } break; case MSG_WINDOW_EVT_CLOSE: - int i = gMsgWndList.getIndex((MsgWndData*)&msgwe->hContact); + int i = gMsgWndList.getIndex((MsgWndData*)&pDlg->m_hContact); if (i != -1) { delete gMsgWndList[i]; gMsgWndList.remove(i); -- cgit v1.2.3