diff options
author | Merov Linden <merov@lindenlab.com> | 2010-12-28 13:21:58 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2010-12-28 13:21:58 -0800 |
commit | 087c105317058dc3a011c937a5aceaf87fdecc26 (patch) | |
tree | 0a3c334d5d1f610eaf4c4c8529c516c9d5c6de96 | |
parent | 5b52a801c6dd31bf6eabd5e995a74dd96866223c (diff) | |
parent | e4336b63b691584df5a429fc5cdeb470b1a5c48b (diff) |
STORM-242 : pull into viewer-development
-rw-r--r-- | indra/newview/app_settings/settings.xml | 11 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 57 |
2 files changed, 49 insertions, 19 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b9833b6592..ea7ac6beda 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12434,5 +12434,16 @@ <key>Value</key> <string>name</string> </map> + <key>ReleaseNotesURL</key> + <map> + <key>Comment</key> + <string>Release notes URL template</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>String</string> + <key>Value</key> + <string>http://secondlife.com/app/releasenotes/?channel=[CHANNEL]&version=[VERSION]</string> + </map> </map> </llsd> diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7313463f1b..7dc5d96689 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -171,6 +171,31 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = FALSE // ControlYourCamera }; +// Extract channel and version from a string like "SL Web Viewer Beta 10.11.29.215604". +// (channel: "SL Web Viewer Beta", version: "10.11.29.215604") +static bool parse_version_info(const std::string& version_info, std::string& channel, std::string& ver) +{ + size_t last_space = version_info.rfind(" "); + channel = version_info; + + if (last_space != std::string::npos) + { + try + { + ver = version_info.substr(last_space + 1); + channel.replace(last_space, ver.length() + 1, ""); // strip version + } + catch (std::out_of_range) + { + return false; + } + + return true; + } + + return false; +} + bool friendship_offer_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -3825,28 +3850,22 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) if (!gLastVersionChannel.empty()) { - // work out the URL for this server's Release Notes - std::string url ="http://wiki.secondlife.com/wiki/Release_Notes/"; - std::string server_version = version_channel; - std::vector<std::string> s_vect; - boost::algorithm::split(s_vect, server_version, isspace); - for(U32 i = 0; i < s_vect.size(); i++) + std::string url = regionp->getCapability("ServerReleaseNotes"); + if (url.empty()) { - if (i != (s_vect.size() - 1)) - { - if(i != (s_vect.size() - 2)) - { - url += s_vect[i] + "_"; - } - else - { - url += s_vect[i] + "/"; - } - } - else + // The capability hasn't arrived yet or is not supported, + // fall back to parsing server version channel. + std::string channel, ver; + if (!parse_version_info(version_channel, channel, ver)) { - url += s_vect[i].substr(0,4); + llwarns << "Failed to parse server version channel (" << version_channel << ")" << llendl; } + + url = gSavedSettings.getString("ReleaseNotesURL"); + LLSD args; + args["CHANNEL"] = LLWeb::escapeURL(channel); + args["VERSION"] = LLWeb::escapeURL(ver); + LLStringUtil::format(url, args); } LLSD args; |