summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp82
1 files changed, 67 insertions, 15 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 215cc4103b..9c8fcd3283 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -102,7 +102,7 @@ enum EMultiAgentChatSessionType
void startConferenceCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId, LLSD agents);
-void startP2PCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId);
+void startP2PVoiceCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId);
void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType);
void chatterBoxHistoryCoro(std::string url, LLUUID sessionId, std::string from, std::string message, U32 timestamp);
@@ -456,14 +456,14 @@ void startConferenceCoro(std::string url,
}
}
-void startP2PCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID otherParticipantId)
+void startP2PVoiceCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID otherParticipantId)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
- LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ConferenceChatStart", httpPolicy));
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("StartP2PVoiceCoro", httpPolicy));
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
LLSD postData;
- postData["method"] = "start p2p";
+ postData["method"] = "start p2p voice";
postData["session-id"] = sessionID;
postData["params"] = otherParticipantId;
LLSD altParams;
@@ -2125,7 +2125,7 @@ bool LLIMModel::sendStartSession(
if (region)
{
std::string url = region->getCapability("ChatSessionRequest");
- LLCoros::instance().launch("startP2P", boost::bind(&startP2PCoro, url, temp_session_id, gAgent.getID(), other_participant_id));
+ LLCoros::instance().launch("startP2PVoiceCoro", boost::bind(&startP2PVoiceCoro, url, temp_session_id, gAgent.getID(), other_participant_id));
}
return true;
}
@@ -2727,7 +2727,7 @@ LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
void LLIncomingCallDialog::onLifetimeExpired()
{
- LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(mPayload["voice_session_info"]);
+ LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(mPayload["voice_channel_info"]);
if (call)
{
// restart notification's timer if call is still valid
@@ -3005,24 +3005,42 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
{
if (type == IM_SESSION_P2P_INVITE)
{
- LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(payload["voice_session_info"]);
+ // decline p2p voice, either via the vivox-style call mechanism
+ // or via the webrtc-style "decline p2p" mechanism.
+ LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(payload["voice_channel_info"]);
if (call)
{
call->declineInvite();
}
+ else
+ {
+ // webrtc-style decline.
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region)
+ {
+ std::string url = region->getCapability("ChatSessionRequest");
+
+ LLSD data;
+ data["method"] = "decline p2p voice";
+ data["session-id"] = session_id;
+
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data, "P2P declined", "P2P decline failed.");
+ }
+ }
}
else
{
- std::string url = gAgent.getRegion()->getCapability(
- "ChatSessionRequest");
+ LLViewerRegion *region = gAgent.getRegion();
+ if (region)
+ {
+ std::string url = region->getCapability("ChatSessionRequest");
- LLSD data;
- data["method"] = "decline invitation";
- data["session-id"] = session_id;
+ LLSD data;
+ data["method"] = "decline invitation";
+ data["session-id"] = session_id;
- LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data,
- "Invitation declined",
- "Invitation decline failed.");
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data, "Invitation declined", "Invitation decline failed.");
+ }
}
}
@@ -3572,6 +3590,40 @@ void LLIMMgr::clearPendingInvitation(const LLUUID& session_id)
void LLIMMgr::processAgentListUpdates(const LLUUID& session_id, const LLSD& body)
{
+ if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap())
+ {
+ LLSD::map_const_iterator update_it;
+ for (update_it = body["agent_updates"].beginMap(); update_it != body["agent_updates"].endMap(); ++update_it)
+ {
+ LLUUID agent_id = LLUUID(update_it->first);
+ LLSD agent_data = update_it->second;
+ if (agent_data.has("transition") && agent_data["transition"].asString() == "LEAVE")
+ {
+ // ignore actual leaves as those will be handled separately.
+ continue;
+ }
+
+ if (agent_id != gAgentID && agent_data.isMap() && agent_data.has("info") && agent_data["info"].isMap())
+ {
+ // Is one of the participants leaving a P2P Chat?
+ if (agent_data["info"].has("can_voice_chat") && !agent_data["info"]["can_voice_chat"].asBoolean())
+ {
+ LLVoiceChannelGroup *channelp = dynamic_cast < LLVoiceChannelGroup*>(LLVoiceChannel::getChannelByID(session_id));
+ if (channelp && channelp->isP2P())
+ {
+ // it's an adhoc-style P2P channel, and the peer has declined voice. notify the user
+ // and shut down the voice channel.
+ LLSD notifyArgs = LLSD::emptyMap();
+ notifyArgs["VOICE_CHANNEL_NAME"] = channelp->getSessionName();
+ LLNotificationsUtil::add("P2PCallDeclined", notifyArgs);
+ endCall(session_id);
+ break;
+ }
+ }
+ }
+ }
+ }
+
LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
if ( im_floater )
{