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 --- src/mir_app/src/meta_services.cpp | 43 +++++++++++++++++++++++---------------- src/mir_app/src/srmm_base.cpp | 8 +------- 2 files changed, 26 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 74f218e3d1..f241d38d8a 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -496,31 +496,38 @@ static int Meta_UserInfo(WPARAM, LPARAM hMeta) ///////////////////////////////////////////////////////////////////////////////////////// // record window open/close status for subs & metas -static int Meta_MessageWindowEvent(WPARAM, LPARAM lParam) +static int Meta_MessageWindowEvent(WPARAM uType, LPARAM lParam) { - MessageWindowEventData *mwed = (MessageWindowEventData*)lParam; - if (mwed->uType == MSG_WINDOW_EVT_OPEN) { - DBCachedContact *cc = g_pCurrDb->getCache()->GetCachedContact(mwed->hContact); - if (cc != nullptr) { - Srmm_SetIconFlags(cc->contactID, META_PROTO, 0, cc->IsMeta() ? 0 : MBF_HIDDEN); - if (cc->IsMeta()) { - MetaSrmmData *p = new MetaSrmmData; - p->m_hMeta = cc->contactID; - p->m_hSub = db_mc_getMostOnline(cc->contactID); - p->m_hWnd = mwed->hwndWindow; - arMetaWindows.insert(p); - - if (p->m_hSub != db_mc_getDefault(cc->contactID)) - db_mc_setDefault(cc->contactID, p->m_hSub, false); + auto *pDlg = (CSrmmBaseDialog *)lParam; + + switch (uType) { + case MSG_WINDOW_EVT_OPEN: + { + DBCachedContact *cc = g_pCurrDb->getCache()->GetCachedContact(pDlg->m_hContact); + if (cc != nullptr) { + Srmm_SetIconFlags(cc->contactID, META_PROTO, 0, cc->IsMeta() ? 0 : MBF_HIDDEN); + if (cc->IsMeta()) { + MetaSrmmData *p = new MetaSrmmData; + p->m_hMeta = cc->contactID; + p->m_hSub = db_mc_getMostOnline(cc->contactID); + p->m_hWnd = pDlg->GetHwnd(); + arMetaWindows.insert(p); + + if (p->m_hSub != db_mc_getDefault(cc->contactID)) + db_mc_setDefault(cc->contactID, p->m_hSub, false); + } } } - } - else if (mwed->uType == MSG_WINDOW_EVT_CLOSING) + break; + + case MSG_WINDOW_EVT_CLOSING: for (auto &p : arMetaWindows) - if (p->m_hWnd == mwed->hwndWindow) { + if (p->m_hWnd == pDlg->GetHwnd()) { arMetaWindows.removeItem(&p); break; } + break; + } return 0; } diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index b9e6e039a9..dfe6b6007e 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -885,13 +885,7 @@ int CSrmmBaseDialog::NotifyEvent(int code) if (m_hContact == 0 && m_hwnd == nullptr) return -1; - MessageWindowEventData mwe = {}; - mwe.hContact = m_hContact; - mwe.hwndWindow = m_hwnd; - mwe.uType = code; - mwe.hwndInput = m_message.GetHwnd(); - mwe.hwndLog = m_pLog->GetHwnd(); - return ::NotifyEventHooks(hHookSrmmEvent, 0, (LPARAM)&mwe); + return ::NotifyEventHooks(hHookSrmmEvent, code, (LPARAM)this); } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3