summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterreporter.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2010-10-15 16:41:30 -0400
committerOz Linden <oz@lindenlab.com>2010-10-15 16:41:30 -0400
commitba2300b8aeff30a64d3f34b0cd5c49aa890e0639 (patch)
treed7a7f4aa61d1b2bd28374e5c61f3d6730d450574 /indra/newview/llfloaterreporter.cpp
parenta8b5da9a70936923e650bd5c200276da49106784 (diff)
parent18321756297bd9b04a4204abe4fbb0e3e8112186 (diff)
pull fix for STORM-211
Diffstat (limited to 'indra/newview/llfloaterreporter.cpp')
-rw-r--r--indra/newview/llfloaterreporter.cpp62
1 files changed, 28 insertions, 34 deletions
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 66d7e804ea..c08848b1ea 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -33,6 +33,8 @@
// linden library includes
#include "llassetstorage.h"
+#include "llavatarnamecache.h"
+#include "llcachename.h"
#include "llfontgl.h"
#include "llimagej2c.h"
#include "llinventory.h"
@@ -175,9 +177,8 @@ BOOL LLFloaterReporter::postBuild()
childSetAction("cancel_btn", onClickCancel, this);
// grab the user's name
- std::string fullname;
- LLAgentUI::buildFullname(fullname);
- getChild<LLUICtrl>("reporter_field")->setValue(fullname);
+ std::string reporter = LLSLURL("agent", gAgent.getID(), "inspect").getSLURLString();
+ getChild<LLUICtrl>("reporter_field")->setValue(reporter);
center();
@@ -260,22 +261,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.append(firstname->getString());
- object_owner.append(1, ' ');
- object_owner.append(lastname->getString());
- }
- else
- {
- object_owner.append("Unknown");
- }
- setFromAvatar(mObjectID, object_owner);
+ setFromAvatarID(mObjectID);
}
else
{
@@ -302,11 +288,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;
- getChild<LLUICtrl>("abuser_name_edit")->setValue(names[0] );
+ getChild<LLUICtrl>("abuser_name_edit")->setValue(names[0].getCompleteName());
mAbuserID = ids[0];
@@ -314,18 +300,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();
getChild<LLUICtrl>("owner_name")->setValue(avatar_link);
- getChild<LLUICtrl>("object_name")->setValue(avatar_name);
- getChild<LLUICtrl>("abuser_name_edit")->setValue(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.getCompleteName();
+ getChild<LLUICtrl>("object_name")->setValue(av_name.getCompleteName());
+ getChild<LLUICtrl>("object_name")->setToolTip(av_name.getCompleteName());
+ getChild<LLUICtrl>("abuser_name_edit")->setValue(av_name.getCompleteName());
+ }
+}
+
+
// static
void LLFloaterReporter::onClickSend(void *userdata)
{
@@ -465,16 +460,15 @@ 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->getChild<LLUICtrl>("reporter_field")->setValue(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;