diff options
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r-- | indra/newview/llimview.cpp | 98 |
1 files changed, 67 insertions, 31 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index ed4bb727cd..46b1cb5f18 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -41,7 +41,7 @@ #include "lltextutil.h" #include "lltrans.h" #include "lluictrlfactory.h" - +#include "llimconversation.h" #include "llagent.h" #include "llagentui.h" #include "llappviewer.h" @@ -171,8 +171,8 @@ void LLIMModel::setActiveSessionID(const LLUUID& session_id) LLIMModel::LLIMModel() { - addNewMsgCallback(LLIMFloater::newIMCallback); - addNewMsgCallback(toast_callback); + addNewMsgCallback(boost::bind(&LLIMFloater::newIMCallback, _1)); + addNewMsgCallback(boost::bind(&toast_callback, _1)); } LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice) @@ -716,6 +716,16 @@ bool LLIMModel::clearSession(const LLUUID& session_id) return true; } +void LLIMModel::getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index, const bool sendNoUnreadMsgs) +{ + getMessagesSilently(session_id, messages, start_index); + + if (sendNoUnreadMsgs) + { + sendNoUnreadMessages(session_id); + } +} + void LLIMModel::getMessagesSilently(const LLUUID& session_id, std::list<LLSD>& messages, int start_index) { LLIMSession* session = findIMSession(session_id); @@ -757,13 +767,6 @@ void LLIMModel::sendNoUnreadMessages(const LLUUID& session_id) mNoUnreadMsgsSignal(arg); } -void LLIMModel::getMessages(const LLUUID& session_id, std::list<LLSD>& messages, int start_index) -{ - getMessagesSilently(session_id, messages, start_index); - - sendNoUnreadMessages(session_id); -} - bool LLIMModel::addToHistory(const LLUUID& session_id, const std::string& from, const LLUUID& from_id, const std::string& utf8_text) { LLIMSession* session = findIMSession(session_id); @@ -904,7 +907,7 @@ const LLUUID& LLIMModel::getOtherParticipantID(const LLUUID& session_id) const LLIMSession* session = findIMSession(session_id); if (!session) { - llwarns << "session " << session_id << "does not exist " << llendl; + llwarns << "session " << session_id << " does not exist " << llendl; return LLUUID::null; } @@ -2403,15 +2406,6 @@ void LLIMMgr::addMessage( bool link_name) // If this is true, then we insert the name and link it to a profile { LLUUID other_participant_id = target_id; - - // don't process muted IMs - if (LLMuteList::getInstance()->isMuted( - other_participant_id, - LLMute::flagTextChat) && !LLMuteList::getInstance()->isLinden(from)) - { - return; - } - LLUUID new_session_id = session_id; if (new_session_id.isNull()) { @@ -2452,10 +2446,28 @@ void LLIMMgr::addMessage( LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, bonus_info.str()); } + // Logically it would make more sense to reject the session sooner, in another area of the + // code, but the session has to be established inside the server before it can be left. + if (LLMuteList::getInstance()->isMuted(other_participant_id) && !LLMuteList::getInstance()->isLinden(from)) + { + llwarns << "Leaving IM session from initiating muted resident " << from << llendl; + if(!gIMMgr->leaveSession(new_session_id)) + { + llinfos << "Session " << new_session_id << " does not exist." << llendl; + } + return; + } + make_ui_sound("UISndNewIncomingIMSession"); } - LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg); + bool skip_message = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && + LLAvatarTracker::instance().getBuddyInfo(other_participant_id) == NULL); + + if (!LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !skip_message) + { + LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg); + } } void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& message_name, const LLSD& args) @@ -2471,8 +2483,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLFloater* chat_bar = LLFloaterReg::getInstance("chat_bar"); - LLNearbyChat* nearby_chat = chat_bar->findChild<LLNearbyChat>("nearby_chat"); + LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); if(nearby_chat) { @@ -2488,6 +2499,7 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess gIMMgr->addMessage(session_id, LLUUID::null, SYSTEM_FROM, message.getString()); } // log message to file + else { std::string session_name; @@ -2661,18 +2673,15 @@ void LLIMMgr::inviteToSession( const std::string& session_handle, const std::string& session_uri) { - //ignore invites from muted residents - if (LLMuteList::getInstance()->isMuted(caller_id)) - { - return; - } - std::string notify_box_type; // voice invite question is different from default only for group call (EXT-7118) std::string question_type = "VoiceInviteQuestionDefault"; BOOL ad_hoc_invite = FALSE; BOOL voice_invite = FALSE; + bool is_linden = LLMuteList::getInstance()->isLinden(caller_name); + + if(type == IM_SESSION_P2P_INVITE) { //P2P is different...they only have voice invitations @@ -2711,7 +2720,18 @@ void LLIMMgr::inviteToSession( payload["session_uri"] = session_uri; payload["notify_box_type"] = notify_box_type; payload["question_type"] = question_type; - + + //ignore invites from muted residents + if (LLMuteList::getInstance()->isMuted(caller_id) && !is_linden) + { + if (voice_invite && "VoiceInviteQuestionDefault" == question_type) + { + llinfos << "Rejecting voice call from initiating muted resident " << caller_name << llendl; + LLIncomingCallDialog::processCallResponse(1, payload); + } + return; + } + LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(session_id); if (channelp && channelp->callStarted()) { @@ -2963,6 +2983,17 @@ bool LLIMMgr::isVoiceCall(const LLUUID& session_id) return im_session->mStartedAsIMCall; } +void LLIMMgr::addNotifiedNonFriendSessionID(const LLUUID& session_id) +{ + mNotifiedNonFriendSessions.insert(session_id); +} + +bool LLIMMgr::isNonFriendSessionNotified(const LLUUID& session_id) +{ + return mNotifiedNonFriendSessions.end() != mNotifiedNonFriendSessions.find(session_id); + +} + void LLIMMgr::noteOfflineUsers( const LLUUID& session_id, const LLDynamicArray<LLUUID>& ids) @@ -3234,7 +3265,7 @@ public: chat.mFromID = from_id; chat.mFromName = name; - if (!is_linden && (is_busy || is_muted)) + if (!is_linden && is_busy) { return; } @@ -3266,6 +3297,11 @@ public: ll_vector3_from_sd(message_params["position"]), true); + if (LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat)) + { + return; + } + //K now we want to accept the invitation std::string url = gAgent.getRegion()->getCapability( "ChatSessionRequest"); |