From 9cf1444eb7888f2d942d220f938aa893396a8a1b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 18 Apr 2018 20:51:18 +0300 Subject: g_hInstance incapulated into PLUGIN<>, no need in the separate variable --- protocols/SkypeWeb/src/main.cpp | 38 ++++++++++++++++++-------------- protocols/SkypeWeb/src/skype_icons.cpp | 2 +- protocols/SkypeWeb/src/skype_options.cpp | 2 +- protocols/SkypeWeb/src/stdafx.h | 1 - 4 files changed, 23 insertions(+), 20 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index bc5ebf60f3..1b358e0651 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -17,9 +17,7 @@ along with this program. If not, see . #include "stdafx.h" -CMPlugin g_plugin; int hLangpack; -HINSTANCE g_hInstance; CLIST_INTERFACE *pcli; char g_szMirVer[100]; HANDLE g_hCallEvent; @@ -39,15 +37,32 @@ PLUGININFOEX pluginInfo = { 0x57e90ac6, 0x1067, 0x423b, { 0x8c, 0xa3, 0x70, 0xa3, 0x9d, 0x20, 0xd, 0x4f } } }; -extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; - extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } +///////////////////////////////////////////////////////////////////////////////////////// + +CMPlugin g_plugin; + +extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain; + +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST }; +///////////////////////////////////////////////////////////////////////////////////////// + +int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) +{ + if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) { + CreateServiceFunction(MODULE "/ParseUri", CSkypeProto::GlobalParseSkypeUriService); + AssocMgr_AddNewUrlTypeW("skype:", TranslateT("Skype Link Protocol"), g_plugin.getInst(), IDI_SKYPE, MODULE "/ParseUri", 0); + } + return 0; +} + extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); @@ -69,21 +84,10 @@ extern "C" int __declspec(dllexport) Load(void) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + extern "C" int __declspec(dllexport) Unload(void) { - DestroyHookableEvent(g_hCallEvent); - - return 0; -} - - -int CSkypeProto::OnModulesLoaded(WPARAM, LPARAM) -{ - if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) - { - CreateServiceFunction(MODULE "/ParseUri", CSkypeProto::GlobalParseSkypeUriService); - AssocMgr_AddNewUrlTypeW("skype:", TranslateT("Skype Link Protocol"), g_hInstance, IDI_SKYPE, MODULE "/ParseUri", 0); - } return 0; } diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp index 412d0c0043..7aba64a40a 100644 --- a/protocols/SkypeWeb/src/skype_icons.cpp +++ b/protocols/SkypeWeb/src/skype_icons.cpp @@ -32,7 +32,7 @@ IconItemT CSkypeProto::Icons[] = void CSkypeProto::InitIcons() { - Icon_RegisterT(g_hInstance, LPGENW("Protocols") L"/" _A2W(MODULE), Icons, _countof(Icons), MODULE); + Icon_RegisterT(g_plugin.getInst(), LPGENW("Protocols") L"/" _A2W(MODULE), Icons, _countof(Icons), MODULE); } HICON CSkypeProto::GetIcon(int iconId) diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp index a8941a18ee..2bac189297 100644 --- a/protocols/SkypeWeb/src/skype_options.cpp +++ b/protocols/SkypeWeb/src/skype_options.cpp @@ -71,7 +71,7 @@ void CSkypeOptionsMain::OnApply() int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; - odp.hInstance = g_hInstance; + odp.hInstance = g_plugin.getInst(); odp.szTitle.w = m_tszUserName; odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE; odp.szGroup.w = LPGENW("Network"); diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 2cb4883414..0be6ba5730 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -58,7 +58,6 @@ along with this program. If not, see . struct CSkypeProto; -extern HINSTANCE g_hInstance; extern char g_szMirVer[]; extern HANDLE g_hCallEvent; -- cgit v1.2.3