[RLVa] Forced TPRequest response is now supported!

This commit is contained in:
Inusaito Sayori
2014-01-28 04:27:38 -05:00
parent 4dcf8f3f45
commit 88ae36f4e1
9 changed files with 153 additions and 69 deletions

View File

@@ -2331,7 +2331,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// && !is_muted // Singu Note: Never if muted
// && from_id.notNull() //not a system message
// && to_id.notNull()) //not global message
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) | Modified: RLVa-1.3.0c
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
else if (offline == IM_ONLINE
&& is_do_not_disturb
&& !is_muted // Singu Note: Never if muted
@@ -2485,16 +2485,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
mute_im = true;
}
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
// Don't block offline IMs, or IMs from Lindens
if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!is_linden) )
{
if (!mute_im)
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id);
message = message.substr(0, message_offset) + RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
}
// [/RLVa:KB]
std::string saved;
if(offline == IM_OFFLINE)
{
@@ -2520,6 +2510,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
mute_im = true;
}
*/
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
// Don't block offline IMs, or IMs from Lindens
if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!is_linden) )
{
if (!mute_im)
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id);
message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
}
// [/RLVa:KB]
if (!mute_im || is_linden)
{
gIMMgr->addMessage(
@@ -2747,7 +2748,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
payload["sender_name"] = name;
payload["group_id"] = group_id;
payload["inventory_name"] = item_name;
payload["inventory_offer"] = info ? info->asLLSD() : LLSD();
if(info && info->asLLSD())
{
payload["inventory_offer"] = info->asLLSD();
}
LLSD args;
args["SUBJECT"] = subj;
@@ -2872,9 +2876,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
info->forceResponse(IOR_DECLINE);
}
/* Singu Note: Handle this inside inventory_offer_handler so if the user wants to autoaccept offers, they can while busy.
// old logic: busy mode must not affect interaction with objects (STORM-565)
// new logic: inventory offers from in-world objects should be auto-declined (CHUI-519)
// Singu Note: We should use old logic
else if (is_do_not_disturb && dialog != IM_TASK_INVENTORY_OFFERED) // busy mode must not affect interaction with objects (STORM-565)
{
// Until throttling is implemented, busy mode should reject inventory instead of silently
// Until throttling is implemented, do not disturb mode should reject inventory instead of silently
// accepting it. SEE SL-39554
info->forceResponse(IOR_DECLINE);
}
@@ -3014,7 +3021,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
chat.mFromName = name;
// Build a link to open the object IM info window.
std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size);
std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1);
if (session_id.notNull())
{
@@ -3113,21 +3120,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_LURE_USER:
case IM_TELEPORT_REQUEST:
{
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c
// If the lure sender is a specific @accepttp exception they will override muted and busy status
bool fRlvSummon = (rlv_handler_t::isEnabled()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, from_id));
// [RLVa:KB] - Checked: 2013-11-08 (RLVa-1.4.9)
// If we auto-accept the offer/request then this will override DnD status (but we'll still let the other party know later)
bool fRlvAutoAccept = (rlv_handler_t::isEnabled()) &&
( ((IM_LURE_USER == dialog) && (RlvActions::autoAcceptTeleportOffer(from_id))) ||
((IM_TELEPORT_REQUEST == dialog) && (RlvActions::autoAcceptTeleportRequest(from_id))) );
// [/RLVa:KB]
// if (is_muted)
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c
if ( (is_muted) && (!fRlvSummon) )
// [/RLVa:KB]
if (is_muted)
{
return;
}
// else if (is_do_not_disturb)
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c
else if ( (is_do_not_disturb) && (!fRlvSummon) )
// [RLVa:KB] - Checked: 2013-11-08 (RLVa-1.4.9)
else if ( (is_do_not_disturb) && (!fRlvAutoAccept) )
// [/RLVa:KB]
{
send_do_not_disturb_message(msg, from_id);
@@ -3187,19 +3193,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
}
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c
// [RLVa:KB] - Checked: 2013-11-08 (RLVa-1.4.9)
if (rlv_handler_t::isEnabled())
{
if (IM_TELEPORT_REQUEST != dialog && !gRlvHandler.canTeleportViaLure(from_id))
if ( ((IM_LURE_USER == dialog) && (!RlvActions::canAcceptTpOffer(from_id))) ||
((IM_TELEPORT_REQUEST == dialog) && (!RlvActions::canAcceptTpRequest(from_id))) )
{
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLURE_REMOTE));
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLUREREQ_REMOTE));
if (is_do_not_disturb)
send_do_not_disturb_message(msg, from_id);
return;
}
// Censor lure message if: 1) restricted from receiving IMs from the sender, or 2) @showloc=n restricted
if ( (!RlvActions::canReceiveIM(from_id)) || (IM_TELEPORT_REQUEST != dialog && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
// Censor lure message if: 1) restricted from receiving IMs from the sender, or 2) teleport offer and @showloc=n restricted
if ( (!RlvActions::canReceiveIM(from_id)) || ((IM_LURE_USER == dialog) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))) )
{
message = RlvStrings::getString(RLV_STRING_HIDDEN);
}
@@ -3218,17 +3225,26 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
payload["lure_id"] = session_id;
payload["godlike"] = FALSE;
payload["region_maturity"] = region_access;
//LLNotificationsUtil::add("TeleportOffered", args, payload);
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c
if ( IM_TELEPORT_REQUEST != dialog && (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTP)) || (fRlvSummon)) )
/* Singu TODO: Figure if we should use these
if (!canUserAccessDstRegion)
{
gRlvHandler.setCanCancelTp(false);
if (is_do_not_disturb)
send_do_not_disturb_message(msg, from_id);
LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0);
LLNotification::Params params("TeleportOffered_MaturityBlocked");
params.substitutions = args;
params.payload = payload;
LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false);
send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id);
send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id);
}
else if (doesUserRequireMaturityIncrease)
{
LLNotification::Params params("TeleportOffered_MaturityExceeded");
params.substitutions = args;
params.payload = payload;
LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false);
}
else
*/
{
/* Singu Note: No default constructor for LLNotification::Params
LLNotification::Params params;
@@ -3247,14 +3263,28 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
params.substitutions = args;
params.payload = payload;
LLNotifications::instance().add(params);
// <edit>
if (IM_LURE_USER == dialog)
gAgent.showLureDestination(name, region_handle, pos.mV[VX], pos.mV[VY], pos.mV[VZ]);
// </edit>
}
// [RLVa:KB] - Checked: 20103-11-08 (RLVa-1.4.9)
if ( (rlv_handler_t::isEnabled()) && (fRlvAutoAccept) )
{
if (IM_LURE_USER == dialog)
gRlvHandler.setCanCancelTp(false);
if (is_do_not_disturb)
send_do_not_disturb_message(msg, from_id);
LLNotifications::instance().forceResponse(LLNotification::Params(params.name).payload(payload), 0);
}
else
{
LLNotifications::instance().add(params);
// <edit>
if (IM_LURE_USER == dialog)
gAgent.showLureDestination(name, region_handle, pos.mV[VX], pos.mV[VY], pos.mV[VZ]);
// </edit>
}
// [/RLVa:KB]
//LLNotificationsUtil::add("TeleportOffered", args, payload);
// LLNotifications::instance().add(params);
}
}
}
break;

View File

@@ -59,6 +59,30 @@ bool RlvActions::canStartIM(const LLUUID& idRecipient)
( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIMTO)) || (!gRlvHandler.isException(RLV_BHVR_STARTIMTO, idRecipient)) ) );
}
// Checked: 2010-12-11 (RLVa-1.2.2)
bool RlvActions::canAcceptTpOffer(const LLUUID& idSender)
{
return ((!gRlvHandler.hasBehaviour(RLV_BHVR_TPLURE)) || (gRlvHandler.isException(RLV_BHVR_TPLURE, idSender))) && (canStand());
}
// Checked: 2013-11-08 (RLVa-1.4.9)
bool RlvActions::autoAcceptTeleportOffer(const LLUUID& idSender)
{
return ((idSender.notNull()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, idSender))) || (gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTP));
}
// Checked: 2013-11-08 (RLVa-1.4.9)
bool RlvActions::canAcceptTpRequest(const LLUUID& idSender)
{
return (!gRlvHandler.hasBehaviour(RLV_BHVR_TPREQUEST)) || (gRlvHandler.isException(RLV_BHVR_TPREQUEST, idSender));
}
// Checked: 2013-11-08 (RLVa-1.4.9)
bool RlvActions::autoAcceptTeleportRequest(const LLUUID& idRequester)
{
return ((idRequester.notNull()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTPREQUEST, idRequester))) || (gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTPREQUEST));
}
// Checked: 2013-05-10 (RLVa-1.4.9)
bool RlvActions::hasBehaviour(ERlvBehaviour eBhvr)
{
@@ -78,4 +102,10 @@ bool RlvActions::hasOpenGroupSession(const LLUUID& idGroup)
return (idGroup.notNull()) && (LLIMMgr::instance().hasSession(idGroup));
}
// Checked: 2013-11-08 (RLVa-1.4.9)
bool RlvActions::isRlvEnabled()
{
return RlvHandler::isEnabled();
}
// ============================================================================

View File

@@ -25,8 +25,10 @@
class RlvActions
{
// =============
// Communication
// =============
public:
/*
* Returns true if the user is allowed to receive IMs from the specified sender (can be an avatar or a group)
*/
@@ -42,6 +44,36 @@ public:
*/
static bool canStartIM(const LLUUID& idRecipient); // @startim and @startimto
// ========
// Movement
// ========
public:
/*
* Returns true if the user can accept an incoming teleport offer from the specified avatar
*/
static bool canAcceptTpOffer(const LLUUID& idSender);
/*
* Returns true if a teleport offer from the specified avatar should be auto-accepted
* (pass the null UUID to check if all teleport offers should be auto-accepted regardless of sender)
*/
static bool autoAcceptTeleportOffer(const LLUUID& idSender);
/*
* Returns true if the user can accept an incoming teleport request from the specified avatar
*/
static bool canAcceptTpRequest(const LLUUID& idSender);
/*
* Returns true if a teleport request from the specified avatar should be auto-accepted
* (pass the null UUID to check if all teleport requests should be auto-accepted regardless of requester)
*/
static bool autoAcceptTeleportRequest(const LLUUID& idRequester);
// ================
// Helper functions
// ================
public:
/*
* Convenience function to check for a behaviour without having to include rlvhandler.h.
* Do NOT call this function if speed is important (i.e. per-frame)
@@ -53,6 +85,11 @@ public:
*/
static bool hasOpenP2PSession(const LLUUID& idAgent);
static bool hasOpenGroupSession(const LLUUID& idGroup);
/*
* Convenience function to check if RLVa is enabled without having to include rlvhandler.h
*/
static bool isRlvEnabled();
};
// ============================================================================

View File

@@ -80,7 +80,6 @@ template<typename T> inline T rlvGetPerUserSetting(const std::string& strSetting
class RlvSettings
{
public:
static F32 getAvatarOffsetZ() { return rlvGetSetting<F32>(RLV_SETTING_AVATAROFFSET_Z, 0.0); }
static bool getDebug() { return rlvGetSetting<bool>(RLV_SETTING_DEBUG, false); }
static bool getCanOOC() { return fCanOOC; }
static bool getForbidGiveToRLV() { return rlvGetSetting<bool>(RLV_SETTING_FORBIDGIVETORLV, true); }

View File

@@ -155,11 +155,13 @@ enum ERlvBehaviour {
RLV_BHVR_TPLM, // "tplm"
RLV_BHVR_TPLOC, // "tploc"
RLV_BHVR_TPLURE, // "tplure"
RLV_BHVR_TPREQUEST, // "tprequest"
RLV_BHVR_VIEWNOTE, // "viewnote"
RLV_BHVR_VIEWSCRIPT, // "viewscript"
RLV_BHVR_VIEWTEXTURE, // "viewtexture"
RLV_BHVR_ACCEPTPERMISSION, // "acceptpermission"
RLV_BHVR_ACCEPTTP, // "accepttp"
RLV_BHVR_ACCEPTTPREQUEST, // "accepttprequest"
RLV_BHVR_ALLOWIDLE, // "allowidle"
RLV_BHVR_EDIT, // "edit"
RLV_BHVR_EDITOBJ, // "editobj"
@@ -335,7 +337,7 @@ enum ERlvAttachGroupType
#define RLV_STRING_BLOCKED_STARTCONF "blocked_startconf"
#define RLV_STRING_BLOCKED_STARTIM "blocked_startim"
#define RLV_STRING_BLOCKED_TELEPORT "blocked_teleport"
#define RLV_STRING_BLOCKED_TPLURE_REMOTE "blocked_tplure_remote"
#define RLV_STRING_BLOCKED_TPLUREREQ_REMOTE "blocked_tplurerequest_remote"
#define RLV_STRING_BLOCKED_VIEWXXX "blocked_viewxxx"
// ============================================================================

View File

@@ -1051,7 +1051,7 @@ BOOL RlvHandler::setEnabled(BOOL fEnable)
LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&RlvHandler::onLoginComplete, &gRlvHandler));
else
gRlvHandler.onLoginComplete();
// Set up RlvUIEnabler
RlvUIEnabler::getInstance();
@@ -1328,7 +1328,9 @@ ERlvCmdRet RlvHandler::processAddRemCommand(const RlvCommand& rlvCmd)
case RLV_BHVR_RECVIM: // @recvim[:<uuid>]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
case RLV_BHVR_STARTIM: // @startim[:<uuid>]=n|y - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h
case RLV_BHVR_TPLURE: // @tplure[:<uuid>]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
case RLV_BHVR_ACCEPTTP: // @accepttp[:<uuid>]=n|y - Checked: 2009-12-05 (RLVa-1.1.0h) | Modified: RLVa-1.1.0h
case RLV_BHVR_TPREQUEST: // @tprequest[:<uuid>]=n|y - Checked: 2013-11-08 (RLVa-1.4.9)
case RLV_BHVR_ACCEPTTP: // @accepttp[:<uuid>]=n|y - Checked: 2009-12-05 (RLVa-1.1.0)
case RLV_BHVR_ACCEPTTPREQUEST: // @accepttprequest[:<uuid>]=n|y - Checked: 2013-11-08 (RLVa-1.4.9)
case RLV_BHVR_TOUCHATTACH: // @touchattach[:<uuid>=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l
#ifdef RLV_EXTENSION_CMD_TOUCHXXX
case RLV_BHVR_TOUCHHUD: // @touchhud[:<uuid>=n|y - Checked: 2010-01-01 (RLVa-1.1.0l) | Added: RLVa-1.1.0l

View File

@@ -98,7 +98,6 @@ public:
bool canShowHoverText(const LLViewerObject* pObj) const; // @showhovertext* command family
bool canSit(LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const;
bool canStand() const;
bool canTeleportViaLure(const LLUUID& idAgent) const;
bool canTouch(const LLViewerObject* pObj, const LLVector3& posOffset = LLVector3::zero) const; // @touch
bool filterChat(std::string& strUTF8Text, bool fFilterEmote) const; // @sendchat, @recvchat and @redirchat
bool redirectChatOrEmote(const std::string& strUTF8Test) const; // @redirchat and @rediremote
@@ -255,12 +254,6 @@ inline bool RlvHandler::canShowHoverText(const LLViewerObject *pObj) const
(isException(RLV_BHVR_SHOWHOVERTEXT, pObj->getID(), RLV_CHECK_PERMISSIVE)) ) );
}
// Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c
inline bool RlvHandler::canTeleportViaLure(const LLUUID& idAgent) const
{
return ((!hasBehaviour(RLV_BHVR_TPLURE)) || (isException(RLV_BHVR_TPLURE, idAgent))) && (canStand());
}
inline bool RlvHandler::hasBehaviour(ERlvBehaviour eBhvr, const std::string& strOption) const
{
return hasBehaviourExcept(eBhvr, strOption, LLUUID::null);

View File

@@ -160,12 +160,12 @@ void RlvCommand::initLookupTable()
std::string arBehaviours[RLV_BHVR_COUNT] =
{
"detach", "attach", "addattach", "remattach", "addoutfit", "remoutfit", "sharedwear", "sharedunwear",
"unsharedwear", "unsharedunwear", "emote", "sendchat", "recvchat", "recvchatfrom", "recvemote", "recvemotefrom",
"unsharedwear", "unsharedunwear", "emote", "sendchat", "recvchat", "recvchatfrom", "recvemote", "recvemotefrom",
"redirchat", "rediremote", "chatwhisper", "chatnormal", "chatshout", "sendchannel", "sendim", "sendimto",
"recvim", "recvimfrom", "startim", "startimto", "permissive", "notify", "showinv", "showminimap", "showworldmap", "showloc",
"shownames", "showhovertext", "showhovertexthud", "showhovertextworld", "showhovertextall", "tplm", "tploc", "tplure",
"viewnote", "viewscript", "viewtexture", "acceptpermission", "accepttp", "allowidle", "edit", "editobj", "rez", "fartouch",
"interact", "touchthis", "touchattach", "touchattachself", "touchattachother", "touchhud", "touchworld", "touchall",
"shownames", "showhovertext", "showhovertexthud", "showhovertextworld", "showhovertextall", "tplm", "tploc", "tplure", "tprequest",
"viewnote", "viewscript", "viewtexture", "acceptpermission", "accepttp", "accepttprequest", "allowidle", "edit", "editobj", "rez",
"fartouch", "interact", "touchthis", "touchattach", "touchattachself", "touchattachother", "touchhud", "touchworld", "touchall",
"touchme", "fly", "setgroup", "unsit", "sit", "sittp", "standtp", "setdebug", "setenv", "alwaysrun", "temprun", "detachme",
"attachover", "attachthis", "attachthisover", "attachthis_except", "detachthis", "detachthis_except", "attachall",
"attachallover", "detachall", "attachallthis", "attachallthis_except", "attachallthisover", "detachallthis",

View File

@@ -104,7 +104,7 @@ public:
protected:
bool m_fValid;
};
struct RlvCommandOptionGeneric : public RlvCommandOption
{
explicit RlvCommandOptionGeneric(const std::string& strOption);
@@ -152,15 +152,6 @@ protected:
uuid_vec_t m_idItems;
};
struct RlvCommandOptionAdjustHeight : public RlvCommandOption
{
RlvCommandOptionAdjustHeight(const RlvCommand& rlvCmd);
F32 m_nPelvisToFoot;
F32 m_nPelvisToFootDeltaMult;
F32 m_nPelvisToFootOffset;
};
struct RlvCommandOptionTpTo : public RlvCommandOption
{
RlvCommandOptionTpTo(const RlvCommand& rlvCmd);
@@ -168,7 +159,6 @@ struct RlvCommandOptionTpTo : public RlvCommandOption
LLVector3d m_posGlobal;
};
// ============================================================================
// RlvObject
//
@@ -443,6 +433,7 @@ inline bool RlvCommand::hasStrictVariant(ERlvBehaviour eBhvr)
case RLV_BHVR_RECVIM:
case RLV_BHVR_SENDIM:
case RLV_BHVR_TPLURE:
case RLV_BHVR_TPREQUEST:
case RLV_BHVR_SENDCHANNEL:
return true;
default: