Skip to content
Snippets Groups Projects
Commit 047b74c4 authored by Aimee Linden's avatar Aimee Linden
Browse files

EXT-8248 FIXED Can't teleport multiple friends

parent 01d06a35
No related branches found
No related tags found
No related merge requests found
...@@ -689,6 +689,7 @@ void LLAvatarActions::toggleBlock(const LLUUID& id) ...@@ -689,6 +689,7 @@ void LLAvatarActions::toggleBlock(const LLUUID& id)
LLMuteList::getInstance()->add(mute); LLMuteList::getInstance()->add(mute);
} }
} }
// static // static
bool LLAvatarActions::canOfferTeleport(const LLUUID& id) bool LLAvatarActions::canOfferTeleport(const LLUUID& id)
{ {
...@@ -704,6 +705,21 @@ bool LLAvatarActions::canOfferTeleport(const LLUUID& id) ...@@ -704,6 +705,21 @@ bool LLAvatarActions::canOfferTeleport(const LLUUID& id)
return true; return true;
} }
// static
bool LLAvatarActions::canOfferTeleport(const uuid_vec_t& ids)
{
bool result = true;
for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
{
if(!canOfferTeleport(*it))
{
result = false;
break;
}
}
return result;
}
void LLAvatarActions::inviteToGroup(const LLUUID& id) void LLAvatarActions::inviteToGroup(const LLUUID& id)
{ {
LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(id)); LLFloaterGroupPicker* widget = LLFloaterReg::showTypedInstance<LLFloaterGroupPicker>("group_picker", LLSD(id));
......
...@@ -171,12 +171,18 @@ public: ...@@ -171,12 +171,18 @@ public:
static void csr(const LLUUID& id, std::string name); static void csr(const LLUUID& id, std::string name);
/** /**
* Checks whether can offer teleport to the avatar * Checks whether we can offer a teleport to the avatar, only offline friends
* Can't offer only for offline friends * cannot be offered a teleport.
*
* @return false if avatar is a friend and not visibly online
*/ */
static bool canOfferTeleport(const LLUUID& id); static bool canOfferTeleport(const LLUUID& id);
/**
* @return false if any one of the specified avatars a friend and not visibly online
*/
static bool canOfferTeleport(const uuid_vec_t& ids);
private: private:
static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
......
...@@ -754,12 +754,6 @@ void LLPanelPeople::buttonSetAction(const std::string& btn_name, const commit_si ...@@ -754,12 +754,6 @@ void LLPanelPeople::buttonSetAction(const std::string& btn_name, const commit_si
button->setClickedCallback(cb); button->setClickedCallback(cb);
} }
bool LLPanelPeople::isFriendOnline(const LLUUID& id)
{
uuid_vec_t ids = mOnlineFriendList->getIDs();
return std::find(ids.begin(), ids.end(), id) != ids.end();
}
void LLPanelPeople::updateButtons() void LLPanelPeople::updateButtons()
{ {
std::string cur_tab = getActiveTabName(); std::string cur_tab = getActiveTabName();
...@@ -821,11 +815,11 @@ void LLPanelPeople::updateButtons() ...@@ -821,11 +815,11 @@ void LLPanelPeople::updateButtons()
bool enable_calls = LLVoiceClient::getInstance()->isVoiceWorking() && LLVoiceClient::getInstance()->voiceEnabled(); bool enable_calls = LLVoiceClient::getInstance()->isVoiceWorking() && LLVoiceClient::getInstance()->voiceEnabled();
buttonSetEnabled("teleport_btn", friends_tab_active && item_selected && isFriendOnline(selected_uuids.front())); buttonSetEnabled("view_profile_btn",item_selected);
buttonSetEnabled("view_profile_btn", item_selected); buttonSetEnabled("share_btn", item_selected);
buttonSetEnabled("im_btn", multiple_selected); // allow starting the friends conference for multiple selection buttonSetEnabled("im_btn", multiple_selected); // allow starting the friends conference for multiple selection
buttonSetEnabled("call_btn", multiple_selected && enable_calls); buttonSetEnabled("call_btn", multiple_selected && enable_calls);
buttonSetEnabled("share_btn", item_selected); // not implemented yet buttonSetEnabled("teleport_btn", multiple_selected && LLAvatarActions::canOfferTeleport(selected_uuids));
bool none_group_selected = item_selected && selected_id.isNull(); bool none_group_selected = item_selected && selected_id.isNull();
buttonSetEnabled("group_info_btn", !none_group_selected); buttonSetEnabled("group_info_btn", !none_group_selected);
...@@ -1329,7 +1323,9 @@ void LLPanelPeople::onGroupCallButtonClicked() ...@@ -1329,7 +1323,9 @@ void LLPanelPeople::onGroupCallButtonClicked()
void LLPanelPeople::onTeleportButtonClicked() void LLPanelPeople::onTeleportButtonClicked()
{ {
LLAvatarActions::offerTeleport(getCurrentItemID()); uuid_vec_t selected_uuids;
getCurrentItemIDs(selected_uuids);
LLAvatarActions::offerTeleport(selected_uuids);
} }
void LLPanelPeople::onShareButtonClicked() void LLPanelPeople::onShareButtonClicked()
......
...@@ -72,7 +72,6 @@ private: ...@@ -72,7 +72,6 @@ private:
void updateNearbyList(); void updateNearbyList();
void updateRecentList(); void updateRecentList();
bool isFriendOnline(const LLUUID& id);
bool isItemsFreeOfFriends(const uuid_vec_t& uuids); bool isItemsFreeOfFriends(const uuid_vec_t& uuids);
void updateButtons(); void updateButtons();
......
...@@ -81,6 +81,7 @@ LLContextMenu* NearbyMenu::createMenu() ...@@ -81,6 +81,7 @@ LLContextMenu* NearbyMenu::createMenu()
// registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, mUUIDs)); // *TODO: unimplemented // registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, mUUIDs)); // *TODO: unimplemented
registrar.add("Avatar.IM", boost::bind(&LLAvatarActions::startConference, mUUIDs)); registrar.add("Avatar.IM", boost::bind(&LLAvatarActions::startConference, mUUIDs));
registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startAdhocCall, mUUIDs)); registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startAdhocCall, mUUIDs));
registrar.add("Avatar.OfferTeleport", boost::bind(&NearbyMenu::offerTeleport, this));
registrar.add("Avatar.RemoveFriend",boost::bind(&LLAvatarActions::removeFriendsDialog, mUUIDs)); registrar.add("Avatar.RemoveFriend",boost::bind(&LLAvatarActions::removeFriendsDialog, mUUIDs));
// registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::startIM, mUUIDs)); // *TODO: unimplemented // registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::startIM, mUUIDs)); // *TODO: unimplemented
// registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, mUUIDs)); // *TODO: unimplemented // registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, mUUIDs)); // *TODO: unimplemented
...@@ -168,8 +169,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) ...@@ -168,8 +169,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata)
} }
else if(item == std::string("can_offer_teleport")) else if(item == std::string("can_offer_teleport"))
{ {
const LLUUID& id = mUUIDs.front(); return LLAvatarActions::canOfferTeleport(mUUIDs);
return LLAvatarActions::canOfferTeleport(id);
} }
return false; return false;
} }
...@@ -191,8 +191,7 @@ void NearbyMenu::offerTeleport() ...@@ -191,8 +191,7 @@ void NearbyMenu::offerTeleport()
{ {
// boost::bind cannot recognize overloaded method LLAvatarActions::offerTeleport(), // boost::bind cannot recognize overloaded method LLAvatarActions::offerTeleport(),
// so we have to use a wrapper. // so we have to use a wrapper.
const LLUUID& id = mUUIDs.front(); LLAvatarActions::offerTeleport(mUUIDs);
LLAvatarActions::offerTeleport(id);
} }
} // namespace LLPanelPeopleMenus } // namespace LLPanelPeopleMenus
...@@ -57,4 +57,13 @@ ...@@ -57,4 +57,13 @@
<on_click <on_click
function="Avatar.Pay" /> function="Avatar.Pay" />
</menu_item_call> </menu_item_call>
<menu_item_call
label="Offer Teleport"
name="teleport">
<menu_item_call.on_click
function="Avatar.OfferTeleport"/>
<menu_item_call.on_enable
function="Avatar.EnableItem"
parameter="can_offer_teleport"/>
</menu_item_call>
</context_menu> </context_menu>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment