Add List.EnableUnmute and List.CopyNames to menu callbacks
This commit is contained in:
@@ -9104,15 +9104,39 @@ class ListEnableIsNotFriend : public view_listener_t
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ListEnableUnmute : public view_listener_t
|
||||||
|
{
|
||||||
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
|
{
|
||||||
|
bool are_blocked = false;
|
||||||
|
for (const auto& id : LFIDBearer::getActiveSelectedIDs())
|
||||||
|
if (are_blocked = LLAvatarActions::isBlocked(id)) // If any are blocked, allow unblocking
|
||||||
|
break;
|
||||||
|
|
||||||
|
gMenuHolder->findControl(userdata["control"].asString())->setValue(are_blocked);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ListEnableMute : public view_listener_t
|
class ListEnableMute : public view_listener_t
|
||||||
{
|
{
|
||||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
{
|
{
|
||||||
const uuid_vec_t& ids = LFIDBearer::getActiveSelectedIDs();
|
bool blockable = false;
|
||||||
bool can_block = true;
|
for (const auto& id : LFIDBearer::getActiveSelectedIDs())
|
||||||
for (uuid_vec_t::const_iterator it = ids.begin(); can_block && it != ids.end(); ++it)
|
{
|
||||||
can_block = LLAvatarActions::canBlock(*it);
|
if (!LLAvatarActions::canBlock(id)) // Exit early only when someone is unblockable
|
||||||
gMenuHolder->findControl(userdata["control"].asString())->setValue(can_block);
|
{
|
||||||
|
blockable = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (blockable) // At least one is unblocked, keep looking for unblockables
|
||||||
|
continue;
|
||||||
|
|
||||||
|
blockable = !LLAvatarActions::isBlocked(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
gMenuHolder->findControl(userdata["control"].asString())->setValue(blockable);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -9145,6 +9169,32 @@ class ListBanFromGroup : public view_listener_t
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void copy_from_ids(const uuid_vec_t & ids, std::function<std::string(const LLUUID&)> func);
|
||||||
|
|
||||||
|
class ListCopyNames : public view_listener_t
|
||||||
|
{
|
||||||
|
static std::string getGroupName(const LLUUID& id)
|
||||||
|
{
|
||||||
|
std::string ret;
|
||||||
|
gCacheName->getGroupName(id, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static std::string getAvatarName(const LLUUID& id)
|
||||||
|
{
|
||||||
|
std::string ret;
|
||||||
|
LLAvatarNameCache::getNSName(id, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
|
{
|
||||||
|
LLWString str;
|
||||||
|
copy_from_ids(LFIDBearer::getActiveSelectedIDs(), LFIDBearer::getActiveType() == LFIDBearer::GROUP ? getGroupName : getAvatarName);
|
||||||
|
if (!str.empty()) LLView::getWindow()->copyTextToClipboard(str);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
class ListCopySLURL : public view_listener_t
|
class ListCopySLURL : public view_listener_t
|
||||||
{
|
{
|
||||||
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
|
||||||
@@ -9845,10 +9895,12 @@ void initialize_menus()
|
|||||||
addMenu(new ListEnableCall(), "List.EnableCall");
|
addMenu(new ListEnableCall(), "List.EnableCall");
|
||||||
addMenu(new ListEnableIsFriend(), "List.EnableIsFriend");
|
addMenu(new ListEnableIsFriend(), "List.EnableIsFriend");
|
||||||
addMenu(new ListEnableIsNotFriend(), "List.EnableIsNotFriend");
|
addMenu(new ListEnableIsNotFriend(), "List.EnableIsNotFriend");
|
||||||
|
addMenu(new ListEnableUnmute(), "List.EnableUnmute");
|
||||||
addMenu(new ListEnableMute(), "List.EnableMute");
|
addMenu(new ListEnableMute(), "List.EnableMute");
|
||||||
addMenu(new ListEnableOfferTeleport(), "List.EnableOfferTeleport");
|
addMenu(new ListEnableOfferTeleport(), "List.EnableOfferTeleport");
|
||||||
addMenu(new ListVisibleWebProfile(), "List.VisibleWebProfile");
|
addMenu(new ListVisibleWebProfile(), "List.VisibleWebProfile");
|
||||||
addMenu(new ListBanFromGroup(), "List.BanFromGroup");
|
addMenu(new ListBanFromGroup(), "List.BanFromGroup");
|
||||||
|
addMenu(new ListCopyNames(), "List.CopyNames");
|
||||||
addMenu(new ListCopySLURL(), "List.CopySLURL");
|
addMenu(new ListCopySLURL(), "List.CopySLURL");
|
||||||
addMenu(new ListCopyUUIDs(), "List.CopyUUIDs");
|
addMenu(new ListCopyUUIDs(), "List.CopyUUIDs");
|
||||||
addMenu(new ListInviteToGroup(), "List.InviteToGroup");
|
addMenu(new ListInviteToGroup(), "List.InviteToGroup");
|
||||||
|
|||||||
@@ -87,10 +87,13 @@
|
|||||||
<on_visible function="List.IsNearby"/>
|
<on_visible function="List.IsNearby"/>
|
||||||
</menu_item_call>
|
</menu_item_call>
|
||||||
<menu label="Moderation" name="Moderation" create_jump_keys="true">
|
<menu label="Moderation" name="Moderation" create_jump_keys="true">
|
||||||
<menu_item_call label="Mute/Unmute" name="Mute/Unmute">
|
<menu_item_call label="Mute" name="Mute">
|
||||||
<on_click function="List.ToggleMute"/>
|
<on_click function="List.ToggleMute"/>
|
||||||
<on_enable function="List.EnableMute"/>
|
<on_visible function="List.EnableMute"/>
|
||||||
<on_visible function="List.EnableAnySelected"/>
|
</menu_item_call>
|
||||||
|
<menu_item_call label="Unmute" name="Unmute">
|
||||||
|
<on_click function="List.ToggleMute"/>
|
||||||
|
<on_visible function="List.EnableUnmute"/>
|
||||||
</menu_item_call>
|
</menu_item_call>
|
||||||
<menu_item_call label="Ban From Group" name="Ban From Group">
|
<menu_item_call label="Ban From Group" name="Ban From Group">
|
||||||
<on_click function="List.BanFromGroup"/>
|
<on_click function="List.BanFromGroup"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user