summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llimview.cpp47
-rw-r--r--indra/newview/llimview.h1
2 files changed, 48 insertions, 0 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index c096b5220a..9a0dcc11e5 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -165,6 +165,11 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
{
mVoiceChannel = new LLVoiceChannelGroup(session_id, name);
}
+
+ if(mVoiceChannel)
+ {
+ mVoiceChannel->setStateChangedCallback(boost::bind(&LLIMSession::onVoiceChannelStateChanged, this, _1, _2));
+ }
mSpeakers = new LLIMSpeakerMgr(mVoiceChannel);
// All participants will be added to the list of people we've recently interacted with.
@@ -191,6 +196,48 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
LLLogChat::loadHistory(mName, &chatFromLogFile, (void *)this);
}
+void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
+{
+ 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)
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, other_avatar_name, mOtherParticipantID, "Started a voice call");
+ break;
+ case LLVoiceChannel::STATE_CONNECTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, "You", gAgent.getID(), "Joined the voice call");
+ break;
+ }
+ }
+ else // outgoing call
+ {
+ switch(new_state)
+ {
+ case LLVoiceChannel::STATE_CALL_STARTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, "You", gAgent.getID(), "Started a voice call");
+ break;
+ case LLVoiceChannel::STATE_CONNECTED :
+ LLIMModel::getInstance()->addMessage(mSessionID, other_avatar_name, mOtherParticipantID, "Joined the voice call");
+ break;
+ }
+ }
+ }
+ else // group || ad-hoc calls
+ {
+
+ }
+}
+
LLIMModel::LLIMSession::~LLIMSession()
{
delete mSpeakers;
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 62a54bc081..79b0acad69 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -61,6 +61,7 @@ public:
void sessionInitReplyReceived(const LLUUID& new_session_id);
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);
static void chatFromLogFile(LLLogChat::ELogLineType type, const LLSD& msg, void* userdata);
LLUUID mSessionID;