summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorJoshua Bell <josh@lindenlab.com>2011-05-11 17:36:11 -0700
committerJoshua Bell <josh@lindenlab.com>2011-05-11 17:36:11 -0700
commite54e9b4eed615f98f1e1fd167178b6d75c3fda43 (patch)
tree8b5fae60b5d1cb9123fd86ad99cb9184545cfc13 /indra/newview
parenta5118ccd6721afdf4f8c71cba6007eb7be4d7c19 (diff)
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
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lllogininstance.cpp1
-rw-r--r--indra/newview/llstartup.cpp37
-rw-r--r--indra/newview/llxmlrpclistener.cpp7
3 files changed, 31 insertions, 14 deletions
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