diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llimview.cpp | 40 | ||||
-rw-r--r-- | indra/newview/llimview.h | 2 |
2 files changed, 23 insertions, 19 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 6b4e1f7289..87a43a48dd 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1990,7 +1990,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(); } @@ -1998,7 +1998,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(); } @@ -2006,20 +2006,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) { @@ -2036,8 +2037,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) { @@ -2098,10 +2099,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); } @@ -2118,7 +2119,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); } } @@ -2525,16 +2526,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 ) { @@ -2542,6 +2546,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 ) { @@ -2565,13 +2570,12 @@ 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) { - 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 @@ -2579,7 +2583,7 @@ void LLIMMgr::inviteToSession( ) { // silently decline the call - LLNotifications::instance().forceResponse(LLNotification::Params("VoiceInviteP2P").payload(payload), 1); + LLIncomingCallDialog::processCallResponse(1, payload); return; } } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index f7a4406f00..352936347d 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -538,9 +538,9 @@ public: static void onReject(void* user_data); static void onStartIM(void* user_data); + static void processCallResponse(S32 response, const LLSD& payload); private: /*virtual*/ void onLifetimeExpired(); - void processCallResponse(S32 response); }; class LLOutgoingCallDialog : public LLCallDialog |