diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-18 20:51:18 +0300 |
commit | 9cf1444eb7888f2d942d220f938aa893396a8a1b (patch) | |
tree | ea87e4cb78e9c26a651af00b2d423324ce4a85a6 /protocols/VKontakte | |
parent | 3936ebbc665c9653d9f62527c1e136944d52e2ca (diff) |
g_hInstance incapulated into PLUGIN<>, no need in the separate variable
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/main.cpp | 14 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/stdafx.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk.h | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 9 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 4 |
6 files changed, 11 insertions, 22 deletions
diff --git a/protocols/VKontakte/src/main.cpp b/protocols/VKontakte/src/main.cpp index 01a6dfb66d..d87612bf7b 100644 --- a/protocols/VKontakte/src/main.cpp +++ b/protocols/VKontakte/src/main.cpp @@ -18,8 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
#include "version.h"
-CMPlugin g_plugin;
-HINSTANCE g_hInstance;
int hLangpack;
CLIST_INTERFACE *pcli;
@@ -37,15 +35,19 @@ PLUGININFOEX pluginInfo = { 0x32579908, 0x724b, 0x467f, {0xad, 0xad, 0x22, 0xb6, 0x35, 0x9a, 0x74, 0x9a}}
};
-/////////////////////////////////////////////////////////////////////////////////////////
-
-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 };
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 1b18bc382b..78408b5e3e 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -79,7 +79,7 @@ static IconItem iconList[] = void InitIcons()
{
- Icon_Register(g_hInstance, LPGEN("Protocols") "/" LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
+ Icon_Register(g_plugin.getInst(), LPGEN("Protocols") "/" LPGEN("VKontakte"), iconList, _countof(iconList), "VKontakte");
}
HANDLE GetIconHandle(int iCommand)
diff --git a/protocols/VKontakte/src/stdafx.h b/protocols/VKontakte/src/stdafx.h index e60368369e..5695d1bbf1 100644 --- a/protocols/VKontakte/src/stdafx.h +++ b/protocols/VKontakte/src/stdafx.h @@ -57,8 +57,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "win2k.h"
-extern HINSTANCE g_hInstance;
-
#include "resource.h"
#include "vk.h"
#include "vk_struct.h"
diff --git a/protocols/VKontakte/src/vk.h b/protocols/VKontakte/src/vk.h index b40f8980ba..e894a6304e 100644 --- a/protocols/VKontakte/src/vk.h +++ b/protocols/VKontakte/src/vk.h @@ -101,9 +101,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #endif
struct CVkProto;
-extern LIST<CVkProto> vk_Instances;
extern mir_cs csInstances;
-extern HINSTANCE g_hInstance;
LPCSTR findHeader(NETLIBHTTPREQUEST *hdr, LPCSTR szField);
bool wlstrstr(wchar_t *_s1, wchar_t *_s2);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 0253c96d6d..cdb207555a 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -29,7 +29,6 @@ static int sttCompareAsyncHttpRequest(const AsyncHttpRequest *p1, const AsyncHtt return (int)p2->m_priority - (int)p1->m_priority;
}
-LIST<CVkProto> vk_Instances(1, sttCompareProtocols);
mir_cs csInstances;
CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) :
@@ -78,10 +77,6 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) : // Set all contacts offline -- in case we crashed
SetAllContactStatuses(ID_STATUS_OFFLINE);
- {
- mir_cslock lck(csInstances);
- vk_Instances.insert(this);
- }
}
CVkProto::~CVkProto()
@@ -95,10 +90,6 @@ CVkProto::~CVkProto() Popup_UnregisterClass(m_hPopupClassError);
if (m_hPopupClassNotification)
Popup_UnregisterClass(m_hPopupClassNotification);
- {
- mir_cslock lck(csInstances);
- vk_Instances.remove(this);
- }
}
int CVkProto::OnModulesLoaded(WPARAM, LPARAM)
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index dc434c5606..1986b3a240 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -52,7 +52,7 @@ void CVkProto::ConnectionFailed(int iReason) static VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD)
{
mir_cslock lck(csInstances);
- for (auto &it : vk_Instances)
+ for (auto &it : g_plugin.g_arInstances)
if (it->IsOnline()) {
it->debugLogA("Tic timer for %s", it->m_szModuleName);
it->OnTimerTic();
@@ -124,7 +124,7 @@ void CVkProto::OnLoggedOut() bool bOnline = false;
{
mir_cslock lck(csInstances);
- for (auto &it : vk_Instances)
+ for (auto &it : g_plugin.g_arInstances)
bOnline = bOnline || it->IsOnline();
}
if (!bOnline)
|