diff --git a/aegisub/src/config/config_windows0.h b/aegisub/src/config/config_windows0.h index 591661751..0bc6e88d7 100644 --- a/aegisub/src/config/config_windows0.h +++ b/aegisub/src/config/config_windows0.h @@ -112,6 +112,18 @@ //#define FINAL_RELEASE +// Specify tags the update checker accepts +// See for details on tags. +// Depending on who will be using your build, you may or may not want to have the +// "source" tag in here. If the string is empty, the update checker will reject any +// update offered. +#if defined(_M_IX86) +# define UPDATE_CHECKER_ACCEPT_TAGS "windows source" +#elif defined(_M_X64) +# define UPDATE_CHECKER_ACCEPT_TAGS "win64 source" +#endif + + ///////////// NOT RECOMMENDED ///////////// diff --git a/aegisub/src/dialog_version_check.cpp b/aegisub/src/dialog_version_check.cpp index 3a2143b56..636784cbc 100644 --- a/aegisub/src/dialog_version_check.cpp +++ b/aegisub/src/dialog_version_check.cpp @@ -61,6 +61,7 @@ #include #include #include +#include #include #endif @@ -323,6 +324,17 @@ static wxString GetSystemLanguage() void AegisubVersionCheckerThread::DoCheck() { + std::set accept_tags; +#ifdef UPDATE_CHECKER_ACCEPT_TAGS + { + wxStringTokenizer tk(wxString(UPDATE_CHECKER_ACCEPT_TAGS, wxConvUTF8), _T(" ")); + while (tk.HasMoreTokens()) + { + accept_tags.insert(tk.GetNextToken()); + } + } +#endif + const wxString servername = _T("updates.aegisub.org"); const wxString base_updates_path = _T("/trunk"); @@ -344,7 +356,7 @@ void AegisubVersionCheckerThread::DoCheck() std::auto_ptr stream(http.GetInputStream(path)); if (stream.get() == 0) // check for null-pointer - throw VersionCheckError("Could not connect to updates server."); + throw VersionCheckError(STD_STR(_("Could not download from updates server."))); if (http.GetResponse() < 200 || http.GetResponse() >= 300) { const std::string str_err = STD_STR(wxString::Format(_("HTTP request failed, got HTTP response %d."), http.GetResponse())); @@ -367,7 +379,7 @@ void AegisubVersionCheckerThread::DoCheck() wxString line_type = parsed[0]; wxString line_revision = parsed[1]; - wxString line_platform = parsed[2]; + wxString line_tags_str = parsed[2]; wxString line_url = inline_string_decode(parsed[3]); wxString line_friendlyname = inline_string_decode(parsed[4]); wxString line_description = inline_string_decode(parsed[5]); @@ -378,24 +390,25 @@ void AegisubVersionCheckerThread::DoCheck() continue; } - // check if the OS is right - wxOperatingSystemId osid = wxGetOsVersion(); - if (line_platform == _T("windows") && !(osid & wxOS_WINDOWS_NT)) + // check if the tags match + if (line_tags_str.IsEmpty() || line_tags_str == _T("all")) { - continue; + // looking good } - if (line_platform == _T("mac") && !(osid & wxOS_MAC_OSX_DARWIN)) + else { - continue; - } - if (line_platform == _T("source") && (osid & wxOS_WINDOWS_NT || osid & wxOS_MAC_OSX_DARWIN)) - { - // TODO: support interested-in-source-releases flag - continue; - } - if (!(line_platform == _T("windows") || line_platform == _T("mac") || line_platform == _T("source") || line_platform == _T("all"))) - { - continue; + bool accepts_all_tags = true; + wxStringTokenizer tk(line_tags_str, _T(" ")); + while (tk.HasMoreTokens()) + { + if (accept_tags.find(tk.GetNextToken()) == accept_tags.end()) + { + accepts_all_tags = false; + break; + } + } + if (!accepts_all_tags) + continue; } if (line_type == _T("upgrade") || line_type == _T("bugfix"))