diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 41f172981..4772df0c4 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -574,6 +574,7 @@ set(viewer_SOURCE_FILES noise.cpp pipeline.cpp qtoolalign.cpp + rlvactions.cpp rlvcommon.cpp rlvextensions.cpp rlvfloaterbehaviour.cpp @@ -1100,6 +1101,7 @@ set(viewer_HEADER_FILES noise.h pipeline.h qtoolalign.h + rlvactions.h rlvcommon.h rlvdefines.h rlvextensions.h diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 42f2e73d8..d9c5e9153 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -52,8 +52,9 @@ #include "llslurl.h" // IDEVO #include "llavatarname.h" #include "llagentui.h" -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h -#include "rlvhandler.h" +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] #include "llviewerwindow.h" @@ -182,16 +183,12 @@ void LLAvatarActions::startIM(const LLUUID& id) if (id.isNull() || gAgentID == id) return; -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(id)) && (!RlvActions::hasOpenP2PSession(id)) ) { - LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); - if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) - { - make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); - return; - } + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); + return; } // [/RLVa:KB] @@ -234,16 +231,12 @@ void LLAvatarActions::startCall(const LLUUID& id) return; } -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(id)) && (!RlvActions::hasOpenP2PSession(id)) ) { - LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); - if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) - { - make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); - return; - } + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); + return; } // [/RLVa:KB] @@ -262,12 +255,12 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) LLDynamicArray id_array; for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) const LLUUID& idAgent = *it; - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + if (!RlvActions::canStartIM(idAgent)) { make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", LLSLURL("agent", idAgent, "completename").getSLURLString())); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF); return; } id_array.push_back(idAgent); @@ -315,12 +308,12 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids) { for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) const LLUUID& idAgent = *it; - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + if (!RlvActions::canStartIM(idAgent)) { make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", LLSLURL("agent", idAgent, "completename").getSLURLString())); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF); return; } // [/RLVa:KB] diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index dec0a2ef7..f503fa3ba 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -37,6 +37,7 @@ #include "llviewerregion.h" // getCapability() #include "llworld.h" // [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.2a) +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -549,8 +550,8 @@ BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, if (dest_agent_id.notNull() && dest_agent_id != gAgentID) { // if (drop) -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (drop) && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStartIM(dest_agent_id)) ) ) +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) + if ( (drop) && (RlvActions::canStartIM(dest_agent_id)) ) // [/RLVa:KB] { // Start up IM before give the item diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 60a4a6caf..da27ac259 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -41,8 +41,10 @@ #include "llviewermessage.h" #include "groupchatlistener.h" #include "hippolimits.h" // for getMaxAgentGroups -// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0f) +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0) #include "llslurl.h" +#include "rlvactions.h" +#include "rlvcommon.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -142,8 +144,8 @@ void LLGroupActions::startCall(const LLUUID& group_id) return; } -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(group_id)) && (!RlvActions::hasOpenGroupSession(group_id)) ) { make_ui_sound("UISndInvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString())); @@ -398,8 +400,8 @@ LLUUID LLGroupActions::startIM(const LLUUID& group_id) { if (group_id.isNull()) return LLUUID::null; -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(group_id)) && (!RlvActions::hasOpenGroupSession(group_id)) ) { make_ui_sound("UISndInvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString())); diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index a02de1998..bb69789b5 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -49,6 +49,10 @@ #include "lltrans.h" #include "llvoavatarself.h" #include "llnotifications.h" +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) +#include "rlvactions.h" +#include "rlvcommon.h" +// [/RLVa:KB] extern LLUUID gAgentID; @@ -455,6 +459,10 @@ class LLBeginIMSession : public inventory_panel_listener_t LLDynamicArray members; EInstantMessage type = IM_SESSION_CONFERENCE_START; +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + bool fRlvCanStartIM = true; +// [/RLVa:KB] + for (std::set::const_iterator iter = selected_items.begin(); iter != selected_items.end(); iter++) { @@ -493,6 +501,9 @@ class LLBeginIMSession : public inventory_panel_listener_t id = item_array.get(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) { +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + fRlvCanStartIM &= RlvActions::canStartIM(id); +// [RLVa:KB] members.put(id); } } @@ -515,6 +526,9 @@ class LLBeginIMSession : public inventory_panel_listener_t if(at.isBuddyOnline(id)) { +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + fRlvCanStartIM &= RlvActions::canStartIM(id); +// [RLVa:KB] members.put(id); } } @@ -526,6 +540,15 @@ class LLBeginIMSession : public inventory_panel_listener_t // the session_id is randomly generated UUID which will be replaced later // with a server side generated number +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + if (!fRlvCanStartIM) + { + make_ui_sound("UISndIvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF); + return true; + } +// [/RLVa:KB] + if (name.empty()) { name = llformat("Session %d", session_num++); diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp new file mode 100644 index 000000000..01c626f2f --- /dev/null +++ b/indra/newview/rlvactions.cpp @@ -0,0 +1,51 @@ +/** + * + * Copyright (c) 2009-2013, 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; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt + * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt + * + * By copying, modifying or distributing this software, you acknowledge that + * you have read and understood your obligations described above, and agree to + * abide by those obligations. + * + */ + +#include "llviewerprecompiledheaders.h" +#include "llimview.h" +#include "rlvactions.h" +#include "rlvhandler.h" + +// ============================================================================ +// RlvActions member functions +// + +// Checked: 2011-04-12 (RLVa-1.3.0) +bool RlvActions::canStartIM(const LLUUID& idRecipient) +{ + // 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) + // - not specifically restricted from starting an IM session with the recipient + return + (!rlv_handler_t::isEnabled()) || + ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIM)) || (gRlvHandler.isException(RLV_BHVR_STARTIM, idRecipient)) ) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIMTO)) || (!gRlvHandler.isException(RLV_BHVR_STARTIMTO, idRecipient)) ) ); +} + +// Checked: 2013-05-09 (RLVa-1.4.9) +bool RlvActions::hasOpenP2PSession(const LLUUID& idAgent) +{ + const LLUUID idSession = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, idAgent); + return (idSession.notNull()) && (LLIMMgr::instance().hasSession(idSession)); +} + +// Checked: 2013-05-09 (RLVa-1.4.9) +bool RlvActions::hasOpenGroupSession(const LLUUID& idGroup) +{ + return (idGroup.notNull()) && (LLIMMgr::instance().hasSession(idGroup)); +} + +// ============================================================================ diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h new file mode 100644 index 000000000..a6b411d24 --- /dev/null +++ b/indra/newview/rlvactions.h @@ -0,0 +1,42 @@ +/** + * + * Copyright (c) 2009-2013, 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; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt + * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt + * + * By copying, modifying or distributing this software, you acknowledge that + * you have read and understood your obligations described above, and agree to + * abide by those obligations. + * + */ + +#ifndef RLV_ACTIONS_H +#define RLV_ACTIONS_H + +// ============================================================================ +// RlvActions class declaration +// + +class RlvActions +{ +public: + + /* + * Returns true if the user is allowed to start a - P2P or group - conversation with the specified UUID. + */ + static bool canStartIM(const LLUUID& idRecipient); // @startim and @startimto + + /* + * Returns true if a - P2P or group - IM session is open with the specified UUID. + */ + static bool hasOpenP2PSession(const LLUUID& idAgent); + static bool hasOpenGroupSession(const LLUUID& idGroup); +}; + +// ============================================================================ + +#endif // RLV_ACTIONS_H diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index 79db80cee..8c0f010af 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -96,7 +96,6 @@ public: bool canShowHoverText(const LLViewerObject* pObj) const; // @showhovertext* command family bool canSendIM(const LLUUID& idRecipient) const; // @sendim and @sendimto bool canSit(LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; - bool canStartIM(const LLUUID& idRecipient) const; // @startim and @startimto bool canStand() const; bool canTeleportViaLure(const LLUUID& idAgent) const; bool canTouch(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; // @touch @@ -277,16 +276,6 @@ inline bool RlvHandler::canShowHoverText(const LLViewerObject *pObj) const (isException(RLV_BHVR_SHOWHOVERTEXT, pObj->getID(), RLV_CHECK_PERMISSIVE)) ) ); } -inline bool RlvHandler::canStartIM(const LLUUID& idRecipient) const -{ - // 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) - // - not specifically restricted from starting an IM session with the recipient - return - ( (!hasBehaviour(RLV_BHVR_STARTIM)) || (isException(RLV_BHVR_STARTIM, idRecipient)) ) && - ( (!hasBehaviour(RLV_BHVR_STARTIMTO)) || (!isException(RLV_BHVR_STARTIMTO, idRecipient)) ); -} - // Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c inline bool RlvHandler::canTeleportViaLure(const LLUUID& idAgent) const { diff --git a/indra/newview/skins/default/xui/de/rlva_strings.xml b/indra/newview/skins/default/xui/de/rlva_strings.xml index 187d6b8bd..9f062332b 100644 --- a/indra/newview/skins/default/xui/de/rlva_strings.xml +++ b/indra/newview/skins/default/xui/de/rlva_strings.xml @@ -15,7 +15,7 @@ Aktion konnte aufgrund von RLV-Einschränkungen nicht durchgeführt werden. Der Versuch „[OBJECT]“ anzuhängen wurde aufgrund von RLV-Einschränkungen verweigert. IM-Sitzung mit [RECIPIENT] konnte aufgrund von RLV-Einschränkungen nicht gestartet werden. - Konferenz mit [RECIPIENT] konnte aufgrund von RLV-Einschränkungen nicht gestartet werden. + Konferenz konnte aufgrund von RLV-Einschränkungen nicht gestartet werden. Teleport konnte aufgrund von RLV-Einschränkungen nicht initialisiert werden. [TYPE] konnte aufgrund von RLV-Einschränkungen nicht geöffnet werden. diff --git a/indra/newview/skins/default/xui/en-us/rlva_strings.xml b/indra/newview/skins/default/xui/en-us/rlva_strings.xml index 8beadd514..73ddc6710 100644 --- a/indra/newview/skins/default/xui/en-us/rlva_strings.xml +++ b/indra/newview/skins/default/xui/en-us/rlva_strings.xml @@ -15,7 +15,7 @@ Unable to perform action due to RLV restrictions Attempt to attach '[OBJECT]' was denied due to RLV restrictions Unable to start IM session with [RECIPIENT] due to RLV restrictions - Unable to start conference with [RECIPIENT] due to RLV restrictions + Unable to start conference due to RLV restrictions Unable to initiate teleport due to RLV restrictions Unable to open [TYPE] due to RLV restrictions diff --git a/indra/newview/skins/default/xui/es/rlva_strings.xml b/indra/newview/skins/default/xui/es/rlva_strings.xml index ec9141ebe..a1e1c3b61 100644 --- a/indra/newview/skins/default/xui/es/rlva_strings.xml +++ b/indra/newview/skins/default/xui/es/rlva_strings.xml @@ -29,7 +29,7 @@ No se puede iniciar sesión de MI con [RECIPIENT] debido a las restricciones RLV - No se puede iniciar una conferencia con [RECIPIENT] debido a las restricciones RLV + No se puede iniciar una conferencia debido a las restricciones RLV No se puede iniciar el Teleporte debido a las restricciones RLV