diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-28 15:38:49 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-28 15:38:49 +0300 |
commit | 2be5844edd93ab3490b4689cad33d75b4c77f3a8 (patch) | |
tree | 13721f733442b6068164efd79c3dfdae6aa622d5 | |
parent | 3ffc894a7a132a013e74fe063b72d79e17c998dc (diff) |
and finally MS_MSG_GETWINDOWDATA has gone, zihrono levraha
29 files changed, 53 insertions, 140 deletions
diff --git a/include/delphi/m_message.inc b/include/delphi/m_message.inc index 249f5e1462..764287720a 100644 --- a/include/delphi/m_message.inc +++ b/include/delphi/m_message.inc @@ -69,22 +69,14 @@ const MSG_WINDOW_STATE_ICONIC = $00000008;
type
- PMessageWindowOutputData = ^TMessageWindowOutputData;
- TMessageWindowOutputData = record
+ PMessageWindowData = ^TMessageWindowData;
+ TMessageWindowData = record
hwndWindow: HWND; // top level window for the contact or NULL if no window exists
uState : int; // see window states
local : pointer; // used to store pointer to custom data
end;
- PMessageWindowData = PMessageWindowOutputData;
- TMessageWindowData = TMessageWindowOutputData;
-const
-{ wparam=(MessageWindowInputData*)
- lparam=(MessageWindowOutputData*)
- returns 0 on success and returns non-zero (1) on error or if no window data
- exists for that hcontact
-}
- MS_MSG_GETWINDOWDATA:PAnsiChar = 'MessageAPI/GetWindowData';
+function Srmm_GetWindowData(hContact:TMCONTACT; pResult:PMessageWindowData) : int; stdcall; external AppDll;
type
PStatusTextData = ^TStatusTextData;
diff --git a/include/m_message.h b/include/m_message.h index 87fb73d92c..2ea263bd50 100644 --- a/include/m_message.h +++ b/include/m_message.h @@ -85,14 +85,12 @@ struct MessageWindowData {
HWND hwndWindow; //top level window for the contact or NULL if no window exists
int uState; // see window states
- void *local; // used to store pointer to custom data
+ class CSrmmBaseDialog *pDlg; // window class object
};
-// wparam = (MCONTACT)hContact
-// lparam = (MessageWindowData*)
-// returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
-#define MS_MSG_GETWINDOWDATA "MessageAPI/GetWindowData"
+EXTERN_C MIR_APP_DLL(int) Srmm_GetWindowData(MCONTACT hContact, MessageWindowData &mwd);
+///////////////////////////////////////////////////////////////////
// wparam = 0 (unused)
// lparam = (MessageWindowEvent*)
// fired before SRMM writes an entered message into the database
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex ec5039b75a..f5bf913b03 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex ea68d5876f..e3ac95fe55 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index 9cf69d9fed..cd2d31a485 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -139,7 +139,7 @@ void CALLBACK UpdateStatusIcons(LPARAM) while (hContact != NULL) {
/* is a message window opened for this contact? */
MessageWindowData msgw; /* output */
- if (!CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
+ if (!Srmm_GetWindowData(hContact, msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
if (bShowStatusIcon) {
int countryNumber = ServiceDetectContactOriginCountry(hContact, 0);
SetStatusIcon(hContact, countryNumber);
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index 8ed963d51e..f06b4514e3 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -111,7 +111,7 @@ int CDropbox::OnProtoAck(WPARAM, LPARAM lParam) for (MCONTACT hContact = db_find_first(ack->szModule); hContact; hContact = db_find_next(hContact, ack->szModule)) {
MessageWindowData msgw;
- if (!CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
+ if (!Srmm_GetWindowData(hContact, msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
BBButton bbd = {};
bbd.pszModuleName = MODULE;
bbd.dwButtonID = BBB_ID_FILE_SEND;
diff --git a/plugins/Dropbox/src/dropbox_options.cpp b/plugins/Dropbox/src/dropbox_options.cpp index 2ce64cca26..1105d3e71a 100644 --- a/plugins/Dropbox/src/dropbox_options.cpp +++ b/plugins/Dropbox/src/dropbox_options.cpp @@ -125,7 +125,7 @@ void CDropboxOptionsInterception::OnApply() // hide tabsrmm button for intercepted accounts
for (MCONTACT hContact = db_find_first(acc->szModuleName); hContact; hContact = db_find_next(hContact, acc->szModuleName)) {
MessageWindowData msgw;
- if (!CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
+ if (!Srmm_GetWindowData(hContact, msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
BBButton bbd = {};
bbd.pszModuleName = MODULE;
bbd.dwButtonID = BBB_ID_FILE_SEND;
diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp index 3aacbc9267..6da10ae8b3 100644 --- a/plugins/Dropbox/src/dropbox_utils.cpp +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -117,7 +117,7 @@ void CDropbox::SendToContact(MCONTACT hContact, const wchar_t *data) void CDropbox::PasteToInputArea(MCONTACT hContact, const wchar_t *data)
{
MessageWindowData mwd;
- if (!CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&mwd)) {
+ if (!Srmm_GetWindowData(hContact, mwd)) {
HWND hEdit = GetDlgItem(mwd.hwndWindow, 1002 /*IDC_MESSAGE*/);
if (!hEdit) hEdit = GetDlgItem(mwd.hwndWindow, 1009 /*IDC_CHATMESSAGE*/);
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 4aad0b4575..e68a3cac24 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -843,7 +843,7 @@ BOOL CheckMsgWnd(MCONTACT hContact, BOOL *focus) {
if (hContact) {
MessageWindowData mwd;
- if (!CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&mwd) && mwd.hwndWindow) {
+ if (!Srmm_GetWindowData(hContact, mwd) && mwd.hwndWindow) {
*focus = mwd.uState & MSG_WINDOW_STATE_FOCUS;
return TRUE;
}
diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 0f9b1aad54..a149601659 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -357,7 +357,7 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) }
MessageWindowData mwd;
- if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)param->targetHandle, (LPARAM)&mwd) && mwd.hwndWindow){
+ if (!Srmm_GetWindowData((WPARAM)param->targetHandle, (LPARAM)&mwd) && mwd.hwndWindow){
HWND parent;
HWND hWnd = mwd.hwndWindow;
while((parent = GetParent(hWnd)) != 0)
diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp index a7f4be9729..962745ef01 100644 --- a/plugins/MirLua/src/m_message.cpp +++ b/plugins/MirLua/src/m_message.cpp @@ -6,7 +6,7 @@ static int message_Paste(lua_State *L) ptrW text(mir_utf8decodeW(luaL_checkstring(L, 2)));
MessageWindowData mwd;
- INT_PTR res = CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&mwd);
+ INT_PTR res = Srmm_GetWindowData(hContact, (LPARAM)&mwd);
lua_pushinteger(L, res);
if (res)
return 1;
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 5e60617648..b4f00d44ab 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -789,7 +789,7 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag bool CAppletManager::IsMessageWindowOpen(MCONTACT hContact) { MessageWindowData mwd; - CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&mwd); + Srmm_GetWindowData(hContact, (LPARAM)&mwd); if (mwd.uState & MSG_WINDOW_STATE_EXISTS) return true; return false; diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 8d256418fc..b8d0570b46 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -86,7 +86,7 @@ int IsSRMsgWindowOpen(MCONTACT hContact, int DefaultRetVal) {
if (ServiceExists(MS_MSG_GETWINDOWDATA)) {
MessageWindowData mwd;
- return !CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&mwd) && mwd.hwndWindow;
+ return !Srmm_GetWindowData(hContact, (LPARAM)&mwd) && mwd.hwndWindow;
}
return DefaultRetVal;
diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index 81a8e51d63..d2b07adf78 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -24,7 +24,6 @@ #include "stdafx.h"
-int g_IsSrmmWindowAPI = 0;
extern PLUGIN_DATA* PopupList[20];
//---------------------------
@@ -113,8 +112,6 @@ int HookedInit(WPARAM, LPARAM) if (pluginOptions.bMenuitem)
MenuitemInit(!pluginOptions.bDisable);
-
- g_IsSrmmWindowAPI = ServiceExists(MS_MSG_GETWINDOWDATA) != 0;
return 0;
}
@@ -169,12 +166,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) int CheckMsgWnd(MCONTACT hContact)
{
- if (g_IsSrmmWindowAPI) {
- MessageWindowData mwd;
- if (!CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&mwd))
- if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
- return 1;
- }
+ MessageWindowData mwd;
+ if (!Srmm_GetWindowData(hContact, mwd))
+ if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
+ return 1;
return 0;
}
diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp index f3216823a8..56ef4931c7 100644 --- a/plugins/NewXstatusNotify/src/utils.cpp +++ b/plugins/NewXstatusNotify/src/utils.cpp @@ -25,7 +25,7 @@ bool CheckMsgWnd(MCONTACT hContact)
{
MessageWindowData mwd;
- if (CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&mwd) != NULL)
+ if (Srmm_GetWindowData(hContact, mwd) != NULL)
return false;
if (mwd.hwndWindow != NULL && (mwd.uState & MSG_WINDOW_STATE_EXISTS))
diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp index 6e71d703bc..a6a03d9acb 100644 --- a/plugins/Nudge/src/shake.cpp +++ b/plugins/Nudge/src/shake.cpp @@ -40,7 +40,7 @@ INT_PTR ShakeChat(WPARAM wParam, LPARAM) if (((HANDLE)wParam) == NULL) return -1;
MessageWindowData mwd;
- CallService(MS_MSG_GETWINDOWDATA, db_mc_tryMeta(wParam), (LPARAM)&mwd);
+ Srmm_GetWindowData(db_mc_tryMeta(wParam), mwd);
HWND parent;
HWND hWnd = mwd.hwndWindow;
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 82ec8e9851..3afb775d89 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1335,19 +1335,6 @@ INT_PTR CSrmmWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) SendMessage(m_hwnd, DM_REMAKELOG, 0, 0);
break;
- case DM_GETWINDOWSTATE:
- {
- UINT state = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(m_hwnd))
- state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == m_hwndParent)
- state |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(m_hwndParent))
- state |= MSG_WINDOW_STATE_ICONIC;
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, state);
- }
- return TRUE;
-
case DM_ACTIVATE:
case WM_ACTIVATE:
if (LOWORD(wParam) != WA_ACTIVE)
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 7f15fcaff5..2be9a2c810 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -283,22 +283,6 @@ static void RestoreUnreadMessageAlerts(void) }
}
-static INT_PTR GetWindowData(WPARAM hContact, LPARAM lParam)
-{
- if (hContact == 0)
- return 1;
-
- MessageWindowData *mwd = (MessageWindowData*)lParam;
- if (mwd == nullptr)
- return 1;
-
- HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
- mwd->hwndWindow = hwnd;
- mwd->local = 0;
- mwd->uState = SendMessage(hwnd, DM_GETWINDOWSTATE, 0, 0);
- return 0;
-}
-
static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
{
StatusTextData *st = (StatusTextData*)lParam;
@@ -679,7 +663,6 @@ int OnLoadModule(void) CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommandW);
- CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText);
CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
CreateServiceFunction("SRMsg/TypingMessage", TypingMessageCommand);
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index 935fdaa1dc..6782a5bee5 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -263,7 +263,6 @@ public: #define DM_SWITCHRTL (WM_USER+51)
#define DM_SWITCHTYPING (WM_USER+53)
#define DM_MESSAGESENDING (WM_USER+54)
-#define DM_GETWINDOWSTATE (WM_USER+55)
#define DM_STATUSICONCHANGE (WM_USER+56)
#define DM_MYAVATARCHANGED (WM_USER+62)
diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 7e0d69efaf..5c4b8a3294 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -396,7 +396,7 @@ INT_PTR CloseCurrentSession(WPARAM, LPARAM) {
while (session_list[0] != 0) {
MessageWindowData mwd;
- CallService(MS_MSG_GETWINDOWDATA, session_list[0], (LPARAM)&mwd);
+ Srmm_GetWindowData(session_list[0], mwd);
SendMessage(mwd.hwndWindow, WM_CLOSE, 0, 0);
}
memset(session_list, 0, sizeof(session_list));
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index edc495cc93..d6ccb076ab 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -60,33 +60,6 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM) }
/////////////////////////////////////////////////////////////////////////////////////////
-// wparam = (MessageWindowInputData*)
-// lparam = (MessageWindowData*)
-// returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
-
-static INT_PTR GetWindowData(WPARAM hContact, LPARAM lParam)
-{
- if (hContact == 0)
- return 1;
-
- MessageWindowData *mwd = (MessageWindowData*)lParam;
- if (mwd == nullptr)
- return 1;
-
- HWND hwnd = M.FindWindow(hContact);
- if (hwnd) {
- mwd->hwndWindow = hwnd;
- mwd->local = GetParent(GetParent(hwnd));
- SendMessage(hwnd, DM_GETWINDOWSTATE, 0, 0);
- mwd->uState = GetWindowLongPtr(hwnd, DWLP_MSGRESULT);
- return 0;
- }
-
- memset(mwd, 0, sizeof(*mwd));
- return 1;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
// basic window class
CTabBaseDlg::CTabBaseDlg(int iResource, SESSION_INFO *si)
@@ -270,19 +243,6 @@ INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) }
return 0;
- case DM_GETWINDOWSTATE:
- {
- UINT state = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(m_hwnd))
- state |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == m_pContainer->m_hwnd)
- state |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(m_pContainer->m_hwnd))
- state |= MSG_WINDOW_STATE_ICONIC;
- SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, state);
- }
- return true;
-
case DM_SPLITTERGLOBALEVENT:
DM_SplitterGlobalEvent(wParam, lParam);
return 0;
@@ -1078,7 +1038,6 @@ static void TSAPI InitAPI() {
CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
- CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText);
CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5ab3b1e144..434f785275 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -727,7 +727,6 @@ struct TIconDescW #define DM_HANDLECLISTEVENT (TM_USER+73)
#define DM_TRAYICONNOTIFY (TM_USER+74)
#define DM_REMOVECLISTEVENT (TM_USER+75)
-#define DM_GETWINDOWSTATE (TM_USER+76)
#define DM_DOCREATETAB (TM_USER+77)
#define DM_SMILEYOPTIONSCHANGED (TM_USER+85)
#define DM_MYAVATARCHANGED (TM_USER+86)
diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index 92dc6074e0..8847ea96f0 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -409,14 +409,14 @@ end; function WndToContact(wnd:HWND):TMCONTACT;
var
hContact:TMCONTACT;
- mwod:TMessageWindowOutputData;
+ mwod:TMessageWindowData;
begin
- wnd:=GetParent(wnd); //!!
+ wnd:=GetParent(wnd);
hContact:=db_find_first();
while hContact<>0 do
begin
- if CallService(MS_MSG_GETWINDOWDATA,hContact,lparam(@mwod))=0 then
+ if Srmm_GetWindowData(hContact,@mwod)=0 then
begin
if mwod.hwndWindow=wnd then
begin
diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.cpp b/plugins/WinterSpeak/src/SpeakAnnounce.cpp index 0609548b59..ef9c85a2ec 100644 --- a/plugins/WinterSpeak/src/SpeakAnnounce.cpp +++ b/plugins/WinterSpeak/src/SpeakAnnounce.cpp @@ -148,7 +148,7 @@ bool SpeakAnnounce::readMessage(MCONTACT contact) if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen) || m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused)) {
// Do not notify if window is already opened
MessageWindowData mwd;
- if (CallService(MS_MSG_GETWINDOWDATA, contact, (LPARAM)&mwd) == 0) {
+ if (Srmm_GetWindowData(contact, (LPARAM)&mwd) == 0) {
if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen))
return ((mwd.uState & MSG_WINDOW_STATE_EXISTS) == 0);
else if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused))
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 680662c28f..c61f47c32a 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -1308,13 +1308,13 @@ bool CMsnProto::MSN_IsMeByContact(MCONTACT hContact, char* szEmail) bool MSN_MsgWndExist(MCONTACT hContact)
{
- MessageWindowData msgWinData = {};
- bool res = CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&msgWinData) != 0;
+ MessageWindowData msgWinData;
+ bool res = Srmm_GetWindowData(hContact, msgWinData) != 0;
res = res || msgWinData.hwndWindow;
if (res) {
hContact = db_mc_getMeta(hContact);
if (hContact != 0) {
- res = CallService(MS_MSG_GETWINDOWDATA, hContact, (LPARAM)&msgWinData) != 0;
+ res = Srmm_GetWindowData(hContact, msgWinData) != 0;
res |= (msgWinData.hwndWindow == NULL);
}
}
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index d0f70ba10d..03ef642e93 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -495,28 +495,6 @@ static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) return 0;
}
-static INT_PTR GetWindowData(WPARAM hContact, LPARAM lParam)
-{
- if (hContact == 0)
- return 1;
-
- MessageWindowData *mwd = (MessageWindowData*)lParam;
- if(mwd == NULL)
- return 1;
-
- HWND hwnd = WindowList_Find(pci->hWindowList, hContact);
- mwd->hwndWindow = hwnd;
- mwd->local = 0;
- mwd->uState = MSG_WINDOW_STATE_EXISTS;
- if (IsWindowVisible(hwnd))
- mwd->uState |= MSG_WINDOW_STATE_VISIBLE;
- if (GetForegroundWindow() == hwnd)
- mwd->uState |= MSG_WINDOW_STATE_FOCUS;
- if (IsIconic(hwnd))
- mwd->uState |= MSG_WINDOW_STATE_ICONIC;
- return 0;
-}
-
static wchar_t tszError[] = LPGENW("Miranda could not load the built-in message module, msftedit.dll is missing. Press 'Yes' to continue loading Miranda.");
int LoadSendRecvMessageModule(void)
@@ -541,7 +519,6 @@ int LoadSendRecvMessageModule(void) CreateServiceFunction(MS_MSG_SENDMESSAGE, SendMessageCommand);
CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W);
- CreateServiceFunction(MS_MSG_GETWINDOWDATA, GetWindowData);
CreateServiceFunction(MS_MSG_SETSTATUSTEXT, SetStatusText);
CreateServiceFunction("SRMsg/ReadMessage", ReadMessageCommand);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 8b65c2bcb6..67645af6f5 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -445,3 +445,4 @@ _stubMessageProc@16 @447 NONAME _stubNicklistProc@16 @448 NONAME
Chat_GetTextPixelSize @449 NONAME
?NotifyEvent@CSrmmBaseDialog@@IAEHH@Z @450 NONAME
+Srmm_GetWindowData @451
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 856beb7707..563b920ab4 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -445,3 +445,4 @@ stubMessageProc @447 NONAME stubNicklistProc @448 NONAME
Chat_GetTextPixelSize @449 NONAME
?NotifyEvent@CSrmmBaseDialog@@IEAAHH@Z @450 NONAME
+Srmm_GetWindowData @451
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index 78ed59e436..2bd064d1ad 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -72,3 +72,25 @@ MIR_APP_DLL(DWORD) CALLBACK Srmm_MessageStreamCallback(DWORD_PTR dwCookie, LPBYT } return 0; } + +MIR_APP_DLL(int) Srmm_GetWindowData(WPARAM hContact, MessageWindowData &mwd) +{ + if (hContact == 0) + return 1; + + HWND hwnd = WindowList_Find(chatApi.hWindowList, hContact); + if (hwnd == nullptr) + return 1; + + mwd.hwndWindow = hwnd; + mwd.pDlg = (CSrmmBaseDialog*)GetWindowLongPtr(hwnd, GWLP_USERDATA); + mwd.uState = MSG_WINDOW_STATE_EXISTS; + if (IsWindowVisible(hwnd)) + mwd.uState |= MSG_WINDOW_STATE_VISIBLE; + if (GetForegroundWindow() == hwnd) + mwd.uState |= MSG_WINDOW_STATE_FOCUS; + if (IsIconic(hwnd)) + mwd.uState |= MSG_WINDOW_STATE_ICONIC; + return 0; +} + |