summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelgroupinvite.cpp
diff options
context:
space:
mode:
authorAimee Linden <aimee@lindenlab.com>2010-09-03 17:41:39 +0100
committerAimee Linden <aimee@lindenlab.com>2010-09-03 17:41:39 +0100
commitffae589843c2977ae7f70de78d84c936e2a91291 (patch)
tree497660a88fe55382639dea1b2f3499241127470d /indra/newview/llpanelgroupinvite.cpp
parent63f2ddf377fa0fc6a666cdc1001289335d86258b (diff)
parent25c29d59cf658acec5901c6f06775add10cf0bfd (diff)
Post-convert merge by convert_monolith.py from /Users/Aimee/Documents/Work/Linden-Lab/Development/viewer/convert/viewer-identity-evolution
Diffstat (limited to 'indra/newview/llpanelgroupinvite.cpp')
-rw-r--r--indra/newview/llpanelgroupinvite.cpp56
1 files changed, 42 insertions, 14 deletions
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 535b2a9e2d..abc4f643d4 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -28,6 +28,7 @@
#include "llpanelgroupinvite.h"
#include "llagent.h"
+#include "llavatarnamecache.h"
#include "llfloateravatarpicker.h"
#include "llbutton.h"
#include "llcallingcard.h"
@@ -62,9 +63,13 @@ public:
static void callbackClickAdd(void* userdata);
static void callbackClickRemove(void* userdata);
static void callbackSelect(LLUICtrl* ctrl, void* userdata);
- static void callbackAddUsers(const std::vector<std::string>& names,
- const uuid_vec_t& agent_ids,
+ static void callbackAddUsers(const uuid_vec_t& agent_ids,
void* user_data);
+
+ static void onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name,
+ void* user_data);
+
bool inviteOwnerCallback(const LLSD& notification, const LLSD& response);
public:
@@ -287,7 +292,7 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata)
LLFloater* parentp;
parentp = gFloaterView->getParentFloater(panelp);
- parentp->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(impl::callbackAddUsers, _1, _2,
+ parentp->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(impl::callbackAddUsers, _1,
panelp->mImplementation),
TRUE));
}
@@ -353,16 +358,38 @@ void LLPanelGroupInvite::impl::callbackClickOK(void* userdata)
if ( selfp ) selfp->submitInvitations();
}
+
+
//static
-void LLPanelGroupInvite::impl::callbackAddUsers(const std::vector<std::string>& names,
- const uuid_vec_t& ids,
- void* user_data)
+void LLPanelGroupInvite::impl::callbackAddUsers(const uuid_vec_t& agent_ids, void* user_data)
+{
+ std::vector<std::string> names;
+ for (S32 i = 0; i < (S32)agent_ids.size(); i++)
+ {
+ LLAvatarNameCache::get(agent_ids[i],
+ boost::bind(&LLPanelGroupInvite::impl::onAvatarNameCache, _1, _2, user_data));
+ }
+
+}
+
+void LLPanelGroupInvite::impl::onAvatarNameCache(const LLUUID& agent_id,
+ const LLAvatarName& av_name,
+ void* user_data)
{
impl* selfp = (impl*) user_data;
- if ( selfp) selfp->addUsers(names, ids);
+ if (selfp)
+ {
+ std::vector<std::string> names;
+ uuid_vec_t agent_ids;
+ agent_ids.push_back(agent_id);
+ names.push_back(av_name.getCompleteName());
+
+ selfp->addUsers(names, agent_ids);
+ }
}
+
LLPanelGroupInvite::LLPanelGroupInvite(const LLUUID& group_id)
: LLPanel(),
mImplementation(new impl(group_id)),
@@ -398,16 +425,18 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
std::vector<std::string> names;
for (S32 i = 0; i < (S32)agent_ids.size(); i++)
{
+ std::string fullname;
LLUUID agent_id = agent_ids[i];
LLViewerObject* dest = gObjectList.findObject(agent_id);
- std::string fullname;
if(dest && dest->isAvatar())
{
LLNameValue* nvfirst = dest->getNVPair("FirstName");
LLNameValue* nvlast = dest->getNVPair("LastName");
if(nvfirst && nvlast)
{
- fullname = std::string(nvfirst->getString()) + " " + std::string(nvlast->getString());
+ fullname = LLCacheName::buildFullName(
+ nvfirst->getString(), nvlast->getString());
+
}
if (!fullname.empty())
{
@@ -430,8 +459,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
{
// actually it should happen, just in case
gCacheName->get(LLUUID(agent_id), false, boost::bind(
- &LLPanelGroupInvite::addUserCallback, this, _1, _2,
- _3));
+ &LLPanelGroupInvite::addUserCallback, this, _1, _2));
// for this special case!
//when there is no cached name we should remove resident from agent_ids list to avoid breaking of sequence
// removed id will be added in callback
@@ -447,16 +475,16 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
mImplementation->addUsers(names, agent_ids);
}
-void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const std::string& first_name, const std::string& last_name)
+void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const std::string& full_name)
{
std::vector<std::string> names;
uuid_vec_t agent_ids;
- std::string full_name = first_name + " " + last_name;
agent_ids.push_back(id);
- names.push_back(first_name + " " + last_name);
+ names.push_back(full_name);
mImplementation->addUsers(names, agent_ids);
}
+
void LLPanelGroupInvite::draw()
{
LLPanel::draw();