From 2be5844edd93ab3490b4689cad33d75b4c77f3a8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 28 Mar 2017 15:38:49 +0300 Subject: and finally MS_MSG_GETWINDOWDATA has gone, zihrono levraha --- plugins/CountryFlags/src/extraimg.cpp | 2 +- plugins/Dropbox/src/dropbox_events.cpp | 2 +- plugins/Dropbox/src/dropbox_options.cpp | 2 +- plugins/Dropbox/src/dropbox_utils.cpp | 2 +- plugins/KeyboardNotify/src/main.cpp | 2 +- plugins/MirFox/src/MirandaUtils.cpp | 2 +- plugins/MirLua/src/m_message.cpp | 2 +- plugins/MirandaG15/src/CAppletManager.cpp | 2 +- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 2 +- plugins/NewEventNotify/src/main.cpp | 13 +++------ plugins/NewXstatusNotify/src/utils.cpp | 2 +- plugins/Nudge/src/shake.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 13 --------- plugins/Scriver/src/msgs.cpp | 17 ------------ plugins/Scriver/src/msgs.h | 1 - plugins/Sessions/Src/Main.cpp | 2 +- plugins/TabSRMM/src/msgs.cpp | 41 ----------------------------- plugins/TabSRMM/src/msgs.h | 1 - plugins/Utils.pas/mircontacts.pas | 6 ++--- plugins/WinterSpeak/src/SpeakAnnounce.cpp | 2 +- 20 files changed, 20 insertions(+), 98 deletions(-) (limited to 'plugins') 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 @@ -59,33 +59,6 @@ int SmileyAddOptionsChanged(WPARAM, LPARAM) return 0; } -///////////////////////////////////////////////////////////////////////////////////////// -// 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 @@ -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)) -- cgit v1.2.3