summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-02-06 17:43:31 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-02-06 17:43:31 +0000
commitf15f4d589ab7e2ad7f4112c42f83edcee8924482 (patch)
treea4e0f11d9ad9a36676c58a7c26de498b68ee0348
parent273417cb0b1e6db3733d72bc94b0ae43cda7d9bd (diff)
PluginUpdater:
-performance improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@12024 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 897950ecc5..18e0033ea8 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -240,20 +240,15 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
return false;
}
+ bool bDoNotSwitchToStable = false;
char str[200];
while(fgets(str, SIZEOF(str), fp) != NULL) {
rtrim(str);
- if (str[0] == ';') {
- db_unset(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE);
+ // Do not allow the user to switch back to stable
+ if (!strcmp(str, "DoNotSwitchToStable")) {
+ bDoNotSwitchToStable = true;
}
- else if (!strcmp(str, "DoNotSwitchToStable")) {
- db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 1);
- // Reset setting if needed
- int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
- if (UpdateMode == UPDATE_MODE_STABLE)
- db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
- }
- else {
+ else if (str[0] != ';') { // ';' marks a comment
Netlib_Logf(hNetlibUser, "Update: %s", str);
char *p = strchr(str, ' ');
if (p != NULL) {
@@ -274,6 +269,17 @@ bool ParseHashes(const TCHAR *ptszUrl, ptrT &baseUrl, SERVLIST &arHashes)
}
fclose(fp);
DeleteFile(tszTmpIni);
+
+ if (bDoNotSwitchToStable) {
+ db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 1);
+ // Reset setting if needed
+ int UpdateMode = db_get_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_STABLE);
+ if (UpdateMode == UPDATE_MODE_STABLE)
+ db_set_b(NULL, MODNAME, DB_SETTING_UPDATE_MODE, UPDATE_MODE_TRUNK);
+ }
+ else
+ db_set_b(NULL, MODNAME, DB_SETTING_DONT_SWITCH_TO_STABLE, 0);
+
return true;
}