From ca075a2786664d1cf635ea04236237fd95e46607 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 9 Jun 2024 16:28:15 +0300 Subject: =?UTF-8?q?fixes=20#4460=20(PluginUpdater=20=D0=BF=D1=8B=D1=82?= =?UTF-8?q?=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5?= =?UTF-8?q?=D1=80=D0=B8=D1=82=D1=8C=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=D0=BD=D0=BE=D0=B2=D0=B0=20?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BD=D0=BE=D0=B2=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/PluginUpdater/src/DlgListNew.cpp | 6 ++++++ plugins/PluginUpdater/src/DlgUpdate.cpp | 28 +++++++++++++++------------- plugins/PluginUpdater/src/Utils.cpp | 11 +++++++---- 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; } -- cgit v1.2.3