Add option "Add to Conference" to Conference chats and Instant Messages
Sync code from upstream for inviting people to conference via Avatar Picker
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llbutton.h"
|
||||
#include "llcombobox.h"
|
||||
#include "llfloateravatarpicker.h"
|
||||
#include "llfloaterchat.h"
|
||||
#include "llfloaterinventory.h"
|
||||
#include "llfloaterwebcontent.h" // For web browser display of logs
|
||||
@@ -980,6 +981,96 @@ bool LLFloaterIMPanel::isInviteAllowed() const
|
||||
return mSessionType == ADHOC_SESSION;
|
||||
}
|
||||
|
||||
void LLFloaterIMPanel::onAddButtonClicked()
|
||||
{
|
||||
LLView * button = findChild<LLButton>("instant_message_flyout");
|
||||
LLFloater* root_floater = gFloaterView->getParentFloater(this);
|
||||
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLFloaterIMPanel::addSessionParticipants, this, _1), TRUE, TRUE, FALSE, root_floater->getName(), button);
|
||||
if (!picker)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Need to disable 'ok' button when selected users are already in conversation.
|
||||
picker->setOkBtnEnableCb(boost::bind(&LLFloaterIMPanel::canAddSelectedToChat, this, _1));
|
||||
|
||||
if (root_floater)
|
||||
{
|
||||
root_floater->addDependentFloater(picker);
|
||||
}
|
||||
}
|
||||
|
||||
bool LLFloaterIMPanel::canAddSelectedToChat(const uuid_vec_t& uuids) const
|
||||
{
|
||||
switch (mSessionType)
|
||||
{
|
||||
case P2P_SESSION: return true; // Don't bother blocking self or peer
|
||||
case ADHOC_SESSION:
|
||||
{
|
||||
// For a conference session we need to check against the list from LLSpeakerMgr,
|
||||
// because this list may change when participants join or leave the session.
|
||||
|
||||
LLSpeakerMgr::speaker_list_t speaker_list;
|
||||
LLIMSpeakerMgr* speaker_mgr = getSpeakerManager();
|
||||
if (speaker_mgr)
|
||||
{
|
||||
speaker_mgr->getSpeakerList(&speaker_list, true);
|
||||
}
|
||||
|
||||
for (const auto& id : uuids)
|
||||
for (const LLPointer<LLSpeaker>& speaker : speaker_list)
|
||||
if (id == speaker->mID)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterIMPanel::addSessionParticipants(const uuid_vec_t& uuids)
|
||||
{
|
||||
if (mSessionType == P2P_SESSION)
|
||||
{
|
||||
LLSD payload;
|
||||
LLSD args;
|
||||
|
||||
LLNotificationsUtil::add("ConfirmAddingChatParticipants", args, payload,
|
||||
boost::bind(&LLFloaterIMPanel::addP2PSessionParticipants, this, _1, _2, uuids));
|
||||
}
|
||||
else inviteToSession(uuids);
|
||||
}
|
||||
|
||||
void LLFloaterIMPanel::addP2PSessionParticipants(const LLSD& notification, const LLSD& response, const uuid_vec_t& uuids)
|
||||
{
|
||||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||
if (option != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLVoiceChannel* voice_channel = LLActiveSpeakerMgr::getInstance()->getVoiceChannel();
|
||||
|
||||
// first check whether this is a voice session
|
||||
bool is_voice_call = voice_channel != nullptr && voice_channel->getSessionID() == mSessionUUID && voice_channel->isActive();
|
||||
|
||||
uuid_vec_t temp_ids;
|
||||
|
||||
// Add the initial participant of a P2P session
|
||||
temp_ids.push_back(mOtherParticipantUUID);
|
||||
temp_ids.insert(temp_ids.end(), uuids.begin(), uuids.end());
|
||||
|
||||
// Start a new ad hoc voice call if we invite new participants to a P2P call,
|
||||
// or start a text chat otherwise.
|
||||
if (is_voice_call)
|
||||
{
|
||||
LLAvatarActions::startAdhocCall(temp_ids);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLAvatarActions::startConference(temp_ids);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterIMPanel::removeDynamics(LLComboBox* flyout)
|
||||
{
|
||||
flyout->remove(mDing ? getString("ding on") : getString("ding off"));
|
||||
@@ -1012,8 +1103,12 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
|
||||
{
|
||||
if (value.isUndefined() || value.asInteger() == 0)
|
||||
{
|
||||
LLAvatarActions::showProfile(mOtherParticipantUUID);
|
||||
return;
|
||||
switch (mSessionType)
|
||||
{
|
||||
case GROUP_SESSION: LLGroupActions::show(mOtherParticipantUUID); return;
|
||||
case P2P_SESSION: LLAvatarActions::showProfile(mOtherParticipantUUID); return;
|
||||
default: onClickHistory(); return; // If there's no profile for this type, we should be the history button.
|
||||
}
|
||||
}
|
||||
|
||||
switch (int option = value.asInteger())
|
||||
@@ -1026,6 +1121,7 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value)
|
||||
case -1: copy_profile_uri(mOtherParticipantUUID); break;
|
||||
case -2: LLAvatarActions::showOnMap(mOtherParticipantUUID); break;
|
||||
case -3: gAgentCamera.lookAtObject(mOtherParticipantUUID); break;
|
||||
case -4: onAddButtonClicked(); break;
|
||||
default: // Options >= 6 use dynamic items
|
||||
{
|
||||
// First remove them all
|
||||
|
||||
Reference in New Issue
Block a user