From d5d9668a59895874951fb3e5927ea0159270a6e8 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Thu, 25 Mar 2010 09:04:01 +0200 Subject: Fixed low bug EXT-6488 (Teleport menuitem is enabled for offline residents in the context menu and inspectors) - Added a check for a teleport offer ability. In XML created a paremeter and check it in source code. Reviewed by Leyla Farazha at https://codereview.productengine.com/secondlife/r/86/ --HG-- branch : product-engine --- indra/newview/llavataractions.cpp | 14 ++++++++++++++ indra/newview/llavataractions.h | 6 ++++++ indra/newview/llinspectavatar.cpp | 7 +++++++ indra/newview/llpanelpeoplemenus.cpp | 5 +++++ .../skins/default/xui/en/menu_inspect_avatar_gear.xml | 2 ++ indra/newview/skins/default/xui/en/menu_people_nearby.xml | 3 +++ 6 files changed, 37 insertions(+) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index cb518f0ad6..699916b0d6 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -442,6 +442,20 @@ void LLAvatarActions::toggleBlock(const LLUUID& id) LLMuteList::getInstance()->add(mute); } } +// static +bool LLAvatarActions::canOfferTeleport(const LLUUID& id) +{ + // First use LLAvatarTracker::isBuddy() + // If LLAvatarTracker::instance().isBuddyOnline function only is used + // then for avatars that are online and not a friend it will return false. + // But we should give an ability to offer a teleport for such avatars. + if(LLAvatarTracker::instance().isBuddy(id)) + { + return LLAvatarTracker::instance().isBuddyOnline(id); + } + + return true; +} void LLAvatarActions::inviteToGroup(const LLUUID& id) { diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index a7f3acad4f..9adf6efec7 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -171,6 +171,12 @@ public: */ static void csr(const LLUUID& id, std::string name); + /** + * Checks whether can offer teleport to the avatar + * Can't offer only for offline friends + */ + static bool canOfferTeleport(const LLUUID& id); + private: static bool callbackAddFriend(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp index 35cb9b3468..94ea236757 100644 --- a/indra/newview/llinspectavatar.cpp +++ b/indra/newview/llinspectavatar.cpp @@ -137,6 +137,7 @@ private: void onVolumeChange(const LLSD& data); bool enableMute(); bool enableUnmute(); + bool enableTeleportOffer(); // Is used to determine if "Add friend" option should be enabled in gear menu bool isNotFriend(); @@ -235,6 +236,7 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd) boost::bind(&LLInspectAvatar::onVisibleZoomIn, this)); mEnableCallbackRegistrar.add("InspectAvatar.Gear.Enable", boost::bind(&LLInspectAvatar::isNotFriend, this)); mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableCall", boost::bind(&LLAvatarActions::canCall)); + mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableTeleportOffer", boost::bind(&LLInspectAvatar::enableTeleportOffer, this)); mEnableCallbackRegistrar.add("InspectAvatar.EnableMute", boost::bind(&LLInspectAvatar::enableMute, this)); mEnableCallbackRegistrar.add("InspectAvatar.EnableUnmute", boost::bind(&LLInspectAvatar::enableUnmute, this)); @@ -764,6 +766,11 @@ bool LLInspectAvatar::enableUnmute() } } +bool LLInspectAvatar::enableTeleportOffer() +{ + return LLAvatarActions::canOfferTeleport(mAvatarID); +} + ////////////////////////////////////////////////////////////////////////////// // LLInspectAvatarUtil ////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index 854651cd01..313ed4b70e 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -226,6 +226,11 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) || gAgent.isGodlike(); } + else if(item == std::string("can_offer_teleport")) + { + const LLUUID& id = mUUIDs.front(); + return LLAvatarActions::canOfferTeleport(id); + } return false; } diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml index 1b002b1c32..a5ac5f76e1 100644 --- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml @@ -40,6 +40,8 @@ name="teleport"> + + -- cgit v1.2.3