diff options
author | Dmitry Oleshko <doleshko@productengine.com> | 2009-11-27 12:49:05 +0200 |
---|---|---|
committer | Dmitry Oleshko <doleshko@productengine.com> | 2009-11-27 12:49:05 +0200 |
commit | ca1d0c82edc361aeaa39678d7fc8983771cc0a28 (patch) | |
tree | f096fc0e0ca9dfe02ce0b2a2891eaa6acf531447 /indra/newview | |
parent | bc57c73814db2297f17e2c6497a3ae8562bf845c (diff) |
partial fix for major sub-task (EXT-2211) Add textual indication (IM messages) about incoming voice calls and reactions on them (All types of IMs)
implemented "Started a voice call" and "Joined the voice call" IM notifications for p2p voice chat.
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llimview.cpp | 47 | ||||
-rw-r--r-- | indra/newview/llimview.h | 1 |
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; |