diff options
author | George Hazan <george.hazan@gmail.com> | 2013-07-29 14:09:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-07-29 14:09:21 +0000 |
commit | c23dc541407d41665fa3bfdda2977f6b31694c68 (patch) | |
tree | 8fb2693bea3b0762f5b1bfd5a9924665c6e0966e /plugins/AVS | |
parent | b648ec6c38c0a2b8ea50ecdb167f41557e2e2584 (diff) |
- resource cleanup removed from ME_SYSTEM_OKTOEXIT;
- old unused files removed;
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@5524 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AVS')
-rw-r--r-- | plugins/AVS/avs_10.vcxproj | 2 | ||||
-rw-r--r-- | plugins/AVS/avs_10.vcxproj.filters | 6 | ||||
-rw-r--r-- | plugins/AVS/avs_11.vcxproj | 2 | ||||
-rw-r--r-- | plugins/AVS/avs_11.vcxproj.filters | 6 | ||||
-rw-r--r-- | plugins/AVS/src/commonheaders.h | 4 | ||||
-rw-r--r-- | plugins/AVS/src/main.cpp | 46 | ||||
-rw-r--r-- | plugins/AVS/src/mir_thread.cpp | 43 | ||||
-rw-r--r-- | plugins/AVS/src/mir_thread.h | 49 |
8 files changed, 24 insertions, 134 deletions
diff --git a/plugins/AVS/avs_10.vcxproj b/plugins/AVS/avs_10.vcxproj index 700f18952f..cdf4553179 100644 --- a/plugins/AVS/avs_10.vcxproj +++ b/plugins/AVS/avs_10.vcxproj @@ -211,7 +211,6 @@ <ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\mir_thread.cpp" />
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\poll.cpp" />
<ClCompile Include="src\main.cpp" />
@@ -220,7 +219,6 @@ <ClInclude Include="src\acc.h" />
<ClInclude Include="src\commonheaders.h" />
<ClInclude Include="src\image_utils.h" />
- <ClInclude Include="src\mir_thread.h" />
<ClInclude Include="src\poll.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
diff --git a/plugins/AVS/avs_10.vcxproj.filters b/plugins/AVS/avs_10.vcxproj.filters index 7402455039..05a3b22fa3 100644 --- a/plugins/AVS/avs_10.vcxproj.filters +++ b/plugins/AVS/avs_10.vcxproj.filters @@ -24,9 +24,6 @@ <ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\mir_thread.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -47,9 +44,6 @@ <ClInclude Include="src\image_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\mir_thread.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\poll.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/AVS/avs_11.vcxproj b/plugins/AVS/avs_11.vcxproj index afd336fb42..9d4563fec1 100644 --- a/plugins/AVS/avs_11.vcxproj +++ b/plugins/AVS/avs_11.vcxproj @@ -214,7 +214,6 @@ <ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
- <ClCompile Include="src\mir_thread.cpp" />
<ClCompile Include="src\options.cpp" />
<ClCompile Include="src\poll.cpp" />
<ClCompile Include="src\main.cpp" />
@@ -223,7 +222,6 @@ <ClInclude Include="src\acc.h" />
<ClInclude Include="src\commonheaders.h" />
<ClInclude Include="src\image_utils.h" />
- <ClInclude Include="src\mir_thread.h" />
<ClInclude Include="src\poll.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
diff --git a/plugins/AVS/avs_11.vcxproj.filters b/plugins/AVS/avs_11.vcxproj.filters index 7402455039..05a3b22fa3 100644 --- a/plugins/AVS/avs_11.vcxproj.filters +++ b/plugins/AVS/avs_11.vcxproj.filters @@ -24,9 +24,6 @@ <ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\mir_thread.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -47,9 +44,6 @@ <ClInclude Include="src\image_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\mir_thread.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\poll.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/AVS/src/commonheaders.h b/plugins/AVS/src/commonheaders.h index 10e7f52c17..e35a5270e5 100644 --- a/plugins/AVS/src/commonheaders.h +++ b/plugins/AVS/src/commonheaders.h @@ -47,7 +47,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h"
#include "version.h"
#include "image_utils.h"
-#include "mir_thread.h"
#include "poll.h"
#include "acc.h"
@@ -88,3 +87,6 @@ int SetAvatarAttribute(HANDLE hContact, DWORD attrib, int mode); #define AVS_IGNORENOTIFY 0x1000
#define AVS_DEFAULT "Global avatar"
+
+void mir_sleep(int time);
+extern bool g_shutDown;
\ No newline at end of file diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 6d99c5243e..2856a7f85c 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
HINSTANCE g_hInst = 0;
+HICON g_hIcon = 0;
+bool g_shutDown = false;
+
int hLangpack;
static TCHAR g_szDataPath[MAX_PATH]; // user datae path (read at startup only)
@@ -33,12 +36,10 @@ static long hwndSetMyAvatar = 0; static HANDLE hMyAvatarsFolder;
static HANDLE hGlobalAvatarFolder;
-static HANDLE hLoaderEvent;
+static HANDLE hLoaderEvent, hShutdownEvent;
static HANDLE hEventContactAvatarChanged, hMyAvatarChanged;
HANDLE hEventChanged;
-HICON g_hIcon = 0;
-
BOOL (WINAPI *AvsAlphaBlend)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION) = NULL;
static struct CacheNode *g_Cache = 0;
@@ -166,6 +167,12 @@ int _DebugTrace(HANDLE hContact, const char *fmt, ...) #endif
+void mir_sleep(int time)
+{
+ if (!g_shutDown)
+ WaitForSingleObject(hShutdownEvent, time);
+}
+
/*
* path utilities (make avatar paths relative to *PROFILE* directory, not miranda directory.
* taken and modified from core services
@@ -1646,19 +1653,17 @@ static INT_PTR ContactOptions(WPARAM wParam, LPARAM lParam) INT_PTR GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- int i;
- char *szProto = (char *)lParam;
-
if (wParam || g_shutDown || fei == NULL)
return 0;
+ char *szProto = (char *)lParam;
if (lParam == 0 || IsBadReadPtr(szProto, 4))
return 0;
- for(i = 0; i < g_MyAvatars.getCount(); i++) {
+ for(int i = 0; i < g_MyAvatars.getCount(); i++)
if (!lstrcmpA(szProto, g_MyAvatars[i].szProtoname) && g_MyAvatars[i].hbmPic != 0)
return (INT_PTR)&g_MyAvatars[i];
- }
+
return 0;
}
@@ -1992,7 +1997,6 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccChanged);
HookEvent(ME_SYSTEM_PRESHUTDOWN, ShutdownProc);
- HookEvent(ME_SYSTEM_OKTOEXIT, OkToExitProc);
HookEvent(ME_USERINFO_INITIALISE, OnDetailsInit);
return 0;
}
@@ -2103,21 +2107,16 @@ static int OptInit(WPARAM wParam, LPARAM lParam) return 0;
}
-static int OkToExitProc(WPARAM wParam, LPARAM lParam)
+static int ShutdownProc(WPARAM wParam, LPARAM lParam)
{
- g_shutDown = TRUE;
+ g_shutDown = true;
SetEvent(hLoaderEvent);
- return 0;
-}
+ SetEvent(hShutdownEvent);
+ CloseHandle(hShutdownEvent); hShutdownEvent = NULL;
-static int ShutdownProc(WPARAM wParam, LPARAM lParam)
-{
DestroyHookableEvent(hEventChanged); hEventChanged = 0;
DestroyHookableEvent(hEventContactAvatarChanged); hEventContactAvatarChanged = 0;
DestroyHookableEvent(hMyAvatarChanged); hMyAvatarChanged = 0;
-
- DeleteCriticalSection(&cachecs);
- DeleteCriticalSection(&alloccs);
return 0;
}
@@ -2311,13 +2310,11 @@ static int OnDetailsInit(WPARAM wParam, LPARAM lParam) static int LoadAvatarModule()
{
- mir_getLP(&pluginInfoEx);
-
- init_mir_thread();
-
InitializeCriticalSection(&cachecs);
InitializeCriticalSection(&alloccs);
+ hShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+
HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
@@ -2372,10 +2369,9 @@ extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirand extern "C" int __declspec(dllexport) Load(void)
{
- INT_PTR result = CALLSERVICE_NOTFOUND;
-
- mir_getLP( &pluginInfoEx );
+ mir_getLP(&pluginInfoEx);
+ INT_PTR result = CALLSERVICE_NOTFOUND;
if (ServiceExists(MS_IMG_GETINTERFACE))
result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fei);
diff --git a/plugins/AVS/src/mir_thread.cpp b/plugins/AVS/src/mir_thread.cpp deleted file mode 100644 index f1eb547b8f..0000000000 --- a/plugins/AVS/src/mir_thread.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/*
-Copyright (C) 2005 Ricardo Pescuma Domenecci
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-#include "commonheaders.h"
-
-BOOL g_shutDown = FALSE;
-static HANDLE hShutdownEvent = NULL;
-
-static int OkToExitProc(WPARAM wParam, LPARAM lParam)
-{
- g_shutDown = TRUE;
- SetEvent(hShutdownEvent);
- CloseHandle(hShutdownEvent);
- return 0;
-}
-
-void init_mir_thread()
-{
- hShutdownEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- HookEvent(ME_SYSTEM_OKTOEXIT, OkToExitProc);
-}
-
-void mir_sleep(int time)
-{
- if (!g_shutDown)
- WaitForSingleObject(hShutdownEvent, time);
-}
diff --git a/plugins/AVS/src/mir_thread.h b/plugins/AVS/src/mir_thread.h deleted file mode 100644 index 0f4f20fe8e..0000000000 --- a/plugins/AVS/src/mir_thread.h +++ /dev/null @@ -1,49 +0,0 @@ -/*
-Copyright (C) 2005 Ricardo Pescuma Domenecci
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-
-#ifndef __MIR_THREAD_H__
-# define __MIR_THREAD_H__
-
-#include <windows.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-void init_mir_thread();
-
-
-// This variable need to be constantly checked against and the thread function must exit
-// when this is true
-extern BOOL g_shutDown;
-
-void mir_sleep(int time);
-
-
-
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __MIR_THREAD_H__
|