From 0d968af0269fd016cef6161c021f95edad4afaec Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 5 Nov 2017 00:03:42 +0100 Subject: [PATCH] [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 --- indra/newview/rlvactions.cpp | 4 ++-- indra/newview/rlvactions.h | 4 ++-- indra/newview/rlvcommon.cpp | 7 +++++-- indra/newview/rlvcommon.h | 2 +- indra/newview/rlvhandler.cpp | 13 ++++++++----- .../newview/skins/default/xui/en/notifications.xml | 8 ++++++++ 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index 55b33126a2..95c17a5f6a 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -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) diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index 82d09510e4..afafa726b8 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -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 diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index ff26494b65..a50761cf19 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -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 diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index ab635aaac3..0374825346 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -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); diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 5952ece089..4c3a95adf9 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -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)); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 1c6b1eb76b..08f8be5ca6 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -7004,6 +7004,14 @@ URL: [AUDIOURL] [MESSAGE] + +[MESSAGE] + +