diff options
author | Eugene Mutavchi <emutavchi@productengine.com> | 2010-04-23 21:52:18 +0300 |
---|---|---|
committer | Eugene Mutavchi <emutavchi@productengine.com> | 2010-04-23 21:52:18 +0300 |
commit | d0204a2b149462371ee20725067e43b018c485bb (patch) | |
tree | c080737d3dc87cb8ea673ba5d351463d2c73154a /indra/newview | |
parent | c540ef450a2567b18174f8bbe7c115a52c63b743 (diff) |
Related to normal bug EXT-6302 (TP requests need to display destination region maturity) - added displaying maturity rating with an icon.
Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/229/.
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llviewermessage.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llviewerregion.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llviewerregion.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 2 |
4 files changed, 54 insertions, 14 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index ba0c8d464d..e12457550a 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1933,7 +1933,7 @@ protected: } }; -static void parse_lure_bucket(const std::string& bucket, +static bool parse_lure_bucket(const std::string& bucket, U64& region_handle, LLVector3& pos, LLVector3& look_at, @@ -1945,15 +1945,25 @@ static void parse_lure_bucket(const std::string& bucket, tokenizer tokens(bucket, sep); tokenizer::iterator iter = tokens.begin(); - S32 gx = boost::lexical_cast<S32>((*(iter)).c_str()); - S32 gy = boost::lexical_cast<S32>((*(++iter)).c_str()); - S32 rx = boost::lexical_cast<S32>((*(++iter)).c_str()); - S32 ry = boost::lexical_cast<S32>((*(++iter)).c_str()); - S32 rz = boost::lexical_cast<S32>((*(++iter)).c_str()); - S32 lx = boost::lexical_cast<S32>((*(++iter)).c_str()); - S32 ly = boost::lexical_cast<S32>((*(++iter)).c_str()); - S32 lz = boost::lexical_cast<S32>((*(++iter)).c_str()); - + S32 gx,gy,rx,ry,rz,lx,ly,lz; + try + { + gx = boost::lexical_cast<S32>((*(iter)).c_str()); + gy = boost::lexical_cast<S32>((*(++iter)).c_str()); + rx = boost::lexical_cast<S32>((*(++iter)).c_str()); + ry = boost::lexical_cast<S32>((*(++iter)).c_str()); + rz = boost::lexical_cast<S32>((*(++iter)).c_str()); + lx = boost::lexical_cast<S32>((*(++iter)).c_str()); + ly = boost::lexical_cast<S32>((*(++iter)).c_str()); + lz = boost::lexical_cast<S32>((*(++iter)).c_str()); + } + catch( boost::bad_lexical_cast& ) + { + LL_WARNS("parse_lure_bucket") + << "Couldn't parse lure bucket." + << LL_ENDL; + return false; + } // Grab region access region_access = SIM_ACCESS_MIN; if (++iter != tokens.end()) @@ -1978,6 +1988,7 @@ static void parse_lure_bucket(const std::string& bucket, look_at.setVec((F32)lx, (F32)ly, (F32)lz); region_handle = to_region_handle(gx, gy); + return true; } void process_improved_im(LLMessageSystem *msg, void **user_data) @@ -2615,15 +2626,21 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) U64 region_handle; U8 region_access; std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size); - parse_lure_bucket(region_info, region_handle, pos, look_at, region_access); + std::string region_access_str = LLStringUtil::null; + std::string region_access_icn = LLStringUtil::null; - std::string region_access_str = LLViewerRegion::accessToString(region_access); + if (parse_lure_bucket(region_info, region_handle, pos, look_at, region_access)) + { + region_access_str = LLViewerRegion::accessToString(region_access); + region_access_icn = LLViewerRegion::getAccessIcon(region_access); + } LLSD args; // *TODO: Translate -> [FIRST] [LAST] (maybe) args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about"); args["MESSAGE"] = message; - args["MATURITY"] = region_access_str; + args["MATURITY_STR"] = region_access_str; + args["MATURITY_ICON"] = region_access_icn; LLSD payload; payload["from_id"] = from_id; payload["lure_id"] = session_id; diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 07d4ac664f..c48668df9a 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -627,6 +627,26 @@ std::string LLViewerRegion::accessToString(U8 sim_access) } // static +std::string LLViewerRegion::getAccessIcon(U8 sim_access) +{ + switch(sim_access) + { + case SIM_ACCESS_MATURE: + return "Parcel_M_Dark"; + + case SIM_ACCESS_ADULT: + return "Parcel_R_Light"; + + case SIM_ACCESS_PG: + return "Parcel_PG_Light"; + + case SIM_ACCESS_MIN: + default: + return ""; + } +} + +// static std::string LLViewerRegion::accessToShortString(U8 sim_access) { switch(sim_access) /* Flawfinder: ignore */ diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index 49d0900f2a..5c4d5a61fd 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -203,6 +203,9 @@ public: // Returns "M", "PG", "A" etc. static std::string accessToShortString(U8 sim_access); + + // Return access icon name + static std::string getAccessIcon(U8 sim_access); // helper function which just makes sure all interested parties // can process the message. diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 5d184fea3a..4479a3dd4d 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5168,7 +5168,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th type="offer"> [NAME_SLURL] has offered to teleport you to their location: -[MESSAGE], ([MATURITY]) +[MESSAGE] - [MATURITY_STR] <icon>[MATURITY_ICON]</icon> <form name="form"> <button index="0" |