diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-19 17:55:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-19 17:55:59 +0300 |
commit | aefd74af9e06fafbecb2bfea1725d80554a45892 (patch) | |
tree | 41e86ce0ee680656fa62164c6b0982fe01cdab63 /plugins | |
parent | c18c8bc1d74b539cc65f0d80ed0611fd5c9223d6 (diff) |
PluginUpdater:
- CMPlugin::bForceRedownload isn't saved in database anymore (what for?);
- update starts each time a user changes platform
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/PluginUpdater/src/DlgUpdate.cpp | 7 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Options.cpp | 42 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/Utils.cpp | 1 | ||||
-rw-r--r-- | plugins/PluginUpdater/src/stdafx.h | 4 |
4 files changed, 20 insertions, 34 deletions
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 1e9b6cb16f..2166503d79 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -145,11 +145,6 @@ static void ApplyUpdates(void *param) }
}
- if (g_plugin.bForceRedownload) {
- g_plugin.bForceRedownload = 0;
- g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
- }
-
// 5) Prepare Restart
int rc = MessageBox(hDlg, TranslateT("Update complete. Press Yes to restart Miranda now or No to postpone a restart until the exit."), TranslateT("Plugin Updater"), MB_YESNO | MB_ICONQUESTION);
PostMessage(hDlg, WM_CLOSE, 0, 0);
@@ -458,8 +453,6 @@ static void DlgUpdateSilent(void *param) Skin_PlaySound("updatecompleted");
g_plugin.bForceRedownload = false;
- g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
-
g_plugin.bChangePlatform = false;
g_plugin.delSetting(DB_SETTING_CHANGEPLATFORM);
diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index fe14f8b2d6..40177e91f7 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -297,47 +297,41 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar InitTimer((void*)1);
+ int iNewMode;
bool bNoSymbols = false;
if (IsDlgButtonChecked(hwndDlg, IDC_STABLE)) {
- g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
- if (!g_plugin.bChangePlatform)
- g_plugin.bForceRedownload = 0;
- g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
+ iNewMode = UPDATE_MODE_STABLE;
bNoSymbols = true;
}
else if (IsDlgButtonChecked(hwndDlg, IDC_STABLE_SYMBOLS)) {
- // Only set ForceRedownload if the previous UpdateMode was different
- // to redownload all plugin with pdb files
- if (g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_STABLE_SYMBOLS) {
- g_plugin.setByte(DB_SETTING_REDOWNLOAD, g_plugin.bForceRedownload = 1);
- g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE_SYMBOLS);
- }
+ iNewMode = UPDATE_MODE_STABLE_SYMBOLS;
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK)) {
- g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
- if (!g_plugin.bChangePlatform)
- g_plugin.bForceRedownload = 0;
- g_plugin.delSetting(DB_SETTING_REDOWNLOAD);
+ iNewMode = UPDATE_MODE_TRUNK;
bNoSymbols = true;
}
else if (IsDlgButtonChecked(hwndDlg, IDC_TRUNK_SYMBOLS)) {
- // Only set ForceRedownload if the previous UpdateMode was different
- // to redownload all plugin with pdb files
- if (g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != UPDATE_MODE_TRUNK_SYMBOLS) {
- g_plugin.setByte(DB_SETTING_REDOWNLOAD, g_plugin.bForceRedownload = 1);
- g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK_SYMBOLS);
- }
+ iNewMode = UPDATE_MODE_TRUNK_SYMBOLS;
}
else {
wchar_t tszUrl[100];
GetDlgItemText(hwndDlg, IDC_CUSTOMURL, tszUrl, _countof(tszUrl));
g_plugin.setWString(DB_SETTING_UPDATE_URL, tszUrl);
- g_plugin.setByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_CUSTOM);
- g_plugin.setByte(DB_SETTING_REDOWNLOAD, g_plugin.bForceRedownload = 1);
+ iNewMode = UPDATE_MODE_CUSTOM;
+ }
+
+ bool bStartUpdate = false;
+
+ // Repository was changed, force recheck
+ if (g_plugin.getByte(DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE) != iNewMode) {
+ g_plugin.setByte(DB_SETTING_UPDATE_MODE, iNewMode);
+ if (!bNoSymbols)
+ g_plugin.bForceRedownload = true;
+ bStartUpdate = true;
}
if (IsDlgButtonChecked(hwndDlg, IDC_CHANGE_PLATFORM)) {
- g_plugin.setByte(DB_SETTING_REDOWNLOAD, g_plugin.bForceRedownload = 1);
+ g_plugin.bForceRedownload = bStartUpdate = true;
g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, g_plugin.bChangePlatform = 1);
}
else g_plugin.setByte(DB_SETTING_CHANGEPLATFORM, g_plugin.bChangePlatform = 0);
@@ -359,7 +353,7 @@ static INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wPar }
// if user tried to change the channel, run the update dialog immediately
- if (g_plugin.bForceRedownload)
+ if (bStartUpdate)
CallService(MS_PU_CHECKUPDATES, 0, 0);
}
}
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index f45ca7db3e..c27b1314cf 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -34,7 +34,6 @@ void LoadOptions() g_plugin.bUpdateOnStartup = g_plugin.getBool("UpdateOnStartup", true);
g_plugin.bOnlyOnceADay = g_plugin.getBool("OnlyOnceADay", true);
g_plugin.bUpdateOnPeriod = g_plugin.getBool("UpdateOnPeriod", false);
- g_plugin.bForceRedownload = g_plugin.getBool(DB_SETTING_REDOWNLOAD, false);
g_plugin.bSilentMode = g_plugin.getBool("SilentMode", false);
g_plugin.bUseHttps = g_plugin.getBool("UseHttps", true);
g_plugin.bBackup = g_plugin.getBool("Backup", false);
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h index f7a03e8ce2..ce638ae1bc 100644 --- a/plugins/PluginUpdater/src/stdafx.h +++ b/plugins/PluginUpdater/src/stdafx.h @@ -129,7 +129,6 @@ enum #define DB_SETTING_UPDATE_MODE "UpdateMode"
#define DB_SETTING_UPDATE_URL "UpdateURL"
-#define DB_SETTING_REDOWNLOAD "ForceRedownload"
#define DB_SETTING_NEED_RESTART "NeedRestart"
#define DB_SETTING_RESTART_COUNT "RestartCount"
#define DB_SETTING_LAST_UPDATE "LastUpdate"
@@ -162,7 +161,8 @@ struct CMPlugin : public PLUGIN<CMPlugin> int Unload() override;
// common options
- bool bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bForceRedownload, bSilentMode, bBackup, bChangePlatform, bSilent, bUseHttps;
+ bool bUpdateOnStartup, bUpdateOnPeriod, bOnlyOnceADay, bSilentMode, bBackup, bChangePlatform, bSilent, bUseHttps;
+ bool bForceRedownload = false; // not a db option
int iPeriod, iPeriodMeasure;
// popup options
|