MAINT-5036 FIXED Blocked user can send invites to group

andreykproductengine 2015-04-07 12:06:23 +03:00
parent e76f352501
commit 264d9d7e2d
3 changed files with 27 additions and 1 deletions

View File

@ -689,6 +689,22 @@ BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) c
return legacy_it != mLegacyMutes.end();
}
BOOL LLMuteList::isMuted(const std::string& username, U32 flags) const
{
mute_set_t::const_iterator mute_iter = mMutes.begin();
while(mute_iter != mMutes.end())
{
// can't convert "leha.test" into "LeHa TesT" so username comparison is more reliable
if (mute_iter->mType == LLMute::AGENT
&& LLCacheName::buildUsername(mute_iter->mName) == username)
{
return TRUE;
}
mute_iter++;
}
return FALSE;
}
//-----------------------------------------------------------------------------
// requestFromServer()
//-----------------------------------------------------------------------------

View File

@ -101,7 +101,10 @@ public:
// Name is required to test against legacy text-only mutes.
BOOL isMuted(const LLUUID& id, const std::string& name = LLStringUtil::null, U32 flags = 0) const;
// Workaround for username-based mute search, a lot of string conversions so use cautiously
BOOL isMuted(const std::string& username, U32 flags = 0) const;
// Alternate (convenience) form for places we don't need to pass the name, but do need flags
BOOL isMuted(const LLUUID& id, U32 flags) const { return isMuted(id, LLStringUtil::null, flags); };

View File

@ -3319,6 +3319,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
break;
case IM_GROUP_INVITATION:
{
if (!is_muted)
{
// group is not blocked, but we still need to check agent that sent the invitation
// and we have no agent's id
// Note: server sends username "first.last".
is_muted |= LLMuteList::getInstance()->isMuted(name);
}
if (is_do_not_disturb || is_muted)
{
send_do_not_disturb_message(msg, from_id);