diff options
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r-- | plugins/PluginUpdater/res/Resource.rc | 10 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Common.h | 4 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 13 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 8 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 19 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Version.h | 2 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/resource.h | 14 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/unzipfile.cpp | 3 |
8 files changed, 27 insertions, 46 deletions
diff --git a/plugins/PluginUpdater/res/Resource.rc b/plugins/PluginUpdater/res/Resource.rc index da87f4345f..736ebbb552 100644 --- a/plugins/PluginUpdater/res/Resource.rc +++ b/plugins/PluginUpdater/res/Resource.rc @@ -66,18 +66,18 @@ BEGIN GROUPBOX "Hotkey",IDC_STATIC,2,0,253,26
CONTROL "Go to Customize -> Hotkeys to change the hotkey",IDC_LINK_HOTKEY,
"Hyperlink",WS_TABSTOP,9,11,199,10
- GROUPBOX "Plugin updates options",IDC_STATIC,1,29,253,61
- CONTROL "On startup",IDC_UPDATEONSTARTUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,44,52,10
+ GROUPBOX "Plugin updates options",IDC_STATIC,1,29,253,48
+ CONTROL "On startup",IDC_UPDATEONSTARTUP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,44,73,10
CONTROL "(but only once a day)",IDC_ONLYONCEADAY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,92,44,161,10
CONTROL "Every",IDC_UPDATEONPERIOD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,58,52,10
EDITTEXT IDC_PERIOD,65,56,28,14,ES_AUTOHSCROLL | ES_NUMBER | WS_DISABLED
CONTROL "",IDC_PERIODSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_DISABLED,92,56,10,15
COMBOBOX IDC_PERIODMEASURE,114,56,58,30,CBS_DROPDOWNLIST | CBS_SORT | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
- CONTROL "Update icons",IDC_UPDATEICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,72,198,10
- GROUPBOX "Files source",IDC_STATIC,1,93,253,96
+ GROUPBOX "Files source",IDC_STATIC,1,80,253,96
CONTROL "Stable version",IDC_STABLE,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,106,236,10
CONTROL "Development version (less stable)",IDC_TRUNK,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,121,236,10
- CONTROL "Development version with debug symbols",IDC_TRUNK_SYMBOLS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,136,236,10
+ CONTROL "Development version with debug symbols",IDC_TRUNK_SYMBOLS,
+ "Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,136,236,10
CONTROL "Custom version",IDC_CUSTOM,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,11,151,236,10
EDITTEXT IDC_CUSTOMURL,11,165,234,16,ES_AUTOHSCROLL
END
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h index 9673cb8226..4caf660fcc 100644 --- a/plugins/PluginUpdater/src/Common.h +++ b/plugins/PluginUpdater/src/Common.h @@ -92,7 +92,7 @@ struct PopupDataText struct PlugOptions
{
- BYTE bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bUpdateIcons, bForceRedownload;
+ BYTE bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bForceRedownload;
BOOL bSilent, bDlgDld;
BYTE bPeriodMeasure;
@@ -180,7 +180,7 @@ void ShowPopup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType) void __stdcall RestartMe(void*);
void __stdcall OpenPluginOptions(void*);
BOOL AllowUpdateOnStartup();
-void InitTimer();
+void InitTimer(bool lastSuccess = true);
INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam);
INT_PTR ShowListCommand(WPARAM wParam,LPARAM lParam);
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 8d9863aced..8c2ff2bd45 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -544,9 +544,10 @@ static void CheckUpdates(void *) tszTempPath[dwLen-1] = 0;
ptrT updateUrl( GetDefaultUrl()), baseUrl;
-
+
SERVLIST hashes(50, CompareHashes);
- if (ParseHashes(updateUrl, baseUrl, hashes)) {
+ bool success = ParseHashes(updateUrl, baseUrl, hashes);
+ if (success) {
FILELIST *UpdateFiles = new FILELIST(20);
VARST dirname( _T("%miranda_path%"));
int count = ScanFolder(dirname, lstrlen(dirname)+1, 0, baseUrl, hashes, UpdateFiles);
@@ -559,7 +560,8 @@ static void CheckUpdates(void *) }
else CallFunctionAsync(LaunchDialog, UpdateFiles);
}
-
+ InitTimer(success);
+
hashes.destroy();
hCheckThread = NULL;
}
@@ -572,9 +574,8 @@ void DoCheck(int iFlag) ShowWindow(hwndDialog, SW_SHOW);
SetForegroundWindow(hwndDialog);
SetFocus(hwndDialog);
- }
- else if (iFlag) {
- hCheckThread = mir_forkthread(CheckUpdates, 0);
+ } else if (iFlag) {
db_set_dw(NULL, MODNAME, "LastUpdate", time(NULL));
+ hCheckThread = mir_forkthread(CheckUpdates, 0);
}
}
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 56f3643ac1..1368f4cbbb 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -57,8 +57,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ComboBox_InsertString(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), 1, TranslateT("days"));
ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), opts.bPeriodMeasure);
- CheckDlgButton(hwndDlg, IDC_UPDATEICONS, opts.bUpdateIcons);
-
EnableWindow(GetDlgItem(hwndDlg, IDC_CUSTOMURL), FALSE);
if ( db_get_s(NULL, MODNAME, "UpdateURL", &dbv)) {
SetDlgItemText(hwndDlg, IDC_CUSTOMURL, _T(DEFAULT_UPDATE_URL));
@@ -114,10 +112,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
- case IDC_UPDATEICONS:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
-
case IDC_LINK_HOTKEY:
{
OPENOPTIONSDIALOG ood = {0};
@@ -155,8 +149,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA db_set_b(NULL, MODNAME, "UpdateOnPeriod", opts.bUpdateOnPeriod);
db_set_b(NULL, MODNAME, "PeriodMeasure", opts.bPeriodMeasure);
db_set_dw(NULL, MODNAME, "Period", opts.Period);
- opts.bUpdateIcons = IsDlgButtonChecked(hwndDlg, IDC_UPDATEICONS);
- db_set_b(NULL, MODNAME, "UpdateIcons", opts.bUpdateIcons);
if ( IsDlgButtonChecked(hwndDlg, IDC_STABLE))
db_set_s(NULL, MODNAME, "UpdateURL", DEFAULT_UPDATE_URL);
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 00c6715a7c..2b57022b51 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -122,7 +122,6 @@ void LoadOptions() opts.bUpdateOnPeriod = db_get_b(NULL, MODNAME, "UpdateOnPeriod", DEFAULT_UPDATEONPERIOD);
opts.Period = db_get_dw(NULL, MODNAME, "Period", DEFAULT_PERIOD);
opts.bPeriodMeasure = db_get_b(NULL, MODNAME, "PeriodMeasure", DEFAULT_PERIODMEASURE);
- opts.bUpdateIcons = db_get_b(NULL, MODNAME, "UpdateIcons", DEFAULT_UPDATEICONS);
opts.bForceRedownload = db_get_b(NULL, MODNAME, "ForceRedownload", 0);
}
@@ -244,9 +243,6 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT& baseUrl, SERVLIST& arHashes) continue;
*p++ = 0;
- if ( !opts.bUpdateIcons && !_strnicmp(str, "icons\\", 6))
- continue;
-
_strlwr(p);
int dwCrc32;
@@ -377,22 +373,31 @@ LONG PeriodToMilliseconds(const int period, BYTE& periodMeasure) void CALLBACK TimerAPCProc(LPVOID lpArg, DWORD dwTimerLowValue, DWORD dwTimerHighValue)
{
- DoCheck(1);
+ DoCheck(true);
}
-void InitTimer()
+void InitTimer(bool lastSuccess)
{
CancelWaitableTimer(Timer);
if (opts.bUpdateOnPeriod) {
LONG interval = PeriodToMilliseconds(opts.Period, opts.bPeriodMeasure);
+ time_t now = time(NULL);
+ time_t was = db_get_dw(NULL, MODNAME, "LastUpdate", 0);
+
+ interval -= (now - was) * 1000;
+ if (interval <= 0)
+ interval = 1000; // no last update or too far in the past -> do it now
+ else if (!lastSuccess)
+ interval = 1000 * 60 * 60; // failed last check, check again in one hour
+
_int64 qwDueTime = -10000i64 * interval;
LARGE_INTEGER li = {0};
li.LowPart = (DWORD) ( qwDueTime & 0xFFFFFFFF );
li.HighPart = (LONG) ( qwDueTime >> 32 );
- SetWaitableTimer(Timer, &li, interval, TimerAPCProc, NULL, 0);
+ SetWaitableTimer(Timer, &li, 0, TimerAPCProc, NULL, 0);
}
}
diff --git a/plugins/PluginUpdater/src/Version.h b/plugins/PluginUpdater/src/Version.h index 686b76657e..f517484a82 100644 --- a/plugins/PluginUpdater/src/Version.h +++ b/plugins/PluginUpdater/src/Version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
diff --git a/plugins/PluginUpdater/src/resource.h b/plugins/PluginUpdater/src/resource.h index 20466bdc0c..86dc26469c 100644 --- a/plugins/PluginUpdater/src/resource.h +++ b/plugins/PluginUpdater/src/resource.h @@ -11,19 +11,10 @@ #define IDI_OK 108
#define IDI_CANCEL 109
#define IDI_INFO 111
-#define IDI_DOWN_DEL 112
-#define IDI_DOWN_FAIL 113
-#define IDI_DOWN_LOAD 114
-#define IDI_DOWN_OK 115
-#define IDI_ICON5 116
-#define IDI_DOWN_SKIP 116
#define IDI_PLGLIST 117
#define IDC_UPDATETEXT 1001
-#define IDC_CURVER 1002
-#define IDC_NEWVER 1003
#define IDC_SELALL 1004
#define IDC_PB 1005
-#define IDC_INFO2 1005
#define IDC_SELNONE 1005
#define IDC_LABEL 1006
#define IDC_DETAILS 1006
@@ -39,17 +30,12 @@ #define IDC_PREVIEW 1016
#define IDC_TIMEOUT_VALUE 1017
#define IDC_USEOWNCOLORS 1018
-#define IDC_ENABLEUPDATES 1019
#define IDC_LIST_UPDATES 1021
-#define IDC_MESSAGE 1022
-#define IDC_DESCR 1023
#define IDC_MSG_BOXES_MSG 1024
#define IDC_ERRORS_MSG 1025
#define IDC_INFO_MESSAGES_MSG 1026
#define IDC_PROGR_DLG_MSG 1027
#define IDC_LINK_HOTKEY 1028
-#define IDC_UPDATEICONS 1029
-#define IDC_SEPARATOR 1030
#define IDC_NOTIFY 1034
#define IDC_UPDATEONSTARTUP 1035
#define IDC_ONLYONCEADAY 1036
diff --git a/plugins/PluginUpdater/src/unzipfile.cpp b/plugins/PluginUpdater/src/unzipfile.cpp index 019c3261a3..189d3ff452 100644 --- a/plugins/PluginUpdater/src/unzipfile.cpp +++ b/plugins/PluginUpdater/src/unzipfile.cpp @@ -52,9 +52,6 @@ bool extractCurrentFile(unzFile uf, TCHAR *ptszDestPath, TCHAR *ptszBackPath) if (err != UNZ_OK)
return false;
- if (!opts.bUpdateIcons && !_strnicmp(filename, "Icons/", 6))
- return true;
-
for (char *p = strchr(filename, '/'); p; p = strchr(p+1, '/'))
*p = '\\';
|