From a3f9b5d2d8cba2aa7de71aee0564a8125ca02e29 Mon Sep 17 00:00:00 2001
From: James Cook <james@lindenlab.com>
Date: Tue, 3 Nov 2009 16:13:54 -0800
Subject: [PATCH] EXT-2093 People inspectors should include an "IM" button

---
 indra/newview/llinspectavatar.cpp             | 19 +++++++++++++++++--
 .../skins/default/xui/en/inspect_avatar.xml   | 12 ++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index bfad2b16248..9989a3b4731 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -188,7 +188,8 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
 {
 	mCommitCallbackRegistrar.add("InspectAvatar.ViewProfile",	boost::bind(&LLInspectAvatar::onClickViewProfile, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.AddFriend",	boost::bind(&LLInspectAvatar::onClickAddFriend, this));	
-	mCommitCallbackRegistrar.add("InspectAvatar.IM",	boost::bind(&LLInspectAvatar::onClickIM, this));	
+	mCommitCallbackRegistrar.add("InspectAvatar.IM",
+		boost::bind(&LLInspectAvatar::onClickIM, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.Teleport",	boost::bind(&LLInspectAvatar::onClickTeleport, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.InviteToGroup",	boost::bind(&LLInspectAvatar::onClickInviteToGroup, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.Pay",	boost::bind(&LLInspectAvatar::onClickPay, this));	
@@ -306,7 +307,21 @@ void LLInspectAvatar::requestUpdate()
 	// You can't re-add someone as a friend if they are already your friend
 	bool is_friend = LLAvatarTracker::instance().getBuddyInfo(mAvatarID) != NULL;
 	bool is_self = (mAvatarID == gAgentID);
-	childSetEnabled("add_friend_btn", !is_friend && !is_self);
+	if (is_self)
+	{
+		getChild<LLUICtrl>("add_friend_btn")->setVisible(false);
+		getChild<LLUICtrl>("im_btn")->setVisible(false);
+	}
+	else if (is_friend)
+	{
+		getChild<LLUICtrl>("add_friend_btn")->setVisible(false);
+		getChild<LLUICtrl>("im_btn")->setVisible(true);
+	}
+	else
+	{
+		getChild<LLUICtrl>("add_friend_btn")->setVisible(true);
+		getChild<LLUICtrl>("im_btn")->setVisible(false);
+	}
 
 	// Use an avatar_icon even though the image id will come down with the
 	// avatar properties because the avatar_icon code maintains a cache of icons
diff --git a/indra/newview/skins/default/xui/en/inspect_avatar.xml b/indra/newview/skins/default/xui/en/inspect_avatar.xml
index 6b13e2f1c7c..e2ae81e0b93 100644
--- a/indra/newview/skins/default/xui/en/inspect_avatar.xml
+++ b/indra/newview/skins/default/xui/en/inspect_avatar.xml
@@ -128,6 +128,8 @@
      left_delta="110"
      tab_stop="false"
      width="18" />
+  <!-- Overlapping buttons for default actions
+    llinspectavatar.cpp makes visible the most likely default action -->
     <button
      follows="bottom|left"
      height="23"
@@ -136,6 +138,16 @@
      top="246"
      name="add_friend_btn"
      width="100" />
+    <button
+     follows="bottom|left"
+     height="23"
+     label="IM"
+     left_delta="0"
+     top_delta="0"
+     name="im_btn"
+     width="100"
+     commit_callback.function="InspectAvatar.IM"
+     />
     <menu_button
      follows="top|left"
      height="18"
-- 
GitLab