diff options
Diffstat (limited to 'indra/newview/llvoicechannel.cpp')
-rw-r--r-- | indra/newview/llvoicechannel.cpp | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index d93913b944..ae32ec7d11 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -870,29 +870,60 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s void LLVoiceChannelP2P::setState(EState state) { - // HACK: Open/close the call window if needed. + // *HACK: Open/close the call window if needed. toggleCallWindowIfNeeded(state); - // *HACK: open outgoing call floater if needed, might be better done elsewhere. - mCallDialogPayload["session_id"] = mSessionID; - mCallDialogPayload["session_name"] = mSessionName; - mCallDialogPayload["other_user_id"] = mOtherUserID; - if (!mReceivedCall && state == STATE_RINGING) - { - llinfos << "RINGINGGGGGGGG " << mSessionName << llendl; - if (!mSessionName.empty()) + if (mReceivedCall) // incoming call + { + // you only "answer" voice invites in p2p mode + // so provide a special purpose message here + if (mReceivedCall && state == STATE_RINGING) { - LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE); + gIMMgr->addSystemMessage(mSessionID, "answering", mNotifyArgs); + doSetState(state); + return; } } - - // you only "answer" voice invites in p2p mode - // so provide a special purpose message here - if (mReceivedCall && state == STATE_RINGING) + else // outgoing call { - gIMMgr->addSystemMessage(mSessionID, "answering", mNotifyArgs); - doSetState(state); - return; + mCallDialogPayload["session_id"] = mSessionID; + mCallDialogPayload["session_name"] = mSessionName; + mCallDialogPayload["other_user_id"] = mOtherUserID; + if (state == STATE_RINGING) + { + // *HACK: open outgoing call floater if needed, might be better done elsewhere. + // *TODO: should move this squirrelly ui-fudging crap into LLOutgoingCallDialog itself + if (!mSessionName.empty()) + { + LLOutgoingCallDialog *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); + } + } + } + /*else if (state == STATE_CONNECTED) + { + LLOutgoingCallDialog *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(true); + } + }*/ + else if (state == STATE_HUNG_UP || + state == STATE_CONNECTED) + { + LLOutgoingCallDialog *ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE)); + if (ocd) + { + ocd->closeFloater(); + } + } } + LLVoiceChannel::setState(state); } |