summaryrefslogtreecommitdiff
path: root/protocols/Tox/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-18 20:51:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-18 20:51:18 +0300
commit9cf1444eb7888f2d942d220f938aa893396a8a1b (patch)
treeea87e4cb78e9c26a651af00b2d423324ce4a85a6 /protocols/Tox/src
parent3936ebbc665c9653d9f62527c1e136944d52e2ca (diff)
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r--protocols/Tox/src/main.cpp18
-rw-r--r--protocols/Tox/src/stdafx.h1
-rw-r--r--protocols/Tox/src/tox_contacts.cpp2
-rw-r--r--protocols/Tox/src/tox_icons.cpp2
-rw-r--r--protocols/Tox/src/tox_options.cpp2
-rw-r--r--protocols/Tox/src/tox_search.cpp2
6 files changed, 17 insertions, 10 deletions
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp
index ec6ae99f82..1b4c10f526 100644
--- a/protocols/Tox/src/main.cpp
+++ b/protocols/Tox/src/main.cpp
@@ -1,10 +1,8 @@
#include "stdafx.h"
int hLangpack;
-CMPlugin g_plugin;
CHAT_MANAGER *pci;
CLIST_INTERFACE *pcli;
-HINSTANCE g_hInstance;
HANDLE hProfileFolderPath;
PLUGININFOEX pluginInfo =
@@ -21,15 +19,23 @@ PLUGININFOEX pluginInfo =
{0x272a3e, 0xf5fa, 0x4090, {0x8b, 0x67, 0x3e, 0x62, 0xac, 0x1e, 0xe0, 0xb4}}
};
-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 OnModulesLoaded(WPARAM, LPARAM)
{
CToxProto::InitIcons();
@@ -38,7 +44,7 @@ int OnModulesLoaded(WPARAM, LPARAM)
if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
CreateServiceFunction(MODULE "/ParseUri", CToxProto::ParseToxUri);
- AssocMgr_AddNewUrlTypeW("tox:", TranslateT("Tox link protocol"), g_hInstance, IDI_TOX, MODULE "/ParseUri", 0);
+ AssocMgr_AddNewUrlTypeW("tox:", TranslateT("Tox link protocol"), g_plugin.getInst(), IDI_TOX, MODULE "/ParseUri", 0);
}
return 0;
@@ -55,6 +61,8 @@ extern "C" int __declspec(dllexport) Load(void)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
extern "C" int __declspec(dllexport) Unload(void)
{
return 0;
diff --git a/protocols/Tox/src/stdafx.h b/protocols/Tox/src/stdafx.h
index c59439eae6..be29bd7edb 100644
--- a/protocols/Tox/src/stdafx.h
+++ b/protocols/Tox/src/stdafx.h
@@ -90,7 +90,6 @@ struct CToxProto;
#include "http_request.h"
-extern HINSTANCE g_hInstance;
extern HANDLE hProfileFolderPath;
#endif //_COMMON_H_ \ No newline at end of file
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 4920e71e44..6c93559463 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -353,7 +353,7 @@ int CToxProto::OnUserInfoInit(WPARAM wParam, LPARAM lParam)
if (szProto != nullptr && !mir_strcmp(szProto, m_szModuleName)) {
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.flags = ODPF_UNICODE | ODPF_DONTTRANSLATE;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.dwInitParam = (LPARAM)this;
odp.szTitle.w = m_tszUserName;
diff --git a/protocols/Tox/src/tox_icons.cpp b/protocols/Tox/src/tox_icons.cpp
index a94405982e..762266799f 100644
--- a/protocols/Tox/src/tox_icons.cpp
+++ b/protocols/Tox/src/tox_icons.cpp
@@ -9,7 +9,7 @@ IconItemT CToxProto::Icons[] =
void CToxProto::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);
}
HANDLE CToxProto::GetIconHandle(int iconId)
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index dfaa9d528d..952bf194f9 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -247,7 +247,7 @@ void CToxOptionsMain::OnApply()
/////////////////////////////////////////////////////////////////////////////////
CToxNodeEditor::CToxNodeEditor(int iItem, CCtrlListView *m_nodes)
- : CSuper(g_hInstance, IDD_NODE_EDITOR),
+ : CSuper(g_plugin.getInst(), IDD_NODE_EDITOR),
m_ipv4(this, IDC_IPV4), m_ipv6(this, IDC_IPV6),
m_port(this, IDC_PORT), m_pkey(this, IDC_PKEY),
m_ok(this, IDOK), m_iItem(iItem)
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp
index 840436b149..ebbddf2ad8 100644
--- a/protocols/Tox/src/tox_search.cpp
+++ b/protocols/Tox/src/tox_search.cpp
@@ -112,5 +112,5 @@ HWND CToxProto::OnSearchAdvanced(HWND owner)
HWND CToxProto::OnCreateExtendedSearchUI(HWND owner)
{
- return CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_SEARCH), owner, SearchDlgProc, (LPARAM)this);
+ return CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SEARCH), owner, SearchDlgProc, (LPARAM)this);
}