diff options
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r-- | indra/newview/llimview.cpp | 144 |
1 files changed, 101 insertions, 43 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 02a693b9a0..0ef502b81b 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -131,6 +131,20 @@ void toast_callback(const LLSD& msg){ return; } + // *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession( + msg["session_id"]); + if (!gSavedSettings.getBOOL("EnableGroupChatPopups") + && session->isGroupSessionType()) + { + return; + } + if (!gSavedSettings.getBOOL("EnableIMChatPopups") + && !session->isGroupSessionType()) + { + return; + } + // Skip toasting if we have open window of IM with this session id LLIMFloater* open_im_floater = LLIMFloater::findInstance(msg["session_id"]); if (open_im_floater && open_im_floater->getVisible()) @@ -265,9 +279,27 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& void LLIMModel::LLIMSession::onAdHocNameCache(const LLAvatarName& av_name) { + if (av_name.mIsTemporaryName) + { + S32 separator_index = mName.rfind(" "); + std::string name = mName.substr(0, separator_index); + ++separator_index; + std::string conference_word = mName.substr(separator_index, mName.length()); + + // additional check that session name is what we expected + if ("Conference" == conference_word) + { LLStringUtil::format_map_t args; - args["[AGENT_NAME]"] = av_name.getCompleteName(); + args["[AGENT_NAME]"] = name; LLTrans::findString(mName, "conference-title-incoming", args); + } + } + else + { + LLStringUtil::format_map_t args; + args["[AGENT_NAME]"] = av_name.getCompleteName(); + LLTrans::findString(mName, "conference-title-incoming", args); + } } void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction) @@ -523,15 +555,14 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { - if (av_name.mLegacyFirstName.empty()) + if (av_name.mUsername.empty()) { - // if mLegacyFirstName is empty it means display names is off and the - // data came from the gCacheName, mDisplayName will be the legacy name - mHistoryFileName = LLCacheName::cleanFullName(av_name.mDisplayName); + // display names is off, use mDisplayName which will be the legacy name + mHistoryFileName = LLCacheName::buildUsername(av_name.mDisplayName); } else { - mHistoryFileName = LLCacheName::cleanFullName(av_name.getLegacyName()); + mHistoryFileName = av_name.mUsername; } } @@ -542,7 +573,12 @@ void LLIMModel::LLIMSession::buildHistoryFileName() //ad-hoc requires sophisticated chat history saving schemes if (isAdHoc()) { - //in case of outgoing ad-hoc sessions + /* in case of outgoing ad-hoc sessions we need to make specilized names + * if this naming system is ever changed then the filtering definitions in + * lllogchat.cpp need to be change acordingly so that the filtering for the + * date stamp code introduced in STORM-102 will work properly and not add + * a date stamp to the Ad-hoc conferences. + */ if (mInitialTargetIDs.size()) { std::set<LLUUID> sorted_uuids(mInitialTargetIDs.begin(), mInitialTargetIDs.end()); @@ -1064,17 +1100,27 @@ void LLIMModel::sendMessage(const std::string& utf8_text, if( session == 0)//??? shouldn't really happen { LLRecentPeople::instance().add(other_participant_id); + return; } - else + // IM_SESSION_INVITE means that this is an Ad-hoc incoming chat + // (it can be also Group chat but it is checked above) + // In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added + // to Recent People to prevent showing of an item with (???)(???). See EXT-8246. + // Concrete participants will be added into this list once they sent message in chat. + if (IM_SESSION_INVITE == dialog) return; + + if (IM_SESSION_CONFERENCE_START == dialog) // outgoing ad-hoc session { - // IM_SESSION_INVITE means that this is an Ad-hoc incoming chat - // (it can be also Group chat but it is checked above) - // In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added - // to Recent People to prevent showing of an item with (???)(???). See EXT-8246. - // Concrete participants will be added into this list once they sent message in chat. - if (IM_SESSION_INVITE == dialog) return; - // Add only online members to recent (EXT-8658) - addSpeakersToRecent(im_session_id); + // Add only online members of conference to recent list (EXT-8658) + addSpeakersToRecent(im_session_id); + } + else // outgoing P2P session + { + // Add the recepient of the session. + if (!session->mInitialTargetIDs.empty()) + { + LLRecentPeople::instance().add(*(session->mInitialTargetIDs.begin())); + } } } } @@ -2061,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(); } @@ -2069,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(); } @@ -2077,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) { @@ -2107,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) { @@ -2142,7 +2189,7 @@ void LLIncomingCallDialog::processCallResponse(S32 response) LLAvatarName av_name; if (LLAvatarNameCache::get(caller_id, &av_name)) { - correct_session_name = av_name.mDisplayName + " (" + av_name.mUsername + ")"; + correct_session_name = av_name.getCompleteName(); correct_session_name.append(ADHOC_NAME_SUFFIX); } } @@ -2172,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); } @@ -2192,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); } } @@ -2599,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 ) { @@ -2616,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 ) { @@ -2639,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; } } @@ -2670,6 +2719,15 @@ void LLIMMgr::inviteToSession( { LLFloaterReg::showInstance("incoming_call", payload, FALSE); } + + // Add the caller to the Recent List here (at this point + // "incoming_call" floater is shown and the recipient can + // reject the call), because even if a recipient will reject + // the call, the caller should be added to the recent list + // anyway. STORM-507. + if(type == IM_SESSION_P2P_INVITE) + LLRecentPeople::instance().add(caller_id); + mPendingInvitations[session_id.asString()] = LLSD(); } } |