summaryrefslogtreecommitdiff
path: root/plugins/WhenWasIt
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2015-07-12 05:14:50 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2015-07-12 05:14:50 +0000
commitefb5fdfa3f31b1c57b9253cd2d062e61d9574c37 (patch)
treef45d9f463b8d5108340251e174551411cd6e0505 /plugins/WhenWasIt
parent53ed793fb92d7a7175eda46aad41b30228bac44f (diff)
WhenWasIt: timers code update
git-svn-id: http://svn.miranda-ng.org/main/trunk@14539 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WhenWasIt')
-rw-r--r--plugins/WhenWasIt/src/WhenWasIt.cpp3
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp29
2 files changed, 10 insertions, 22 deletions
diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp
index effd2d632f..f6f2f739ad 100644
--- a/plugins/WhenWasIt/src/WhenWasIt.cpp
+++ b/plugins/WhenWasIt/src/WhenWasIt.cpp
@@ -144,9 +144,6 @@ extern "C" int __declspec(dllexport) Unload()
WindowList_Broadcast(hAddBirthdayWndsList, WM_CLOSE, 0, 0);
WindowList_Destroy(hAddBirthdayWndsList);
- Log("%s", "Killing timers ...");
- KillTimers();
-
Log("%s", "Unhooking events ...");
UnhookEvents();
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index a421260b7e..ebc715a279 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -24,10 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define EXCLUDE_HIDDEN 1
#define EXCLUDE_IGNORED 2
-UINT_PTR hCheckTimer = NULL;
-UINT_PTR hDateChangeTimer = NULL;
+static UINT_PTR hCheckTimer = NULL;
+static UINT_PTR hDateChangeTimer = NULL;
+static int currentDay = 0;
-int currentDay;
static int OnTopToolBarModuleLoaded(WPARAM, LPARAM)
{
@@ -145,31 +145,22 @@ int RefreshContactListIcons(MCONTACT hContact)
int UpdateTimers()
{
- if (hCheckTimer) {
- KillTimer(NULL, hCheckTimer);
- hCheckTimer = NULL;
- }
-
- long interval = db_get_dw(NULL, ModuleName, "Interval", CHECK_INTERVAL);
- interval *= 1000 * 60 * 60; //go from miliseconds to hours
+ UINT interval = db_get_dw(NULL, ModuleName, "Interval", CHECK_INTERVAL);
+ interval *= (1000 * 60 * 60); //go from miliseconds to hours
hCheckTimer = SetTimer(NULL, 0, interval, OnCheckTimer);
if (!hDateChangeTimer)
- hDateChangeTimer = SetTimer(NULL, 0, 1000 * DATE_CHANGE_CHECK_INTERVAL, OnDateChangeTimer);
+ hDateChangeTimer = SetTimer(NULL, 0, (1000 * DATE_CHANGE_CHECK_INTERVAL), OnDateChangeTimer);
return 0;
}
int KillTimers()
{
- if (hCheckTimer) {
- KillTimer(NULL, hCheckTimer);
- hCheckTimer = NULL;
- }
+ KillTimer(NULL, hCheckTimer);
+ hCheckTimer = NULL;
- if (hDateChangeTimer) {
- KillTimer(NULL, hDateChangeTimer);
- hDateChangeTimer = NULL;
- }
+ KillTimer(NULL, hDateChangeTimer);
+ hDateChangeTimer = NULL;
return 0;
}