summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-06-09 16:28:15 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-06-09 16:28:15 +0300
commitca075a2786664d1cf635ea04236237fd95e46607 (patch)
tree1f3bb3b2cabe916635867b9aab65c5da31922987 /plugins/PluginUpdater
parent2aea1cb52b3b9c3bcf121356aa09daed19fed809 (diff)
fixes #4460 (PluginUpdater пытается проверить обновления снова и снова)
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp6
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp28
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp11
3 files changed, 28 insertions, 17 deletions
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 4b8a0d6ec6..2ac37ce98d 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -408,9 +408,12 @@ static void GetList(void *)
ptrW updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
+LBL_Error:
hListThread = nullptr;
return;
}
+ if (!hashes.getCount())
+ goto LBL_Error;
FILELIST *UpdateFiles = new FILELIST(20);
@@ -481,9 +484,12 @@ static INT_PTR ParseUriService(WPARAM, LPARAM lParam)
ptrW updateUrl(GetDefaultUrl()), baseUrl;
SERVLIST hashes(50, CompareHashes);
if (!ParseHashes(updateUrl, baseUrl, hashes)) {
+LBL_Error:
hListThread = nullptr;
return 1;
}
+ if (!hashes.getCount())
+ goto LBL_Error;
ServListEntry *hash = hashes.find((ServListEntry*)&pluginPath);
if (hash == nullptr)
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index ba31e29480..a9ab7fd60b 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -786,19 +786,21 @@ static void CheckUpdates(void *)
SERVLIST hashes(50, CompareHashes);
bool success = ParseHashes(updateUrl, baseUrl, hashes);
if (success) {
- FILELIST *UpdateFiles = new FILELIST(20);
- int count = ScanFolder(g_mirandaPath, mir_wstrlen(g_mirandaPath) + 1, baseUrl, hashes, UpdateFiles);
- if (count == 0) {
- if (!g_plugin.bSilent)
- ShowPopup(TranslateT("Plugin Updater"), TranslateT("No updates found."), POPUP_TYPE_INFO);
- delete UpdateFiles;
- }
- else {
- // Show dialog
- if (g_plugin.bSilentMode && g_plugin.bSilent)
- mir_forkthread(DlgUpdateSilent, UpdateFiles);
- else
- CallFunctionAsync(LaunchDialog, UpdateFiles);
+ if (hashes.getCount()) {
+ FILELIST *UpdateFiles = new FILELIST(20);
+ int count = ScanFolder(g_mirandaPath, mir_wstrlen(g_mirandaPath) + 1, baseUrl, hashes, UpdateFiles);
+ if (count == 0) {
+ if (!g_plugin.bSilent)
+ ShowPopup(TranslateT("Plugin Updater"), TranslateT("No updates found."), POPUP_TYPE_INFO);
+ delete UpdateFiles;
+ }
+ else {
+ // Show dialog
+ if (g_plugin.bSilentMode && g_plugin.bSilent)
+ mir_forkthread(DlgUpdateSilent, UpdateFiles);
+ else
+ CallFunctionAsync(LaunchDialog, UpdateFiles);
+ }
}
// reset timer to next update
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 90921aaa13..bfc68c97df 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -54,11 +54,14 @@ bool ParseHashes(const wchar_t *pwszUrl, ptrW &baseUrl, SERVLIST &arHashes)
if (ret != ERROR_SUCCESS) {
Netlib_LogfW(g_hNetlibUser, L"Downloading list of available updates from %s failed with error %d", baseUrl.get(), ret);
- if (ret == 404)
- ShowPopup(TranslateT("Plugin Updater"), TranslateT("Updates are temporarily disabled, try again later."), POPUP_TYPE_INFO);
- else
- ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
Skin_PlaySound("updatefailed");
+
+ if (ret == 404) {
+ ShowPopup(TranslateT("Plugin Updater"), TranslateT("Updates are temporarily disabled, try again later."), POPUP_TYPE_INFO);
+ return true;
+ }
+
+ ShowPopup(TranslateT("Plugin Updater"), TranslateT("An error occurred while checking for new updates."), POPUP_TYPE_ERROR);
return false;
}