diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 71d2f7eef..6360a953b 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -365,6 +365,7 @@ LLFloaterIMPanel::LLFloaterIMPanel( mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID); mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mSessionLabel, mOtherParticipantUUID); + LLAvatarTracker::instance().addParticularFriendObserver(mOtherParticipantUUID, this); break; default: llwarns << "Unknown session type" << llendl; @@ -482,6 +483,20 @@ LLFloaterIMPanel::~LLFloaterIMPanel() mFocusLostSignal.disconnect(); } +// virtual +void LLFloaterIMPanel::changed(U32 mask) +{ + if (mask & REMOVE|ADD) // Fix remove/add friend choices + rebuildDynamics(getChild("instant_message_flyout")); + /* Singu TODO: Chat UI - Online icons? + if (mask & ONLINE) + // Show online icon here + else if (mask & NONE) + // Show offline icon here + */ +} + +// virtual BOOL LLFloaterIMPanel::postBuild() { requires("chat_editor"); @@ -988,12 +1003,16 @@ void LLFloaterIMPanel::removeDynamics(LLComboBox* flyout) { flyout->remove(mDing ? getString("ding on") : getString("ding off")); flyout->remove(mRPMode ? getString("rp mode on") : getString("rp mode off")); + flyout->remove(LLAvatarActions::isFriend(mOtherParticipantUUID) ? getString("remove friend") : getString("add friend")); + //flyout->remove(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute")); } void LLFloaterIMPanel::addDynamics(LLComboBox* flyout) { flyout->add(mDing ? getString("ding on") : getString("ding off"), 6); flyout->add(mRPMode ? getString("rp mode on") : getString("rp mode off"), 7); + flyout->add(LLAvatarActions::isFriend(mOtherParticipantUUID) ? getString("remove friend") : getString("add friend"), 8); + //flyout->add(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute"), 9); } void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) @@ -1018,6 +1037,8 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) // Toggle as requested, adjust the strings if (option == 6) mDing = !mDing; else if (option == 7) mRPMode = !mRPMode; + else if (option == 8) LLAvatarActions::isFriend(mOtherParticipantUUID) ? LLAvatarActions::removeFriendDialog(mOtherParticipantUUID) : LLAvatarActions::requestFriendshipDialog(mOtherParticipantUUID); + //else if (option == 9) LLAvatarActions::toggleBlock(mOtherParticipantUUID); // Last add them back addDynamics(flyout); diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 130cfa1f3..94e6b1414 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -32,6 +32,7 @@ #ifndef LL_IMPANEL_H #define LL_IMPANEL_H +#include "llcallingcard.h" #include "llfloater.h" #include "lllogchat.h" @@ -46,7 +47,7 @@ class LLParticipantList; class LLViewerTextEditor; class LLVoiceChannel; -class LLFloaterIMPanel : public LLFloater +class LLFloaterIMPanel : public LLFloater, public LLFriendObserver { public: @@ -65,6 +66,7 @@ public: void lookupName(); void onAvatarNameLookup(const LLUUID&, const LLAvatarName& avatar_name); + /*virtual*/ void changed(U32 mask); // From LLFriendObserver, check friend status /*virtual*/ BOOL postBuild(); // Check typing timeout timer. @@ -74,7 +76,7 @@ public: // add target ids to the session. // Return TRUE if successful, otherwise FALSE. - BOOL inviteToSession(const LLDynamicArray& agent_ids); + bool inviteToSession(const LLDynamicArray& agent_ids); void addHistoryLine(const std::string &utf8msg, LLColor4 incolor = LLColor4::white, diff --git a/indra/newview/skins/default/xui/en-us/floater_instant_message.xml b/indra/newview/skins/default/xui/en-us/floater_instant_message.xml index 10fabcfd6..53a441397 100644 --- a/indra/newview/skins/default/xui/en-us/floater_instant_message.xml +++ b/indra/newview/skins/default/xui/en-us/floater_instant_message.xml @@ -19,6 +19,10 @@ + + +