diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-07-20 13:44:24 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-07-20 13:44:24 +0000 |
commit | 5161dd2a33e0e2147a40865a42461837aee5d7ed (patch) | |
tree | 639179332e9ca9201f6fb2fc82a8d2699591c41e /plugins/PluginUpdater/src/Utils.cpp | |
parent | 2d3b85b61fbd644508fac957e194a1618830191b (diff) |
Plugin Updater: Fixed various issues
- Checking after resume from hibernation finally works
- Checking after having opened update dialog for too long works
- After closing update dialog without updating and checking for updates again now correctly checks for new updates (and not show old unusable window)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9888 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater/src/Utils.cpp')
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index cf3de1c7ec..07e17b2231 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -362,6 +362,9 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) BOOL AllowUpdateOnStartup()
{
+ if (!opts.bUpdateOnStartup)
+ return FALSE;
+
if (opts.bOnlyOnceADay) {
time_t now = time(NULL);
time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
@@ -393,16 +396,15 @@ LONG PeriodToMilliseconds(const int period, BYTE& periodMeasure) void CALLBACK TimerAPCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHighValue)
{
- DoCheck(true);
+ DoCheck();
}
-void InitTimer(int type)
+void InitTimer(void *type)
{
- CancelWaitableTimer(Timer);
if (opts.bUpdateOnPeriod) {
LONG interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
- switch (type) {
+ switch ((int)type) {
case 0: // default, plan next check relative to last check
{
time_t now = time(NULL);
@@ -420,9 +422,17 @@ void InitTimer(int type) break;
}
- LARGE_INTEGER li = {0};
- li.QuadPart = -1 * (interval * 10000LL);
+ FILETIME ft;
+ GetSystemTimeAsFileTime(&ft);
+
+ LARGE_INTEGER li;
+ li.LowPart = ft.dwLowDateTime;
+ li.HighPart = ft.dwHighDateTime;
+ li.QuadPart += (ULONGLONG)(interval * 10000LL);
SetWaitableTimer(Timer, &li, 0, TimerAPCProc, NULL, 0);
+
+ // Wait in an alertable state for the timer to go off.
+ SleepEx(INFINITE, TRUE);
}
}
|