From f580be3d9dcccb14831d6bed9e7dfca600f5b6f8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Mar 2019 16:15:45 +0300 Subject: popups: - internal implementation details & all service declarations moved to m_popup_int.h; - all service calls removed and replaced with function calls; - direct access to popup serttings replaced with Popup_Enable / Popup_Enabled; --- protocols/CloudFile/src/utils.cpp | 2 +- protocols/ConnectionNotify/src/ConnectionNotify.cpp | 2 +- protocols/FacebookRM/src/events.cpp | 6 +++--- protocols/Gadu-Gadu/src/popups.cpp | 6 +++--- protocols/JabberG/src/jabber_misc.cpp | 8 ++++---- protocols/MSN/src/msn_misc.cpp | 6 +++--- protocols/Sametime/src/utils.cpp | 6 +++--- protocols/SkypeWeb/src/skype_popups.cpp | 6 +++--- protocols/Steam/src/steam_utils.cpp | 2 +- protocols/Tox/src/tox_utils.cpp | 2 +- protocols/VKontakte/src/vk_proto.cpp | 6 +++--- protocols/YAMN/src/browser/badconnect.cpp | 5 ++--- protocols/YAMN/src/browser/mailbrowser.cpp | 4 ++-- 13 files changed, 30 insertions(+), 31 deletions(-) (limited to 'protocols') diff --git a/protocols/CloudFile/src/utils.cpp b/protocols/CloudFile/src/utils.cpp index b386afe597..3e02092e9a 100644 --- a/protocols/CloudFile/src/utils.cpp +++ b/protocols/CloudFile/src/utils.cpp @@ -5,7 +5,7 @@ void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, if (Miranda_IsTerminated()) return; - if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { + if (Popup_Enabled()) { POPUPDATAW ppd = { 0 }; ppd.lchContact = hContact; wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME); diff --git a/protocols/ConnectionNotify/src/ConnectionNotify.cpp b/protocols/ConnectionNotify/src/ConnectionNotify.cpp index 01f00983ca..9a2a3d5122 100644 --- a/protocols/ConnectionNotify/src/ConnectionNotify.cpp +++ b/protocols/ConnectionNotify/src/ConnectionNotify.cpp @@ -737,7 +737,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case UM_INITPOPUP: //struct CONNECTON *conn=NULL; - //conn = (struct CONNECTION*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)conn); + //conn = (struct CONNECTION*)PUGetPluginData(hWnd,(LPARAM)conn); //MessageBox(NULL,conn->extIp); //PUDeletePopUp(hWnd); break; diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index fdcc2029af..d04cbb38ad 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -69,8 +69,8 @@ HWND FacebookProto::NotifyEvent(const wchar_t* title, const wchar_t* text, MCONT if (!getByte(FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY)) { POPUPDATACLASS pd = { sizeof(pd) }; - pd.pwszTitle = title; - pd.pwszText = text; + pd.szTitle.w = title; + pd.szText.w = text; pd.pszClassName = name; pd.hContact = contact; @@ -82,7 +82,7 @@ HWND FacebookProto::NotifyEvent(const wchar_t* title, const wchar_t* text, MCONT data->notification_id = *notification_id; pd.PluginData = data; } - return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&pd); + return Popup_AddClass(&pd); } else { if (!Clist_TrayNotifyW(m_szModuleName, title, text, type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO, 10000)) diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index 962c570002..8fcf1a00ff 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -110,8 +110,8 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) char szName[256]; POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.pwszTitle = puData->title; - ppd.pwszText = puData->text; + ppd.szTitle.w = puData->title; + ppd.szText.w = puData->text; ppd.PluginData = puData; ppd.pszClassName = szName; @@ -119,7 +119,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Error"); else mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Notify"); - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + Popup_AddClass(&ppd); } void GaduProto::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags) diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index beb3ad7389..3417f7195b 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -426,14 +426,14 @@ void CJabberProto::InitPopups(void) void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle) { char name[256]; + mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.pwszTitle = szTitle; - ppd.pwszText = szMsg; + ppd.szTitle.w = szTitle; + ppd.szText.w = szMsg; ppd.pszClassName = name; ppd.hContact = hContact; - mir_snprintf(name, "%s_%s", m_szModuleName, "Error"); - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + Popup_AddClass(&ppd); } CMStringA CJabberProto::ExtractImage(const TiXmlElement *node) diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 51c75757c1..8d62b4984d 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -849,8 +849,8 @@ void CALLBACK sttMainThreadCallback(void *param) char name[256]; POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.pwszTitle = pud->title; - ppd.pwszText = pud->text; + ppd.szTitle.w = pud->title; + ppd.szText.w = pud->text; ppd.PluginData = pud; ppd.pszClassName = name; @@ -861,7 +861,7 @@ void CALLBACK sttMainThreadCallback(void *param) else mir_snprintf(name, "%s_%s", pud->proto->m_szModuleName, "Notify"); - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + Popup_AddClass(&ppd); } void CMsnProto::MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int flags, const char* url) diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index b83b46ea68..368a9cc093 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -79,14 +79,14 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) if (disp == ED_POP) { POPUPDATACLASS ppd = { sizeof(ppd) }; char szName[256]; - ppd.pwszTitle = puData->title; - ppd.pwszText = puData->text; + ppd.szTitle.w = puData->title; + ppd.szText.w = puData->text; if (puData->flag == SAMETIME_POPUP_ERROR) mir_snprintf(szName, "%s_%s", proto->m_szModuleName, "Error"); else mir_snprintf(szName, "%s_%s", proto->m_szModuleName, "Notify"); ppd.pszClassName = szName; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + Popup_AddClass(&ppd); } else if (disp == ED_BAL) { int flags, timeout; diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index ba00d60709..f279a936b5 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -64,11 +64,11 @@ void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *messag } POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.pwszTitle = caption; - ppd.pwszText = message; + ppd.szTitle.w = caption; + ppd.szText.w = message; ppd.pszClassName = className.GetBuffer(); ppd.hContact = hContact; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + Popup_AddClass(&ppd); } void CSkypeProto::ShowNotification(const wchar_t *message, MCONTACT hContact) diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 901fc4089d..ea3c6d20ed 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -51,7 +51,7 @@ void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *messag if (Miranda_IsTerminated()) return; - if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { + if (Popup_Enabled()) { POPUPDATAW ppd = { 0 }; ppd.lchContact = hContact; wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME); diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 421f16e09e..e2839a8a55 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -104,7 +104,7 @@ void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message, return; } - if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { + if (Popup_Enabled()) { POPUPDATAW ppd = { 0 }; ppd.lchContact = hContact; wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME); diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index ffe457b3ad..10e1a2693f 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -436,13 +436,13 @@ void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *wszMsg, const wchar_t char name[256]; POPUPDATACLASS ppd = { sizeof(ppd) }; - ppd.pwszTitle = wszTitle; - ppd.pwszText = wszMsg; + ppd.szTitle.w = wszTitle; + ppd.szText.w = wszMsg; ppd.pszClassName = name; ppd.hContact = hContact; ppd.PluginData = new CVkSendMsgParam(hContact); mir_snprintf(name, "%s_%s", m_szModuleName, err ? "Error" : "Notification"); - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); + Popup_AddClass(&ppd); } void CVkProto::MsgPopup(const wchar_t *wszMsg, const wchar_t *wszTitle, bool err) diff --git a/protocols/YAMN/src/browser/badconnect.cpp b/protocols/YAMN/src/browser/badconnect.cpp index aacae630d7..29b1fd285c 100644 --- a/protocols/YAMN/src/browser/badconnect.cpp +++ b/protocols/YAMN/src/browser/badconnect.cpp @@ -13,16 +13,15 @@ LRESULT CALLBACK BadConnectPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - DWORD PluginParam; switch (msg) { case WM_COMMAND: // if clicked and it's new mail popup window - if ((HIWORD(wParam) == STN_CLICKED) && (CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&PluginParam))) { + if ((HIWORD(wParam) == STN_CLICKED) && (PUGetPluginData(hWnd))) { PROCESS_INFORMATION pi; STARTUPINFOW si; memset(&si, 0, sizeof(si)); si.cb = sizeof(si); - HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0); + HACCOUNT ActualAccount = (HACCOUNT)PUGetPluginData(hWnd); #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read wait\n"); #endif diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp index bbac178d15..d9c3af6f6c 100644 --- a/protocols/YAMN/src/browser/mailbrowser.cpp +++ b/protocols/YAMN/src/browser/mailbrowser.cpp @@ -790,8 +790,8 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa INT_PTR PluginParam = 0; switch (msg) { case WM_COMMAND: - //if clicked and it's new mail popup window - if ((HIWORD(wParam) == STN_CLICKED) && (-1 != (PluginParam = CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&PluginParam)))) { + // if clicked and it's new mail popup window + if ((HIWORD(wParam) == STN_CLICKED) && (-1 != (PluginParam = (INT_PTR)PUGetPluginData(hWnd)))) { MCONTACT hContact = 0; HACCOUNT Account; if (PluginParam) { -- cgit v1.2.3