summaryrefslogtreecommitdiff
path: root/indra/newview/llvoicechannel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoicechannel.cpp')
-rw-r--r--indra/newview/llvoicechannel.cpp93
1 files changed, 84 insertions, 9 deletions
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index cefc88ebee..8f63df8c29 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -33,6 +33,7 @@
#include "llviewerprecompiledheaders.h"
#include "llagent.h"
+#include "llfloatercall.h"
#include "llfloaterreg.h"
#include "llimview.h"
#include "llnotifications.h"
@@ -46,6 +47,7 @@ LLVoiceChannel::voice_channel_map_t LLVoiceChannel::sVoiceChannelMap;
LLVoiceChannel::voice_channel_map_uri_t LLVoiceChannel::sVoiceChannelURIMap;
LLVoiceChannel* LLVoiceChannel::sCurrentVoiceChannel = NULL;
LLVoiceChannel* LLVoiceChannel::sSuspendedVoiceChannel = NULL;
+LLVoiceChannel::channel_changed_signal_t LLVoiceChannel::sCurrentVoiceChannelChangedSignal;
BOOL LLVoiceChannel::sSuspended = FALSE;
@@ -305,8 +307,10 @@ void LLVoiceChannel::activate()
// activating the proximal channel between IM calls
LLVoiceChannel* old_channel = sCurrentVoiceChannel;
sCurrentVoiceChannel = this;
+ mCallDialogPayload["old_channel_name"] = "";
if (old_channel)
{
+ mCallDialogPayload["old_channel_name"] = old_channel->getSessionName();
old_channel->deactivate();
}
}
@@ -320,6 +324,8 @@ void LLVoiceChannel::activate()
{
setState(STATE_CALL_STARTED);
}
+
+ sCurrentVoiceChannelChangedSignal(this->mSessionID);
}
void LLVoiceChannel::getChannelInfo()
@@ -403,9 +409,14 @@ void LLVoiceChannel::doSetState(const EState& new_state)
void LLVoiceChannel::toggleCallWindowIfNeeded(EState state)
{
+ LLFloaterCall* floater = dynamic_cast<LLFloaterCall*>(LLFloaterReg::getInstance("voice_call", mSessionID));
+ if (!floater)
+ return;
+
if (state == STATE_CONNECTED)
{
- LLFloaterReg::showInstance("voice_call", mSessionID);
+ floater->init(mSessionID);
+ floater->openFloater(mSessionID);
}
// By checking that current state is CONNECTED we make sure that the call window
// has been shown, hence there's something to hide. This helps when user presses
@@ -413,7 +424,8 @@ void LLVoiceChannel::toggleCallWindowIfNeeded(EState state)
// *TODO: move this check to LLFloaterCall?
else if (state == STATE_HUNG_UP && mState == STATE_CONNECTED)
{
- LLFloaterReg::hideInstance("voice_call", mSessionID);
+ floater->reset();
+ floater->closeFloater();
}
}
@@ -742,6 +754,8 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string
void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
{
+ llinfos << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << llendl;
+
// status updates
switch(type)
{
@@ -865,16 +879,77 @@ 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);
+
+ llinfos << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << llendl;
- // you only "answer" voice invites in p2p mode
- // so provide a special purpose message here
- if (mReceivedCall && state == STATE_RINGING)
+ if (mReceivedCall) // incoming call
{
- 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)
+ {
+ gIMMgr->addSystemMessage(mSessionID, "answering", mNotifyArgs);
+ doSetState(state);
+ return;
+ }
}
+ else // outgoing call
+ {
+ mCallDialogPayload["session_id"] = mSessionID;
+ mCallDialogPayload["session_name"] = mSessionName;
+ mCallDialogPayload["other_user_id"] = mOtherUserID;
+ if (state == STATE_RINGING ||
+ state == STATE_CALL_STARTED)
+ {
+ // *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);
+ ocd->getChild<LLTextBox>("noanswer")->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);
+ ocd->getChild<LLTextBox>("noanswer")->setVisible(false);
+ }
+ }*/
+ else if (state == STATE_ERROR)
+ {
+ 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(false);
+ ocd->getChild<LLTextBox>("noanswer")->setVisible(true);
+ }
+ }
+ else if (state == STATE_HUNG_UP ||
+ state == STATE_CONNECTED)
+ {
+ // hide popup
+ LLOutgoingCallDialog *ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE));
+ if (ocd)
+ {
+ ocd->closeFloater();
+ }
+ }
+ }
+
LLVoiceChannel::setState(state);
}