summaryrefslogtreecommitdiff
path: root/plugins/PluginUpdater
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-09-07 11:43:13 +0000
committerRobert Pösel <robyer@seznam.cz>2014-09-07 11:43:13 +0000
commite45814fa79757ad4ba4611ffcc945ecc05d0245a (patch)
tree6524cdfb5c71baedefb14882f44f22d12246d2c1 /plugins/PluginUpdater
parent79e0cd73cc37cd26df6957df584c1c12e61d7dc2 (diff)
PluginUpdater: Detect update source from core version if there is no or unknown value set; version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@10389 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/PluginUpdater')
-rw-r--r--plugins/PluginUpdater/src/Common.h1
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp44
-rw-r--r--plugins/PluginUpdater/src/Version.h2
3 files changed, 32 insertions, 15 deletions
diff --git a/plugins/PluginUpdater/src/Common.h b/plugins/PluginUpdater/src/Common.h
index 6c52978a0f..3c7bd6d7c4 100644
--- a/plugins/PluginUpdater/src/Common.h
+++ b/plugins/PluginUpdater/src/Common.h
@@ -119,6 +119,7 @@ struct PlugOptions
#define UPDATE_MODE_STABLE 1
#define UPDATE_MODE_TRUNK 2
#define UPDATE_MODE_TRUNK_SYMBOLS 3
+#define UPDATE_MODE_MAX_VALUE 3 // when adding new mode, increment this number
#define POPUP_TYPE_MSG 0
#define POPUP_TYPE_ERROR 1
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index db6f432e29..b3fa6e2df2 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -147,22 +147,38 @@ TCHAR* GetDefaultUrl()
#if MIRANDA_VER < 0x0A00
return mir_tstrdup(_T("http://miranda-ng.org/distr/deprecated/0.94.9/x%platform%"));
#else
- // If "UpdateMode" is missing, try to use "UpdateURL" directly
- BYTE UpdateMode = db_get_b(NULL,MODNAME,"UpdateMode",UPDATE_MODE_CUSTOM);
- if (UpdateMode==UPDATE_MODE_STABLE)
- return mir_tstrdup(_T(DEFAULT_UPDATE_URL));
- else if (UpdateMode==UPDATE_MODE_TRUNK)
- return mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK));
- else if (UpdateMode==UPDATE_MODE_TRUNK_SYMBOLS)
- return mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
- else {
- TCHAR *result = db_get_tsa(NULL, MODNAME, "UpdateURL");
- if (result == NULL) { // URL is not set
- db_set_b(NULL,MODNAME,"UpdateMode",UPDATE_MODE_STABLE);
- result = mir_tstrdup( _T(DEFAULT_UPDATE_URL));
+ int UpdateMode = db_get_b(NULL, MODNAME, "UpdateMode", -1);
+
+ TCHAR *url = NULL;
+
+ // Check if there is url for custom mode
+ if (UpdateMode == UPDATE_MODE_CUSTOM) {
+ url = db_get_tsa(NULL, MODNAME, "UpdateMode");
+ if (url == NULL) {
+ // No url for custom mode, reset that setting so it will be determined automatically
+ db_unset(NULL, MODNAME, "UpdateMode");
+ UpdateMode = -1;
}
- return result;
}
+
+ if (UpdateMode < 0 || UpdateMode > UPDATE_MODE_MAX_VALUE) {
+ // Missing or unknown mode, determine correct from version of running core
+ char coreVersion[512];
+ CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)SIZEOF(coreVersion), (LPARAM)coreVersion);
+ UpdateMode = (strstr(coreVersion, "alpha") == NULL) ? UPDATE_MODE_STABLE : UPDATE_MODE_TRUNK;
+ }
+
+ if (UpdateMode == UPDATE_MODE_STABLE) {
+ url = mir_tstrdup(_T(DEFAULT_UPDATE_URL));
+ } else if (UpdateMode == UPDATE_MODE_TRUNK) {
+ url = mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK));
+ } else if (UpdateMode == UPDATE_MODE_TRUNK_SYMBOLS) {
+ url = mir_tstrdup(_T(DEFAULT_UPDATE_URL_TRUNK_SYMBOLS));
+ } else if (UpdateMode == UPDATE_MODE_CUSTOM) {
+ // url was loaded in the beginning, no need to load it again
+ }
+
+ return url;
#endif
}
diff --git a/plugins/PluginUpdater/src/Version.h b/plugins/PluginUpdater/src/Version.h
index bb4ff2248e..f498bab3d7 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 2
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>