summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelgroupinvite.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2013-11-19 17:59:55 -0500
committerOz Linden <oz@lindenlab.com>2013-11-19 17:59:55 -0500
commit0031e9a97be1bf6e9fe773c23506494d09ce91ae (patch)
tree220f195c82174b7cc8e94dceb2553e59fe5837a5 /indra/newview/llpanelgroupinvite.cpp
parentb7edc965bc77ab21e9a1e3f6b424299a50053529 (diff)
parentebc9bcbf69f7a519677a6522979a6bf6cbb04bb8 (diff)
merge up to 3.6.10-release; some of the storm-68 changes lost
Diffstat (limited to 'indra/newview/llpanelgroupinvite.cpp')
-rwxr-xr-x[-rw-r--r--]indra/newview/llpanelgroupinvite.cpp99
1 files changed, 74 insertions, 25 deletions
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 7a15d93181..a9a3c686a6 100644..100755
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -83,11 +83,15 @@ public:
LLTextBox *mGroupName;
std::string mOwnerWarning;
std::string mAlreadyInGroup;
+ std::string mTooManySelected;
bool mConfirmedOwnerInvite;
+ std::set<LLUUID> mInviteeIDs;
void (*mCloseCallback)(void* data);
void* mCloseCallbackUserData;
+
+ boost::signals2::connection mAvatarNameCacheConnection;
};
@@ -101,39 +105,43 @@ LLPanelGroupInvite::impl::impl(const LLUUID& group_id):
mGroupName( NULL ),
mConfirmedOwnerInvite( false ),
mCloseCallback( NULL ),
- mCloseCallbackUserData( NULL )
+ mCloseCallbackUserData( NULL ),
+ mAvatarNameCacheConnection()
{
}
LLPanelGroupInvite::impl::~impl()
{
+ if (mAvatarNameCacheConnection.connected())
+ {
+ mAvatarNameCacheConnection.disconnect();
+ }
}
+const S32 MAX_GROUP_INVITES = 100; // Max invites per request. 100 to match server cap.
+
void LLPanelGroupInvite::impl::addUsers(const std::vector<std::string>& names,
const uuid_vec_t& agent_ids)
{
std::string name;
LLUUID id;
+ if (names.size() + mInviteeIDs.size() > MAX_GROUP_INVITES)
+ {
+ // Fail! Show a warning and don't add any names.
+ LLSD msg;
+ msg["MESSAGE"] = mTooManySelected;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ return;
+ }
+
for (S32 i = 0; i < (S32)names.size(); i++)
{
name = names[i];
id = agent_ids[i];
// Make sure this agent isn't already in the list.
- bool already_in_list = false;
- std::vector<LLScrollListItem*> items = mInvitees->getAllData();
- for (std::vector<LLScrollListItem*>::iterator iter = items.begin();
- iter != items.end(); ++iter)
- {
- LLScrollListItem* item = *iter;
- if (item->getUUID() == id)
- {
- already_in_list = true;
- break;
- }
- }
- if (already_in_list)
+ if (mInviteeIDs.find(id) != mInviteeIDs.end())
{
continue;
}
@@ -144,6 +152,7 @@ void LLPanelGroupInvite::impl::addUsers(const std::vector<std::string>& names,
row["columns"][0]["value"] = name;
mInvitees->addElement(row);
+ mInviteeIDs.insert(id);
}
}
@@ -185,6 +194,16 @@ void LLPanelGroupInvite::impl::submitInvitations()
role_member_pairs[item->getUUID()] = role_id;
}
+ if (role_member_pairs.size() > MAX_GROUP_INVITES)
+ {
+ // Fail!
+ LLSD msg;
+ msg["MESSAGE"] = mTooManySelected;
+ LLNotificationsUtil::add("GenericAlert", msg);
+ (*mCloseCallback)(mCloseCallbackUserData);
+ return;
+ }
+
LLGroupMgr::getInstance()->sendGroupMemberInvites(mGroupID, role_member_pairs);
if(already_in_group)
@@ -289,11 +308,13 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata)
//Soon the avatar picker will be embedded into this panel
//instead of being it's own separate floater. But that is next week.
//This will do for now. -jwolk May 10, 2006
+ LLView * button = panelp->findChild<LLButton>("add_button");
+ LLFloater * root_floater = gFloaterView->getParentFloater(panelp);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE);
+ boost::bind(impl::callbackAddUsers, _1, panelp->mImplementation), TRUE, FALSE, FALSE, root_floater->getName(), button);
if (picker)
{
- gFloaterView->getParentFloater(panelp)->addDependentFloater(picker);
+ root_floater->addDependentFloater(picker);
}
}
}
@@ -313,6 +334,12 @@ void LLPanelGroupInvite::impl::handleRemove()
mInvitees->getAllSelected();
if (selection.empty()) return;
+ std::vector<LLScrollListItem*>::iterator iter;
+ for(iter = selection.begin(); iter != selection.end(); ++iter)
+ {
+ mInviteeIDs.erase( (*iter)->getUUID() );
+ }
+
// Remove all selected invitees.
mInvitees->deleteSelectedItems();
mRemoveButton->setEnabled(FALSE);
@@ -366,8 +393,24 @@ void LLPanelGroupInvite::impl::callbackAddUsers(const uuid_vec_t& agent_ids, voi
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));
+ LLAvatarName av_name;
+ if (LLAvatarNameCache::get(agent_ids[i], &av_name))
+ {
+ LLPanelGroupInvite::impl::onAvatarNameCache(agent_ids[i], av_name, user_data);
+ }
+ else
+ {
+ impl* selfp = (impl*) user_data;
+ if (selfp)
+ {
+ if (selfp->mAvatarNameCacheConnection.connected())
+ {
+ selfp->mAvatarNameCacheConnection.disconnect();
+ }
+ // *TODO : Add a callback per avatar name being fetched.
+ selfp->mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_ids[i],boost::bind(&LLPanelGroupInvite::impl::onAvatarNameCache, _1, _2, user_data));
+ }
+ }
}
}
@@ -380,6 +423,10 @@ void LLPanelGroupInvite::impl::onAvatarNameCache(const LLUUID& agent_id,
if (selfp)
{
+ if (selfp->mAvatarNameCacheConnection.connected())
+ {
+ selfp->mAvatarNameCacheConnection.disconnect();
+ }
std::vector<std::string> names;
uuid_vec_t agent_ids;
agent_ids.push_back(agent_id);
@@ -418,6 +465,7 @@ void LLPanelGroupInvite::clear()
mImplementation->mRoleNames->clear();
mImplementation->mRoleNames->removeall();
mImplementation->mOKButton->setEnabled(FALSE);
+ mImplementation->mInviteeIDs.clear();
}
void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
@@ -455,11 +503,11 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
//so we need to do this additional search in avatar tracker, see EXT-4732
if (LLAvatarTracker::instance().isBuddy(agent_id))
{
- if (!gCacheName->getFullName(agent_id, fullname))
+ LLAvatarName av_name;
+ if (!LLAvatarNameCache::get(agent_id, &av_name))
{
// actually it should happen, just in case
- gCacheName->get(LLUUID(agent_id), false, boost::bind(
- &LLPanelGroupInvite::addUserCallback, this, _1, _2));
+ //LLAvatarNameCache::get(LLUUID(agent_id), boost::bind(&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
@@ -467,7 +515,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
}
else
{
- names.push_back(fullname);
+ names.push_back(av_name.getAccountName());
}
}
}
@@ -475,12 +523,12 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
mImplementation->addUsers(names, agent_ids);
}
-void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const std::string& full_name)
+void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const LLAvatarName& av_name)
{
std::vector<std::string> names;
uuid_vec_t agent_ids;
agent_ids.push_back(id);
- names.push_back(full_name);
+ names.push_back(av_name.getAccountName());
mImplementation->addUsers(names, agent_ids);
}
@@ -558,8 +606,8 @@ void LLPanelGroupInvite::updateLists()
if (!mPendingUpdate)
{
LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID);
- LLGroupMgr::getInstance()->sendGroupMembersRequest(mImplementation->mGroupID);
LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID);
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mImplementation->mGroupID);
}
mPendingUpdate = TRUE;
}
@@ -621,6 +669,7 @@ BOOL LLPanelGroupInvite::postBuild()
mImplementation->mOwnerWarning = getString("confirm_invite_owner_str");
mImplementation->mAlreadyInGroup = getString("already_in_group");
+ mImplementation->mTooManySelected = getString("invite_selection_too_large");
update();