From 4d296c19e55b779051984d8d4dd3df780e768317 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 27 Dec 2010 21:47:06 +0200 Subject: STORM-242 FIXED Fixed incorrect release notes URL in the "You just entered a region using a different server version" notification. --- indra/newview/app_settings/settings.xml | 11 +++++++ indra/newview/llviewermessage.cpp | 55 ++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 21 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index b3324ea6c6..0ca4272b23 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12423,5 +12423,16 @@ Value name + ReleaseNotesURL + + Comment + Release notes URL template + Persist + 1 + Type + String + Value + http://secondlife.com/app/releasenotes/?channel=[CHANNEL]&version=[VERSION] + diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 7313463f1b..5e198a7578 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -171,6 +171,29 @@ 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& e) + { + return false; + } + } + + return true; +} + bool friendship_offer_callback(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); @@ -3825,28 +3848,18 @@ 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 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 - { - url += s_vect[i].substr(0,4); - } + // The capability hasn't arrived yet or is not supported, + // fall back to parsing server version channel. + std::string channel, ver; + llassert(parse_version_info(version_channel, channel, ver) == true); + url = gSavedSettings.getString("ReleaseNotesURL"); + LLSD args; + args["CHANNEL"] = LLWeb::escapeURL(channel); + args["VERSION"] = LLWeb::escapeURL(ver); + LLStringUtil::format(url, args); } LLSD args; -- cgit v1.2.3 From d790003055a0b2127278715ae94c8261b95f3f15 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 28 Dec 2010 14:30:52 +0200 Subject: STORM-242 ADDITIONAL_FIX Fixed release build and error handling. --- indra/newview/llviewermessage.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 5e198a7578..88c841468b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -189,9 +189,11 @@ static bool parse_version_info(const std::string& version_info, std::string& cha { return false; } + + return true; } - return true; + return false; } bool friendship_offer_callback(const LLSD& notification, const LLSD& response) @@ -3854,7 +3856,11 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) // The capability hasn't arrived yet or is not supported, // fall back to parsing server version channel. std::string channel, ver; - llassert(parse_version_info(version_channel, channel, ver) == true); + if (!parse_version_info(version_channel, channel, ver)) + { + llwarns << "Failed to parse server version channel (" << version_channel << ")" << llendl; + } + url = gSavedSettings.getString("ReleaseNotesURL"); LLSD args; args["CHANNEL"] = LLWeb::escapeURL(channel); -- cgit v1.2.3 From e4336b63b691584df5a429fc5cdeb470b1a5c48b Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Tue, 28 Dec 2010 19:01:57 +0200 Subject: STORM-242 ADDITIONAL_FIX One more build fix... --- indra/newview/llviewermessage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 88c841468b..7dc5d96689 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -185,7 +185,7 @@ static bool parse_version_info(const std::string& version_info, std::string& cha ver = version_info.substr(last_space + 1); channel.replace(last_space, ver.length() + 1, ""); // strip version } - catch (std::out_of_range& e) + catch (std::out_of_range) { return false; } -- cgit v1.2.3