From e54e9b4eed615f98f1e1fd167178b6d75c3fda43 Mon Sep 17 00:00:00 2001 From: Joshua Bell <josh@lindenlab.com> Date: Wed, 11 May 2011 17:36:11 -0700 Subject: WIP: viewer side of ER-864: Include message ids and args in login.cgi responses * Look for message_id and message_args in XMLRPC response, look up localized string in strings.xml * Support sub-maps in XMLRPC response conversion to LLSD * Explicitly request extended error info during login (since including sub-maps breaks older viewers) * Support LLSD-based substitutions in LLTrans::getString/findString --- indra/llxuixml/lltrans.cpp | 50 +++++++++++++++++++++++++++++++------- indra/llxuixml/lltrans.h | 4 +++ indra/newview/lllogininstance.cpp | 1 + indra/newview/llstartup.cpp | 37 +++++++++++++++++----------- indra/newview/llxmlrpclistener.cpp | 7 ++++++ 5 files changed, 76 insertions(+), 23 deletions(-) diff --git a/indra/llxuixml/lltrans.cpp b/indra/llxuixml/lltrans.cpp index e13d73c640..7619e4b7ac 100644 --- a/indra/llxuixml/lltrans.cpp +++ b/indra/llxuixml/lltrans.cpp @@ -30,6 +30,7 @@ #include "llfasttimer.h" // for call count statistics #include "llxuiparser.h" +#include "llsd.h" #include <map> @@ -154,13 +155,28 @@ std::string LLTrans::getString(const std::string &xml_desc, const LLStringUtil:: } else { - LLSD args; - args["STRING_NAME"] = xml_desc; LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; + return "MissingString("+xml_desc+")"; + } +} - //LLNotificationsUtil::add("MissingString", args); // *TODO: resurrect - //return xml_desc; +//static +std::string LLTrans::getString(const std::string &xml_desc, const LLSD& msg_args) +{ + // Don't care about time as much as call count. Make sure we're not + // calling LLTrans::getString() in an inner loop. JC + LLFastTimer timer(FTM_GET_TRANS); + template_map_t::iterator iter = sStringTemplates.find(xml_desc); + if (iter != sStringTemplates.end()) + { + std::string text = iter->second.mText; + LLStringUtil::format(text, msg_args); + return text; + } + else + { + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; return "MissingString("+xml_desc+")"; } } @@ -182,11 +198,27 @@ bool LLTrans::findString(std::string &result, const std::string &xml_desc, const } else { - LLSD args; - args["STRING_NAME"] = xml_desc; - LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; - //LLNotificationsUtil::add("MissingString", args); - + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; + return false; + } +} + +//static +bool LLTrans::findString(std::string &result, const std::string &xml_desc, const LLSD& msg_args) +{ + LLFastTimer timer(FTM_GET_TRANS); + + template_map_t::iterator iter = sStringTemplates.find(xml_desc); + if (iter != sStringTemplates.end()) + { + std::string text = iter->second.mText; + LLStringUtil::format(text, msg_args); + result = text; + return true; + } + else + { + LL_WARNS_ONCE("configuration") << "Missing String in strings.xml: [" << xml_desc << "]" << LL_ENDL; return false; } } diff --git a/indra/llxuixml/lltrans.h b/indra/llxuixml/lltrans.h index 5b127b53cf..63f7d431d3 100644 --- a/indra/llxuixml/lltrans.h +++ b/indra/llxuixml/lltrans.h @@ -32,6 +32,8 @@ #include "llstring.h" #include "llxmlnode.h" +class LLSD; + /** * @brief String template loaded from strings.xml */ @@ -72,7 +74,9 @@ public: * @returns Translated string */ static std::string getString(const std::string &xml_desc, const LLStringUtil::format_map_t& args); + static std::string getString(const std::string &xml_desc, const LLSD& args); static bool findString(std::string &result, const std::string &xml_desc, const LLStringUtil::format_map_t& args); + static bool findString(std::string &result, const std::string &xml_desc, const LLSD& args); // Returns translated string with [COUNT] replaced with a number, following // special per-language logic for plural nouns. For example, some languages diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 36c5d12897..00de6a86e1 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -608,6 +608,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia request_params["channel"] = LLVersionInfo::getChannel(); request_params["id0"] = mSerialNumber; request_params["host_id"] = gSavedSettings.getString("HostID"); + request_params["extended_errors"] = true; // request message_id and message_args mRequestData.clear(); mRequestData["method"] = "login_to_simulator"; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ca908ef822..ee18c37558 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -995,6 +995,7 @@ bool idle_startup() if(STATE_LOGIN_PROCESS_RESPONSE == LLStartUp::getStartupState()) { + // Generic failure message std::ostringstream emsg; emsg << LLTrans::getString("LoginFailed") << "\n"; if(LLLoginInstance::getInstance()->authFailure()) @@ -1003,24 +1004,32 @@ bool idle_startup() << LLLoginInstance::getInstance()->getResponse() << LL_ENDL; LLSD response = LLLoginInstance::getInstance()->getResponse(); // Still have error conditions that may need some - // sort of handling. + // sort of handling - dig up specific message std::string reason_response = response["reason"]; std::string message_response = response["message"]; - - if(!message_response.empty()) + std::string message_id = response["message_id"]; + std::string message; // actual string to show the user + + if(!message_id.empty() && LLTrans::findString(message, message_id, response["message_args"])) { - // XUI: fix translation for strings returned during login - // We need a generic table for translations - std::string big_reason = LLAgent::sTeleportErrorMessages[ message_response ]; - if ( big_reason.size() == 0 ) - { - emsg << message_response; - } - else - { - emsg << big_reason; - } + // message will be populated with the templated string } + else if(!message_response.empty()) + { + // *HACK: "no_inventory_host" sent as the message itself. + // Remove this clause when server is sending message_id as well. + message = LLAgent::sTeleportErrorMessages[ message_response ]; + } + + if (message.empty()) + { + // Fallback to server-supplied string; necessary since server + // may add strings that this viewer is not yet aware of + message = message_response; + } + + emsg << message; + if(reason_response == "key") { diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp index 2596f239ca..97a9eb7f5f 100644 --- a/indra/newview/llxmlrpclistener.cpp +++ b/indra/newview/llxmlrpclistener.cpp @@ -499,6 +499,13 @@ private: // 'array' as the value of this 'key'. responses.insert(key, array); } + else if (xmlrpc_type_struct == type) + { + LLSD submap = parseValues(status_string, + STRINGIZE(key_pfx << key << ':'), + current); + responses.insert(key, submap); + } else { // whoops - unrecognized type -- cgit v1.2.3 From f440cd4af6cb7cd791e5f0eddb8dc9b99a37e0b0 Mon Sep 17 00:00:00 2001 From: Joshua Bell <josh@lindenlab.com> Date: Mon, 16 May 2011 10:08:09 -0700 Subject: WIP viewer side of ER-864: comment change --- indra/newview/llstartup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ee18c37558..2560320257 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1012,7 +1012,7 @@ bool idle_startup() if(!message_id.empty() && LLTrans::findString(message, message_id, response["message_args"])) { - // message will be populated with the templated string + // message will be filled in with the template and arguments } else if(!message_response.empty()) { -- cgit v1.2.3 From 6c61e85fc4c421376eb53b16461ab3d83b42f340 Mon Sep 17 00:00:00 2001 From: Joshua Bell <josh@lindenlab.com> Date: Mon, 16 May 2011 14:14:24 -0700 Subject: VWR-22299 Error strings for login failure conditions --- indra/newview/skins/default/xui/en/strings.xml | 77 ++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index b0ede60fa0..56580b13da 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -58,6 +58,83 @@ <string name="Quit">Quit</string> <string name="create_account_url">http://join.secondlife.com/</string> + <string name="LoginFailedViewerNotPermitted"> +The viewer you are using can no longer access Second Life. Please visit the following page to download a new viewer: +http://secondlife.com/download + +For more information, see our FAQ below: +http://secondlife.com/viewer-access-faq</string> + <string name="LoginIntermediateOptionalUpdateAvailable">Optional viewer update available: [VERSION]</string> + <string name="LoginFailedRequiredUpdate">Required viewer update: [VERSION]</string> + <string name="LoginFailedAlreadyLoggedIn">This agent is already logged in. +</string> + <string name="LoginFailedAuthenticationFailed">Sorry! We couldn't log you in. +Please check to make sure you entered the right + * Username (like bobsmith12 or steller.sunshine) + * Password +Also, please make sure your Caps Lock key is off.</string> + <string name="LoginFailedPasswordChanged">As a security precaution your password has been changed. +Please go to your account page at http://secondlife.com/password +and answer the security question to reset your password. +We are very sorry for the inconvenience.</string> + <string name="LoginFailedPasswordReset">We made some changes to our system and you will need to reset your password. +Please go to your account page at http://secondlife.com/password +and answer the security question to reset your password. +We are very sorry for the inconvenience.</string> + <string name="LoginFailedEmployeesOnly">Second Life is temporarily closed for maintenance. +Logins are currently restricted to employees only. +Check www.secondlife.com/status for updates.</string> + <string name="LoginFailedPremiumOnly">Second Life logins are temporarily restricted in order to make sure that those in-world have the best possible experience. + +People with free accounts will not be able to access Second Life during this time, to make room for those who have paid for Second Life.</string> + <string name="LoginFailedComputerProhibited">Second Life cannot be accessed from this computer. +If you feel this is an error, please contact +support@secondlife.com.</string> + <string name="LoginFailedAcountSuspended">Your account is not accessible until +[TIME] Pacific Time.</string> + <string name="LoginFailedAccountDisabled">We are unable to complete your request at this time. +Please contact Second Life support for assistance at http://secondlife.com/support. +If you are unable to change your password, please call (866) 476-9763.</string> + <string name="LoginFailedTransformError">Data inconsistency found during login. +Please contact support@secondlife.com.</string> + <string name="LoginFailedAccountMaintenance">Your account is undergoing minor maintenance. +Your account is not accessible until +[TIME] Pacific Time. +If you feel this is an error, please contact support@secondlife.com.</string> + <string name="LoginFailedPendingLogoutFault">Request for logout responded with a fault from simulator.</string> + <string name="LoginFailedPendingLogout">The system is logging you out right now. +Your Account will not be available until +[TIME] Pacific Time.</string> + <string name="LoginFailedUnableToCreateSession">Unable to create valid session.</string> + <string name="LoginFailedUnableToConnectToSimulator">Unable to connect to a simulator.</string> + <string name="LoginFailedRestrictedHours">Your account can only access Second Life +between [START] and [END] Pacific Time. +Please come back during those hours. +If you feel this is an error, please contact support@secondlife.com.</string> + <string name="LoginFailedIncorrectParameters">Incorrect parameters. +If you feel this is an error, please contact support@secondlife.com.</string> + <string name="LoginFailedFirstNameNotAlphanumeric">First name parameter must be alphanumeric. +If you feel this is an error, please contact support@secondlife.com.</string> + <string name="LoginFailedLastNameNotAlphanumeric">Last name parameter must be alphanumeric. +If you feel this is an error, please contact support@secondlife.com.</string> + <string name="LogoutFailedRegionGoingOffline">Region is going offline. +Please try logging in again in a minute.</string> + <string name="LogoutFailedAgentNotInRegion">Agent not in region. +Please try logging in again in a minute.</string> + <string name="LogoutFailedPendingLogin">The region was logging in another session. +Please try logging in again in a minute.</string> + <string name="LogoutFailedLoggingOut">The region was logging out the previous session. +Please try logging in again in a minute.</string> + <string name="LogoutFailedStillLoggingOut">The region is still logging out the previous session. +Please try logging in again in a minute.</string> + <string name="LogoutSucceeded">Region has logged out last session. +Please try logging in again in a minute.</string> + <string name="LogoutFailedLogoutBegun">Region has begun the logout process. +Please try logging in again in a minute.</string> + <string name="LoginFailedLoggingOutSession">The system has begun logging out your last session. +Please try logging in again in a minute.</string> + + <!-- Disconnection --> <string name="AgentLostConnection">This region may be experiencing trouble. Please check your connection to the Internet.</string> <string name="SavingSettings">Saving your settings...</string> -- cgit v1.2.3