summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp344
1 files changed, 191 insertions, 153 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 4d2ba16a4c..9e878f8c75 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -72,7 +72,6 @@
#include "llviewerwindow.h"
#include "llnotifications.h"
#include "llnotificationsutil.h"
-#include "llnotify.h"
#include "llnearbychat.h"
#include "llviewerregion.h"
#include "llvoicechannel.h"
@@ -94,7 +93,8 @@ const static std::string ADHOC_NAME_SUFFIX(" Conference");
std::string LLCallDialogManager::sPreviousSessionlName = "";
std::string LLCallDialogManager::sCurrentSessionlName = "";
LLIMModel::LLIMSession* LLCallDialogManager::sSession = NULL;
-
+LLVoiceChannel::EState LLCallDialogManager::sOldState = LLVoiceChannel::STATE_READY;
+const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-1417BF03DDB4");
//
// Globals
//
@@ -154,7 +154,7 @@ LLIMModel::LLIMModel()
addNewMsgCallback(toast_callback);
}
-LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids)
+LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice)
: mSessionID(session_id),
mName(name),
mType(type),
@@ -168,24 +168,42 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
mCallBackEnabled(true),
mTextIMPossible(true),
mOtherParticipantIsAvatar(true),
- mStartCallOnInitialize(false)
+ mStartCallOnInitialize(false),
+ mStartedAsIMCall(voice)
{
+ // set P2P type by default
+ mSessionType = P2P_SESSION;
+
if (IM_NOTHING_SPECIAL == type || IM_SESSION_P2P_INVITE == type)
{
mVoiceChannel = new LLVoiceChannelP2P(session_id, name, other_participant_id);
+
+ // check if it was AVALINE call
+ if (!mOtherParticipantIsAvatar)
+ {
+ mSessionType = AVALINE_SESSION;
+ }
}
else
{
mVoiceChannel = new LLVoiceChannelGroup(session_id, name);
+
+ // determine whether it is group or conference session
+ if (gAgent.isInGroup(mSessionID))
+ {
+ mSessionType = GROUP_SESSION;
+ }
+ else
+ {
+ mSessionType = ADHOC_SESSION;
+ }
}
if(mVoiceChannel)
{
- mVoiceChannelStateChangeConnection = mVoiceChannel->setStateChangedCallback(boost::bind(&LLIMSession::onVoiceChannelStateChanged, this, _1, _2));
+ mVoiceChannelStateChangeConnection = mVoiceChannel->setStateChangedCallback(boost::bind(&LLIMSession::onVoiceChannelStateChanged, this, _1, _2, _3));
}
- // define what type of session was opened
- setSessionType();
-
+
mSpeakers = new LLIMSpeakerMgr(mVoiceChannel);
// All participants will be added to the list of people we've recently interacted with.
@@ -218,53 +236,27 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
}
}
-void LLIMModel::LLIMSession::setSessionType()
-{
- // set P2P type by default
- mSessionType = P2P_SESSION;
-
- if (dynamic_cast<LLVoiceChannelP2P*>(mVoiceChannel) && !mOtherParticipantIsAvatar) // P2P AVALINE channel was opened
- {
- mSessionType = AVALINE_SESSION;
- return;
- }
- else if(dynamic_cast<LLVoiceChannelGroup*>(mVoiceChannel)) // GROUP channel was opened
- {
- if (mType == IM_SESSION_CONFERENCE_START)
- {
- mSessionType = ADHOC_SESSION;
- return;
- }
- else if(mType == IM_SESSION_GROUP_START)
- {
- mSessionType = GROUP_SESSION;
- return;
- }
- }
-}
-
-void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
+void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction)
{
- // *TODO: remove hardcoded string!!!!!!!!!!!
-
bool is_p2p_session = dynamic_cast<LLVoiceChannelP2P*>(mVoiceChannel);
- bool is_incoming_call = false;
std::string other_avatar_name;
if(is_p2p_session)
{
- is_incoming_call = static_cast<LLVoiceChannelP2P*>(mVoiceChannel)->isIncomingCall();
gCacheName->getFullName(mOtherParticipantID, other_avatar_name);
+ std::string you = LLTrans::getString("You");
+ std::string started_call = LLTrans::getString("started_call");
+ std::string joined_call = LLTrans::getString("joined_call");
- if(is_incoming_call)
+ if(direction == LLVoiceChannel::INCOMING_CALL)
{
switch(new_state)
{
case LLVoiceChannel::STATE_CALL_STARTED :
- LLIMModel::getInstance()->addMessage(mSessionID, other_avatar_name, mOtherParticipantID, "Started a voice call");
+ LLIMModel::getInstance()->addMessageSilently(mSessionID, other_avatar_name, mOtherParticipantID, started_call);
break;
case LLVoiceChannel::STATE_CONNECTED :
- LLIMModel::getInstance()->addMessage(mSessionID, "You", gAgent.getID(), "Joined the voice call");
+ LLIMModel::getInstance()->addMessageSilently(mSessionID, you, gAgent.getID(), joined_call);
default:
break;
}
@@ -274,10 +266,10 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES
switch(new_state)
{
case LLVoiceChannel::STATE_CALL_STARTED :
- LLIMModel::getInstance()->addMessage(mSessionID, "You", gAgent.getID(), "Started a voice call");
+ LLIMModel::getInstance()->addMessageSilently(mSessionID, you, gAgent.getID(), started_call);
break;
case LLVoiceChannel::STATE_CONNECTED :
- LLIMModel::getInstance()->addMessage(mSessionID, other_avatar_name, mOtherParticipantID, "Joined the voice call");
+ LLIMModel::getInstance()->addMessageSilently(mSessionID, other_avatar_name, mOtherParticipantID, joined_call);
default:
break;
}
@@ -463,7 +455,7 @@ void LLIMModel::testMessages()
//session name should not be empty
bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
- const LLUUID& other_participant_id, const std::vector<LLUUID>& ids)
+ const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice)
{
if (name.empty())
{
@@ -477,7 +469,7 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co
return false;
}
- LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids);
+ LLIMSession* session = new LLIMSession(session_id, name, type, other_participant_id, ids, voice);
mId2SessionMap[session_id] = session;
LLIMMgr::getInstance()->notifyObserverSessionAdded(session_id, name, other_participant_id);
@@ -486,6 +478,12 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co
}
+bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice)
+{
+ std::vector<LLUUID> no_ids;
+ return newSession(session_id, name, type, other_participant_id, no_ids, voice);
+}
+
bool LLIMModel::clearSession(const LLUUID& session_id)
{
if (mId2SessionMap.find(session_id) == mId2SessionMap.end()) return false;
@@ -585,12 +583,33 @@ bool LLIMModel::proccessOnlineOfflineNotification(
bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
const std::string& utf8_text, bool log2file /* = true */) {
+
+ LLIMSession* session = addMessageSilently(session_id, from, from_id, utf8_text, log2file);
+ if (!session) return false;
+
+ // notify listeners
+ LLSD arg;
+ arg["session_id"] = session_id;
+ arg["num_unread"] = session->mNumUnread;
+ arg["participant_unread"] = session->mParticipantUnreadMessageCount;
+ arg["message"] = utf8_text;
+ arg["from"] = from;
+ arg["from_id"] = from_id;
+ arg["time"] = LLLogChat::timestamp(false);
+ mNewMsgSignal(arg);
+
+ return true;
+}
+
+LLIMModel::LLIMSession* LLIMModel::addMessageSilently(const LLUUID& session_id, const std::string& from, const LLUUID& from_id,
+ const std::string& utf8_text, bool log2file /* = true */)
+{
LLIMSession* session = findIMSession(session_id);
if (!session)
{
llwarns << "session " << session_id << "does not exist " << llendl;
- return false;
+ return NULL;
}
addToHistory(session_id, from, from_id, utf8_text);
@@ -604,19 +623,7 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
++(session->mParticipantUnreadMessageCount);
}
-
- // notify listeners
- LLSD arg;
- arg["session_id"] = session_id;
- arg["num_unread"] = session->mNumUnread;
- arg["participant_unread"] = session->mParticipantUnreadMessageCount;
- arg["message"] = utf8_text;
- arg["from"] = from;
- arg["from_id"] = from_id;
- arg["time"] = LLLogChat::timestamp(false);
- mNewMsgSignal(arg);
-
- return true;
+ return session;
}
@@ -1060,15 +1067,15 @@ public:
if (LLIMMgr::INVITATION_TYPE_VOICE == mInvitiationType)
{
- gIMMgr->startCall(mSessionID);
+ gIMMgr->startCall(mSessionID, LLVoiceChannel::INCOMING_CALL);
}
if ((mInvitiationType == LLIMMgr::INVITATION_TYPE_VOICE
|| mInvitiationType == LLIMMgr::INVITATION_TYPE_IMMEDIATE)
&& LLIMModel::getInstance()->findIMSession(mSessionID))
{
- // always open IM window when connecting to voice
- LLIMFloater::show(mSessionID);
+ // TODO remove in 2010, for voice calls we do not open an IM window
+ //LLIMFloater::show(mSessionID);
}
gIMMgr->clearPendingAgentListUpdates(mSessionID);
@@ -1267,71 +1274,45 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
}
sSession = session;
sSession->mVoiceChannel->setStateChangedCallback(LLCallDialogManager::onVoiceChannelStateChanged);
- sPreviousSessionlName = sCurrentSessionlName;
- sCurrentSessionlName = session->mName;
+ if(sCurrentSessionlName != session->mName)
+ {
+ sPreviousSessionlName = sCurrentSessionlName;
+ sCurrentSessionlName = session->mName;
+ }
}
-void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
+void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction)
{
LLSD mCallDialogPayload;
- LLOutgoingCallDialog* ocd;
- bool is_incoming;
+ LLOutgoingCallDialog* ocd = NULL;
+
+ if(sOldState == new_state)
+ {
+ return;
+ }
+
+ sOldState = new_state;
mCallDialogPayload["session_id"] = sSession->mSessionID;
mCallDialogPayload["session_name"] = sSession->mName;
mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID;
mCallDialogPayload["old_channel_name"] = sPreviousSessionlName;
+ mCallDialogPayload["state"] = new_state;
+ mCallDialogPayload["disconnected_channel_name"] = sSession->mName;
+ mCallDialogPayload["session_type"] = sSession->mSessionType;
switch(new_state)
{
case LLVoiceChannel::STATE_CALL_STARTED :
// do not show "Calling to..." if it is incoming call
- is_incoming = LLVoiceClient::getInstance()->isSessionIncoming(sSession->mSessionID);
- // *TODO: implement for AdHoc and Group voice chats
- if(is_incoming)
+ if(direction == LLVoiceChannel::INCOMING_CALL)
{
return;
}
-
- ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE));
- if (ocd)
- {
- ocd->getChild<LLTextBox>("calling")->setVisible(true);
- ocd->getChild<LLTextBox>("leaving")->setVisible(true);
- ocd->getChild<LLTextBox>("connecting")->setVisible(false);
- ocd->getChild<LLTextBox>("noanswer")->setVisible(false);
- ocd->getChild<LLButton>("Cancel")->setVisible(true);
- }
- return;
-
- case LLVoiceChannel::STATE_RINGING :
- ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE));
- if (ocd)
- {
- ocd->getChild<LLTextBox>("calling")->setVisible(false);
- ocd->getChild<LLTextBox>("leaving")->setVisible(true);
- ocd->getChild<LLTextBox>("connecting")->setVisible(true);
- ocd->getChild<LLTextBox>("noanswer")->setVisible(false);
- ocd->getChild<LLButton>("Cancel")->setVisible(true);
- }
- return;
-
- case LLVoiceChannel::STATE_ERROR :
- mCallDialogPayload["start_timer"] = true;
- ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE));
- if (ocd)
- {
- ocd->getChild<LLTextBox>("calling")->setVisible(false);
- ocd->getChild<LLTextBox>("leaving")->setVisible(false);
- ocd->getChild<LLTextBox>("connecting")->setVisible(false);
- ocd->getChild<LLTextBox>("noanswer")->setVisible(true);
- ocd->getChild<LLButton>("Cancel")->setVisible(false);
- }
- return;
+ break;
case LLVoiceChannel::STATE_CONNECTED :
- case LLVoiceChannel::STATE_HUNG_UP :
- ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE));
+ ocd = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
if (ocd)
{
ocd->closeFloater();
@@ -1342,6 +1323,11 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat
break;
}
+ ocd = LLFloaterReg::getTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
+ if(ocd)
+ {
+ ocd->show(mCallDialogPayload);
+ }
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1371,12 +1357,13 @@ void LLCallDialog::onOpen(const LLSD& key)
LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) :
LLCallDialog(payload)
{
- LLOutgoingCallDialog* instance = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", payload);
+ LLOutgoingCallDialog* instance = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
if(instance && instance->getVisible())
{
instance->onCancel(instance);
}
}
+
void LLOutgoingCallDialog::draw()
{
if (lifetimeHasExpired())
@@ -1405,10 +1392,14 @@ void LLOutgoingCallDialog::onLifetimeExpired()
closeFloater();
}
-void LLOutgoingCallDialog::onOpen(const LLSD& key)
+void LLOutgoingCallDialog::show(const LLSD& key)
{
- LLCallDialog::onOpen(key);
+ mPayload = key;
+
+ // hide all text at first
+ hideAllText();
+ // customize text strings
// tell the user which voice channel they are leaving
if (!mPayload["old_channel_name"].asString().empty())
{
@@ -1419,6 +1410,12 @@ void LLOutgoingCallDialog::onOpen(const LLSD& key)
childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat"));
}
+ if (!mPayload["disconnected_channel_name"].asString().empty())
+ {
+ childSetTextArg("nearby", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString());
+ childSetTextArg("nearby_P2P", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString());
+ }
+
std::string callee_name = mPayload["session_name"].asString();
if (callee_name == "anonymous")
{
@@ -1435,12 +1432,48 @@ void LLOutgoingCallDialog::onOpen(const LLSD& key)
// stop timer by default
mLifetimeTimer.stop();
- if(mPayload.has("start_timer"))
+
+ // show only necessary strings and controls
+ switch(mPayload["state"].asInteger())
{
- mLifetimeTimer.reset();
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ getChild<LLTextBox>("calling")->setVisible(true);
+ getChild<LLTextBox>("leaving")->setVisible(true);
+ break;
+ case LLVoiceChannel::STATE_RINGING :
+ getChild<LLTextBox>("leaving")->setVisible(true);
+ getChild<LLTextBox>("connecting")->setVisible(true);
+ break;
+ case LLVoiceChannel::STATE_ERROR :
+ getChild<LLTextBox>("noanswer")->setVisible(true);
+ getChild<LLButton>("Cancel")->setVisible(false);
+ mLifetimeTimer.start();
+ break;
+ case LLVoiceChannel::STATE_HUNG_UP :
+ if (mPayload["session_type"].asInteger() == LLIMModel::LLIMSession::P2P_SESSION)
+ {
+ getChild<LLTextBox>("nearby_P2P")->setVisible(true);
+ }
+ else
+ {
+ getChild<LLTextBox>("nearby")->setVisible(true);
+ }
+ getChild<LLButton>("Cancel")->setVisible(false);
+ mLifetimeTimer.start();
}
+
+ openFloater(LLOutgoingCallDialog::OCD_KEY);
}
+void LLOutgoingCallDialog::hideAllText()
+{
+ getChild<LLTextBox>("calling")->setVisible(false);
+ getChild<LLTextBox>("leaving")->setVisible(false);
+ getChild<LLTextBox>("connecting")->setVisible(false);
+ getChild<LLTextBox>("nearby_P2P")->setVisible(false);
+ getChild<LLTextBox>("nearby")->setVisible(false);
+ getChild<LLTextBox>("noanswer")->setVisible(false);
+}
//static
void LLOutgoingCallDialog::onCancel(void* user_data)
@@ -1470,6 +1503,7 @@ BOOL LLOutgoingCallDialog::postBuild()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLIncomingCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
LLCallDialog(payload)
{
@@ -1479,26 +1513,34 @@ BOOL LLIncomingCallDialog::postBuild()
{
LLDockableFloater::postBuild();
+ LLUUID session_id = mPayload["session_id"].asUUID();
LLSD caller_id = mPayload["caller_id"];
- EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger();
-
- std::string call_type = getString("VoiceInviteP2P");
std::string caller_name = mPayload["caller_name"].asString();
+
+ std::string call_type;
+ if (gAgent.isInGroup(session_id))
+ {
+ LLStringUtil::format_map_t args;
+ LLGroupData data;
+ if (gAgent.getGroupData(session_id, data))
+ {
+ args["[GROUP]"] = data.mName;
+ call_type = getString(mPayload["notify_box_type"], args);
+ }
+ }
+ else
+ {
+ call_type = getString(mPayload["notify_box_type"]);
+ }
+
if (caller_name == "anonymous")
{
caller_name = getString("anonymous");
}
setTitle(caller_name + " " + call_type);
-
- // If it is not a P2P invite, then it's an AdHoc invite
- if ( type != IM_SESSION_P2P_INVITE )
- {
- call_type = getString("VoiceInviteAdHoc");
- }
// check to see if this is an Avaline call
- LLUUID session_id = mPayload["session_id"].asUUID();
bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
childSetVisible("Start IM", is_avatar); // no IM for avaline
@@ -1587,11 +1629,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
if (voice)
{
- if (gIMMgr->startCall(session_id))
- {
- // always open IM window when connecting to voice
- LLIMFloater::show(session_id);
- }
+ gIMMgr->startCall(session_id, LLVoiceChannel::INCOMING_CALL);
}
gIMMgr->clearPendingAgentListUpdates(session_id);
@@ -1630,11 +1668,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
}
}
- LLUUID new_session_id = gIMMgr->addSession(correct_session_name, type, session_id);
- if (new_session_id != LLUUID::null)
- {
- LLIMFloater::show(new_session_id);
- }
+ LLUUID new_session_id = gIMMgr->addSession(correct_session_name, type, session_id, true);
std::string url = gAgent.getRegion()->getCapability(
"ChatSessionRequest");
@@ -1710,11 +1744,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
payload["session_handle"].asString(),
payload["session_uri"].asString());
- if (gIMMgr->startCall(session_id))
- {
- // always open IM window when connecting to voice
- LLIMFloater::show(session_id);
- }
+ gIMMgr->startCall(session_id);
gIMMgr->clearPendingAgentListUpdates(session_id);
gIMMgr->clearPendingInvitation(session_id);
@@ -1724,11 +1754,7 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
LLUUID new_session_id = gIMMgr->addSession(
payload["session_name"].asString(),
type,
- session_id);
- if (new_session_id != LLUUID::null)
- {
- LLIMFloater::show(new_session_id);
- }
+ session_id, true);
std::string url = gAgent.getRegion()->getCapability(
"ChatSessionRequest");
@@ -1798,6 +1824,8 @@ LLIMMgr::LLIMMgr() :
{
mPendingInvitations = LLSD::emptyMap();
mPendingAgentListUpdates = LLSD::emptyMap();
+
+ LLIMModel::getInstance()->addNewMsgCallback(boost::bind(&LLIMFloater::sRemoveTypingIndicator, _1));
}
// Add a message to a session.
@@ -2021,11 +2049,7 @@ LLUUID LLIMMgr::addP2PSession(const std::string& name,
const std::string& voice_session_handle,
const std::string& caller_uri)
{
- LLUUID session_id = addSession(name, IM_NOTHING_SPECIAL, other_participant_id);
- if (session_id != LLUUID::null)
- {
- LLIMFloater::show(session_id);
- }
+ LLUUID session_id = addSession(name, IM_NOTHING_SPECIAL, other_participant_id, true);
LLIMSpeakerMgr* speaker_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
if (speaker_mgr)
@@ -2046,11 +2070,11 @@ LLUUID LLIMMgr::addP2PSession(const std::string& name,
LLUUID LLIMMgr::addSession(
const std::string& name,
EInstantMessage dialog,
- const LLUUID& other_participant_id)
+ const LLUUID& other_participant_id, bool voice)
{
LLDynamicArray<LLUUID> ids;
ids.put(other_participant_id);
- return addSession(name, dialog, other_participant_id, ids);
+ return addSession(name, dialog, other_participant_id, ids, voice);
}
// Adds a session using the given session_id. If the session already exists
@@ -2059,7 +2083,7 @@ LLUUID LLIMMgr::addSession(
const std::string& name,
EInstantMessage dialog,
const LLUUID& other_participant_id,
- const LLDynamicArray<LLUUID>& ids)
+ const LLDynamicArray<LLUUID>& ids, bool voice)
{
if (0 == ids.getLength())
{
@@ -2078,7 +2102,7 @@ LLUUID LLIMMgr::addSession(
if (new_session)
{
- LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids);
+ LLIMModel::getInstance()->newSession(session_id, name, dialog, other_participant_id, ids, voice);
}
@@ -2438,11 +2462,12 @@ void LLIMMgr::removeSessionObserver(LLIMSessionObserver *observer)
mSessionObservers.remove(observer);
}
-bool LLIMMgr::startCall(const LLUUID& session_id)
+bool LLIMMgr::startCall(const LLUUID& session_id, LLVoiceChannel::EDirection direction)
{
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(session_id);
if (!voice_channel) return false;
+ voice_channel->setCallDirection(direction);
voice_channel->activate();
return true;
}
@@ -2456,6 +2481,14 @@ bool LLIMMgr::endCall(const LLUUID& session_id)
return true;
}
+bool LLIMMgr::isVoiceCall(const LLUUID& session_id)
+{
+ LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
+ if (!im_session) return false;
+
+ return im_session->mStartedAsIMCall;
+}
+
// create a floater and update internal representation for
// consistency. Returns the pointer, caller (the class instance since
// it is a private method) is not responsible for deleting the
@@ -2730,6 +2763,11 @@ public:
{
im_floater->processSessionUpdate(input["body"]["info"]);
}
+ LLIMSpeakerMgr* im_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id);
+ if (im_mgr)
+ {
+ im_mgr->processSessionUpdate(input["body"]["info"]);
+ }
}
};