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
meow-7.2.2
Dmitry Oleshko 2009-11-27 12:49:05 +02:00
parent bc57c73814
commit ca1d0c82ed
2 changed files with 48 additions and 0 deletions

View File

@ -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;

View File

@ -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;