[RLVa] b15fdd026026 ported

- internal : reviewed @recvim and @sendim for CHUI (SL-3.5)

Singu changes:
- Updated busy to be referred to as do_not_disturb in llviewermessage.cpp
- Don't send autoresponse if we can't send an IM by rlva
- Updated checks for from name being system to be to_id and from_id null checks.
- Minor compile fix in rlvui.cpp for last commit.
This commit is contained in:
Inusaito Sayori
2014-01-27 23:42:09 -05:00
parent 755d3be89b
commit 94aee52c64
9 changed files with 170 additions and 127 deletions

View File

@@ -62,8 +62,9 @@
#include "boost/algorithm/string.hpp"
// [RLVa:KB]
#include "rlvhandler.h"
// [RLVa:KB] - Checked: 2013-05-10 (RLVa-1.4.9)
#include "rlvactions.h"
#include "rlvcommon.h"
// [/RLVa:KB]
class AIHTTPTimeoutPolicy;
@@ -1142,6 +1143,7 @@ void deliver_message(const std::string& utf8_text,
bool convert_roleplay_text(std::string& text); // Returns true if text is an action
// Singu Note: LLFloaterIMSession::sendMsg
void LLFloaterIMPanel::onSendMsg()
{
if (!gAgent.isGodlike()
@@ -1164,17 +1166,18 @@ void LLFloaterIMPanel::onSendMsg()
bool action = convert_roleplay_text(utf8_text);
if (!action && mRPMode)
utf8_text = "((" + utf8_text + "))";
// [RLVa:KB] - Checked: 2011-09-17 (RLVa-1.1.4b) | Modified: RLVa-1.1.4b
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) )
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
if ( (RlvActions::hasBehaviour(RLV_BHVR_SENDIM)) || (RlvActions::hasBehaviour(RLV_BHVR_SENDIMTO)) )
{
bool fRlvFilter = false;
switch (mSessionType)
{
case P2P_SESSION: // One-on-one IM
fRlvFilter = !gRlvHandler.canSendIM(mOtherParticipantUUID);
fRlvFilter = !RlvActions::canSendIM(mOtherParticipantUUID);
break;
case GROUP_SESSION: // Group chat
fRlvFilter = !gRlvHandler.canSendIM(mSessionUUID);
fRlvFilter = !RlvActions::canSendIM(mSessionUUID);
break;
case ADHOC_SESSION: // Conference chat: allow if all participants can be sent an IM
{
@@ -1190,7 +1193,7 @@ void LLFloaterIMPanel::onSendMsg()
itSpeaker != speakers.end(); ++itSpeaker)
{
const LLSpeaker* pSpeaker = *itSpeaker;
if ( (gAgentID != pSpeaker->mID) && (!gRlvHandler.canSendIM(pSpeaker->mID)) )
if ( (gAgentID != pSpeaker->mID) && (!RlvActions::canSendIM(pSpeaker->mID)) )
{
fRlvFilter = true;
break;
@@ -1204,7 +1207,9 @@ void LLFloaterIMPanel::onSendMsg()
}
if (fRlvFilter)
{
utf8_text = RlvStrings::getString(RLV_STRING_BLOCKED_SENDIM);
}
}
// [/RLVa:KB]

View File

@@ -55,8 +55,9 @@
#include "llvoavatar.h" // For mIdleTimer reset
#include "llviewerregion.h"
// [RLVa:KB]
#include "rlvhandler.h"
// [RLVa:KB] - Checked: 2013-05-10 (RLVa-1.4.9)
#include "rlvactions.h"
#include "rlvcommon.h"
// [/RLVa:KB]
class AIHTTPTimeoutPolicy;
@@ -86,7 +87,7 @@ LLColor4 agent_chat_color(const LLUUID& id, const std::string& name, bool local_
return gSavedSettings.getColor4("AscentLindenColor");
// [RLVa:LF] Chat colors would identify names, don't use them in local chat if restricted
if (local_chat && rlv_handler_t::isEnabled() && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
if (local_chat && RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMES))
return gSavedSettings.getColor4("AgentChatColor");
static const LLCachedControl<bool> color_friend_chat("ColorFriendChat");
@@ -104,11 +105,6 @@ LLColor4 agent_chat_color(const LLUUID& id, const std::string& name, bool local_
return local_chat ? gSavedSettings.getColor4("AgentChatColor") : gSavedSettings.getColor("IMChatColor");
}
// returns true if a should appear before b
//static BOOL group_dictionary_sort( LLGroupData* a, LLGroupData* b )
//{
// return (LLStringUtil::compareDict( a->mName, b->mName ) < 0);
//}
class LLViewerChatterBoxInvitationAcceptResponder : public LLHTTPClient::ResponderWithResult
{
@@ -1492,15 +1488,15 @@ public:
}
bool group = gAgent.isInGroup(session_id);
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) )
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
if ( (RlvActions::hasBehaviour(RLV_BHVR_RECVIM)) || (RlvActions::hasBehaviour(RLV_BHVR_RECVIMFROM)) )
{
if (group) // Group chat: don't accept the invite if not an exception
if (group)
{
if (!gRlvHandler.canReceiveIM(session_id))
if (!RlvActions::canReceiveIM(session_id))
return;
}
else if (!gRlvHandler.canReceiveIM(from_id)) // Conference chat: don't block; censor if not an exception
else if (!RlvActions::canReceiveIM(from_id))
{
message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
}

View File

@@ -111,7 +111,7 @@
#include "llviewerregion.h"
// [RLVa:KB] - Checked: 2010-03-09 (RLVa-1.2.0a)
#include "llfloateravatarinfo.h" // Checked: 2009-07-08 (RLVa-1.0.0e)
#include "rlvactions.h"
#include "rlvhandler.h"
#include "rlvinventory.h"
#include "rlvui.h"
@@ -1628,6 +1628,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
args["[NAME]"] = mFromName;
LLFloaterChat::addChatHistory(LLTrans::getString("InvOfferAcceptSilent", args));
}
break;
case IOR_BUSY:
@@ -1688,7 +1689,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
}
if (busy && (!mFromGroup && !mFromObject))
{
busy_message(msg,mFromID);
send_do_not_disturb_message(msg,mFromID);
}
break;
}
@@ -2246,7 +2247,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
llinfos << "RegionID: " << region_id.asString() << llendl;
// </edit>
BOOL is_busy = gAgent.getBusy();
BOOL is_do_not_disturb = gAgent.getBusy();
BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat)
// object IMs contain sender object id in session_id (STORM-1209)
|| dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id);
@@ -2315,7 +2316,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// do nothing -- don't distract newbies in
// Prelude with global IMs
}
// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a
// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0)
else if ( (rlv_handler_t::isEnabled()) && (offline == IM_ONLINE) && ("@version" == message) &&
(!is_muted) && ((!accept_im_from_only_friend) || (is_friend)) )
{
@@ -2325,19 +2326,28 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
gIMMgr->processIMTypingStop(im_info);
}
// [/RLVa:KB]
// else if (offline == IM_ONLINE && !is_linden && !is_muted && is_busy && name != SYSTEM_FROM)
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
else if ( (offline == IM_ONLINE && !is_linden && !is_muted && is_busy && name != SYSTEM_FROM) && (gRlvHandler.canReceiveIM(from_id)) )
// else if (offline == IM_ONLINE
// && is_do_not_disturb
// && !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
else if (offline == IM_ONLINE
&& is_do_not_disturb
&& !is_muted // Singu Note: Never if muted
&& from_id.notNull() //not a system message
&& to_id.notNull() //not global message
&& RlvActions::canReceiveIM(from_id))
// [/RLVa:KB]
{
// return a standard "busy" message, but only do it to online IM
// return a standard "do not disturb" message, but only do it to online IM
// (i.e. not other auto responses and not store-and-forward IM)
if (!gIMMgr->hasSession(session_id) || gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat"))
{
// if the user wants to repeat responses over and over or
// if there is not a panel for this conversation (i.e. it is a new IM conversation
// initiated by the other party) then...
if (to_id.notNull()) busy_message(msg, from_id);
send_do_not_disturb_message(msg, from_id, session_id);
}
// now store incoming IM in chat history
@@ -2361,9 +2371,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset);
LLFloaterChat::addChat(chat, true, true);
}
// else if (to_id.notNull() && offline == IM_ONLINE && !is_linden && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && name != SYSTEM_FROM)
// [RLVa:LF] - Same as above: Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
else if (to_id.notNull() && offline == IM_ONLINE && !is_linden && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && name != SYSTEM_FROM && gRlvHandler.canReceiveIM(from_id))
// else if (offline == IM_ONLINE && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && from_id.notNull() && to_id.notNull())
// [RLVa:LF] - Same as above: Checked: 2010-11-30 (RLVa-1.3.0)
else if (offline == IM_ONLINE && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && from_id.notNull() && to_id.notNull() && RlvActions::canReceiveIM(from_id) && RlvActions::canSendIM(from_id))
// [/RLVa:LF]
{
// now store incoming IM in chat history
@@ -2475,9 +2485,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
mute_im = true;
}
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
// [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) && (!is_linden) && (!gRlvHandler.canReceiveIM(from_id)) )
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);
@@ -2562,7 +2572,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_TYPING_START:
{
// Don't announce that someone has started messaging, if they're muted or when in busy mode
if (!is_muted && (!accept_im_from_only_friend || is_friend) && !is_busy && !gIMMgr->hasSession(computed_session_id) && gSavedSettings.getBOOL("AscentInstantMessageAnnounceIncoming"))
if (!is_muted && (!accept_im_from_only_friend || is_friend) && !is_do_not_disturb && !gIMMgr->hasSession(computed_session_id) && gSavedSettings.getBOOL("AscentInstantMessageAnnounceIncoming"))
{
std::string pns_name;
if (!LLAvatarNameCache::getPNSName(from_id, pns_name)) pns_name = name;
@@ -2758,12 +2768,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
break;
case IM_GROUP_INVITATION:
{
//if (!is_linden && (is_busy || is_muted))
//if (is_do_not_disturb || is_muted)
if (is_muted) return;
if (is_busy)
if (is_do_not_disturb)
{
LLMessageSystem *msg = gMessageSystem;
busy_message(msg,from_id);
send_do_not_disturb_message(msg,from_id);
}
else
{
@@ -2850,7 +2860,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
info->mFromName = name;
info->mDesc = message;
info->mHost = msg->getSender();
//if (((is_busy && !is_owned_by_me) || is_muted))
//if (((is_do_not_disturb && !is_owned_by_me) || is_muted))
if (is_muted)
{
// Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)
@@ -2862,7 +2872,7 @@ 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.
else if (is_busy && dialog != IM_TASK_INVENTORY_OFFERED) // busy mode must not affect interaction with objects (STORM-565)
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
// accepting it. SEE SL-39554
@@ -2920,7 +2930,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_SESSION_SEND:
{
if (!is_linden && is_busy)
if (!is_linden && is_do_not_disturb)
{
return;
}
@@ -2938,16 +2948,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
return;
}
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) )
if (from_id != gAgentID && (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM) || gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)))
{
switch (pIMFloater->getSessionType())
{
case LLFloaterIMPanel::GROUP_SESSION: // Group chat
if ( (from_id != gAgent.getID()) && (!gRlvHandler.canReceiveIM(session_id)) )
if (!RlvActions::canReceiveIM(session_id))
return;
break;
case LLFloaterIMPanel::ADHOC_SESSION: // Conference chat
if ( (from_id != gAgent.getID()) && (!gRlvHandler.canReceiveIM(from_id)) )
if (!RlvActions::canReceiveIM(from_id))
message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
break;
default:
@@ -2996,7 +3006,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_FROM_TASK:
{
if (is_busy && !is_owned_by_me)
if (is_do_not_disturb && !is_owned_by_me)
{
return;
}
@@ -3075,8 +3085,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
LLFloaterChat::addChat(chat, FALSE, FALSE);
}
break;
case IM_FROM_TASK_AS_ALERT:
if (is_busy && !is_owned_by_me)
if (is_do_not_disturb && !is_owned_by_me)
{
return;
}
@@ -3090,14 +3101,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_BUSY_AUTO_RESPONSE:
if (is_muted)
{
LL_DEBUGS("Messaging") << "Ignoring busy response from " << from_id << LL_ENDL;
LL_DEBUGS("Messaging") << "Ignoring do-not-disturb response from " << from_id << LL_ENDL;
return;
}
else
{
// TODO: after LLTrans hits release, get "busy response" into translatable file
buffer = llformat("%s (%s): %s", name.c_str(), "busy response", message.substr(message_offset).c_str());
gIMMgr->addMessage(session_id, from_id, name, buffer);
gIMMgr->addMessage(session_id, from_id, name, message);
}
break;
@@ -3116,12 +3125,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
{
return;
}
// else if (is_busy)
// else if (is_do_not_disturb)
// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c
else if ( (is_busy) && (!fRlvSummon) )
else if ( (is_do_not_disturb) && (!fRlvSummon) )
// [/RLVa:KB]
{
busy_message(msg,from_id);
send_do_not_disturb_message(msg, from_id);
}
else
{
@@ -3184,13 +3193,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
if (IM_TELEPORT_REQUEST != dialog && !gRlvHandler.canTeleportViaLure(from_id))
{
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLURE_REMOTE));
if (is_busy)
busy_message(msg,from_id);
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 ( (!gRlvHandler.canReceiveIM(from_id)) || (IM_TELEPORT_REQUEST != dialog && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
if ( (!RlvActions::canReceiveIM(from_id)) || (IM_TELEPORT_REQUEST != dialog && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) )
{
message = RlvStrings::getString(RLV_STRING_HIDDEN);
}
@@ -3215,8 +3224,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
if ( IM_TELEPORT_REQUEST != dialog && (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTP)) || (fRlvSummon)) )
{
gRlvHandler.setCanCancelTp(false);
if (is_busy)
busy_message(msg,from_id);
if (is_do_not_disturb)
send_do_not_disturb_message(msg, from_id);
LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0);
}
else
@@ -3355,17 +3364,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
payload["online"] = (offline == IM_ONLINE);
payload["sender"] = msg->getSender().getIPandPort();
if (!is_muted && is_busy)
{
busy_message(msg, from_id);
LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1);
}
else if (is_muted)
if (is_muted)
{
LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1);
}
else
{
if (is_do_not_disturb)
{
send_do_not_disturb_message(msg, from_id);
}
args["[NAME]"] = name;
if(message.empty())
{
@@ -3395,12 +3403,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
args["NAME"] = name;
LLSD payload;
payload["from_id"] = from_id;
LLAvatarNameCache::get(from_id, boost::bind(&notification_display_name_callback,
_1,
_2,
"FriendshipAccepted",
args,
payload));
LLAvatarNameCache::get(from_id, boost::bind(&notification_display_name_callback, _1, _2, "FriendshipAccepted", args, payload));
}
break;
@@ -3418,7 +3421,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
}
void busy_message (LLMessageSystem* msg, LLUUID from_id)
void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id)
{
if (gAgent.getBusy())
{
@@ -3429,7 +3432,7 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id)
from_name = LLCacheName::cleanFullName(from_name);
std::string response = gSavedPerAccountSettings.getString("BusyModeResponse");
pack_instant_message(
gMessageSystem,
msg,
gAgent.getID(),
FALSE,
gAgent.getSessionID(),
@@ -3487,7 +3490,7 @@ bool callingcard_offer_callback(const LLSD& notification, const LLSD& response)
msg->nextBlockFast(_PREHASH_TransactionBlock);
msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID());
msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
busy_message(msg, notification["payload"]["source_id"].asUUID());
send_do_not_disturb_message(msg, notification["payload"]["source_id"].asUUID());
break;
default:
// close button probably, possibly timed out
@@ -3748,7 +3751,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
chat.mFromName = from_name;
}
BOOL is_busy = gAgent.getBusy();
BOOL is_do_not_disturb = gAgent.getBusy();
BOOL is_muted = FALSE;
BOOL is_linden = FALSE;
@@ -3866,7 +3869,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
// record last audible utterance
if (is_audible
&& (is_linden || (!is_muted && !is_busy)))
&& (is_linden || (!is_muted && !is_do_not_disturb)))
{
if (chat.mChatType != CHAT_TYPE_START
&& chat.mChatType != CHAT_TYPE_STOP)
@@ -4057,7 +4060,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
static_cast<LLVOAvatar*>(chatter)->stopTyping();
if (!is_muted /*&& !is_busy*/)
if (!is_muted /*&& !is_do_not_disturb*/)
{
static const LLCachedControl<bool> use_chat_bubbles("UseChatBubbles",false);
visible_in_chat_bubble = use_chat_bubbles;
@@ -4200,7 +4203,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
}
chat.mMuted = is_muted && !is_linden;
bool only_history = visible_in_chat_bubble || (!is_linden && !is_owned_by_me && is_busy);
bool only_history = visible_in_chat_bubble || (!is_linden && !is_owned_by_me && is_do_not_disturb);
#if 0 // Google translate doesn't work anymore
if (!chat.mMuted)
{
@@ -7590,14 +7593,14 @@ void send_lures(const LLSD& notification, const LLSD& response)
LLAgentUI::buildSLURL(slurl);
text.append("\r\n").append(slurl.getSLURLString());
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) )
// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
if ( (RlvActions::hasBehaviour(RLV_BHVR_SENDIM)) || (RlvActions::hasBehaviour(RLV_BHVR_SENDIMTO)) )
{
// Filter the lure message if one of the recipients of the lure can't be sent an IM to
for (LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray();
it != notification["payload"]["ids"].endArray(); ++it)
{
if (!gRlvHandler.canSendIM(it->asUUID()))
if (!RlvActions::canSendIM(it->asUUID()))
{
text = RlvStrings::getString(RLV_STRING_HIDDEN);
break;

View File

@@ -70,7 +70,6 @@ enum InventoryOfferResponse
BOOL can_afford_transaction(S32 cost);
void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group = FALSE,
S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null);
void busy_message (LLMessageSystem* msg, LLUUID from_id);
void process_logout_reply(LLMessageSystem* msg, void**);
void process_layer_data(LLMessageSystem *mesgsys, void **user_data);
@@ -160,6 +159,8 @@ void send_group_notice(const LLUUID& group_id,
const std::string& message,
const LLInventoryItem* item);
void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id = LLUUID::null);
void handle_lure(const LLUUID& invitee);
void handle_lure(const uuid_vec_t& ids);

View File

@@ -23,6 +23,30 @@
// RlvActions member functions
//
// Checked: 2010-11-30 (RLVa-1.3.0)
bool RlvActions::canReceiveIM(const LLUUID& idSender)
{
// User can receive an IM from "sender" (could be an agent or a group) if:
// - not generally restricted from receiving IMs (or the sender is an exception)
// - not specifically restricted from receiving an IM from the sender
return
(!rlv_handler_t::isEnabled()) ||
( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, idSender)) ) &&
( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) || (!gRlvHandler.isException(RLV_BHVR_RECVIMFROM, idSender)) ) );
}
// Checked: 2010-11-30 (RLVa-1.3.0)
bool RlvActions::canSendIM(const LLUUID& idRecipient)
{
// User can send an IM to "recipient" (could be an agent or a group) if:
// - not generally restricted from sending IMs (or the recipient is an exception)
// - not specifically restricted from sending an IM to the recipient
return
(!rlv_handler_t::isEnabled()) ||
( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.isException(RLV_BHVR_SENDIM, idRecipient)) ) &&
( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) || (!gRlvHandler.isException(RLV_BHVR_SENDIMTO, idRecipient)) ) );
}
// Checked: 2011-04-12 (RLVa-1.3.0)
bool RlvActions::canStartIM(const LLUUID& idRecipient)
{
@@ -35,6 +59,12 @@ bool RlvActions::canStartIM(const LLUUID& idRecipient)
( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIMTO)) || (!gRlvHandler.isException(RLV_BHVR_STARTIMTO, idRecipient)) ) );
}
// Checked: 2013-05-10 (RLVa-1.4.9)
bool RlvActions::hasBehaviour(ERlvBehaviour eBhvr)
{
return gRlvHandler.hasBehaviour(eBhvr);
}
// Checked: 2013-05-09 (RLVa-1.4.9)
bool RlvActions::hasOpenP2PSession(const LLUUID& idAgent)
{

View File

@@ -17,19 +17,37 @@
#ifndef RLV_ACTIONS_H
#define RLV_ACTIONS_H
#include "rlvdefines.h"
// ============================================================================
// RlvActions class declaration
// RlvActions class declaration - developer-friendly non-RLVa code facing class, use in lieu of RlvHandler whenever possible
//
class RlvActions
{
public:
/*
* Returns true if the user is allowed to receive IMs from the specified sender (can be an avatar or a group)
*/
static bool canReceiveIM(const LLUUID& idSender);
/*
* Returns true if the user is allowed to send IMs to the specified recipient (can be an avatar or a group)
*/
static bool canSendIM(const LLUUID& idRecipient);
/*
* 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
/*
* 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)
*/
static bool hasBehaviour(ERlvBehaviour eBhvr);
/*
* Returns true if a - P2P or group - IM session is open with the specified UUID.
*/

View File

@@ -92,9 +92,7 @@ public:
// Command specific helper functions
bool canEdit(const LLViewerObject* pObj) const; // @edit and @editobj
bool canReceiveIM(const LLUUID& idSender) const; // @recvim and @recvimfrom
bool canShowHoverText(const LLViewerObject* pObj) const; // @showhovertext* command family
bool canSendIM(const LLUUID& idRecipient) const; // @sendim and @sendimto
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;
@@ -244,29 +242,7 @@ inline bool RlvHandler::canEdit(const LLViewerObject* pObj) const
((!hasBehaviour(RLV_BHVR_EDITOBJ)) || (!isException(RLV_BHVR_EDITOBJ, pObj->getRootEdit()->getID())));
}
// Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
inline bool RlvHandler::canReceiveIM(const LLUUID& idSender) const
{
// User can receive an IM from "sender" (could be an agent or a group) if:
// - not generally restricted from receiving IMs (or the sender is an exception)
// - not specifically restricted from receiving an IM from the sender
return
( (!hasBehaviour(RLV_BHVR_RECVIM)) || (isException(RLV_BHVR_RECVIM, idSender)) ) &&
( (!hasBehaviour(RLV_BHVR_RECVIMFROM)) || (!isException(RLV_BHVR_RECVIMFROM, idSender)) );
}
// Checked: 2010-11-30 (RLVa-1.3.0c) | Added: RLVa-1.3.0c
inline bool RlvHandler::canSendIM(const LLUUID& idRecipient) const
{
// User can send an IM to "recipient" (could be an agent or a group) if:
// - not generally restricted from sending IMs (or the recipient is an exception)
// - not specifically restricted from sending an IM to the recipient
return
( (!hasBehaviour(RLV_BHVR_SENDIM)) || (isException(RLV_BHVR_SENDIM, idRecipient)) ) &&
( (!hasBehaviour(RLV_BHVR_SENDIMTO)) || (!isException(RLV_BHVR_SENDIMTO, idRecipient)) );
}
// Checked: 2010-03-27 (RLVa-1.2.0b) | Modified: RLVa-1.0.0f
// Checked: 2010-03-27 (RLVa-1.4.0a) | Modified: RLVa-1.0.0f
inline bool RlvHandler::canShowHoverText(const LLViewerObject *pObj) const
{
return ( (!pObj) || (LL_PCODE_VOLUME != pObj->getPCode()) ||

View File

@@ -47,6 +47,8 @@
#include "llfloaterchat.h"
#include "llfloateravatarlist.h"
#include "llfloaterworldmap.h"
#include "llmenugl.h"
#include "lluictrlfactory.h"
#include "llviewerregion.h"
#include "rlvui.h"
@@ -80,6 +82,7 @@ RlvUIEnabler::RlvUIEnabler()
// onToggleXXX
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_EDIT, boost::bind(&RlvUIEnabler::onToggleEdit, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SENDIM, boost::bind(&RlvUIEnabler::onToggleSendIM, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SETDEBUG, boost::bind(&RlvUIEnabler::onToggleSetDebug, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SETENV, boost::bind(&RlvUIEnabler::onToggleSetEnv, this)));
m_Handlers.insert(std::pair<ERlvBehaviour, behaviour_handler_t>(RLV_BHVR_SHOWINV, boost::bind(&RlvUIEnabler::onToggleShowInv, this, _1)));
@@ -130,7 +133,7 @@ void RlvUIEnabler::onToggleEdit()
// Turn off "View / Highlight Transparent"
LLDrawPoolAlpha::sShowDebugAlpha = FALSE;
// Close the Beacons floater if it's open
// Hide the Beacons floater if it's currently visible
if (LLFloaterBeacons::instanceVisible())
LLFloaterBeacons::toggleInstance();
@@ -156,6 +159,15 @@ void RlvUIEnabler::onToggleMovement()
gAgent.clearTempRun();
}
// Checked: 2013-05-11 (RLVa-1.4.9)
void RlvUIEnabler::onToggleSendIM()
{
/* Singu Note: Don't hide settings just because they won't be used, that's just wrong.
bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM);
gSavedPerAccountSettings.getControl("BusyModeResponse")->setHiddenFromSettingsEditor(!fEnable);
*/
}
// Checked: 2011-05-28 (RLVa-1.4.0a) | Added: RLVa-1.4.0a
void RlvUIEnabler::onToggleSetDebug()
{
@@ -231,13 +243,13 @@ void RlvUIEnabler::onToggleShowInv(bool fQuitting)
//
if (!fEnable)
{
gMenuHolder->childSetEnabled("My Outfits", false);
gMenuHolder->childSetEnabled("Favorites", false);
LLMenuGL::sMenuContainer->childSetEnabled("My Outfits", false);
LLMenuGL::sMenuContainer->childSetEnabled("Favorites", false);
}
else
{
gMenuHolder->childSetEnabled("My Outfits", true);
gMenuHolder->childSetEnabled("Favorites", true);
LLMenuGL::sMenuContainer->childSetEnabled("My Outfits", true);
LLMenuGL::sMenuContainer->childSetEnabled("Favorites", true);
}
}
@@ -251,13 +263,14 @@ void RlvUIEnabler::onToggleShowLoc()
if (!fEnable)
{
// Close the "About Land" floater if it's currently visible
// Hide the "About Land" floater if it's currently visible
if (LLFloaterLand::instanceVisible())
LLFloaterLand::hideInstance();
LLFloaterLand::hideInstance();
// Close the "Estate Tools" floater is it's currently visible
// Hide the "Region / Estate" floater if it's currently visible
if (LLFloaterRegionInfo::instanceVisible())
LLFloaterRegionInfo::hideInstance();
LLFloaterRegionInfo::hideInstance();
// Hide the "God Tools" floater if it's currently visible
LLFloaterGodTools::hide();
}
}
@@ -265,7 +278,6 @@ void RlvUIEnabler::onToggleShowLoc()
// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a
void RlvUIEnabler::onToggleShowMinimap()
{
bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWMINIMAP);
// Start or stop filtering showing the mini-map floater
@@ -281,12 +293,10 @@ void RlvUIEnabler::onToggleShowNames(bool fQuitting)
bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES);
// Close the "Active Speakers" panel if it's currently visible
// Force the use of the "display name" cache so we can filter both display and legacy names (or return back to the user's preference)
if (!fEnable)
{
// Close the "Active Speakers" panel if it's currently visible
LLFloaterChat::getInstance()->childSetVisible("active_speakers_panel", false);
// Close the "Avatar List/Radar" floater if it's currently visible
if ( LLFloaterAvatarList::instanceExists() && LLFloaterAvatarList::getInstance()->getVisible() )
@@ -314,7 +324,8 @@ void RlvUIEnabler::onToggleShowWorldMap()
// Checked: 2010-08-22 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
void RlvUIEnabler::onToggleTp()
{
/* // Disable the navigation bar "Home" button if both @tplm=n *and* @tploc=n restricted
/* Singu TODO: LLNavigationBar
// Disable the navigation bar "Home" button if both @tplm=n *and* @tploc=n restricted
LLButton* pNavBarHomeBtn = LLNavigationBar::getInstance()->findChild<LLButton>("home_btn");
RLV_ASSERT(pNavBarHomeBtn);
if (pNavBarHomeBtn)
@@ -325,7 +336,7 @@ void RlvUIEnabler::onToggleTp()
// Checked: 2010-03-01 (RLVa-1.2.0c) | Added: RLVa-1.2.0a
void RlvUIEnabler::onToggleUnsit()
{
/*
/* Singu TODO?
bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT);
LLPanelStandStopFlying* pPanelStand = LLPanelStandStopFlying::getInstance();
@@ -343,15 +354,17 @@ void RlvUIEnabler::onToggleUnsit()
// Checked: 2010-03-01 (RLVa-1.2.0b) | Added: RLVa-1.2.0a
void RlvUIEnabler::onToggleViewXXX()
{
/* Singu TODO?
// If any of the three are still active then we keep filtering
/*bool fHasViewXXX = (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE)) ||
bool fHasViewXXX = (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWNOTE)) ||
(gRlvHandler.hasBehaviour(RLV_BHVR_VIEWSCRIPT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_VIEWTEXTURE));
// Start or stop filtering opening the preview floaters
if ( (fHasViewXXX) && (!m_ConnFloaterViewXXX.connected()) )
m_ConnFloaterViewXXX = LLFloaterReg::setValidateCallback(boost::bind(&RlvUIEnabler::filterFloaterViewXXX, this, _1, _2));
else if ( (!fHasViewXXX) && (m_ConnFloaterViewXXX.connected()) )
m_ConnFloaterViewXXX.disconnect();*/
m_ConnFloaterViewXXX.disconnect();
*/
}
// Checked: 2010-04-01 (RLVa-1.2.0c) | Added: RLVa-1.2.0c
@@ -370,7 +383,6 @@ void RlvUIEnabler::onUpdateLoginLastLocation(bool fQuitting)
if (!m_ConnFloaterGeneric.connected())
m_ConnFloaterGeneric = LLFloaterReg::setValidateCallback(boost::bind(&RlvUIEnabler::filterFloaterGeneric, this, _1, _2));
}
// Checked: 2010-02-28 (RLVa-1.4.0a) | Added: RLVa-1.2.0a
@@ -436,7 +448,8 @@ bool RlvUIEnabler::filterFloaterViewXXX(const std::string& strName, const LLSD&)
return false;
}
return true;
}*/
}
*/
// ============================================================================

View File

@@ -45,6 +45,7 @@ protected:
void onRefreshHoverText(); // showloc, shownames, showhovertext(all|world|hud)
void onToggleEdit(); // edit
void onToggleMovement(); // fly, alwaysrun and temprun
void onToggleSendIM(); // sendim
void onToggleSetDebug(); // setdebug
void onToggleSetEnv(); // setenv
void onToggleShowInv(bool fQuitting); // showinv