[RLVa] f9f8dbe23ec3 ported

- internal : reviewed @startim for CHUI (SL-3.5)
    -> fixed : "Start Conference Chat" on a selection of multiple calling cards opens an IM session
    -> fixed : actions that would result in an IM window opening shouldn't be blocked if the session is already open
    -> added : RlvActions class to mimick LLAvatarActions and lowering the rlvhandler.h include dependency
This commit is contained in:
Inusaito Sayori
2014-01-27 13:54:13 -05:00
parent 42bf70849c
commit 6a3ee5fac4
11 changed files with 150 additions and 47 deletions

View File

@@ -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

View File

@@ -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<LLUUID> 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]

View File

@@ -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

View File

@@ -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()));

View File

@@ -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<LLUUID> 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<LLUUID>::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++);

View File

@@ -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));
}
// ============================================================================

View File

@@ -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

View File

@@ -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
{

View File

@@ -15,7 +15,7 @@
<string name="blocked_generic">Aktion konnte aufgrund von RLV-Einschränkungen nicht durchgeführt werden.</string>
<string name="blocked_permattach">Der Versuch „[OBJECT]“ anzuhängen wurde aufgrund von RLV-Einschränkungen verweigert.</string>
<string name="blocked_startim">IM-Sitzung mit [RECIPIENT] konnte aufgrund von RLV-Einschränkungen nicht gestartet werden.</string>
<string name="blocked_startconf">Konferenz mit [RECIPIENT] konnte aufgrund von RLV-Einschränkungen nicht gestartet werden.</string>
<string name="blocked_startconf">Konferenz konnte aufgrund von RLV-Einschränkungen nicht gestartet werden.</string>
<string name="blocked_teleport">Teleport konnte aufgrund von RLV-Einschränkungen nicht initialisiert werden.</string>
<string name="blocked_viewxxx">[TYPE] konnte aufgrund von RLV-Einschränkungen nicht geöffnet werden.</string>

View File

@@ -15,7 +15,7 @@
<string name="blocked_generic">Unable to perform action due to RLV restrictions</string>
<string name="blocked_permattach">Attempt to attach '[OBJECT]' was denied due to RLV restrictions</string>
<string name="blocked_startim">Unable to start IM session with [RECIPIENT] due to RLV restrictions</string>
<string name="blocked_startconf">Unable to start conference with [RECIPIENT] due to RLV restrictions</string>
<string name="blocked_startconf">Unable to start conference due to RLV restrictions</string>
<string name="blocked_teleport">Unable to initiate teleport due to RLV restrictions</string>
<string name="blocked_viewxxx">Unable to open [TYPE] due to RLV restrictions</string>

View File

@@ -29,7 +29,7 @@
No se puede iniciar sesión de MI con [RECIPIENT] debido a las restricciones RLV
</string>
<string name="blocked_startconf">
No se puede iniciar una conferencia con [RECIPIENT] debido a las restricciones RLV
No se puede iniciar una conferencia debido a las restricciones RLV
</string>
<string name="blocked_teleport">
No se puede iniciar el Teleporte debido a las restricciones RLV