From e54e9b4eed615f98f1e1fd167178b6d75c3fda43 Mon Sep 17 00:00:00 2001 From: Joshua Bell 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/newview/llstartup.cpp | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'indra/newview/llstartup.cpp') 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") { -- cgit v1.2.3 From f440cd4af6cb7cd791e5f0eddb8dc9b99a37e0b0 Mon Sep 17 00:00:00 2001 From: Joshua Bell 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(-) (limited to 'indra/newview/llstartup.cpp') 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