summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llimview.cpp137
-rw-r--r--indra/newview/llimview.h14
-rw-r--r--indra/newview/llviewerfloaterreg.cpp2
-rw-r--r--indra/newview/llvoicechannel.cpp9
-rw-r--r--indra/newview/skins/default/xui/en/floater_outgoing_call.xml22
5 files changed, 172 insertions, 12 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 3214d7c8fa..899e1a6112 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1102,6 +1102,143 @@ LLIMMgr::onConfirmForceCloseError(
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLOutgoingCallDialog
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) :
+ LLDockableFloater(NULL, payload),
+ mPayload(payload)
+{
+}
+
+BOOL LLOutgoingCallDialog::postBuild()
+{
+ BOOL success = LLFloater::postBuild();
+
+ LLSD callee_id = mPayload["session_id"];//mPayload["caller_id"];
+
+ std::string calling_str = getString("calling");
+ std::string callee_name = mPayload["session_name"].asString();//mPayload["caller_name"].asString();
+ if (callee_name == "anonymous")
+ {
+ callee_name = getString("anonymous");
+ }
+
+ setTitle(callee_name);
+
+ LLUICtrl* callee_name_widget = getChild<LLUICtrl>("callee name");
+ // *TODO: substitute callee name properly
+ callee_name_widget->setValue(calling_str + " " + callee_name);
+ LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");
+ icon->setValue(callee_id);
+
+ //childSetAction("Reject", onReject, this);
+
+ return success;
+}
+
+void LLOutgoingCallDialog::processCallResponse(S32 response)
+{
+ if (!gIMMgr)
+ return;
+
+ LLUUID session_id = mPayload["session_id"].asUUID();
+ EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger();
+ LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger();
+ bool voice = true;
+ switch(response)
+ {
+ case 2: // start IM: just don't start the voice chat
+ {
+ voice = false;
+ /* FALLTHROUGH */
+ }
+ case 0: // accept
+ {
+ if (type == IM_SESSION_P2P_INVITE)
+ {
+ // create a normal IM session
+ session_id = gIMMgr->addP2PSession(
+ mPayload["session_name"].asString(),
+ mPayload["caller_id"].asUUID(),
+ mPayload["session_handle"].asString());
+
+ if (voice)
+ {
+ if (gIMMgr->startCall(session_id))
+ {
+ // always open IM window when connecting to voice
+ LLIMFloater::show(session_id);
+ }
+ }
+
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ }
+ else
+ {
+ LLUUID session_id = gIMMgr->addSession(
+ mPayload["session_name"].asString(),
+ type,
+ session_id);
+ if (session_id != LLUUID::null)
+ {
+ LLIMFloater::show(session_id);
+ }
+
+ std::string url = gAgent.getRegion()->getCapability(
+ "ChatSessionRequest");
+
+ if (voice)
+ {
+ LLSD data;
+ data["method"] = "accept invitation";
+ data["session-id"] = session_id;
+ LLHTTPClient::post(
+ url,
+ data,
+ new LLViewerChatterBoxInvitationAcceptResponder(
+ session_id,
+ inv_type));
+ }
+ }
+ if (voice)
+ {
+ break;
+ }
+ }
+ case 1: // decline
+ {
+ if (type == IM_SESSION_P2P_INVITE)
+ {
+ if(gVoiceClient)
+ {
+ std::string s = mPayload["session_handle"].asString();
+ gVoiceClient->declineInvite(s);
+ }
+ }
+ else
+ {
+ std::string url = gAgent.getRegion()->getCapability(
+ "ChatSessionRequest");
+
+ LLSD data;
+ data["method"] = "decline invitation";
+ data["session-id"] = session_id;
+ LLHTTPClient::post(
+ url,
+ data,
+ NULL);
+ }
+ }
+
+ gIMMgr->clearPendingAgentListUpdates(session_id);
+ gIMMgr->clearPendingInvitation(session_id);
+ }
+}
+
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLIncomingCallDialog
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 6269386b44..b6e0c87dcf 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -38,6 +38,7 @@
#include "llspeakers.h" //for LLIMSpeakerMgr
#include "llimpanel.h" //for voice channels
#include "llmodaldialog.h"
+#include "lldockablefloater.h"
#include "llinstantmessage.h"
#include "lluuid.h"
#include "llmultifloater.h"
@@ -421,6 +422,19 @@ private:
LLSD mPayload;
};
+class LLOutgoingCallDialog : public LLDockableFloater
+{
+public:
+ LLOutgoingCallDialog(const LLSD& payload);
+
+ /*virtual*/ BOOL postBuild();
+
+private:
+ void processCallResponse(S32 response);
+
+ LLSD mPayload;
+};
+
// Globals
extern LLIMMgr *gIMMgr;
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index edbac69e1b..7cd660110f 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -195,7 +195,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("notifications_console", "floater_notifications_console.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotificationConsole>);
LLFloaterReg::add("openobject", "floater_openobject.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOpenObject>);
-
+ LLFloaterReg::add("outgoing_call", "floater_outgoing_call.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutgoingCallDialog>);
LLFloaterReg::add("parcel_info", "floater_preview_url.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterParcelInfo>);
LLFloaterPayUtil::registerFloater();
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 89649407ff..b0ea07946c 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -378,9 +378,18 @@ void LLVoiceChannel::setURI(std::string uri)
void LLVoiceChannel::setState(EState state)
{
+ LLSD payload;
+ payload["session_id"] = mSessionID;
+ payload["session_name"] = mSessionName;
+
switch(state)
{
case STATE_RINGING:
+ llinfos << "RINGINGGGGGGGG " << mSessionName << llendl;
+ if (!mSessionName.empty())
+ {
+ LLFloaterReg::showInstance("outgoing_call", payload, TRUE);
+ }
gIMMgr->addSystemMessage(mSessionID, "ringing", mNotifyArgs);
break;
case STATE_CONNECTED:
diff --git a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
index 3838fe4bc7..fd936232c9 100644
--- a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
+++ b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml
@@ -15,8 +15,8 @@
anonymous
</floater.string>
<floater.string
- name="VoiceInviteP2P">
- is calling.
+ name="calling">
+ Calling [CALLEE]
</floater.string>
<floater.string
name="VoiceInviteAdHoc">
@@ -38,35 +38,35 @@
layout="topleft"
left="77"
max_length="2147483647"
- name="caller name"
+ name="callee name"
read_only="true"
top="21"
width="163"
word_wrap="true" />
<button
height="24"
- label="Accept"
- label_selected="Accept"
+ label="Bar"
+ label_selected="Bar"
layout="topleft"
left="70"
- name="Accept"
+ name="Bar"
top="92"
width="100" />
<button
height="24"
- label="Reject"
- label_selected="Reject"
+ label="Foo"
+ label_selected="Foo"
layout="topleft"
left_delta="0"
- name="Reject"
+ name="Foo"
top_pad="12"
width="100" />
<button
height="24"
- label="Start IM"
+ label="Baz"
layout="topleft"
left_delta="0"
- name="Start IM"
+ name="Baz"
top_pad="12"
width="100" />
</floater>