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.
This commit is contained in:
Inusaito Sayori
2015-05-20 11:31:28 -04:00
parent 078a6980b9
commit 03f2192684
5 changed files with 37 additions and 18 deletions

View File

@@ -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<LLUUID>& ids)

View File

@@ -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<LLHandle<LLFloater> > 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<LLUUID> notified_non_friend_sessions_t;
notified_non_friend_sessions_t mNotifiedNonFriendSessions;
// An IM has been received that you haven't seen yet.
int mIMUnreadCount;

View File

@@ -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<LLUUID>(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")) : LLUUID::null, true);
autoresponder_finish(gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"), computed_session_id, from_id, name, gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem") ? static_cast<LLUUID>(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")) : LLUUID::null, true);
}
}
}

View File

@@ -2796,6 +2796,9 @@ Falls diese Meldung weiterhin angezeigt wird, wenden Sie sich bitte an [SUPPORT_
<string name="Unnamed">(Nicht benannt)</string>
<string name="inventory_item_offered_to">Inventory item offered to</string>
<string name="Saved_message" value="(Saved [LONG_TIMESTAMP]) "/>
<string name="IM_unblock_only_groups_friends">
Wenn Sie diese Meldung sehen, müssen Sie unter „Einstellungen“ &gt; „Privatsphäre“ die Option „Nur IMs und Anrufe von Freunden oder Gruppen durchstellen“ deaktivieren.
</string>
<string name="StartPointSet">Start point set</string>
<string name="EndPointSet">End point set</string>
<string name="MeasuredDistance">Distance: [DIST]</string>

View File

@@ -4157,6 +4157,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
<string name="Unnamed">(Unnamed)</string>
<string name="inventory_item_offered_to">Inventory item offered to</string>
<string name="Saved_message" value="(Saved [LONG_TIMESTAMP]) "/>
<string name="IM_unblock_only_groups_friends">To see this message, you must uncheck &apos;Only friends and groups can call or IM me&apos; in Preferences/Privacy.</string>
<string name="StartPointSet">Start point set</string>
<string name="EndPointSet">End point set</string>
<string name="MeasuredDistance">Distance: [DIST]</string>