[LLIMMgr/LLIMPanel Revision] Feature Request: Friendship operations from IM

Also adds the toggle mute option, but this was deemed too risky and has been left commented out for future projects to decide for themselves on
This commit is contained in:
Inusaito Sayori
2013-10-10 04:03:41 -04:00
parent 42d9b425e9
commit 402f4f7068
4 changed files with 33 additions and 2 deletions

View File

@@ -365,6 +365,7 @@ LLFloaterIMPanel::LLFloaterIMPanel(
mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID); mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionUUID);
mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mSessionLabel, mOtherParticipantUUID); mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mSessionLabel, mOtherParticipantUUID);
LLAvatarTracker::instance().addParticularFriendObserver(mOtherParticipantUUID, this);
break; break;
default: default:
llwarns << "Unknown session type" << llendl; llwarns << "Unknown session type" << llendl;
@@ -482,6 +483,20 @@ LLFloaterIMPanel::~LLFloaterIMPanel()
mFocusLostSignal.disconnect(); mFocusLostSignal.disconnect();
} }
// virtual
void LLFloaterIMPanel::changed(U32 mask)
{
if (mask & REMOVE|ADD) // Fix remove/add friend choices
rebuildDynamics(getChild<LLComboBox>("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() BOOL LLFloaterIMPanel::postBuild()
{ {
requires<LLLineEditor>("chat_editor"); requires<LLLineEditor>("chat_editor");
@@ -988,12 +1003,16 @@ void LLFloaterIMPanel::removeDynamics(LLComboBox* flyout)
{ {
flyout->remove(mDing ? getString("ding on") : getString("ding off")); flyout->remove(mDing ? getString("ding on") : getString("ding off"));
flyout->remove(mRPMode ? getString("rp mode on") : getString("rp mode 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) void LLFloaterIMPanel::addDynamics(LLComboBox* flyout)
{ {
flyout->add(mDing ? getString("ding on") : getString("ding off"), 6); flyout->add(mDing ? getString("ding on") : getString("ding off"), 6);
flyout->add(mRPMode ? getString("rp mode on") : getString("rp mode off"), 7); 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) 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 // Toggle as requested, adjust the strings
if (option == 6) mDing = !mDing; if (option == 6) mDing = !mDing;
else if (option == 7) mRPMode = !mRPMode; 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 // Last add them back
addDynamics(flyout); addDynamics(flyout);

View File

@@ -32,6 +32,7 @@
#ifndef LL_IMPANEL_H #ifndef LL_IMPANEL_H
#define LL_IMPANEL_H #define LL_IMPANEL_H
#include "llcallingcard.h"
#include "llfloater.h" #include "llfloater.h"
#include "lllogchat.h" #include "lllogchat.h"
@@ -46,7 +47,7 @@ class LLParticipantList;
class LLViewerTextEditor; class LLViewerTextEditor;
class LLVoiceChannel; class LLVoiceChannel;
class LLFloaterIMPanel : public LLFloater class LLFloaterIMPanel : public LLFloater, public LLFriendObserver
{ {
public: public:
@@ -65,6 +66,7 @@ public:
void lookupName(); void lookupName();
void onAvatarNameLookup(const LLUUID&, const LLAvatarName& avatar_name); void onAvatarNameLookup(const LLUUID&, const LLAvatarName& avatar_name);
/*virtual*/ void changed(U32 mask); // From LLFriendObserver, check friend status
/*virtual*/ BOOL postBuild(); /*virtual*/ BOOL postBuild();
// Check typing timeout timer. // Check typing timeout timer.
@@ -74,7 +76,7 @@ public:
// add target ids to the session. // add target ids to the session.
// Return TRUE if successful, otherwise FALSE. // Return TRUE if successful, otherwise FALSE.
BOOL inviteToSession(const LLDynamicArray<LLUUID>& agent_ids); bool inviteToSession(const LLDynamicArray<LLUUID>& agent_ids);
void addHistoryLine(const std::string &utf8msg, void addHistoryLine(const std::string &utf8msg,
LLColor4 incolor = LLColor4::white, LLColor4 incolor = LLColor4::white,

View File

@@ -19,6 +19,10 @@
<string name="ding off" value="Ding on new messages (Off)"/> <string name="ding off" value="Ding on new messages (Off)"/>
<string name="rp mode on" value="RP Mode (On)"/> <string name="rp mode on" value="RP Mode (On)"/>
<string name="rp mode off" value="RP Mode (Off)"/> <string name="rp mode off" value="RP Mode (Off)"/>
<string name="add friend" value="Add Friend"/>
<string name="remove friend" value="Remove Friend"/>
<!--string name="mute" value="Mute"/>
<string name="unmute" value="Unmute"/-->
<button bottom_delta="0" follows="left|top" height="20" left_delta="81" width="50" name="tp_btn" label="TP"/> <button bottom_delta="0" follows="left|top" height="20" left_delta="81" width="50" name="tp_btn" label="TP"/>
<button bottom_delta="0" follows="left|top" height="20" left_delta="50" width="50" name="pay_btn" label="Pay"/> <button bottom_delta="0" follows="left|top" height="20" left_delta="50" width="50" name="pay_btn" label="Pay"/>
<button bottom_delta="0" follows="left|top" height="20" left_delta="50" width="50" name="history_btn" label="Log"/> <button bottom_delta="0" follows="left|top" height="20" left_delta="50" width="50" name="history_btn" label="Log"/>

View File

@@ -22,6 +22,10 @@
<string name="ding off" value="Ding on new messages (Off)"/> <string name="ding off" value="Ding on new messages (Off)"/>
<string name="rp mode on" value="RP Mode (On)"/> <string name="rp mode on" value="RP Mode (On)"/>
<string name="rp mode off" value="RP Mode (Off)"/> <string name="rp mode off" value="RP Mode (Off)"/>
<string name="add friend" value="Add Friend"/>
<string name="remove friend" value="Remove Friend"/>
<!--string name="mute" value="Mute"/>
<string name="unmute" value="Unmute"/-->
<button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-start.tga" image_overlay_alignment="left" label="Call" left_delta="81" name="start_call_btn" width="60"/> <button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-start.tga" image_overlay_alignment="left" label="Call" left_delta="81" name="start_call_btn" width="60"/>
<button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-end.tga" image_overlay_alignment="left" scale_image="true" label="End" name="end_call_btn" width="24"/> <button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-end.tga" image_overlay_alignment="left" scale_image="true" label="End" name="end_call_btn" width="24"/>
<panel mouse_opaque="false" border="false" bottom="-20" follows="right|top" height="20" left_delta="16" name="speaker_controls" width="60"> <panel mouse_opaque="false" border="false" bottom="-20" follows="right|top" height="20" left_delta="16" name="speaker_controls" width="60">