From d69604b866d77eaff7691377f0059c76a20abd4a Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 13 Sep 2020 19:10:18 +0200 Subject: [PATCH 1/6] [FIXED] Assertion failure on m_Object.empty() in RlvHandler::cleanup() when an object only issues unknown commands -> In this case @nohax=n by an OpenCollar --- indra/newview/rlvhandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index d64bcabeb4..7f750be450 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -506,6 +506,11 @@ ERlvCmdRet RlvHandler::processCommand(std::reference_wrapper r { RlvCommand rlvCmdRem(rlvCmd, RLV_TYPE_REMOVE); itObj->second.removeCommand(rlvCmdRem); + if (itObj->second.m_Commands.empty()) + { + RLV_DEBUGS << "\t- command list empty => removing " << idCurObj << RLV_ENDL; + m_Objects.erase(itObj); + } } // notifyBehaviourObservers(rlvCmd, !fFromObj); } From 487a487ce2eda4f2ec328802af9c3aa6ec31bf12 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Sun, 13 Sep 2020 20:52:39 +0200 Subject: [PATCH 2/6] [FIXED] Assertion failure on LLApp::isQuitting() in RlvHandler::cleanup() when disconnecting -> Also prefer using isExiting() over isQuitting() --- indra/newview/llappviewer.cpp | 5 ++++- indra/newview/rlvcommon.cpp | 2 +- indra/newview/rlvhandler.cpp | 15 +++++++++------ indra/newview/rlvui.cpp | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9117d8da60..3d3404e494 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -378,7 +378,10 @@ const std::string START_MARKER_FILE_NAME("SecondLife.start_marker"); const std::string ERROR_MARKER_FILE_NAME("SecondLife.error_marker"); const std::string LLERROR_MARKER_FILE_NAME("SecondLife.llerror_marker"); const std::string LOGOUT_MARKER_FILE_NAME("SecondLife.logout_marker"); -static BOOL gDoDisconnect = FALSE; +//static BOOL gDoDisconnect = FALSE; +// [RLVa:KB] - Checked: RLVa-2.3 +BOOL gDoDisconnect = FALSE; +// [/RLVa:KB] static std::string gLaunchFileOnQuit; // Used on Win32 for other apps to identify our window (eg, win_setup) diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index e9f2d2fc69..0eee08d0a6 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -136,7 +136,7 @@ void RlvSettings::initClass() // Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-0.2.1d void RlvSettings::updateLoginLastLocation() { - if ( (!LLApp::isQuitting()) && (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) ) + if ( (!LLApp::isExiting()) && (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) ) { BOOL fValue = (gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) || (!RlvActions::canStand()); if (gSavedPerAccountSettings.getBOOL(RLV_SETTING_LOGINLASTLOCATION) != fValue) diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 7f750be450..6c7e549767 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -70,6 +70,9 @@ // Boost includes #include +// llappviewer.cpp +extern BOOL gDoDisconnect; + // ============================================================================ // Static variable initialization // @@ -158,7 +161,7 @@ void RlvHandler::cleanup() // // Clean up any restrictions that are still active // - RLV_ASSERT(LLApp::isQuitting()); // Several commands toggle debug settings but won't if they know the viewer is quitting + RLV_ASSERT(LLApp::isExiting() || gDoDisconnect); // Several commands toggle debug settings but won't if they know the viewer is quitting // Assume we have no way to predict how m_Objects will change so make a copy ahead of time uuid_vec_t idRlvObjects; @@ -2385,7 +2388,7 @@ ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvComma template<> template<> void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) { - if (LLApp::isQuitting()) + if (LLApp::isExiting()) return; // Nothing to do if the viewer is shutting down // @@ -2440,7 +2443,7 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour template<> template<> void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) { - if (LLApp::isQuitting()) + if (LLApp::isExiting()) return; // Nothing to do if the viewer is shutting down // Update the shownames context @@ -2477,7 +2480,7 @@ template<> template<> ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) { ERlvCmdRet eRet = RlvBehaviourGenericHandler::onCommand(rlvCmd, fRefCount); - if ( (RLV_RET_SUCCESS == eRet) && (rlvCmd.hasOption()) && (!LLApp::isQuitting()) ) + if ( (RLV_RET_SUCCESS == eRet) && (rlvCmd.hasOption()) && (!LLApp::isExiting()) ) { const LLUUID idAgent = RlvCommandOptionHelper::parseOption(rlvCmd.getOption()); @@ -2502,7 +2505,7 @@ ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& template<> template<> void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) { - if (LLApp::isQuitting()) + if (LLApp::isExiting()) return; // Nothing to do if the viewer is shutting down // Update the shownames context @@ -2526,7 +2529,7 @@ ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvComman template<> template<> void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) { - if (LLApp::isQuitting()) + if (LLApp::isExiting()) return; // Nothing to do if the viewer is shutting down // Refresh the nearby people list diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index cd6e5831ce..846460096d 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -77,7 +77,7 @@ RlvUIEnabler::RlvUIEnabler() // Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a void RlvUIEnabler::onBehaviourToggle(ERlvBehaviour eBhvr, ERlvParamType eType) { - bool fQuitting = LLApp::isQuitting(); + bool fQuitting = LLApp::isExiting(); for (behaviour_handler_map_t::const_iterator itHandler = m_Handlers.lower_bound(eBhvr), endHandler = m_Handlers.upper_bound(eBhvr); itHandler != endHandler; ++itHandler) { From 4501d4eb1af631969461ea3818f9dc7b1f5e2f15 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 14 Sep 2020 14:17:15 +0200 Subject: [PATCH 3/6] Add @buy and @pay restrictions to block object purchases and avatar payments respectively (because of baguettes) --- indra/newview/rlvactions.cpp | 26 +++++++++++++++++++++++++- indra/newview/rlvactions.h | 17 ++++++++++++++++- indra/newview/rlvdefines.h | 4 +++- indra/newview/rlvhandler.cpp | 30 ++++++++++++++++++++++++++++++ indra/newview/rlvhelper.cpp | 4 +++- 5 files changed, 77 insertions(+), 4 deletions(-) diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index ed17275c0e..b2fa52b5bb 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (c) 2009-2016, Kitty Barnett + * Copyright (c) 2009-2020, Kitty Barnett * * The source code in this file is provided to you under the terms of the * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; @@ -367,6 +367,14 @@ bool RlvActions::canBuild() (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)); } +// Handles: @buy +bool RlvActions::canBuyObject(const LLUUID& idObj) +{ + // User can buy an object set for sale if: + // - not restricted from buying objects + return (!RlvHandler::instance().hasBehaviour(RLV_BHVR_BUY)); +} + // Handles: @edit and @editobj bool RlvActions::canEdit(const LLViewerObject* pObj) { @@ -397,6 +405,22 @@ bool RlvActions::canInteract(const LLViewerObject* pObj, const LLVector3& posOff ( (!rlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH)) || (pObj->isHUDAttachment()) || (dist_vec_squared(gAgent.getPositionGlobal(), pObj->getPositionGlobal() + LLVector3d(posOffset)) <= s_nFartouchDist * s_nFartouchDist)) ); } +// Handles: @pay +bool RlvActions::canPayAvatar(const LLUUID& idAvatar) +{ + // User can pay an avatar if: + // - not restricted from paying avatars + return (!RlvHandler::instance().hasBehaviour(RLV_BHVR_PAY)); +} + +// Handles: @buy +bool RlvActions::canPayObject(const LLUUID& idObj) +{ + // User can pay an object/vendor if: + // - not restricted from buying objects + return (!RlvHandler::instance().hasBehaviour(RLV_BHVR_BUY)); +} + bool RlvActions::canRez() { return (!gRlvHandler.hasBehaviour(RLV_BHVR_REZ)); diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index 90b1069f6b..dbb88c5abd 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -1,6 +1,6 @@ /** * - * Copyright (c) 2009-2016, Kitty Barnett + * Copyright (c) 2009-2020, Kitty Barnett * * The source code in this file is provided to you under the terms of the * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; @@ -222,6 +222,11 @@ public: */ static bool canBuild(); + /* + * Returns true if the user can buy an object set for sale + */ + static bool canBuyObject(const LLUUID& idObj); + /* * Returns true if the user can edit the specified object (with an optional relative offset) */ @@ -238,6 +243,16 @@ public: */ static bool canInteract(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero); + /* + * Returns true if the user can pay an avatar + */ + static bool canPayAvatar(const LLUUID& idAvatar); + + /* + * Returns true if the user can pay an object (i.e. vendor) + */ + static bool canPayObject(const LLUUID& idObj); + /* * Returns true if the user can rez new objects (from inventory or through the create tool) */ diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index f43a332f9f..5410f0e7c0 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -1,6 +1,6 @@ /** * - * Copyright (c) 2009-2016, Kitty Barnett + * Copyright (c) 2009-2020, Kitty Barnett * * The source code in this file is provided to you under the terms of the * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; @@ -151,8 +151,10 @@ enum ERlvBehaviour { RLV_BHVR_ACCEPTTP, // "accepttp" RLV_BHVR_ACCEPTTPREQUEST, // "accepttprequest" RLV_BHVR_ALLOWIDLE, // "allowidle" + RLV_BHVR_BUY, // "buy" RLV_BHVR_EDIT, // "edit" RLV_BHVR_EDITOBJ, // "editobj" + RLV_BHVR_PAY, // "pay" RLV_BHVR_REZ, // "rez" RLV_BHVR_FARTOUCH, // "fartouch" RLV_BHVR_INTERACT, // "interact" diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index d64bcabeb4..3a7c01bf42 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1859,6 +1859,25 @@ ERlvCmdRet RlvBehaviourAddRemAttachHandler::onCommand(const RlvCommand& rlvCmd, return RLV_RET_SUCCESS; } +// Handles: @buy=n|y toggles +template<> template<> +void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + // Start or stop filtering opening the buy, buy contents and pay object floaters + if (fHasBhvr) + { + RlvUIEnabler::instance().addGenericFloaterFilter("buy_object"); + RlvUIEnabler::instance().addGenericFloaterFilter("buy_object_contents"); + RlvUIEnabler::instance().addGenericFloaterFilter("pay_object"); + } + else + { + RlvUIEnabler::instance().removeGenericFloaterFilter("buy_object"); + RlvUIEnabler::instance().removeGenericFloaterFilter("buy_object_contents"); + RlvUIEnabler::instance().removeGenericFloaterFilter("pay_object"); + } +} + // Handles: @detach[:]=n|y template<> template<> ERlvCmdRet RlvBehaviourHandler::onCommand(const RlvCommand& rlvCmd, bool& fRefCount) @@ -1997,6 +2016,17 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBh RlvUIEnabler::instance().removeGenericFloaterFilter("beacons"); } +// Handles: @pay=n|y toggles +template<> template<> +void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) +{ + // Start or stop filtering opening the pay avatar floater + if (fHasBhvr) + RlvUIEnabler::instance().addGenericFloaterFilter("pay_resident"); + else + RlvUIEnabler::instance().removeGenericFloaterFilter("pay_resident"); +} + // Handles: @setoverlay=n|y toggles template<> template<> void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhvr, bool fHasBhvr) diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 2a0ecf6d97..b08875fca5 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (c) 2009-2016, Kitty Barnett + * Copyright (c) 2009-2020, Kitty Barnett * * The source code in this file is provided to you under the terms of the * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; @@ -89,6 +89,7 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourInfo("attachallthis", RLV_BHVR_ATTACHTHIS, RLV_TYPE_ADDREM, RlvBehaviourInfo::FORCEWEAR_SUBTREE)); addEntry(new RlvBehaviourInfo("attachthis_except", RLV_BHVR_ATTACHTHISEXCEPT, RLV_TYPE_ADDREM, RlvBehaviourInfo::FORCEWEAR_NODE)); addEntry(new RlvBehaviourInfo("attachallthis_except", RLV_BHVR_ATTACHTHISEXCEPT, RLV_TYPE_ADDREM, RlvBehaviourInfo::FORCEWEAR_SUBTREE)); + addEntry(new RlvBehaviourGenericToggleProcessor("buy")); addEntry(new RlvBehaviourGenericProcessor("chatwhisper", RLV_BHVR_CHATWHISPER)); addEntry(new RlvBehaviourGenericProcessor("chatnormal", RLV_BHVR_CHATNORMAL)); addEntry(new RlvBehaviourGenericProcessor("chatshout", RLV_BHVR_CHATSHOUT)); @@ -106,6 +107,7 @@ RlvBehaviourDictionary::RlvBehaviourDictionary() addEntry(new RlvBehaviourGenericProcessor("interact", RLV_BHVR_INTERACT, RlvBehaviourInfo::BHVR_EXTENDED)); addEntry(new RlvBehaviourGenericProcessor("jump", RLV_BHVR_JUMP)); addEntry(new RlvBehaviourInfo("notify", RLV_BHVR_NOTIFY, RLV_TYPE_ADDREM)); + addEntry(new RlvBehaviourGenericToggleProcessor("pay")); addEntry(new RlvBehaviourGenericProcessor("permissive", RLV_BHVR_PERMISSIVE)); addEntry(new RlvBehaviourGenericProcessor("recvchat", RLV_BHVR_RECVCHAT, RlvBehaviourInfo::BHVR_STRICT)); addEntry(new RlvBehaviourGenericProcessor("recvchatfrom", RLV_BHVR_RECVCHATFROM, RlvBehaviourInfo::BHVR_STRICT)); From a3c0d62eb51a360ab199a00295a341681ee1a66a Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Mon, 14 Sep 2020 15:09:16 +0200 Subject: [PATCH 4/6] Enable/disable additions for @buy/pay restrictions + show a blocked notification whenever the floater would have opened to inform the user --- indra/newview/llchathistory.cpp | 7 +++ indra/newview/llconversationloglist.cpp | 9 +++ indra/newview/llfloaterimcontainer.cpp | 14 ++++- indra/newview/llpanelpeoplemenus.cpp | 6 ++ indra/newview/lltoolpie.cpp | 39 +++++++++++- indra/newview/llviewermenu.cpp | 19 +++++- indra/newview/rlvhandler.cpp | 40 +++++++----- indra/newview/rlvui.cpp | 62 ++++++++++++++----- indra/newview/rlvui.h | 7 ++- .../skins/default/xui/en/menu_avatar_icon.xml | 1 + 10 files changed, 165 insertions(+), 39 deletions(-) diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 3b4cdd022a..dfdd11f2d0 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -66,6 +66,7 @@ #include "llviewercontrol.h" #include "llviewerobjectlist.h" // [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) +#include "rlvactions.h" #include "rlvcommon.h" // [/RLVa:KB] @@ -486,6 +487,12 @@ public: { return canModerate(userdata); } +// [RLVa:KB] - @pay + else if (level == "can_pay") + { + return RlvActions::canPayAvatar(getAvatarId()); + } +// [/RLVa:KB] else if (level == "can_ban_member") { return canBanGroupMember(getAvatarId()); diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp index 86e23e7c83..45fd7b327f 100644 --- a/indra/newview/llconversationloglist.cpp +++ b/indra/newview/llconversationloglist.cpp @@ -34,6 +34,9 @@ #include "llconversationloglistitem.h" #include "llviewermenu.h" #include "lltrans.h" +// [RLVa:KB] - @pay +#include "rlvactions.h" +// [/RLVa:KB] static LLDefaultChildRegistry::Register r("conversation_log_list"); @@ -387,6 +390,12 @@ bool LLConversationLogList::isActionEnabled(const LLSD& userdata) { return (is_p2p || is_group_member) && LLAvatarActions::canCall(); } +// [RLVa:KB] - @pay + else if ("can_pay" == command_name) + { + return is_p2p && RlvActions::canPayAvatar(selected_id); + } +// [/RLVa:KB] else if ("add_rem_friend" == command_name || "can_invite_to_group" == command_name || "can_share" == command_name || diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 21420b122b..6ebb1dd7f2 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -55,6 +55,9 @@ #include "llworld.h" #include "llsdserialize.h" #include "llviewerobjectlist.h" +// [RLVa:KB] - @pay +#include "rlvactions.h" +// [/RLVa:KB] #include "boost/foreach.hpp" // @@ -1426,11 +1429,20 @@ bool LLFloaterIMContainer::enableContextMenuItem(const std::string& item, uuid_v } // Handle all other options - if (("can_invite" == item) || ("can_chat_history" == item) || ("can_share" == item) || ("can_pay" == item)) +// if (("can_invite" == item) || ("can_chat_history" == item) || ("can_share" == item) || ("can_pay" == item)) +// [RLVa:KB] - @pay + if (("can_invite" == item) || ("can_chat_history" == item) || ("can_share" == item)) +// [/RLVa:KB] { // Those menu items are enable only if a single avatar is selected return is_single_select; } +// [RLVa:KB] - @pay + else if ("can_pay" == item) + { + return is_single_select && RlvActions::canPayAvatar(single_id); + } +// [/RLVa:KB] else if ("can_block" == item) { return (is_single_select ? LLAvatarActions::canBlock(single_id) : false); diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp index f3c693a29a..c615a36299 100644 --- a/indra/newview/llpanelpeoplemenus.cpp +++ b/indra/newview/llpanelpeoplemenus.cpp @@ -254,6 +254,12 @@ bool PeopleContextMenu::enableContextMenuItem(const LLSD& userdata) { return LLLogChat::isTranscriptExist(mUUIDs.front()); } +// [RLVa:KB] - @pay + else if (item == std::string("can_pay")) + { + return RlvActions::canPayAvatar(mUUIDs.front()); + } +// [/RLVa:KB] else if (item == std::string("can_im") || item == std::string("can_invite") || item == std::string("can_share") || item == std::string("can_pay")) { diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 214450beba..533e71a40d 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -277,14 +277,39 @@ BOOL LLToolPie::handleLeftClickPick() } // [/RLVa:KB] +// [RLVa:KB] - @buy + const std::function fnRlvCheck = [](const LLUUID& idObj, U8 clickAction) { + switch (clickAction) + { + case CLICK_ACTION_BUY: + return RlvActions::canBuyObject(idObj); + case CLICK_ACTION_PAY: + return RlvActions::canPayObject(idObj); + default: + return true; + } + }; +// [/RLVa:KB] mClickAction = 0; if (object && object->getClickAction()) { mClickAction = object->getClickAction(); +// [RLVa:KB] - @buy + if ( (RlvActions::isRlvEnabled()) && (!fnRlvCheck(object->getID(), mClickAction)) ) + { + mClickAction = CLICK_ACTION_NONE; + } +// [/RLVa:KB] } else if (parent && parent->getClickAction()) { mClickAction = parent->getClickAction(); +// [RLVa:KB] - @buy + if ((RlvActions::isRlvEnabled()) && (!fnRlvCheck(parent->getID(), mClickAction))) + { + mClickAction = CLICK_ACTION_NONE; + } +// [/RLVa:KB] } switch(mClickAction) @@ -524,7 +549,12 @@ ECursorType LLToolPie::cursorFromObject(LLViewerObject* object) LLSelectNode* node = LLSelectMgr::getInstance()->getHoverNode(); if (!node || node->mSaleInfo.isForSale()) { - cursor = UI_CURSOR_TOOLBUY; +// [RLVa:KB] - @buy + cursor = (!object || RlvActions::canBuyObject(parent ? parent->getID() : object->getID())) + ? UI_CURSOR_TOOLBUY + : ((object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch())) ? UI_CURSOR_HAND : UI_CURSOR_ARROW; +// [/RLVa:KB] +// cursor = UI_CURSOR_TOOLBUY; } } break; @@ -541,7 +571,12 @@ ECursorType LLToolPie::cursorFromObject(LLViewerObject* object) if ((object && object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) { - cursor = UI_CURSOR_TOOLBUY; +// [RLVa:KB] - @buy + cursor = ((object && RlvActions::canPayObject(object->getID())) || (parent && RlvActions::canPayObject(parent->getID()))) + ? UI_CURSOR_TOOLBUY + : ((object && object->flagHandleTouch()) || (parent && parent->flagHandleTouch())) ? UI_CURSOR_HAND : UI_CURSOR_ARROW; +// [/RLVa:KB] +// cursor = UI_CURSOR_TOOLBUY; } } break; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 75793ac975..034bc96bbd 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3653,6 +3653,11 @@ bool enable_buy_object() if( for_sale_selection(node) ) { +// [RLVa:KB] - @buy + if (!RlvActions::canBuyObject(obj->getID())) + return false; +// [/RLVa:KB] + // *NOTE: Is this needed? This checks to see if anyone owns the // object, dating back to when we had "public" objects owned by // no one. JC @@ -5132,6 +5137,11 @@ BOOL is_selection_buy_not_take() LLViewerObject* obj = node->getObject(); if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale())) { +// [RLVa:KB] - @buy + if (!RlvActions::canBuyObject(obj->getID())) + continue; +// [/RLVa:KB] + // you do not own the object and it is for sale, thus, // it's a buy return TRUE; @@ -6427,8 +6437,8 @@ bool enable_pay_avatar() LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); LLVOAvatar* avatar = find_avatar_from_object(obj); // return (avatar != NULL); -// [RLVa:KB] - Checked: RLVa-1.2.1 - return (avatar != NULL) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())); +// [RLVa:KB] - @shownames and @pay + return (avatar != NULL) && (RlvActions::canShowName(RlvActions::SNC_DEFAULT, avatar->getID())) && (RlvActions::canPayAvatar(avatar->getID())); // [/RLVa:KB] } @@ -6440,7 +6450,10 @@ bool enable_pay_object() LLViewerObject *parent = (LLViewerObject *)object->getParent(); if((object->flagTakesMoney()) || (parent && parent->flagTakesMoney())) { - return true; +// [RLVa:KB] - @buy + return RlvActions::canBuyObject(object->getID()); +// [/RLVa:KB] +// return true; } } return false; diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 3a7c01bf42..5f7168f261 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1866,15 +1866,15 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhv // Start or stop filtering opening the buy, buy contents and pay object floaters if (fHasBhvr) { - RlvUIEnabler::instance().addGenericFloaterFilter("buy_object"); - RlvUIEnabler::instance().addGenericFloaterFilter("buy_object_contents"); - RlvUIEnabler::instance().addGenericFloaterFilter("pay_object"); + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("buy_object", std::string(RLV_STRING_BLOCKED_GENERIC))); + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("buy_object_contents", std::string(RLV_STRING_BLOCKED_GENERIC))); + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("pay_object", std::string(RLV_STRING_BLOCKED_GENERIC))); } else { - RlvUIEnabler::instance().removeGenericFloaterFilter("buy_object"); - RlvUIEnabler::instance().removeGenericFloaterFilter("buy_object_contents"); - RlvUIEnabler::instance().removeGenericFloaterFilter("pay_object"); + RLV_VERIFY(RlvUIEnabler::instance().removeGenericFloaterFilter("buy_object")); + RLV_VERIFY(RlvUIEnabler::instance().removeGenericFloaterFilter("buy_object_contents")); + RLV_VERIFY(RlvUIEnabler::instance().removeGenericFloaterFilter("pay_object")); } } @@ -2011,9 +2011,13 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBh // Start or stop filtering opening the beacons floater if (fHasBhvr) - RlvUIEnabler::instance().addGenericFloaterFilter("beacons"); + { + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("beacons")); + } else - RlvUIEnabler::instance().removeGenericFloaterFilter("beacons"); + { + RLV_VERIFY(RlvUIEnabler::instance().removeGenericFloaterFilter("beacons")); + } } // Handles: @pay=n|y toggles @@ -2022,9 +2026,13 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhv { // Start or stop filtering opening the pay avatar floater if (fHasBhvr) - RlvUIEnabler::instance().addGenericFloaterFilter("pay_resident"); + { + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("pay_resident")); + } else - RlvUIEnabler::instance().removeGenericFloaterFilter("pay_resident"); + { + RLV_VERIFY(RlvUIEnabler::instance().removeGenericFloaterFilter("pay_resident")); + } } // Handles: @setoverlay=n|y toggles @@ -2366,11 +2374,11 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour e LLFloaterReg::const_instance_list_t envFloaters = LLFloaterReg::getFloaterList(strEnvFloaters[idxFloater]); for (LLFloater* pFloater : envFloaters) pFloater->closeFloater(); - RlvUIEnabler::instance().addGenericFloaterFilter(strEnvFloaters[idxFloater]); + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter(strEnvFloaters[idxFloater])); } else { - RlvUIEnabler::instance().removeGenericFloaterFilter(strEnvFloaters[idxFloater]); + RLV_VERIFY(RlvUIEnabler::instance().removeGenericFloaterFilter(strEnvFloaters[idxFloater])); } } @@ -2456,9 +2464,13 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour // Filter (or stop filtering) opening new inventory floaters // if (fHasBhvr) - RlvUIEnabler::instance().addGenericFloaterFilter("inventory"); + { + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("inventory")); + } else - RlvUIEnabler::instance().removeGenericFloaterFilter("inventory"); + { + RLV_VERIFY(RlvUIEnabler::instance().removeGenericFloaterFilter("inventory")); + } } // Handles: @shownames[:]=n|y toggles diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index cd6e5831ce..4d8699b55a 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -182,9 +182,13 @@ void RlvUIEnabler::onToggleShowMinimap() // Start or stop filtering showing the mini-map floater if (!fEnable) - addGenericFloaterFilter("mini_map"); + { + RLV_VERIFY(addGenericFloaterFilter("mini_map")); + } else - removeGenericFloaterFilter("mini_map"); + { + RLV_VERIFY(removeGenericFloaterFilter("mini_map")); + } // Hide the mini-map floater if it's currently visible (or restore it if it was previously visible) static bool fPrevVisibile = false; @@ -217,9 +221,13 @@ void RlvUIEnabler::onToggleShowWorldMap() // Start or stop filtering opening the world map if (!fEnable) - addGenericFloaterFilter("world_map"); + { + RLV_VERIFY(addGenericFloaterFilter("world_map")); + } else - removeGenericFloaterFilter("world_map"); + { + RLV_VERIFY(removeGenericFloaterFilter("world_map")); + } } // Checked: 2010-08-22 (RLVa-1.2.1a) | Added: RLVa-1.2.1a @@ -271,31 +279,53 @@ void RlvUIEnabler::onUpdateLoginLastLocation(bool fQuitting) // ============================================================================ -// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a -void RlvUIEnabler::addGenericFloaterFilter(const std::string& strFloaterName) +bool RlvUIEnabler::addGenericFloaterFilter(const std::string& strFloaterName, const std::string& strRlvNotification) { - m_FilteredFloaters.insert(strFloaterName); + return addGenericFloaterFilter(strFloaterName, [strRlvNotification]() { RlvUtil::notifyBlocked(strRlvNotification); }); +} + +bool RlvUIEnabler::addGenericFloaterFilter(const std::string& strFloaterName, const std::function& fn) +{ + // NOTE: we don't currently support multiple filters for the same floater (due to the need to remove the correct one at the end of it all) + if (m_FilteredFloaterMap.end() != m_FilteredFloaterMap.find(strFloaterName)) + return false; + + m_FilteredFloaterMap.insert(std::make_pair(strFloaterName, fn)); if (!m_ConnFloaterGeneric.connected()) + { m_ConnFloaterGeneric = LLFloaterReg::setValidateCallback(boost::bind(&RlvUIEnabler::filterFloaterGeneric, this, _1, _2)); + } + + return true; } -// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a -void RlvUIEnabler::removeGenericFloaterFilter(const std::string& strFloaterName) +bool RlvUIEnabler::removeGenericFloaterFilter(const std::string& strFloaterName) { - std::multiset::iterator itFloater = m_FilteredFloaters.find(strFloaterName); - RLV_ASSERT_DBG(itFloater != m_FilteredFloaters.end()); - m_FilteredFloaters.erase(itFloater); + auto itFloater = m_FilteredFloaterMap.find(strFloaterName); + if (itFloater != m_FilteredFloaterMap.end()) + return false; + + m_FilteredFloaterMap.erase(itFloater); RLV_ASSERT_DBG(m_ConnFloaterGeneric.connected()); - if (m_FilteredFloaters.empty()) + if (m_FilteredFloaterMap.empty()) m_ConnFloaterGeneric.disconnect(); + + return true; } -// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a -bool RlvUIEnabler::filterFloaterGeneric(const std::string& strName, const LLSD&) +bool RlvUIEnabler::filterFloaterGeneric(const std::string& strFloaterName, const LLSD&) { - return m_FilteredFloaters.end() == m_FilteredFloaters.find(strName); + auto itFloater = m_FilteredFloaterMap.find(strFloaterName); + if (m_FilteredFloaterMap.end() != itFloater) + { + if (itFloater->second) + itFloater->second(); + return false; + } + return true; + } // Checked: 2010-04-22 (RLVa-1.4.5) | Added: RLVa-1.2.0 diff --git a/indra/newview/rlvui.h b/indra/newview/rlvui.h index c6f945a2c5..c53a9ab190 100644 --- a/indra/newview/rlvui.h +++ b/indra/newview/rlvui.h @@ -55,8 +55,9 @@ protected: * Floater and sidebar validation callbacks */ public: - void addGenericFloaterFilter(const std::string& strFloaterName); - void removeGenericFloaterFilter(const std::string& strFloaterName); + bool addGenericFloaterFilter(const std::string& strFloaterName, const std::string& strRlvNotification); + bool addGenericFloaterFilter(const std::string& strFloaterName, const std::function& fn = nullptr); + bool removeGenericFloaterFilter(const std::string& strFloaterName); protected: bool filterFloaterGeneric(const std::string&, const LLSD&); @@ -86,7 +87,7 @@ protected: typedef std::multimap behaviour_handler_map_t; behaviour_handler_map_t m_Handlers; - std::multiset m_FilteredFloaters; + std::map> m_FilteredFloaterMap; }; // ============================================================================ diff --git a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml index 05ab4d35a0..597f480e83 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_icon.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_icon.xml @@ -95,6 +95,7 @@ layout="topleft" name="Pay"> + Date: Wed, 16 Sep 2020 13:20:41 +0200 Subject: [PATCH 5/6] CATZ-576: Indicate user typing status with @redirchat=n with an optional toggle --- indra/newview/app_settings/settings.xml | 13 ++++++++++++- indra/newview/llagent.cpp | 7 +++++++ indra/newview/llchatbar.cpp | 6 +----- indra/newview/llfloaterimnearbychat.cpp | 5 +---- indra/newview/rlvactions.cpp | 9 +++++++++ indra/newview/rlvactions.h | 5 +++++ indra/newview/rlvdefines.h | 1 + indra/newview/skins/default/xui/en/menu_viewer.xml | 10 ++++++++++ 8 files changed, 46 insertions(+), 10 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0b7be374ba..54b443b865 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -255,10 +255,21 @@ Value 1 + RLVaShowRedirectChatTyping + + Comment + Sends typing start messages (and optionally plays the typing animation) when @redirchat restricted + Persist + 1 + Type + Boolean + Value + 0 + RLVaSplitRedirectChat Comment - Splits long nearby chat lines across multiple messages when @redir* restricted. + Splits long nearby chat lines across multiple messages when @redir* restricted Persist 1 Type diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 3c493604a7..66da75c6d8 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1992,6 +1992,13 @@ BOOL LLAgent::needsRenderHead() //----------------------------------------------------------------------------- void LLAgent::startTyping() { +// [RLVa:KB] - @redirchat + if (!RlvActions::canSendTypingStart()) + { + return; + } +// [/RLVa:KB] + mTypingTimer.reset(); if (getRenderState() & AGENT_STATE_TYPING) diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index e19f1bd15c..501c6c119d 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -479,11 +479,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata ) S32 length = raw_text.length(); -// if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences -// [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Modified: RLVa-1.0.0d - // RELEASE-RLVa: [SL-2.0.0] This entire class appears to be dead/non-functional? - if ( (length > 0) && (raw_text[0] != '/') && (!RlvActions::hasBehaviour(RLV_BHVR_REDIRCHAT)) ) -// [/RLVa:KB] + if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { gAgent.startTyping(); } diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp index 269172f282..655276af0b 100644 --- a/indra/newview/llfloaterimnearbychat.cpp +++ b/indra/newview/llfloaterimnearbychat.cpp @@ -476,10 +476,7 @@ void LLFloaterIMNearbyChat::onChatBoxKeystroke() S32 length = raw_text.length(); -// if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences -// [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Modified: RLVa-1.0.0d - if ( (length > 0) && (raw_text[0] != '/') && (!RlvActions::hasBehaviour(RLV_BHVR_REDIRCHAT)) ) -// [/RLVa:KB] + if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences { gAgent.startTyping(); } diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp index ed17275c0e..d1786dab5e 100644 --- a/indra/newview/rlvactions.cpp +++ b/indra/newview/rlvactions.cpp @@ -188,6 +188,15 @@ bool RlvActions::canSendIM(const LLUUID& idRecipient) ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) || (!gRlvHandler.isException(RLV_BHVR_SENDIMTO, idRecipient)) ) ); } +// Handles: @redirchat +bool RlvActions::canSendTypingStart() +{ + // The CHAT_TYPE_START indicator can be sent if: + // - nearby chat isn't being redirected + // - the user specifically indicated that they want to show typing under @redirchat + return !RlvHandler::instance().hasBehaviour(RLV_BHVR_REDIRCHAT) || gSavedSettings.get(RLV_SETTING_SHOWREDIRECTCHATTYPING); +} + bool RlvActions::canStartIM(const LLUUID& idRecipient, bool fIgnoreOpen) { // User can start an IM session with "recipient" (could be an agent or a group) if: diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h index 90b1069f6b..5fcf40b1d1 100644 --- a/indra/newview/rlvactions.h +++ b/indra/newview/rlvactions.h @@ -107,6 +107,11 @@ public: */ static bool canSendIM(const LLUUID& idRecipient); + /* + * Returns true if the viewer can inform the region about the user's (nearby chat) typing + */ + static bool canSendTypingStart(); + /* * 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) */ diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index f43a332f9f..a724cbcc0e 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -380,6 +380,7 @@ enum ERlvAttachGroupType #define RLV_SETTING_HIDELOCKEDATTACH "RLVaHideLockedAttachments" #define RLV_SETTING_HIDELOCKEDINVENTORY "RLVaHideLockedInventory" #define RLV_SETTING_LOGINLASTLOCATION "RLVaLoginLastLocation" +#define RLV_SETTING_SHOWREDIRECTCHATTYPING "RLVaShowRedirectChatTyping" #define RLV_SETTING_SHAREDINVAUTORENAME "RLVaSharedInvAutoRename" #define RLV_SETTING_SHOWASSERTIONFAIL "RLVaShowAssertionFailures" #define RLV_SETTING_SPLITREDIRECTCHAT "RLVaSplitRedirectChat" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 10e88f1f7d..9bd07bdceb 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1657,6 +1657,16 @@ function="ToggleControl" parameter="RestrainedLoveShowEllipsis" /> + + + + From 6b0838e59ea0ad778c5a702df51b773798bf2632 Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Wed, 16 Sep 2020 15:09:15 +0200 Subject: [PATCH 6/6] [FIXED] Floater filter remove check is backwards --- indra/newview/rlvhandler.cpp | 2 +- indra/newview/rlvui.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index a4cc038730..72dd6e4c7d 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -2035,7 +2035,7 @@ void RlvBehaviourToggleHandler::onCommandToggle(ERlvBehaviour eBhv // Start or stop filtering opening the pay avatar floater if (fHasBhvr) { - RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("pay_resident")); + RLV_VERIFY(RlvUIEnabler::instance().addGenericFloaterFilter("pay_resident", std::string(RLV_STRING_BLOCKED_GENERIC))); } else { diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp index 62ddf89189..1cb6ed35a1 100644 --- a/indra/newview/rlvui.cpp +++ b/indra/newview/rlvui.cpp @@ -303,7 +303,7 @@ bool RlvUIEnabler::addGenericFloaterFilter(const std::string& strFloaterName, co bool RlvUIEnabler::removeGenericFloaterFilter(const std::string& strFloaterName) { auto itFloater = m_FilteredFloaterMap.find(strFloaterName); - if (itFloater != m_FilteredFloaterMap.end()) + if (m_FilteredFloaterMap.end() == itFloater) return false; m_FilteredFloaterMap.erase(itFloater);