summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/meta_services.cpp43
-rw-r--r--src/mir_app/src/srmm_base.cpp8
2 files changed, 26 insertions, 25 deletions
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);
}
/////////////////////////////////////////////////////////////////////////////////////////