summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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>