diff options
author | James Cook <james@lindenlab.com> | 2010-03-30 16:42:00 -0700 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2010-03-30 16:42:00 -0700 |
commit | 8a702f9493d764d133ff2c62168c1c3503dde56c (patch) | |
tree | 32fbbf56a8d3250eac4174ac2bfad035da09577d /indra | |
parent | be58f87ebb20bc2ef0057cb787b52fb279a702c3 (diff) |
Work-in-progress localization/name fixup for object returns
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewermessage.cpp | 89 |
1 files changed, 66 insertions, 23 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ffe638dfbf..07288dc96f 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1717,21 +1717,54 @@ static std::string clean_name_from_im(const std::string& name, EInstantMessage t } } -static std::string clean_name_from_task_im(const std::string& msg) +//static std::string clean_name_from_task_im(const std::string& msg) +//{ +// boost::smatch match; +// static const boost::regex returned_exp( +// "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); +// if (boost::regex_match(msg, match, returned_exp)) +// { +// // match objects are 1-based for groups +// std::string final = match[1].str(); +// std::string name = match[2].str(); +// final += LLCacheName::cleanFullName(name); +// final += match[3].str(); +// return final; +// } +// return msg; +//} + +static void parse_bucket_im_from_task(const std::string& bucket, + const LLUUID& from_id, + BOOL from_group, + const LLUUID& to_id, + const LLVector3& position, + const std::string& message, + std::string *object_slurl, + std::string *final_message) { - boost::smatch match; - static const boost::regex returned_exp( - "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); - if (boost::regex_match(msg, match, returned_exp)) - { - // match objects are 1-based for groups - std::string final = match[1].str(); - std::string name = match[2].str(); - final += LLCacheName::cleanFullName(name); - final += match[3].str(); - return final; - } - return msg; + static const std::string DEREZ_TO_OWNER = "|derezToOwner"; + if (bucket.compare(0, DEREZ_TO_OWNER.length(), DEREZ_TO_OWNER)) + { + // ...starts with special tag + // See simulator LLRoundRobin::derezObjectsBackToOwner() for details + typedef boost::tokenizer<boost::char_separator<char> > tokenizer; + boost::char_separator<char> sep("|"); + tokenizer tokens(bucket, sep); + tokenizer::iterator token_it = tokens.begin(); + //S32 destination_type; + //S32 object_count; + + // JAMESDEBUG TODO: HERE + *object_slurl = "JAMESDEBUG"; + *final_message = "JAMESDEBUG"; + } + else + { + // ...normal IM from task + *object_slurl = bucket; + *final_message = message; + } } void process_improved_im(LLMessageSystem *msg, void **user_data) @@ -2263,9 +2296,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) return; } - // Build a link to open the object IM info window. - std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1); - if (session_id.notNull()) { chat.mFromID = session_id; @@ -2280,18 +2310,31 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = from_id ^ gAgent.getSessionID(); } + // Build a link to open the object IM info window. + // Also handle localization for certain system messages + // sent as IM_FROM_TASK. + std::string object_slurl; + std::string final_message; + std::string bucket_im_from_task = + ll_safe_string((char*)binary_bucket, binary_bucket_size-1); + parse_bucket_im_from_task( + bucket_im_from_task, + from_id, from_group, to_id, position, message, + &object_slurl, &final_message); + if(SYSTEM_FROM == name) { // System's UUID is NULL (fixes EXT-4766) - chat.mFromID = from_id = LLUUID::null; + chat.mFromID = LLUUID::null; + from_id = LLUUID::null; } // IDEVO Some messages have embedded resident names - message = clean_name_from_task_im(message); + //message = clean_name_from_task_im(message); LLSD query_string; query_string["owner"] = from_id; - query_string["slurl"] = location; + query_string["slurl"] = object_slurl; query_string["name"] = name; if (from_group) { @@ -2312,7 +2355,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { LLSD args; args["owner_id"] = from_id; - args["slurl"] = location; + args["slurl"] = object_slurl; args["type"] = LLNotificationsUI::NT_NEARBYCHAT; LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); } @@ -2323,13 +2366,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLSD substitutions; substitutions["NAME"] = name; - substitutions["MSG"] = message; + substitutions["MSG"] = final_message; LLSD payload; payload["object_id"] = session_id; payload["owner_id"] = from_id; payload["from_id"] = from_id; - payload["slurl"] = location; + payload["slurl"] = object_slurl; payload["name"] = name; std::string session_name; gCacheName->getFullName(from_id, session_name); |