diff options
Diffstat (limited to 'indra/newview/llpanelgroupinvite.cpp')
-rw-r--r-- | indra/newview/llpanelgroupinvite.cpp | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index b26bcc854c..ca48e8561b 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(); |