[FIXED] CATZ-311: @stopim doesn't end the IM session when @startim restricted

-> The local notification now logs to nearby chat
  -> Send the close response even if there is currently no IM session open
master
Kitty Barnett 2017-11-05 00:03:42 +01:00
parent d08515b967
commit 0d968af026
6 changed files with 26 additions and 12 deletions

View File

@ -184,7 +184,7 @@ bool RlvActions::canSendIM(const LLUUID& idRecipient)
( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) || (!gRlvHandler.isException(RLV_BHVR_SENDIMTO, idRecipient)) ) );
}
bool RlvActions::canStartIM(const LLUUID& idRecipient)
bool RlvActions::canStartIM(const LLUUID& idRecipient, bool fIgnoreOpen)
{
// User can start an IM session with "recipient" (could be an agent or a group) if:
// - not generally restricted from starting IM sessions (or the recipient is an exception or inside the exclusion range)
@ -194,7 +194,7 @@ bool RlvActions::canStartIM(const LLUUID& idRecipient)
(!isRlvEnabled()) ||
( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIM)) || (gRlvHandler.isException(RLV_BHVR_STARTIM, idRecipient)) || (rlvCheckAvatarIMDistance(idRecipient, RLV_MODIFIER_STARTIMDISTMIN, RLV_MODIFIER_STARTIMDISTMAX)) ) &&
( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIMTO)) || (!gRlvHandler.isException(RLV_BHVR_STARTIMTO, idRecipient)) ) ) ||
( (hasOpenP2PSession(idRecipient)) || (hasOpenGroupSession(idRecipient)) );
( (!fIgnoreOpen) && ((hasOpenP2PSession(idRecipient)) || (hasOpenGroupSession(idRecipient))) );
}
bool RlvActions::canShowName(EShowNamesContext eContext, const LLUUID& idAgent)

View File

@ -108,9 +108,9 @@ public:
static bool canSendIM(const LLUUID& idRecipient);
/*
* Returns true if the user is allowed to start a - P2P or group - conversation with the specified UUID (or if the session already exists)
* Returns true if the user is allowed to start a - P2P or group - conversation with the specified UUID (or if the session already exists, unless 'ignore open' is specified)
*/
static bool canStartIM(const LLUUID& idRecipient);
static bool canStartIM(const LLUUID& idRecipient, bool fIgnoreOpen = false);
/*
* Returns true if an avatar's name should be hidden for the requested operation/context

View File

@ -551,14 +551,17 @@ bool RlvUtil::isNearbyRegion(const std::string& strRegion)
}
// Checked: 2011-04-11 (RLVa-1.3.0h) | Modified: RLVa-1.3.0h
void RlvUtil::notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs)
void RlvUtil::notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs, bool fLogToChat)
{
std::string strMsg = RlvStrings::getString(strNotifcation);
LLStringUtil::format(strMsg, sdArgs);
LLSD sdNotify;
sdNotify["MESSAGE"] = strMsg;
LLNotificationsUtil::add("SystemMessageTip", sdNotify);
if (!fLogToChat)
LLNotificationsUtil::add("SystemMessageTip", sdNotify);
else
LLNotificationsUtil::add("ChatSystemMessageTip", sdNotify);
}
// Checked: 2010-11-11 (RLVa-1.2.1g) | Added: RLVa-1.2.1g

View File

@ -176,7 +176,7 @@ public:
static bool isForceTp() { return m_fForceTp; }
static void forceTp(const LLVector3d& posDest); // Ignores restrictions that might otherwise prevent tp'ing
static void notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs = LLSD());
static void notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs = LLSD(), bool fLogToChat = false);
static void notifyBlockedGeneric() { notifyBlocked(RLV_STRING_BLOCKED_GENERIC); }
static void notifyBlockedViewXXX(LLAssetType::EType assetType) { notifyBlocked(RLV_STRING_BLOCKED_VIEWXXX, LLSD().with("[TYPE]", LLTrans::getString(LLAssetType::lookupHumanReadable(assetType)))); }
static void notifyFailedAssertion(const std::string& strAssert, const std::string& strFile, int nLine);

View File

@ -482,16 +482,19 @@ bool RlvHandler::processIMQuery(const LLUUID& idSender, const std::string& strMe
{
if ("@stopim" == strMessage)
{
// If the user can't start an IM session and one is open terminate it - always notify the sender in this case
if ( (!RlvActions::canStartIM(idSender)) && (RlvActions::hasOpenP2PSession(idSender)) )
// If the user can't start an IM session terminate it (if one is open) - always notify the sender in this case
if (!RlvActions::canStartIM(idSender, true))
{
RlvUtil::sendBusyMessage(idSender, RlvStrings::getString(RLV_STRING_STOPIM_ENDSESSION_REMOTE));
LLAvatarActions::endIM(idSender);
RlvUtil::notifyBlocked(RLV_STRING_STOPIM_ENDSESSION_LOCAL, LLSD().with("NAME", LLSLURL("agent", idSender, "about").getSLURLString()));
if (RlvActions::hasOpenP2PSession(idSender))
{
LLAvatarActions::endIM(idSender);
RlvUtil::notifyBlocked(RLV_STRING_STOPIM_ENDSESSION_LOCAL, LLSD().with("NAME", LLSLURL("agent", idSender, "about").getSLURLString()), true);
}
return true;
}
// User can start an IM session (or one isn't open) so we do nothing - notify and hide it from the user only if IM queries are enabled
// User can start an IM session so we do nothing - notify and hide it from the user only if IM queries are enabled
if (!RlvSettings::getEnableIMQuery())
return false;
RlvUtil::sendBusyMessage(idSender, RlvStrings::getString(RLV_STRING_STOPIM_NOSESSION));

View File

@ -7004,6 +7004,14 @@ URL: [AUDIOURL]
[MESSAGE]
</notification>
<notification
icon="notifytip.tga"
name="ChatSystemMessageTip"
log_to_chat="true"
type="notifytip">
[MESSAGE]
</notification>
<notification
icon="notifytip.tga"
name="IMSystemMessageTip"