summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llimview.cpp71
-rw-r--r--indra/newview/llimview.h7
-rw-r--r--indra/newview/llvoicechannel.cpp3
-rw-r--r--indra/newview/llvoicechannel.h17
-rw-r--r--indra/newview/llvoiceclient.cpp15
-rw-r--r--indra/newview/llvoiceclient.h2
6 files changed, 48 insertions, 67 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index fbed1494ff..bc35260983 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -169,22 +169,39 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
mOtherParticipantIsAvatar(true),
mStartCallOnInitialize(false)
{
+ // 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.
@@ -217,45 +234,18 @@ 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);
- if(is_incoming_call)
+ if(direction == LLVoiceChannel::INCOMING_CALL)
{
switch(new_state)
{
@@ -1059,7 +1049,7 @@ public:
if (LLIMMgr::INVITATION_TYPE_VOICE == mInvitiationType)
{
- gIMMgr->startCall(mSessionID);
+ gIMMgr->startCall(mSessionID, LLVoiceChannel::INCOMING_CALL);
}
if ((mInvitiationType == LLIMMgr::INVITATION_TYPE_VOICE
@@ -1270,11 +1260,10 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
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;
mCallDialogPayload["session_id"] = sSession->mSessionID;
mCallDialogPayload["session_name"] = sSession->mName;
@@ -1285,9 +1274,7 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat
{
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;
}
@@ -1469,6 +1456,7 @@ BOOL LLOutgoingCallDialog::postBuild()
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLIncomingCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
LLCallDialog(payload)
{
@@ -1594,7 +1582,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
if (voice)
{
- if (gIMMgr->startCall(session_id))
+ if (gIMMgr->startCall(session_id, LLVoiceChannel::INCOMING_CALL))
{
// always open IM window when connecting to voice
LLIMFloater::show(session_id);
@@ -2445,11 +2433,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;
}
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index f26889ac91..e2fcd63e28 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -69,10 +69,9 @@ public:
virtual ~LLIMSession();
void sessionInitReplyReceived(const LLUUID& new_session_id);
- void setSessionType(); //define what type of session was opened
void addMessagesFromHistory(const std::list<LLSD>& history);
void addMessage(const std::string& from, const LLUUID& from_id, const std::string& utf8_text, const std::string& time);
- void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state);
+ void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction);
static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata);
LLUUID mSessionID;
@@ -384,7 +383,7 @@ public:
* Start call in a session
* @return false if voice channel doesn't exist
**/
- bool startCall(const LLUUID& session_id);
+ bool startCall(const LLUUID& session_id, LLVoiceChannel::EDirection direction = LLVoiceChannel::OUTGOING_CALL);
/**
* End call in a session
@@ -448,7 +447,7 @@ public:
static void initClass();
static void onVoiceChannelChanged(const LLUUID &session_id);
- static void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state);
+ static void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction);
protected:
static std::string sPreviousSessionlName;
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 175b6f1d10..fd4e7bb91f 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -122,6 +122,7 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
mSessionID(session_id),
mState(STATE_NO_CHANNEL_INFO),
mSessionName(session_name),
+ mCallDirection(OUTGOING_CALL),
mIgnoreNextSessionLeave(FALSE)
{
mNotifyArgs["VOICE_CHANNEL_NAME"] = mSessionName;
@@ -405,7 +406,7 @@ void LLVoiceChannel::doSetState(const EState& new_state)
EState old_state = mState;
mState = new_state;
if (!mStateChangedCallback.empty())
- mStateChangedCallback(old_state, mState);
+ mStateChangedCallback(old_state, mState, mCallDirection);
}
//static
diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h
index 1bed329ba2..77801142cb 100644
--- a/indra/newview/llvoicechannel.h
+++ b/indra/newview/llvoicechannel.h
@@ -52,7 +52,13 @@ public:
STATE_CONNECTED
} EState;
- typedef boost::signals2::signal<void(const EState& old_state, const EState& new_state)> state_changed_signal_t;
+ typedef enum e_voice_channel_direction
+ {
+ INCOMING_CALL,
+ OUTGOING_CALL
+ } EDirection;
+
+ typedef boost::signals2::signal<void(const EState& old_state, const EState& new_state, const EDirection& direction)> state_changed_signal_t;
// on current channel changed signal
typedef boost::function<void(const LLUUID& session_id)> channel_changed_callback_t;
@@ -87,6 +93,9 @@ public:
void updateSessionID(const LLUUID& new_session_id);
const LLSD& getNotifyArgs() { return mNotifyArgs; }
+ void setCallDirection(EDirection direction) {mCallDirection = direction;}
+ EDirection getCallDirection() {return mCallDirection;}
+
static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
static LLVoiceChannel* getChannelByURI(std::string uri);
static LLVoiceChannel* getCurrentVoiceChannel() { return sCurrentVoiceChannel; }
@@ -103,6 +112,9 @@ protected:
void doSetState(const EState& state);
void setURI(std::string uri);
+ // there can be two directions ICOMING and OUTGOING
+ EDirection mCallDirection;
+
std::string mURI;
std::string mCredentials;
LLUUID mSessionID;
@@ -175,9 +187,6 @@ public:
void setSessionHandle(const std::string& handle, const std::string &inURI);
- // returns TRUE if call is incoming and FALSE otherwise
- BOOL isIncomingCall() { return mReceivedCall; }
-
protected:
virtual void setState(EState state);
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 63acba50e7..7e1e7c940f 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -4279,7 +4279,6 @@ void LLVoiceClient::mediaStreamUpdatedEvent(
{
// Send the voice chat invite to the GUI layer
// *TODO: Question: Should we correlate with the mute list here?
- session->mIncoming = true;
session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
session->mVoiceInvitePending = true;
if(session->mName.empty())
@@ -6354,20 +6353,6 @@ LLVoiceClient::sessionState *LLVoiceClient::findSession(const LLUUID &participan
return result;
}
-bool LLVoiceClient::isSessionIncoming(const LLUUID &session_id)
-{
- for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
- {
- sessionState *session = *iter;
- if(session->mIMSessionID == session_id)
- {
- return session->mIncoming;
- break;
- }
- }
- return false;
-}
-
LLVoiceClient::sessionState *LLVoiceClient::addSession(const std::string &uri, const std::string &handle)
{
sessionState *result = NULL;
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index edfe0173f8..347fae6156 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -527,8 +527,6 @@ static void updatePosition(void);
// Currently this will be false only for PSTN P2P calls.
// NOTE: this will return true if the session can't be found.
bool isSessionTextIMPossible(const LLUUID &session_id);
-
- bool isSessionIncoming(const LLUUID &session_id);
private: