summaryrefslogtreecommitdiff
path: root/protocols/EmLanProto/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/EmLanProto/src
parent3936ebbc665c9653d9f62527c1e136944d52e2ca (diff)
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'protocols/EmLanProto/src')
-rw-r--r--protocols/EmLanProto/src/amdproto.cpp47
-rw-r--r--protocols/EmLanProto/src/stdafx.h16
2 files changed, 27 insertions, 36 deletions
diff --git a/protocols/EmLanProto/src/amdproto.cpp b/protocols/EmLanProto/src/amdproto.cpp
index 9efd5a1ac3..4e5db0990e 100644
--- a/protocols/EmLanProto/src/amdproto.cpp
+++ b/protocols/EmLanProto/src/amdproto.cpp
@@ -3,6 +3,21 @@
#include "stdafx.h"
+CMPlugin g_plugin;
+
+extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
+
+//////////////////////////////////////////////////////////////////////////
+
+CMLan* g_lan = nullptr;
+
+int hLangpack;
+bool g_InitOptions = false;
+
+#ifdef VERBOSE
+std::fstream emlanLog("EmLanLog.txt", std::ios::out|std::ios::app);
+#endif
+
//////////////////////////////////////////////////////////////////////////
PLUGININFOEX pluginInfo = {
@@ -18,22 +33,12 @@ PLUGININFOEX pluginInfo = {
{ 0xe08ce7c4, 0x9eeb, 0x4272, { 0xb5, 0x44, 0xd, 0x32, 0xe1, 0x8d, 0x90, 0xde } }
};
-HINSTANCE g_hInstance = nullptr;
-CMLan* g_lan = nullptr;
-
-int hLangpack;
-bool g_InitOptions = false;
-
-#ifdef VERBOSE
-std::fstream emlanLog("EmLanLog.txt", std::ios::out|std::ios::app);
-#endif
-
extern "C" __declspec(dllexport) PLUGININFOEX* __cdecl MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
-//////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
@@ -42,7 +47,6 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOC
BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID)
{
- g_hInstance = hInstDLL;
if (reason == DLL_PROCESS_ATTACH) {
EMLOG("EmLan Started");
DisableThreadLibraryCalls(hInstDLL);
@@ -84,7 +88,7 @@ static INT_PTR __cdecl EMPLoadIcon(WPARAM wParam, LPARAM)
if ((wParam & 0xFFFF) != PLI_PROTOCOL)
return 0;
- return (INT_PTR)LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_ICON_ONLINE));
+ return (INT_PTR)LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_ICON_ONLINE));
}
static INT_PTR __cdecl EMPGetStatus(WPARAM, LPARAM)
@@ -272,7 +276,7 @@ int __cdecl EMPCreateOptionsDlg(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { 0 };
odp.position = 100000000;
- odp.hInstance = g_hInstance;
+ odp.hInstance = g_plugin.getInst();
odp.pszTemplate = MAKEINTRESOURCEA(IDD_EMP_FORM_OPT);
odp.szTitle.a = LPGEN("E-mage LAN protocol");
odp.szGroup.a = LPGEN("Network");
@@ -359,18 +363,3 @@ extern "C" int __declspec(dllexport) __cdecl Unload()
delete g_lan;
return 0;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-struct CMPlugin : public PLUGIN<CMPlugin>
-{
- CMPlugin() :
- PLUGIN<CMPlugin>(PROTONAME)
- {
- RegisterProtocol(PROTOTYPE_PROTOCOL);
- SetUniqueId("Nick");
- }
-}
- g_plugin;
-
-extern "C" _pfnCrtInit _pRawDllMain = &CMPlugin::RawDllMain;
diff --git a/protocols/EmLanProto/src/stdafx.h b/protocols/EmLanProto/src/stdafx.h
index d80030c4b1..f3156dd280 100644
--- a/protocols/EmLanProto/src/stdafx.h
+++ b/protocols/EmLanProto/src/stdafx.h
@@ -26,13 +26,15 @@
#define PROTONAME "EM_LAN_PROTO"
-//#define ME_ICQ_STATUSMSGREQ "ICQ/StatusMsgReq"
-//
-//#define ICQ_MSGTYPE_GETAWAYMSG 0xE8
-//#define ICQ_MSGTYPE_GETOCCUMSG 0xE9
-//#define ICQ_MSGTYPE_GETNAMSG 0xEA
-//#define ICQ_MSGTYPE_GETDNDMSG 0xEB
-//#define ICQ_MSGTYPE_GETFFCMSG 0xEC
+struct CMPlugin : public PLUGIN<CMPlugin>
+{
+ CMPlugin() :
+ PLUGIN<CMPlugin>(PROTONAME)
+ {
+ RegisterProtocol(PROTOTYPE_PROTOCOL);
+ SetUniqueId("Nick");
+ }
+};
//#define VERBOSE