diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-25 00:27:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-25 00:27:33 +0000 |
commit | 402c282619b316fc77d71546ea40f026e0506bbb (patch) | |
tree | 5c9e5c2120fdd5f62f9826f77d967b5f5ac6de0f /protocols/MRA/src/Mra.cpp | |
parent | 05b2e149be5b49508d99f39bf9d53c6f9a170dc4 (diff) |
MRA:
- all menu related code moved to Mra_menus.cpp;
- mra-specific menu items moved to the Services... submenu;
git-svn-id: http://svn.miranda-ng.org/main/trunk@6616 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Mra.cpp')
-rw-r--r-- | protocols/MRA/src/Mra.cpp | 59 |
1 files changed, 20 insertions, 39 deletions
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index ca07b67f0a..73328b2a45 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -2,7 +2,6 @@ LIST<CMraProto> g_Instances(1, PtrKeySortT);
-MRA_SETTINGS masMraSettings;
CLIST_INTERFACE *pcli;
int hLangpack;
@@ -20,21 +19,31 @@ PLUGININFOEX pluginInfoEx = { { 0xe7c48bab, 0x8ace, 0x4cb3, { 0x84, 0x46, 0xd4, 0xb7, 0x34, 0x81, 0xf4, 0x97 } }
};
+HANDLE g_hHeap;
+HINSTANCE g_hInstance;
+HMODULE g_hDLLXStatusIcons;
+HICON g_hMainIcon;
+
+DWORD g_dwGlobalPluginRunning;
+bool g_bChatExist;
+
+size_t g_dwMirWorkDirPathLen;
+WCHAR g_szMirWorkDirPath[MAX_FILEPATH];
+
void IconsLoad();
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID Reserved)
{
switch (dwReason) {
case DLL_PROCESS_ATTACH:
- bzero(&masMraSettings, sizeof(masMraSettings));
- masMraSettings.hInstance = hInstance;
- masMraSettings.hHeap = HeapCreate(0, 0, 0);
+ g_hInstance = hInstance;
+ g_hHeap = HeapCreate(0, 0, 0);
DisableThreadLibraryCalls(hInstance);
break;
case DLL_PROCESS_DETACH:
- HeapDestroy(masMraSettings.hHeap);
- masMraSettings.hHeap = NULL;
+ HeapDestroy(g_hHeap);
+ g_hHeap = NULL;
}
return TRUE;
@@ -67,13 +76,13 @@ static int mraProtoUninit(CMraProto *ppro) static int OnModulesLoaded(WPARAM, LPARAM)
{
- masMraSettings.dwGlobalPluginRunning = TRUE;
+ g_dwGlobalPluginRunning = TRUE;
return 0;
}
static int OnPreShutdown(WPARAM, LPARAM)
{
- masMraSettings.dwGlobalPluginRunning = FALSE;
+ g_dwGlobalPluginRunning = FALSE;
return 0;
}
@@ -83,34 +92,6 @@ extern "C" __declspec(dllexport) int Load(void) mir_getCLI();
IconsLoad();
-
- TCHAR szBuff[MAX_FILEPATH];
- LPSTR lpszFullFileName = (LPSTR)szBuff;
-
- // load libs
- if (GetModuleFileName(NULL, szBuff, MAX_FILEPATH)) {
- LPWSTR lpwszFileName;
- masMraSettings.dwMirWorkDirPathLen = GetFullPathName(szBuff, MAX_FILEPATH, masMraSettings.szMirWorkDirPath, &lpwszFileName);
- if (masMraSettings.dwMirWorkDirPathLen) {
- masMraSettings.dwMirWorkDirPathLen -= lstrlenW(lpwszFileName);
- masMraSettings.szMirWorkDirPath[masMraSettings.dwMirWorkDirPathLen] = 0;
-
- // load xstatus icons lib
- size_t dwBuffLen;
- DWORD dwErrorCode = FindFile(masMraSettings.szMirWorkDirPath, (DWORD)masMraSettings.dwMirWorkDirPathLen, _T("xstatus_MRA.dll"), -1, szBuff, SIZEOF(szBuff), (DWORD*)&dwBuffLen);
- if (dwErrorCode == NO_ERROR) {
- masMraSettings.hDLLXStatusIcons = LoadLibraryEx(szBuff, NULL, 0);
- if (masMraSettings.hDLLXStatusIcons) {
- dwBuffLen = LoadString(masMraSettings.hDLLXStatusIcons, IDS_IDENTIFY, szBuff, MAX_FILEPATH);
- if (dwBuffLen == 0 || _tcsnicmp(_T("# Custom Status Icons #"), szBuff, 23)) {
- FreeLibrary(masMraSettings.hDLLXStatusIcons);
- masMraSettings.hDLLXStatusIcons = NULL;
- }
- }
- }
- }
- }
-
InitXStatusIcons();
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
@@ -128,9 +109,9 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void)
{
DestroyXStatusIcons();
- if (masMraSettings.hDLLXStatusIcons) {
- FreeLibrary(masMraSettings.hDLLXStatusIcons);
- masMraSettings.hDLLXStatusIcons = NULL;
+ if (g_hDLLXStatusIcons) {
+ FreeLibrary(g_hDLLXStatusIcons);
+ g_hDLLXStatusIcons = NULL;
}
g_Instances.destroy();
|