SL-1942 Fixed the estate list change Confirmation messages to show agent names properly

meow-7.2.2
AndreyL ProductEngine 2019-01-18 18:19:27 +02:00
parent 71b3a97a09
commit 7621b34273
2 changed files with 40 additions and 26 deletions

View File

@ -1696,11 +1696,13 @@ struct LLEstateAccessChangeInfo
LLSD sd;
sd["name"] = mDialogName;
sd["operation"] = (S32)mOperationFlag;
for (uuid_vec_t::const_iterator it = mAgentOrGroupIDs.begin();
it != mAgentOrGroupIDs.end();
++it)
for (U32 i = 0; i < mAgentOrGroupIDs.size(); ++i)
{
sd["allowed_ids"].append(*it);
sd["allowed_ids"].append(mAgentOrGroupIDs[i]);
if (mAgentNames.size() > i)
{
sd["allowed_names"].append(mAgentNames[i].asLLSD());
}
}
return sd;
}
@ -1708,6 +1710,7 @@ struct LLEstateAccessChangeInfo
U32 mOperationFlag; // ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc.
std::string mDialogName;
uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change
std::vector<LLAvatarName> mAgentNames; // Optional list of the agent names for notifications
};
// static
@ -3597,7 +3600,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r
}
// avatar picker yes multi-select, yes close-on-select
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, (void*)change_info),
LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateAccess::accessAddCore3, _1, _2, (void*)change_info),
TRUE, TRUE, FALSE, parent_floater_name, button);
//Allows the closed parent floater to close the child floater (avatar picker)
@ -3610,7 +3613,7 @@ bool LLPanelEstateAccess::accessAddCore2(const LLSD& notification, const LLSD& r
}
// static
void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, std::vector<LLAvatarName> names, void* data)
{
LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data;
if (!change_info) return;
@ -3646,11 +3649,12 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
}
uuid_vec_t ids_allowed;
std::vector<LLAvatarName> names_allowed;
std::string already_allowed;
bool single = true;
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
for (U32 i = 0; i < ids.size(); ++i)
{
LLScrollListItem* item = name_list->getNameItemByAgentId(*it);
LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
if (item)
{
if (!already_allowed.empty())
@ -3662,7 +3666,8 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
}
else
{
ids_allowed.push_back(*it);
ids_allowed.push_back(ids[i]);
names_allowed.push_back(names[i]);
}
}
if (!already_allowed.empty())
@ -3678,6 +3683,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
}
}
change_info->mAgentOrGroupIDs = ids_allowed;
change_info->mAgentNames = names_allowed;
}
if (change_info->mOperationFlag & ESTATE_ACCESS_BANNED_AGENT_ADD)
{
@ -3697,13 +3703,14 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
}
uuid_vec_t ids_allowed;
std::vector<LLAvatarName> names_allowed;
std::string already_banned;
std::string em_ban;
bool single = true;
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
for (U32 i = 0; i < ids.size(); ++i)
{
bool is_allowed = true;
LLScrollListItem* em_item = em_list->getNameItemByAgentId(*it);
LLScrollListItem* em_item = em_list->getNameItemByAgentId(ids[i]);
if (em_item)
{
if (!em_ban.empty())
@ -3714,7 +3721,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
is_allowed = false;
}
LLScrollListItem* item = name_list->getNameItemByAgentId(*it);
LLScrollListItem* item = name_list->getNameItemByAgentId(ids[i]);
if (item)
{
if (!already_banned.empty())
@ -3728,7 +3735,8 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
if (is_allowed)
{
ids_allowed.push_back(*it);
ids_allowed.push_back(ids[i]);
names_allowed.push_back(names[i]);
}
}
if (!em_ban.empty())
@ -3755,6 +3763,7 @@ void LLPanelEstateAccess::accessAddCore3(const uuid_vec_t& ids, void* data)
}
}
change_info->mAgentOrGroupIDs = ids_allowed;
change_info->mAgentNames = names_allowed;
}
LLSD args;
@ -3877,12 +3886,9 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
std::string names;
U32 listed_names = 0;
LLSD::array_const_iterator end_it = notification["payload"]["allowed_ids"].endArray();
for (LLSD::array_const_iterator iter = notification["payload"]["allowed_ids"].beginArray();
iter != end_it;
iter++)
for (U32 i = 0; i < notification["payload"]["allowed_ids"].size(); ++i)
{
if (iter + 1 != end_it)
if (i + 1 != notification["payload"]["allowed_ids"].size())
{
flags |= ESTATE_ACCESS_NO_REPLY;
}
@ -3891,7 +3897,7 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
flags &= ~ESTATE_ACCESS_NO_REPLY;
}
const LLUUID id = iter->asUUID();
const LLUUID id = notification["payload"]["allowed_ids"][i].asUUID();
if (((U32)notification["payload"]["operation"].asInteger() & ESTATE_ACCESS_BANNED_AGENT_ADD)
&& region && (region->getOwner() == id))
{
@ -3906,15 +3912,23 @@ bool LLPanelEstateAccess::accessCoreConfirm(const LLSD& notification, const LLSD
// fill the name list for confirmation
if (listed_names < MAX_LISTED_NAMES)
{
LLAvatarName av_name;
if (LLAvatarNameCache::get(id, &av_name))
if (!names.empty())
{
if (!names.empty())
names += ", ";
}
if (!notification["payload"]["allowed_names"][i]["display_name"].asString().empty())
{
names += notification["payload"]["allowed_names"][i]["display_name"].asString();
}
else
{ //try to get an agent name from cache
LLAvatarName av_name;
if (LLAvatarNameCache::get(id, &av_name))
{
names += ", ";
names += av_name.getCompleteName();
}
names += av_name.getCompleteName();
}
}
}
listed_names++;
}

View File

@ -532,7 +532,7 @@ private:
// Core methods for all above add/remove button clicks
static void accessAddCore(U32 operation_flag, const std::string& dialog_name);
static bool accessAddCore2(const LLSD& notification, const LLSD& response);
static void accessAddCore3(const uuid_vec_t& ids, void* data);
static void accessAddCore3(const uuid_vec_t& ids, std::vector<LLAvatarName> names, void* data);
static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name);
static bool accessRemoveCore2(const LLSD& notification, const LLSD& response);