summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-09-21 14:34:07 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-09-21 14:34:07 +0300
commitc9b740a178828eae5cc4be7ab054e5f26d3a27e7 (patch)
treee15ce76cb41feb3375a76c95d861294b899bfe48
parent6024e32d70da7a7c703de51e30b6c6407df8a745 (diff)
MessageWindowEventData: useless structure removed
-rw-r--r--include/m_message.h16
-rw-r--r--include/m_srmm_int.h17
-rw-r--r--plugins/AsSingleWindow/src/AsSingleWindow.cpp11
-rw-r--r--plugins/CountryFlags/src/extraimg.cpp17
-rw-r--r--plugins/FavContacts/src/services.cpp20
-rw-r--r--plugins/FingerprintNG/src/fingerprint.cpp20
-rw-r--r--plugins/HistorySweeperLight/src/historysweeperlight.cpp15
-rw-r--r--plugins/MagneticWindows/src/MagneticWindows.cpp11
-rw-r--r--plugins/MenuItemEx/src/main.cpp8
-rw-r--r--plugins/MessageState/src/messagestate.cpp9
-rw-r--r--plugins/MirLua/src/Modules/m_message.cpp4
-rw-r--r--plugins/MirOTR/src/dbfilter.cpp13
-rw-r--r--plugins/MirandaG15/src/CAppletManager.cpp11
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.cpp23
-rw-r--r--plugins/New_GPG/src/srmm.cpp11
-rw-r--r--plugins/NoHistory/src/dllmain.cpp8
-rw-r--r--plugins/Nudge/src/main.cpp9
-rw-r--r--plugins/PasteIt/src/PasteIt.cpp16
-rw-r--r--plugins/Popup/src/srmm_menu.cpp14
-rw-r--r--plugins/RecentContacts/src/RecentContacts.cpp9
-rw-r--r--plugins/SecureIM/src/svcs_srmm.cpp8
-rw-r--r--plugins/Sessions/Src/Main.cpp17
-rw-r--r--plugins/SmileyAdd/src/dlgboxsubclass.cpp46
-rw-r--r--plugins/SpellChecker/src/utils.cpp14
-rw-r--r--plugins/TabSRMM/src/stdafx.h1
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp15
-rw-r--r--protocols/CloudFile/src/srmm.cpp13
-rw-r--r--protocols/JabberG/src/jabber_menu.cpp18
-rw-r--r--protocols/Sametime/src/sametime.cpp10
-rw-r--r--protocols/VKontakte/src/misc.cpp21
-rw-r--r--src/mir_app/src/meta_services.cpp43
-rw-r--r--src/mir_app/src/srmm_base.cpp8
32 files changed, 236 insertions, 240 deletions
diff --git a/include/m_message.h b/include/m_message.h
index 975ff417b6..684069bb36 100644
--- a/include/m_message.h
+++ b/include/m_message.h
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_database.h>
#include <m_langpack.h>
+#include <m_srmm_int.h>
/////////////////////////////////////////////////////////////////////////////////////////
// brings up the send message dialog for a contact
@@ -52,23 +53,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/////////////////////////////////////////////////////////////////////////////////////////
// gets fired when a message window appears/disappears
-// wparam = 0
-// lparam = (WPARAM)(MessageWindowEventData*)hWindowEvent;
+// wparam = MSG_WINDOW_EVT_* constant
+// lparam = (WPARAM)(CSrmmBaseDialog*)pDialog;
#define MSG_WINDOW_EVT_OPENING 1 // window is about to be opened
#define MSG_WINDOW_EVT_OPEN 2 // window has been opened
#define MSG_WINDOW_EVT_CLOSING 3 // window is about to be closed
#define MSG_WINDOW_EVT_CLOSE 4 // window has been closed
-struct MessageWindowEventData
-{
- MCONTACT hContact;
- HWND hwndWindow; // top level window for the contact
- uint32_t uType; // see event types above
- HWND hwndInput; // input area window for the contact (or NULL if there is none)
- HWND hwndLog; // log area window for the contact (or NULL if there is none)
-};
-
#define ME_MSG_WINDOWEVENT "MessageAPI/WindowEvent"
/////////////////////////////////////////////////////////////////////////////////////////
@@ -84,7 +76,7 @@ struct MessageWindowData
{
HWND hwndWindow; //top level window for the contact or NULL if no window exists
int uState; // see window states
- class CSrmmBaseDialog *pDlg; // window class object
+ CSrmmBaseDialog *pDlg; // window class object
};
EXTERN_C MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd);
diff --git a/include/m_srmm_int.h b/include/m_srmm_int.h
index 2dd9488c0a..67059a625f 100644
--- a/include/m_srmm_int.h
+++ b/include/m_srmm_int.h
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_SRMM_INT_H__
#define M_SRMM_INT_H__ 1
+#include <shellapi.h>
+
#include <m_gui.h>
#define SRMM_MODULE "SRMM"
@@ -332,23 +334,24 @@ public:
virtual void AddLog(const LOGINFO &lin);
virtual void CloseTab() {}
- virtual void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) PURE;
- virtual void EventAdded(MEVENT, const DB::EventInfo &dbei) PURE;
- virtual bool GetFirstEvent() PURE;
- virtual bool IsActive() const PURE;
- virtual void LoadSettings() PURE;
- virtual void RemakeLog() PURE;
+ virtual void DrawNickList(USERINFO *ui, DRAWITEMSTRUCT *dis) = 0;
+ virtual void EventAdded(MEVENT, const DB::EventInfo &dbei) = 0;
+ virtual bool GetFirstEvent() = 0;
+ virtual bool IsActive() const = 0;
+ virtual void LoadSettings() = 0;
+ virtual void RemakeLog() = 0;
virtual void SetStatusText(const wchar_t *, HICON) {}
virtual void ShowFilterMenu() {}
virtual void UpdateFilterButton();
virtual void UpdateOptions();
virtual void UpdateStatusBar() {}
- virtual void UpdateTitle() PURE;
+ virtual void UpdateTitle() = 0;
virtual LRESULT WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam);
virtual LRESULT WndProc_Nicklist(UINT msg, WPARAM wParam, LPARAM lParam);
__forceinline bool isChat() const { return m_si != nullptr; }
+ __forceinline MWindow GetInput() const { return m_message.GetHwnd(); }
__forceinline SESSION_INFO *getChat() const { return m_si; }
__forceinline CSrmmLogWindow *log() const { return m_pLog; }
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<MessageWindowEventData>(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<MCONTACT, HWND>::iterator it = contactWindows->find(lParam->hContact);
+ else if (uType == MSG_WINDOW_EVT_CLOSE) {
+ std::map<MCONTACT, HWND>::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 <msapi/vsstyle.h>
#include <msapi/comptr.h>
+#include <newpluginapi.h>
#include <m_avatars.h>
#include <m_message.h>
#include <newpluginapi.h>
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);
diff --git a/protocols/CloudFile/src/srmm.cpp b/protocols/CloudFile/src/srmm.cpp
index 161ddfffd0..b36211de30 100644
--- a/protocols/CloudFile/src/srmm.cpp
+++ b/protocols/CloudFile/src/srmm.cpp
@@ -15,17 +15,16 @@ int OnSrmmToolbarLoaded(WPARAM, LPARAM)
return 0;
}
-int OnSrmmWindowOpened(WPARAM, LPARAM lParam)
+int OnSrmmWindowOpened(WPARAM uType, LPARAM lParam)
{
- MessageWindowEventData *ev = (MessageWindowEventData*)lParam;
- if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact) {
+ auto *pDlg = (CSrmmBaseDialog *)lParam;
+
+ if (uType == MSG_WINDOW_EVT_OPENING && pDlg->m_hContact) {
BBButton bbd = {};
bbd.pszModuleName = MODULENAME;
bbd.dwButtonID = BBB_ID_FILE_SEND;
- bbd.bbbFlags = CanSendToContact(ev->hContact)
- ? BBSF_RELEASED
- : BBSF_DISABLED;
- Srmm_SetButtonState(ev->hContact, &bbd);
+ bbd.bbbFlags = CanSendToContact(pDlg->m_hContact) ? BBSF_RELEASED : BBSF_DISABLED;
+ Srmm_SetButtonState(pDlg->m_hContact, &bbd);
}
return 0;
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp
index 715909e915..5c601611b6 100644
--- a/protocols/JabberG/src/jabber_menu.cpp
+++ b/protocols/JabberG/src/jabber_menu.cpp
@@ -796,29 +796,29 @@ void CJabberProto::MenuUpdateSrmmIcon(JABBER_LIST_ITEM *item)
Srmm_SetIconFlags(hContact, m_szModuleName, 0, item->arResources.getCount() ? 0 : MBF_DISABLED);
}
-int CJabberProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
+int CJabberProto::OnProcessSrmmEvent(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);
- ptrA jid(getUStringA(event->hContact, "jid"));
+ ptrA jid(getUStringA(pDlg->m_hContact, "jid"));
if (jid != nullptr) {
JABBER_LIST_ITEM *pItem = ListGetItemPtr(LIST_ROSTER, jid);
if (pItem && m_ThreadInfo && (m_ThreadInfo->jabberServerCaps & JABBER_CAPS_ARCHIVE_AUTO) && m_bEnableMsgArchive)
- RetrieveMessageArchive(event->hContact, pItem);
+ RetrieveMessageArchive(pDlg->m_hContact, pItem);
}
}
- 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());
if (m_bJabberOnline) {
char jid[JABBER_MAX_JID_LEN];
- if (GetClientJID(event->hContact, jid, _countof(jid))) {
+ if (GetClientJID(pDlg->m_hContact, jid, _countof(jid))) {
pResourceStatus r(ResourceInfoFromJID(jid));
if (m_bEnableChatStates && (GetResourceCapabilities(jid, r) & JABBER_CAPS_CHATSTATES))
m_ThreadInfo->send(XmlNode("message") << XATTR("to", jid) << XATTR("type", "chat") << XATTRID(SerialNext()) << XCHILDNS("gone", JABBER_FEAT_CHATSTATES));
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp
index e11388ca86..238f559d6b 100644
--- a/protocols/Sametime/src/sametime.cpp
+++ b/protocols/Sametime/src/sametime.cpp
@@ -99,15 +99,15 @@ void __cdecl sttRecvAwayThread(TFakeAckParams *tParam)
free(tParam);
}
-int CSametimeProto::OnWindowEvent(WPARAM, LPARAM lParam)
+int CSametimeProto::OnWindowEvent(WPARAM uType, LPARAM lParam)
{
- MessageWindowEventData *mwed = (MessageWindowEventData*)lParam;
+ auto *pDlg = (CSrmmBaseDialog *)lParam;
- if ((mwed == nullptr) || Contact::IsGroupChat(mwed->hContact, m_szModuleName))
+ if (Contact::IsGroupChat(pDlg->m_hContact, m_szModuleName))
return 0;
- if ((mwed->uType == MSG_WINDOW_EVT_CLOSING) || (mwed->uType == MSG_WINDOW_EVT_CLOSE))
- CloseIm(mwed->hContact);
+ if (uType == MSG_WINDOW_EVT_CLOSING || uType == MSG_WINDOW_EVT_CLOSE)
+ CloseIm(pDlg->m_hContact);
return 0;
}
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index ff3ed307e1..6cd5957735 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -838,25 +838,24 @@ int CVkProto::IsHystoryMessageExist(MCONTACT hContact)
return -1;
}
-int CVkProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam)
+int CVkProto::OnProcessSrmmEvent(WPARAM uType, LPARAM lParam)
{
debugLogA("CVkProto::OnProcessSrmmEvent");
- MessageWindowEventData *event = (MessageWindowEventData *)lParam;
+ auto *pDlg = (CSrmmBaseDialog *)lParam;
-
- CMStringA szProto(Proto_GetBaseAccountName(event->hContact));
+ CMStringA szProto(Proto_GetBaseAccountName(pDlg->m_hContact));
if (szProto.IsEmpty() || szProto != m_szModuleName)
return 0;
- if (event->uType == MSG_WINDOW_EVT_OPENING && !g_bMessageState)
- SetSrmmReadStatus(event->hContact);
+ if (uType == MSG_WINDOW_EVT_OPENING && !g_bMessageState)
+ SetSrmmReadStatus(pDlg->m_hContact);
- if (event->uType == MSG_WINDOW_EVT_OPENING && m_vkOptions.bLoadLastMessageOnMsgWindowsOpen
- && !isChatRoom(event->hContact) && IsHystoryMessageExist(event->hContact) != 1) {
+ if (uType == MSG_WINDOW_EVT_OPENING && m_vkOptions.bLoadLastMessageOnMsgWindowsOpen
+ && !isChatRoom(pDlg->m_hContact) && IsHystoryMessageExist(pDlg->m_hContact) != 1) {
m_bNotifyForEndLoadingHistory = false;
- if (!getBool(event->hContact, "ActiveHistoryTask")) {
- setByte(event->hContact, "ActiveHistoryTask", 1);
- GetServerHistory(event->hContact, 0, MAXHISTORYMIDSPERONE, 0, 0, true);
+ if (!getBool(pDlg->m_hContact, "ActiveHistoryTask")) {
+ setByte(pDlg->m_hContact, "ActiveHistoryTask", 1);
+ GetServerHistory(pDlg->m_hContact, 0, MAXHISTORYMIDSPERONE, 0, 0, true);
}
}
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);
}
/////////////////////////////////////////////////////////////////////////////////////////