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.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index f5f59d5973..ce305dcd89 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2107,7 +2107,7 @@ void LLIncomingCallDialog::onOpen(const LLSD& key)
void LLIncomingCallDialog::onAccept(void* user_data)
{
LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
- self->processCallResponse(0);
+ processCallResponse(0, self->mPayload);
self->closeFloater();
}
@@ -2115,7 +2115,7 @@ void LLIncomingCallDialog::onAccept(void* user_data)
void LLIncomingCallDialog::onReject(void* user_data)
{
LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
- self->processCallResponse(1);
+ processCallResponse(1, self->mPayload);
self->closeFloater();
}
@@ -2123,20 +2123,21 @@ void LLIncomingCallDialog::onReject(void* user_data)
void LLIncomingCallDialog::onStartIM(void* user_data)
{
LLIncomingCallDialog* self = (LLIncomingCallDialog*)user_data;
- self->processCallResponse(2);
+ processCallResponse(2, self->mPayload);
self->closeFloater();
}
-void LLIncomingCallDialog::processCallResponse(S32 response)
+// static
+void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload)
{
if (!gIMMgr || gDisconnected)
return;
- LLUUID session_id = mPayload["session_id"].asUUID();
- LLUUID caller_id = mPayload["caller_id"].asUUID();
- std::string session_name = mPayload["session_name"].asString();
- EInstantMessage type = (EInstantMessage)mPayload["type"].asInteger();
- LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)mPayload["inv_type"].asInteger();
+ LLUUID session_id = payload["session_id"].asUUID();
+ LLUUID caller_id = payload["caller_id"].asUUID();
+ std::string session_name = payload["session_name"].asString();
+ EInstantMessage type = (EInstantMessage)payload["type"].asInteger();
+ LLIMMgr::EInvitationType inv_type = (LLIMMgr::EInvitationType)payload["inv_type"].asInteger();
bool voice = true;
switch(response)
{
@@ -2153,8 +2154,8 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
session_id = gIMMgr->addP2PSession(
session_name,
caller_id,
- mPayload["session_handle"].asString(),
- mPayload["session_uri"].asString());
+ payload["session_handle"].asString(),
+ payload["session_uri"].asString());
if (voice)
{
@@ -2218,10 +2219,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
inv_type));
// send notification message to the corresponding chat
- if (mPayload["notify_box_type"].asString() == "VoiceInviteGroup" || mPayload["notify_box_type"].asString() == "VoiceInviteAdHoc")
+ if (payload["notify_box_type"].asString() == "VoiceInviteGroup" || payload["notify_box_type"].asString() == "VoiceInviteAdHoc")
{
LLStringUtil::format_map_t string_args;
- string_args["[NAME]"] = mPayload["caller_name"].asString();
+ string_args["[NAME]"] = payload["caller_name"].asString();
std::string message = LLTrans::getString("name_started_call", string_args);
LLIMModel::getInstance()->addMessageSilently(session_id, SYSTEM_FROM, LLUUID::null, message);
}
@@ -2238,7 +2239,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
{
if(LLVoiceClient::getInstance())
{
- std::string s = mPayload["session_handle"].asString();
+ std::string s = payload["session_handle"].asString();
LLVoiceClient::getInstance()->declineInvite(s);
}
}
@@ -2645,16 +2646,19 @@ void LLIMMgr::inviteToSession(
std::string question_type = "VoiceInviteQuestionDefault";
BOOL ad_hoc_invite = FALSE;
+ BOOL voice_invite = FALSE;
if(type == IM_SESSION_P2P_INVITE)
{
//P2P is different...they only have voice invitations
notify_box_type = "VoiceInviteP2P";
+ voice_invite = TRUE;
}
else if ( gAgent.isInGroup(session_id) )
{
//only really old school groups have voice invitations
notify_box_type = "VoiceInviteGroup";
question_type = "VoiceInviteQuestionGroup";
+ voice_invite = TRUE;
}
else if ( inv_type == INVITATION_TYPE_VOICE )
{
@@ -2662,6 +2666,7 @@ void LLIMMgr::inviteToSession(
//and a voice ad-hoc
notify_box_type = "VoiceInviteAdHoc";
ad_hoc_invite = TRUE;
+ voice_invite = TRUE;
}
else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
{
@@ -2685,23 +2690,21 @@ void LLIMMgr::inviteToSession(
if (channelp && channelp->callStarted())
{
// you have already started a call to the other user, so just accept the invite
- LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 0);
+ LLIncomingCallDialog::processCallResponse(0, payload);
return;
}
- if (type == IM_SESSION_P2P_INVITE || ad_hoc_invite)
+ if (voice_invite)
{
- // is the inviter a friend?
- if (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL)
+ if ( // if we're rejecting all incoming call requests
+ gSavedSettings.getBOOL("VoiceCallsRejectAll")
+ // or we're rejecting non-friend voice calls and this isn't a friend
+ || (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == NULL))
+ )
{
- // if not, and we are ignoring voice invites from non-friends
- // then silently decline
- if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly"))
- {
- // invite not from a friend, so decline
- LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 1);
- return;
- }
+ // silently decline the call
+ LLIncomingCallDialog::processCallResponse(1, payload);
+ return;
}
}