summaryrefslogtreecommitdiff
path: root/plugins/SeenPlugin/src/main.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-18 09:37:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-18 09:37:22 +0000
commit00f7de90210080e231b2f8c2a0bf39c8b0a048ac (patch)
treea80c1ac3b852810fc4df35c08787bd2ec582d506 /plugins/SeenPlugin/src/main.cpp
parenta03fab81e7d29d92d00c4268a8fa45e16ffd84dc (diff)
- major design flaw fixed in LastSeen plugin;
- version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@4089 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SeenPlugin/src/main.cpp')
-rw-r--r--plugins/SeenPlugin/src/main.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp
index 101681cb66..650382c8b6 100644
--- a/plugins/SeenPlugin/src/main.cpp
+++ b/plugins/SeenPlugin/src/main.cpp
@@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
HINSTANCE hInstance;
HANDLE ehmissed = NULL, ehuserinfo = NULL, ehmissed_proto = NULL;
+HANDLE g_hShutdownEvent;
int hLangpack;
@@ -91,6 +92,23 @@ int MainInit(WPARAM wparam,LPARAM lparam)
return 0;
}
+static int OnShutdown(WPARAM, LPARAM)
+{
+ SetEvent(g_hShutdownEvent);
+ return 0;
+}
+
+extern "C" __declspec(dllexport) int Load(void)
+{
+ mir_getLP(&pluginInfo);
+
+ g_hShutdownEvent = CreateEvent(0, TRUE, FALSE, 0);
+
+ HookEvent(ME_SYSTEM_MODULESLOADED, MainInit);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
+ return 0;
+}
+
extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirandaVersion)
{
return &pluginInfo;
@@ -101,6 +119,7 @@ extern "C" __declspec(dllexport) int Unload(void)
if (ehmissed)
UnhookEvent(ehmissed);
+ CloseHandle(g_hShutdownEvent);
UninitMenuitem();
return 0;
}
@@ -110,16 +129,3 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD fdwReason, LPVOID lpvReserved)
hInstance=hinst;
return 1;
}
-
-extern "C" __declspec(dllexport) int Load(void)
-{
-
- mir_getLP(&pluginInfo);
- // this isn't required for most events
- // but the ME_USERINFO_INITIALISE
- // I decided to hook all events after
- // everything is loaded because it seems
- // to be safer in my opinion
- HookEvent(ME_SYSTEM_MODULESLOADED,MainInit);
- return 0;
-} \ No newline at end of file