From 03f2192684440d99d117a58f98d4c7b7f5476c1c Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Wed, 20 May 2015 11:31:28 -0400 Subject: [PATCH] At the request of Aleeri in group, add support for EXP-901 Notifies nonfriends when their chat is blocked This is instead of showing the muted autoresponse message, so only muted people will see it now. Also cleans up some excess autoresponder code. --- indra/newview/llimview.cpp | 10 +++++++ indra/newview/llimview.h | 12 ++++++++ indra/newview/llviewermessage.cpp | 29 +++++++------------ .../newview/skins/default/xui/de/strings.xml | 3 ++ .../skins/default/xui/en-us/strings.xml | 1 + 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 9c8c6222e..943db95f9 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1086,6 +1086,16 @@ LLFloaterIMPanel* LLIMMgr::createFloater( return floater; } +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( LLFloaterIMPanel* floater, const LLDynamicArray& ids) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 2a2ac9dc7..376e52301 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -184,6 +184,10 @@ public: **/ bool endCall(const LLUUID& session_id); + void addNotifiedNonFriendSessionID(const LLUUID& session_id); + + bool isNonFriendSessionNotified(const LLUUID& session_id); + private: // create a panel and update internal representation for // consistency. Returns the pointer, caller (the class instance @@ -210,6 +214,14 @@ private: private: std::set > mFloaters; + // EXP-901 + // If "Only friends and groups can IM me" option is ON but the user got message from non-friend, + // the user should be notified that to be able to see this message the option should be OFF. + // This set stores session IDs in which user was notified. Need to store this IDs so that the user + // be notified only one time per session with non-friend. + typedef std::set notified_non_friend_sessions_t; + notified_non_friend_sessions_t mNotifiedNonFriendSessions; + // An IM has been received that you haven't seen yet. int mIMUnreadCount; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a506437e4..64e61827b 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2496,8 +2496,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { // standard message, not from system bool mute_im = is_muted; - if(accept_im_from_only_friend&&!is_friend) + if (accept_im_from_only_friend && !is_friend && !is_linden) { + if (!gIMMgr->isNonFriendSessionNotified(session_id)) + { + std::string message = LLTrans::getString("IM_unblock_only_groups_friends"); + gIMMgr->addMessage(session_id, from_id, name, message); + gIMMgr->addNotifiedNonFriendSessionID(session_id); + } + mute_im = true; } @@ -2513,20 +2520,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; -/* - bool mute_im = is_muted; - if (accept_im_from_only_friend && !is_friend) - { - if (!gIMMgr->isNonFriendSessionNotified(session_id)) - { - std::string message = LLTrans::getString("IM_unblock_only_groups_friends"); - gIMMgr->addMessage(session_id, from_id, name, message); - gIMMgr->addNotifiedNonFriendSessionID(session_id); - } - - mute_im = true; - } -*/ + // Muted nonfriend code moved up // [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) // Don't block offline IMs, or IMs from Lindens @@ -2563,7 +2557,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLFloaterChat::addChat(chat, true, true); // Autoresponse to muted avatars - if (gSavedPerAccountSettings.getBOOL("AutoresponseMuted")) + if (!gIMMgr->isNonFriendSessionNotified(session_id) && gSavedPerAccountSettings.getBOOL("AutoresponseMuted")) { std::string my_name; LLAgentUI::buildFullname(my_name); @@ -2579,8 +2573,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) IM_BUSY_AUTO_RESPONSE, session_id); gAgent.sendReliableMessage(); - LLAvatarName av_name; - autoresponder_finish(gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"), computed_session_id, from_id, LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name, gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem") ? static_cast(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")) : LLUUID::null, true); + autoresponder_finish(gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"), computed_session_id, from_id, name, gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem") ? static_cast(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")) : LLUUID::null, true); } } } diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml index 5ee529312..3906c31db 100644 --- a/indra/newview/skins/default/xui/de/strings.xml +++ b/indra/newview/skins/default/xui/de/strings.xml @@ -2796,6 +2796,9 @@ Falls diese Meldung weiterhin angezeigt wird, wenden Sie sich bitte an [SUPPORT_ (Nicht benannt) Inventory item offered to + + Wenn Sie diese Meldung sehen, müssen Sie unter „Einstellungen“ > „Privatsphäre“ die Option „Nur IMs und Anrufe von Freunden oder Gruppen durchstellen“ deaktivieren. + Start point set End point set Distance: [DIST] diff --git a/indra/newview/skins/default/xui/en-us/strings.xml b/indra/newview/skins/default/xui/en-us/strings.xml index 15594f42c..1025b1925 100644 --- a/indra/newview/skins/default/xui/en-us/strings.xml +++ b/indra/newview/skins/default/xui/en-us/strings.xml @@ -4157,6 +4157,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. (Unnamed) Inventory item offered to + To see this message, you must uncheck 'Only friends and groups can call or IM me' in Preferences/Privacy. Start point set End point set Distance: [DIST]