diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-05-25 14:13:26 -0700 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-05-25 14:13:26 -0700 |
commit | 94945f996a689f24d1b553d400e681246459de63 (patch) | |
tree | 64377d2a8a46a088cadf0bff1a4661a84095d53a /indra | |
parent | 5769670cd1dc2cca68f1f890df644d25dd82b3b9 (diff) |
Report abuse floater updated for display names compatibility
reviewed by James
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloaterreporter.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llfloaterreporter.h | 6 | ||||
-rw-r--r-- | indra/newview/llinspectavatar.cpp | 26 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_report_abuse.xml | 1 |
4 files changed, 40 insertions, 49 deletions
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index bdaf036d0e..021c18fe04 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -39,6 +39,7 @@ // linden library includes #include "llassetstorage.h" +#include "llavatarnamecache.h" #include "llcachename.h" #include "llfontgl.h" #include "llimagej2c.h" @@ -183,9 +184,8 @@ BOOL LLFloaterReporter::postBuild() childSetAction("cancel_btn", onClickCancel, this); // grab the user's name - std::string fullname; - LLAgentUI::buildFullname(fullname); - childSetText("reporter_field", fullname); + std::string reporter = LLSLURL("agent", gAgent.getID(), "inspect").getSLURLString(); + childSetText("reporter_field", reporter); center(); @@ -268,21 +268,7 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) if (objectp->isAvatar()) { - // we have the information we need - std::string object_owner; - - LLNameValue* firstname = objectp->getNVPair("FirstName"); - LLNameValue* lastname = objectp->getNVPair("LastName"); - if (firstname && lastname) - { - object_owner = LLCacheName::buildFullName( - firstname->getString(), lastname->getString()); - } - else - { - object_owner.append("Unknown"); - } - setFromAvatar(mObjectID, object_owner); + setFromAvatarID(mObjectID); } else { @@ -309,11 +295,11 @@ void LLFloaterReporter::onClickSelectAbuser() gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE )); } -void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids) +void LLFloaterReporter::callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names) { if (ids.empty() || names.empty()) return; - childSetText("abuser_name_edit", names[0] ); + childSetText("abuser_name_edit", names[0].getNameAndSLID()); mAbuserID = ids[0]; @@ -321,18 +307,27 @@ void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, } -void LLFloaterReporter::setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name) +void LLFloaterReporter::setFromAvatarID(const LLUUID& avatar_id) { mAbuserID = mObjectID = avatar_id; - mOwnerName = avatar_name; - - std::string avatar_link = - LLSLURL("agent", mObjectID, "inspect").getSLURLString(); + std::string avatar_link = LLSLURL("agent", mObjectID, "inspect").getSLURLString(); childSetText("owner_name", avatar_link); - childSetText("object_name", avatar_name); - childSetText("abuser_name_edit", avatar_name); + + LLAvatarNameCache::get(avatar_id, boost::bind(&LLFloaterReporter::onAvatarNameCache, this, _1, _2)); } +void LLFloaterReporter::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) +{ + if (mObjectID == avatar_id) + { + mOwnerName = av_name.getNameAndSLID(); + childSetText("object_name", av_name.getNameAndSLID()); + childSetToolTip("object_name", av_name.getNameAndSLID()); + childSetText("abuser_name_edit", av_name.getNameAndSLID()); + } +} + + // static void LLFloaterReporter::onClickSend(void *userdata) { @@ -472,16 +467,11 @@ void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_ { LLFloaterReporter* f = LLFloaterReg::showTypedInstance<LLFloaterReporter>("reporter"); - // grab the user's name - std::string fullname; - LLAgentUI::buildFullname(fullname); - f->childSetText("reporter_field", fullname); - if (avatar_name.empty()) // Request info for this object f->getObjectInfo(object_id); else - f->setFromAvatar(object_id, avatar_name); + f->setFromAvatarID(object_id); // Need to deselect on close f->mDeselectOnClose = TRUE; diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 23784b7650..1f8526b1de 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -38,6 +38,7 @@ #include "lluuid.h" #include "v3math.h" +class LLAvatarName; class LLMessageSystem; class LLViewerTexture; class LLInventoryItem; @@ -123,8 +124,9 @@ private: void setPosBox(const LLVector3d &pos); void enableControls(BOOL own_avatar); void getObjectInfo(const LLUUID& object_id); - void callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids); - void setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name = LLStringUtil::null); + void callbackAvatarID(const uuid_vec_t& ids, const std::vector<LLAvatarName> names); + void setFromAvatarID(const LLUUID& avatar_id); + void onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name); private: EReportType mReportType; diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index c4144c9844..3126676871 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -150,7 +150,7 @@ private: private: LLUUID mAvatarID; // Need avatar name information to spawn friend add request - std::string mLegacyName; + LLAvatarName mAvatarName; // an in-flight request for avatar properties from LLAvatarPropertiesProcessor // is represented by this object LLFetchAvatarData* mPropertiesRequest; @@ -205,7 +205,7 @@ public: LLInspectAvatar::LLInspectAvatar(const LLSD& sd) : LLInspect( LLSD() ), // single_instance, doesn't really need key mAvatarID(), // set in onOpen() *Note: we used to show partner's name but we dont anymore --angela 3rd Dec* - mLegacyName(), + mAvatarName(), mPropertiesRequest(NULL) { mCommitCallbackRegistrar.add("InspectAvatar.ViewProfile", boost::bind(&LLInspectAvatar::onClickViewProfile, this)); @@ -560,7 +560,7 @@ void LLInspectAvatar::updateVolumeSlider() LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn"); - bool is_linden = LLStringUtil::endsWith(mLegacyName, " Linden"); + bool is_linden = LLStringUtil::endsWith(mAvatarName.getLegacyName(), " Linden"); mute_btn->setEnabled( !is_linden); mute_btn->setValue( is_muted ); @@ -591,7 +591,7 @@ void LLInspectAvatar::onClickMuteVolume() LLMuteList* mute_list = LLMuteList::getInstance(); bool is_muted = mute_list->isMuted(mAvatarID, LLMute::flagVoiceChat); - LLMute mute(mAvatarID, mLegacyName, LLMute::AGENT); + LLMute mute(mAvatarID, mAvatarName.getLegacyName(), LLMute::AGENT); if (!is_muted) { mute_list->add(mute, LLMute::flagVoiceChat); @@ -618,13 +618,13 @@ void LLInspectAvatar::onAvatarNameCache( { getChild<LLUICtrl>("user_name")->setValue(av_name.mDisplayName); getChild<LLUICtrl>("user_slid")->setValue(av_name.mUsername); - mLegacyName = av_name.getLegacyName(); + mAvatarName = av_name; } } void LLInspectAvatar::onClickAddFriend() { - LLAvatarActions::requestFriendshipDialog(mAvatarID, mLegacyName); + LLAvatarActions::requestFriendshipDialog(mAvatarID, mAvatarName.getLegacyName()); closeFloater(); } @@ -692,7 +692,7 @@ void LLInspectAvatar::onClickShare() void LLInspectAvatar::onToggleMute() { - LLMute mute(mAvatarID, mLegacyName, LLMute::AGENT); + LLMute mute(mAvatarID, mAvatarName.getLegacyName(), LLMute::AGENT); if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName)) { @@ -709,7 +709,7 @@ void LLInspectAvatar::onToggleMute() void LLInspectAvatar::onClickReport() { - LLFloaterReporter::showFromAvatar(mAvatarID, mLegacyName); + LLFloaterReporter::showFromAvatar(mAvatarID, mAvatarName.getNameAndSLID()); closeFloater(); } @@ -733,17 +733,17 @@ void LLInspectAvatar::onClickZoomIn() void LLInspectAvatar::onClickFindOnMap() { - gFloaterWorldMap->trackAvatar(mAvatarID, mLegacyName); + gFloaterWorldMap->trackAvatar(mAvatarID, mAvatarName.getLegacyName()); LLFloaterReg::showInstance("world_map"); } bool LLInspectAvatar::enableMute() { - bool is_linden = LLStringUtil::endsWith(mLegacyName, " Linden"); + bool is_linden = LLStringUtil::endsWith(mAvatarName.getLegacyName(), " Linden"); bool is_self = mAvatarID == gAgent.getID(); - if (!is_linden && !is_self && !LLMuteList::getInstance()->isMuted(mAvatarID, mLegacyName)) + if (!is_linden && !is_self && !LLMuteList::getInstance()->isMuted(mAvatarID, mAvatarName.getLegacyName())) { return true; } @@ -755,10 +755,10 @@ bool LLInspectAvatar::enableMute() bool LLInspectAvatar::enableUnmute() { - bool is_linden = LLStringUtil::endsWith(mLegacyName, " Linden"); + bool is_linden = LLStringUtil::endsWith(mAvatarName.getLegacyName(), " Linden"); bool is_self = mAvatarID == gAgent.getID(); - if (!is_linden && !is_self && LLMuteList::getInstance()->isMuted(mAvatarID, mLegacyName)) + if (!is_linden && !is_self && LLMuteList::getInstance()->isMuted(mAvatarID, mAvatarName.getLegacyName())) { return true; } diff --git a/indra/newview/skins/default/xui/en/floater_report_abuse.xml b/indra/newview/skins/default/xui/en/floater_report_abuse.xml index 21c0bfef48..47383c8010 100644 --- a/indra/newview/skins/default/xui/en/floater_report_abuse.xml +++ b/indra/newview/skins/default/xui/en/floater_report_abuse.xml @@ -373,7 +373,6 @@ height="23" layout="topleft" left_delta="0" - max_length="32" name="abuser_name_edit" top_pad="0" width="195" /> |