diff options
Diffstat (limited to 'indra/newview/llimfloater.cpp')
-rw-r--r-- | indra/newview/llimfloater.cpp | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 9d3c0f98ce..536d0b9a23 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -322,7 +322,7 @@ BOOL LLIMFloater::postBuild() void LLIMFloater::onAddButtonClicked() { - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::onAvatarPicked, this, _1, _2), TRUE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLIMFloater::addSessionParticipants, this, _1), TRUE, TRUE); if (!picker) { return; @@ -337,25 +337,6 @@ void LLIMFloater::onAddButtonClicked() } } -void LLIMFloater::onAvatarPicked(const uuid_vec_t& ids, const std::vector<LLAvatarName> names) -{ - if (mIsP2PChat) - { - mStartConferenceInSameFloater = true; - onClose(false); - - uuid_vec_t temp_ids; - temp_ids.push_back(mOtherParticipantUUID); - temp_ids.insert(temp_ids.end(), ids.begin(), ids.end()); - - LLAvatarActions::startConference(temp_ids, mSessionID); - } - else - { - inviteToSession(ids); - } -} - bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) { if (!mSession @@ -388,6 +369,44 @@ bool LLIMFloater::canAddSelectedToChat(const uuid_vec_t& uuids) return true; } +void LLIMFloater::addSessionParticipants(const uuid_vec_t& uuids) +{ + if (mIsP2PChat) + { + mStartConferenceInSameFloater = true; + + 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()); + + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + + // first check whether this is a voice session + bool is_voice_call = voice_channel != NULL && voice_channel->isActive(); + + // then we can close the current session + gIMMgr->leaveSession(mSessionID); + LLIMConversation::onClose(false); + + // 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, mSessionID); + } + else + { + LLAvatarActions::startConference(temp_ids, mSessionID); + } + } + else + { + inviteToSession(uuids); + } +} + void LLIMFloater::boundVoiceChannel() { LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); @@ -1096,19 +1115,7 @@ bool LLIMFloater::dropPerson(LLUUID* person_id, bool drop) res = canAddSelectedToChat(ids); if(res && drop) { - if (mIsP2PChat) - { - mStartConferenceInSameFloater = true; - onClose(false); - - ids.push_back(mOtherParticipantUUID); - - LLAvatarActions::startConference(ids, mSessionID); - } - else - { - inviteToSession(ids); - } + addSessionParticipants(ids); } } |