Change RLVa string constants over to opt-in constexpr string_views (but keep char* by default)

master
Kitty Barnett 2020-09-16 01:35:44 +02:00
parent 9b03257a1e
commit aebcd1855d
25 changed files with 168 additions and 101 deletions

View File

@ -4139,7 +4139,7 @@ void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id)
: gRlvHandler.hasBehaviour(RLV_BHVR_TPLM) && gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC) ) ||
((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (isAgentAvatarValid()) && (gAgentAvatarp->isSitting())) ))
{
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::Teleport);
return;
}
// [/RLVa:KB]
@ -4241,7 +4241,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global)
{
if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal(pos_global) : !RlvActions::canTeleportToLocation() )
{
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::Teleport);
return;
}
@ -4311,7 +4311,7 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global, const LLVe
{
if ( (RlvActions::isLocalTp(pos_global)) ? !RlvActions::canTeleportToLocal(pos_global) : !RlvActions::canTeleportToLocation() )
{
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::Teleport);
return;
}

View File

@ -106,8 +106,8 @@ BOOL LLAgentUI::buildLocationString(std::string& str, ELocationFormat fmt,const
// RELEASE-RLVa: [SL-2.0.0] Check ELocationFormat to make sure our switch still makes sense
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
parcel_name = RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL);
region_name = RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
parcel_name = RlvStrings::getString(RlvStringKeys::Hidden::Parcel);
region_name = RlvStrings::getString(RlvStringKeys::Hidden::Region);
if (LOCATION_FORMAT_NO_MATURITY == fmt)
fmt = LOCATION_FORMAT_LANDMARK;
else if (LOCATION_FORMAT_FULL == fmt)

View File

@ -3170,7 +3170,7 @@ LLSD LLAppViewer::getViewerInfo() const
}
else
{
info["REGION"] = RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
info["REGION"] = RlvStrings::getString(RlvStringKeys::Hidden::Region);
}
info["SERVER_VERSION"] = gLastVersionChannel;
// [/RLVa:KB]

View File

@ -211,7 +211,7 @@ void LLAvatarActions::startIM(const LLUUID& id)
if (!RlvActions::canStartIM(id))
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString()));
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartIm, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString()));
return;
}
// [/RLVa:KB]
@ -256,7 +256,7 @@ void LLAvatarActions::startCall(const LLUUID& id)
if (!RlvActions::canStartIM(id))
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString()));
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartIm, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString()));
return;
}
// [/RLVa:KB]
@ -282,7 +282,7 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids, const LLUUID& floate
if (!RlvActions::canStartIM(idAgent))
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartConference);
return;
}
id_array.push_back(idAgent);
@ -339,7 +339,7 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids, const LLUUID& float
if (!RlvActions::canStartIM(idAgent))
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartConference);
return;
}
id_array.push_back(idAgent);
@ -467,7 +467,7 @@ void LLAvatarActions::teleport_request_callback(const LLSD& notification, const
// Filter the request message if the recipients is IM-blocked
if ( (RlvActions::isRlvEnabled()) && ((!RlvActions::canStartIM(idRecipient)) || (!RlvActions::canSendIM(idRecipient))) )
{
strMessage = RlvStrings::getString(RLV_STRING_HIDDEN);
strMessage = RlvStrings::getString(RlvStringKeys::Hidden::Generic);
}
// [/RLVa:KB]

View File

@ -321,7 +321,7 @@ void LLFloaterIMSession::sendMsg(const std::string& msg)
if (fRlvFilter)
{
utf8_text = RlvStrings::getString(RLV_STRING_BLOCKED_SENDIM);
utf8_text = RlvStrings::getString(RlvStringKeys::Blocked::SendIm);
}
}
// [/RLVa:KB]

View File

@ -676,7 +676,7 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global)
mTrackedStatus = LLTracker::TRACKING_LOCATION;
LLWorldMap::getInstance()->cancelTracking(); // The floater is taking over the tracking
// [RLVa:KB] - Checked: 2012-02-08 (RLVa-1.4.5) | Added: RLVa-1.4.5
LLTracker::trackLocation(pos_global, (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? full_name : RlvStrings::getString(RLV_STRING_HIDDEN).c_str(), tooltip);
LLTracker::trackLocation(pos_global, (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? full_name : RlvStrings::getString(RlvStringKeys::Hidden::Generic).c_str(), tooltip);
// [/RLVa:KB]
// LLTracker::trackLocation(pos_global, full_name, tooltip);
@ -755,7 +755,7 @@ void LLFloaterWorldMap::updateLocation()
mSetToUserPosition = FALSE;
// Fill out the location field
getChild<LLUICtrl>("location")->setValue(RlvStrings::getString(RLV_STRING_HIDDEN_REGION));
getChild<LLUICtrl>("location")->setValue(RlvStrings::getString(RlvStringKeys::Hidden::Region));
// update the coordinate display with location of avatar in region
updateTeleportCoordsDisplay( agentPos );
@ -814,7 +814,7 @@ void LLFloaterWorldMap::updateLocation()
{
mSLURL = LLSLURL();
childSetValue("location", RlvStrings::getString(RLV_STRING_HIDDEN_REGION));
childSetValue("location", RlvStrings::getString(RlvStringKeys::Hidden::Region));
}
else if (gotSimName)
// [/RLVa:KB]

View File

@ -215,7 +215,7 @@ void LLGroupActions::startCall(const LLUUID& group_id)
if (!RlvActions::canStartIM(group_id))
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString()));
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartIm, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString()));
return;
}
// [/RLVa:KB]
@ -455,7 +455,7 @@ LLUUID LLGroupActions::startIM(const LLUUID& group_id)
if (!RlvActions::canStartIM(group_id))
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString()));
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartIm, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString()));
return LLUUID::null;
}
// [/RLVa:KB]

View File

@ -620,8 +620,8 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!LLMuteList::getInstance()->isLinden(original_name) ))
{
if (!mute_im)
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id);
buffer = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RlvStringKeys::Blocked::RecvImRemote), session_id);
buffer = RlvStrings::getString(RlvStringKeys::Blocked::RecvIm);
}
// [/RLVa:KB]
@ -1089,7 +1089,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
{
std::string::size_type idxPos = location.find('/');
if ( (std::string::npos != idxPos) && (RlvUtil::isNearbyRegion(location.substr(0, idxPos))) )
location = RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
location = RlvStrings::getString(RlvStringKeys::Hidden::Region);
}
}
// [/RLVa:KB]
@ -1337,7 +1337,7 @@ void LLIMProcessing::processNewMessage(LLUUID 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_TPLUREREQ_REMOTE));
RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RlvStringKeys::Blocked::TpLureRequestRemote));
if (is_do_not_disturb)
send_do_not_disturb_message(gMessageSystem, from_id);
return;
@ -1347,7 +1347,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
if ( (!RlvActions::canReceiveIM(from_id)) ||
((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (IM_LURE_USER == dialog || IM_TELEPORT_REQUEST == dialog)) )
{
message = RlvStrings::getString(RLV_STRING_HIDDEN);
message = RlvStrings::getString(RlvStringKeys::Hidden::Generic);
}
}
// [/RLVa:KB]

View File

@ -3671,7 +3671,7 @@ public:
}
else if (!RlvActions::canReceiveIM(from_id)) // Conference chat: don't block; censor if not an exception
{
message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
message = RlvStrings::getString(RlvStringKeys::Blocked::RecvIm);
}
}
// [/RLVa:KB]

View File

@ -200,7 +200,7 @@ void LLInspectRemoteObject::update()
getChild<LLUICtrl>("block_btn")->setEnabled(!mObjectID.isNull() && !LLMuteList::getInstance()->isMuted(mObjectID));
// [RLVa:KB] - Checked: 2010-04-22 (RLVa-1.2.0f) | Added: RLVa-1.2.0f
if ( (rlv_handler_t::isEnabled()) && (RlvStrings::getString(RLV_STRING_HIDDEN_REGION) == mSLurl) )
if ( (rlv_handler_t::isEnabled()) && (RlvStrings::getString(RlvStringKeys::Hidden::Region) == mSLurl) )
{
getChild<LLUICtrl>("object_slurl")->setValue(mSLurl);
getChild<LLUICtrl>("map_btn")->setEnabled(false);

View File

@ -3778,7 +3778,7 @@ void LLFolderBridge::perform_pasteFromClipboard()
// [RLVa:KB] - Checked: RLVa-2.1.0
if ( ((item) && (!RlvActions::canPasteInventory(item, dest_folder))) || ((cat) && (!RlvActions::canPasteInventory(cat, dest_folder))) )
{
RlvActions::notifyBlocked(RLV_STRING_BLOCKED_INVFOLDER);
RlvActions::notifyBlocked(RlvStringKeys::Blocked::InvFolder);
return;
}
// [/RLVa:KB]
@ -5906,7 +5906,7 @@ void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string act
if (!RlvActions::canStartIM(item->getCreatorUUID()))
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", item->getCreatorUUID(), "completename").getSLURLString()));
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartIm, LLSD().with("RECIPIENT", LLSLURL("agent", item->getCreatorUUID(), "completename").getSLURLString()));
return;
}
// [/RLVa:KB]

View File

@ -1365,7 +1365,7 @@ bool LLInventoryPanel::beginIMSession()
if (!fRlvCanStartIM)
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::StartConference);
return true;
}
// [/RLVa:KB]

View File

@ -636,7 +636,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, MASK mask )
// region_name = region->getName();
// [RLVa:KB] - Checked: RLVa-1.2.2
region_name = (RlvActions::canShowLocation()) ? region->getName() : RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
region_name = (RlvActions::canShowLocation()) ? region->getName() : RlvStrings::getString(RlvStringKeys::Hidden::Region);
// [/RLVa:KB]
if (!region_name.empty())
{

View File

@ -397,7 +397,7 @@ std::string LLSLURL::getSLURLString() const
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.0d) | Added: RLVa-1.2.0d
return LLGridManager::getInstance()->getSLURLBase(mGrid) +
( ((!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) || (!RlvUtil::isNearbyRegion(mRegion)))
? (LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z)) : RlvStrings::getString(RLV_STRING_HIDDEN_REGION) );
? (LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z)) : RlvStrings::getString(RlvStringKeys::Hidden::Region) );
// [/RLVa:KB]
}
case APP:

View File

@ -187,7 +187,7 @@ void LLTeleportHistory::updateCurrentLocation(const LLVector3d& new_pos)
}
else
{
mItems[mCurrentItem] = LLTeleportHistoryItem(RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL), LLVector3d::zero);
mItems[mCurrentItem] = LLTeleportHistoryItem(RlvStrings::getString(RlvStringKeys::Hidden::Parcel), LLVector3d::zero);
}
// [/RLVa:KB]
}

View File

@ -808,7 +808,7 @@ BOOL LLToolPie::handleMouseUp(S32 x, S32 y, MASK mask)
if ( (fValidPick) && (RlvActions::isRlvEnabled()) && (!RlvActions::canTeleportToLocal(mPick.mPosGlobal)) )
{
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_AUTOPILOT);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::AutoPilot);
fValidPick = false;
}
@ -919,7 +919,7 @@ BOOL LLToolPie::handleDoubleClick(S32 x, S32 y, MASK mask)
if ( (fValidPick) && (RlvActions::isRlvEnabled()) && (!RlvActions::canTeleportToLocal(mPick.mPosGlobal)) )
{
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_AUTOPILOT);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::AutoPilot);
fValidPick = false;
}

View File

@ -1227,7 +1227,7 @@ class LLAdvancedToggleWireframe : public view_listener_t
// [RLVa:KB] - Checked: RLVa-2.0.0
bool fRlvBlockWireframe = gRlvAttachmentLocks.hasLockedHUD();
if ( (!gUseWireframe) && (fRlvBlockWireframe) )
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_WIREFRAME);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::Wireframe);
set_use_wireframe( (!gUseWireframe) && (!fRlvBlockWireframe) );
return true;
}

View File

@ -5818,8 +5818,8 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp
// [RLVa:KB] - Checked: 2010-04-23 (RLVa-1.2.0g) | Modified: RLVa-1.0.0a
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
{
notice.setArg("[REGIONNAME]", RlvStrings::getString(RLV_STRING_HIDDEN_REGION));
notice.setArg("[REGIONPOS]", RlvStrings::getString(RLV_STRING_HIDDEN));
notice.setArg("[REGIONNAME]", RlvStrings::getString(RlvStringKeys::Hidden::Region));
notice.setArg("[REGIONPOS]", RlvStrings::getString(RlvStringKeys::Hidden::Generic));
}
else if (!foundpos)
// [/RLVa:KB]
@ -6556,7 +6556,7 @@ void send_lures(const LLSD& notification, const LLSD& response)
if ( (gRlvHandler.isEnabled()) &&
(std::any_of(sdRecipients.beginArray(), sdRecipients.endArray(), [](const LLSD& id) { return !RlvActions::canStartIM(id.asUUID()) || !RlvActions::canSendIM(id.asUUID()); })) )
{
text = RlvStrings::getString(RLV_STRING_HIDDEN);
text = RlvStrings::getString(RlvStringKeys::Hidden::Generic);
}
// [/RLVa:KB]
@ -6652,7 +6652,7 @@ void handle_lure(const uuid_vec_t& ids)
LLSD edit_args;
// [RLVa:KB] - Checked: 2010-04-07 (RLVa-1.2.0d) | Modified: RLVa-1.0.0a
edit_args["REGION"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? gAgent.getRegion()->getName() : RlvStrings::getString(RLV_STRING_HIDDEN);
edit_args["REGION"] = (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? gAgent.getRegion()->getName() : RlvStrings::getString(RlvStringKeys::Hidden::Generic);
// [/RLVa:KB]
// edit_args["REGION"] = gAgent.getRegion()->getName();
@ -6668,7 +6668,7 @@ void handle_lure(const uuid_vec_t& ids)
if ( (!gRlvHandler.isException(RLV_BHVR_TPLURE, idAgent, RLV_CHECK_PERMISSIVE)) &&
((!pBuddyInfo) || (!pBuddyInfo->isOnline()) || (!pBuddyInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION))) )
{
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT_OFFER);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::TeleportOffer);
return;
}
}

View File

@ -1068,7 +1068,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, MASK mask )
// [RLVa:KB] - Checked: 2010-04-19 (RLVa-1.4.5) | Modified: RLVa-1.4.5
std::string message = llformat("%s (%s)",
(RlvActions::canShowLocation()) ? info->getName().c_str() : RlvStrings::getString(RLV_STRING_HIDDEN_REGION).c_str(),
(RlvActions::canShowLocation()) ? info->getName().c_str() : RlvStrings::getString(RlvStringKeys::Hidden::Region).c_str(),
info->getAccessString().c_str());
// [/RLVa:KB]
// std::string message = llformat("%s (%s)", info->getName().c_str(), info->getAccessString().c_str());

View File

@ -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;
@ -584,7 +584,11 @@ bool RlvActions::isRlvEnabled()
return RlvHandler::isEnabled();
}
#ifdef CATZNIP_STRINGVIEW
void RlvActions::notifyBlocked(const boost::string_view& strNotifcation, const LLSD& sdArgs)
#else
void RlvActions::notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs)
#endif // CATZNIP_STRINGVIEW
{
RlvUtil::notifyBlocked(strNotifcation, sdArgs);
}

View File

@ -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;
@ -309,7 +309,11 @@ public:
/*
* Shows one of the blocked toast notifications (see rlva_strings.xml)
*/
#ifdef CATZNIP_STRINGVIEW
static void notifyBlocked(const boost::string_view& strNotifcation, const LLSD& sdArgs = LLSD());
#else
static void notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs = LLSD());
#endif // CATZNIP_STRINGVIEW
};
// ============================================================================

View File

@ -1,17 +1,17 @@
/**
/**
*
* Copyright (c) 2009-2011, Kitty Barnett
*
* The source code in this file is provided to you under the terms of the
* 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;
* 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
* 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
* you have read and understood your obligations described above, and agree to
* abide by those obligations.
*
*
*/
#include "llviewerprecompiledheaders.h"
@ -360,7 +360,11 @@ const std::string& RlvStrings::getAnonym(const std::string& strName)
}
// Checked: 2011-11-08 (RLVa-1.5.0)
#ifdef CATZNIP_STRINGVIEW
const std::string& RlvStrings::getString(const boost::string_view& strStringName)
#else
const std::string& RlvStrings::getString(const std::string& strStringName)
#endif // CATZNIP_STRINGVIEW
{
static const std::string strMissing = "(Missing RLVa string)";
string_map_t::const_iterator itString = m_StringMap.find(strStringName);
@ -476,14 +480,14 @@ void RlvUtil::filterLocation(std::string& strUTF8Text)
{
// Filter any mention of the surrounding region names
LLWorld::region_list_t regions = LLWorld::getInstance()->getRegionList();
const std::string& strHiddenRegion = RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
const std::string& strHiddenRegion = RlvStrings::getString(RlvStringKeys::Hidden::Region);
for (LLWorld::region_list_t::const_iterator itRegion = regions.begin(); itRegion != regions.end(); ++itRegion)
boost::ireplace_all(strUTF8Text, (*itRegion)->getName(), strHiddenRegion);
// Filter any mention of the parcel name
LLViewerParcelMgr* pParcelMgr = LLViewerParcelMgr::getInstance();
if (pParcelMgr)
boost::ireplace_all(strUTF8Text, pParcelMgr->getAgentParcelName(), RlvStrings::getString(RLV_STRING_HIDDEN_PARCEL));
boost::ireplace_all(strUTF8Text, pParcelMgr->getAgentParcelName(), RlvStrings::getString(RlvStringKeys::Hidden::Parcel));
}
// Checked: 2010-12-08 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c
@ -529,7 +533,7 @@ void RlvUtil::filterScriptQuestions(S32& nQuestions, LLSD& sdPayload)
if ((!gRlvAttachmentLocks.canAttach()) && (SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_ATTACH].permbit & nQuestions))
{
// Notify the user that we blocked it since they're not allowed to wear any new attachments
sdPayload["rlv_blocked"] = RLV_STRING_BLOCKED_PERMATTACH;
sdPayload["rlv_blocked"] = RlvStringKeys::Blocked::PermissionAttach;
nQuestions &= ~SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_ATTACH].permbit;
}
@ -537,7 +541,7 @@ void RlvUtil::filterScriptQuestions(S32& nQuestions, LLSD& sdPayload)
if ((gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) && (SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_TELEPORT].permbit & nQuestions))
{
// Notify the user that we blocked it since they're not allowed to teleport
sdPayload["rlv_blocked"] = RLV_STRING_BLOCKED_PERMTELEPORT;
sdPayload["rlv_blocked"] = RlvStringKeys::Blocked::PermissionTeleport;
nQuestions &= ~SCRIPT_PERMISSIONS[SCRIPT_PERMISSION_TELEPORT].permbit;
}
@ -580,7 +584,11 @@ bool RlvUtil::isNearbyRegion(const std::string& strRegion)
}
// Checked: 2011-04-11 (RLVa-1.3.0h) | Modified: RLVa-1.3.0h
#ifdef CATZNIP_STRINGVIEW
void RlvUtil::notifyBlocked(const boost::string_view& strNotifcation, const LLSD& sdArgs, bool fLogToChat)
#else
void RlvUtil::notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs, bool fLogToChat)
#endif // CATZNIP_STRINGVIEW
{
std::string strMsg = RlvStrings::getString(strNotifcation);
LLStringUtil::format(strMsg, sdArgs);

View File

@ -1,21 +1,20 @@
/**
/**
*
* Copyright (c) 2009-2011, Kitty Barnett
*
* The source code in this file is provided to you under the terms of the
* 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;
* 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
* 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
* you have read and understood your obligations described above, and agree to
* abide by those obligations.
*
*
*/
#ifndef RLV_COMMON_H
#define RLV_COMMON_H
#pragma once
#include "llavatarname.h"
#include "llselectmgr.h"
@ -146,7 +145,11 @@ public:
static const std::string& getAnonym(const LLAvatarName& avName); // @shownames
static const std::string& getAnonym(const std::string& strName); // @shownames
#ifdef CATZNIP_STRINGVIEW
static const std::string& getString(const boost::string_view& strStringName);
#else
static const std::string& getString(const std::string& strStringName);
#endif // CATZNIP_STRINGVIEW
static const char* getStringFromReturnCode(ERlvCmdRet eRet);
static const std::string& getStringMapPath() { return m_StringMapPath; }
static std::string getVersion(const LLUUID& idRlvObject, bool fLegacy = false);
@ -158,7 +161,7 @@ public:
protected:
static std::vector<std::string> m_Anonyms;
typedef std::map<std::string, std::list<std::string> > string_map_t;
typedef std::map<std::string, std::list<std::string>, std::less<>> string_map_t;
static string_map_t m_StringMap;
static std::string m_StringMapPath;
};
@ -181,9 +184,14 @@ public:
static bool isForceTp() { return m_fForceTp; }
static void forceTp(const LLVector3d& posDest); // Ignores restrictions that might otherwise prevent tp'ing
#ifdef CATZNIP_STRINGVIEW
static void notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs = LLSD(), bool fLogToChat = false) { notifyBlocked(boost::string_view(strNotifcation), sdArgs, fLogToChat); }
static void notifyBlocked(const boost::string_view& strNotifcation, const LLSD& sdArgs = LLSD(), bool fLogToChat = false);
#else
static void notifyBlocked(const std::string& strNotifcation, const LLSD& sdArgs = LLSD(), bool fLogToChat = false);
static void notifyBlockedGeneric() { notifyBlocked(RLV_STRING_BLOCKED_GENERIC); }
static void notifyBlockedViewXXX(LLAssetType::EType assetType) { notifyBlocked(RLV_STRING_BLOCKED_VIEWXXX, LLSD().with("[TYPE]", LLAssetType::lookup(assetType))); }
#endif // CATZNIP_STRINGVIEW
static void notifyBlockedGeneric() { notifyBlocked(RlvStringKeys::Blocked::Generic); }
static void notifyBlockedViewXXX(LLAssetType::EType assetType) { notifyBlocked(RlvStringKeys::Blocked::ViewXxx, LLSD().with("[TYPE]", LLAssetType::lookup(assetType))); }
static void notifyFailedAssertion(const std::string& strAssert, const std::string& strFile, int nLine);
static void sendBusyMessage(const LLUUID& idTo, const std::string& strMsg, const LLUUID& idSession = LLUUID::null);
@ -332,5 +340,3 @@ inline bool RlvUtil::sendChatReply(const std::string& strChannel, const std::str
}
// ============================================================================
#endif // RLV_COMMON_H

View File

@ -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;
@ -14,8 +14,11 @@
*
*/
#ifndef RLV_DEFINES_H
#define RLV_DEFINES_H
#pragma once
#ifdef CATZNIP_STRINGVIEW
#include "llstringview.h"
#endif // CATZNIP_STRINGVIE
// ============================================================================
// Defines
@ -393,30 +396,72 @@ enum ERlvAttachGroupType
// Strings (see rlva_strings.xml)
//
#define RLV_STRING_HIDDEN "hidden_generic"
#define RLV_STRING_HIDDEN_PARCEL "hidden_parcel"
#define RLV_STRING_HIDDEN_REGION "hidden_region"
namespace RlvStringKeys
{
namespace Blocked
{
#ifdef CATZNIP_STRINGVIEW
/*inline*/ constexpr boost::string_view AutoPilot = make_string_view("blocked_autopilot");
/*inline*/ constexpr boost::string_view Generic = make_string_view("blocked_generic");
/*inline*/ constexpr boost::string_view GroupChange = make_string_view("blocked_groupchange");
/*inline*/ constexpr boost::string_view InvFolder = make_string_view("blocked_invfolder");
/*inline*/ constexpr boost::string_view PermissionAttach = make_string_view("blocked_permattach");
/*inline*/ constexpr boost::string_view PermissionTeleport = make_string_view("blocked_permteleport");
/*inline*/ constexpr boost::string_view RecvIm = make_string_view("blocked_recvim");
/*inline*/ constexpr boost::string_view RecvImRemote = make_string_view("blocked_recvim_remote");
/*inline*/ constexpr boost::string_view SendIm = make_string_view("blocked_sendim");
/*inline*/ constexpr boost::string_view StartConference = make_string_view("blocked_startconf");
/*inline*/ constexpr boost::string_view StartIm = make_string_view("blocked_startim");
/*inline*/ constexpr boost::string_view Teleport = make_string_view("blocked_teleport");
/*inline*/ constexpr boost::string_view TeleportOffer = make_string_view("blocked_teleport_offer");
/*inline*/ constexpr boost::string_view TpLureRequestRemote = make_string_view("blocked_tplurerequest_remote");
/*inline*/ constexpr boost::string_view ViewXxx = make_string_view("blocked_viewxxx");
/*inline*/ constexpr boost::string_view Wireframe = make_string_view("blocked_wireframe");
#else
constexpr const char AutoPilot[] = "blocked_autopilot";
constexpr const char Generic[] = "blocked_generic";
constexpr const char GroupChange[] = "blocked_groupchange";
constexpr const char InvFolder[] = "blocked_invfolder";
constexpr const char PermissionAttach[] = "blocked_permattach";
constexpr const char PermissionTeleport[] = "blocked_permteleport";
constexpr const char RecvIm[] = "blocked_recvim";
constexpr const char RecvImRemote[] = "blocked_recvim_remote";
constexpr const char SendIm[] = "blocked_sendim";
constexpr const char StartConference[] = "blocked_startconf";
constexpr const char StartIm[] = "blocked_startim";
constexpr const char Teleport[] = "blocked_teleport";
constexpr const char TeleportOffer[] = "blocked_teleport_offer";
constexpr const char TpLureRequestRemote[] = "blocked_tplurerequest_remote";
constexpr const char ViewXxx[] = "blocked_viewxxx";
constexpr const char Wireframe[] = "blocked_wireframe";
#endif // CATZNIP_STRINGVIEW
}
#define RLV_STRING_BLOCKED_AUTOPILOT "blocked_autopilot"
#define RLV_STRING_BLOCKED_GENERIC "blocked_generic"
#define RLV_STRING_BLOCKED_GROUPCHANGE "blocked_groupchange"
#define RLV_STRING_BLOCKED_INVFOLDER "blocked_invfolder"
#define RLV_STRING_BLOCKED_PERMATTACH "blocked_permattach"
#define RLV_STRING_BLOCKED_PERMTELEPORT "blocked_permteleport"
#define RLV_STRING_BLOCKED_RECVIM "blocked_recvim"
#define RLV_STRING_BLOCKED_RECVIM_REMOTE "blocked_recvim_remote"
#define RLV_STRING_BLOCKED_SENDIM "blocked_sendim"
#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_TELEPORT_OFFER "blocked_teleport_offer"
#define RLV_STRING_BLOCKED_TPLUREREQ_REMOTE "blocked_tplurerequest_remote"
#define RLV_STRING_BLOCKED_VIEWXXX "blocked_viewxxx"
#define RLV_STRING_BLOCKED_WIREFRAME "blocked_wireframe"
#define RLV_STRING_STOPIM_NOSESSION "stopim_nosession"
#define RLV_STRING_STOPIM_ENDSESSION_REMOTE "stopim_endsession_remote"
#define RLV_STRING_STOPIM_ENDSESSION_LOCAL "stopim_endsession_local"
namespace Hidden
{
#ifdef CATZNIP_STRINGVIEW
/*inline*/ constexpr boost::string_view Generic = make_string_view("hidden_generic");
/*inline*/ constexpr boost::string_view Parcel = make_string_view("hidden_parcel");
/*inline*/ constexpr boost::string_view Region = make_string_view("hidden_region");
#else
constexpr const char Generic[] = "hidden_generic";
constexpr const char Parcel[] = "hidden_parcel";
constexpr const char Region[] = "hidden_region";
#endif // CATZNIP_STRINGVIEW
}
namespace StopIm
{
#ifdef CATZNIP_STRINGVIEW
/*inline*/ constexpr boost::string_view NoSession = make_string_view("stopim_nosession");
/*inline*/ constexpr boost::string_view EndSessionRemote = make_string_view("stopim_endsession_remote");
/*inline*/ constexpr boost::string_view EndSessionLocal = make_string_view("stopim_endsession_local");
#else
constexpr const char NoSession[] = "stopim_nosession";
constexpr const char EndSessionRemote[] = "stopim_endsession_remote";
constexpr const char EndSessionLocal[] = "stopim_endsession_local";
#endif // CATZNIP_STRINGVIEW
}
}
// ============================================================================
#endif // RLV_DEFINES_H

View File

@ -631,11 +631,11 @@ bool RlvHandler::processIMQuery(const LLUUID& idSender, const std::string& strMe
// If the user can't start an IM session terminate it (if one is open) - always notify the sender in this case
if (!RlvActions::canStartIM(idSender, true))
{
RlvUtil::sendBusyMessage(idSender, RlvStrings::getString(RLV_STRING_STOPIM_ENDSESSION_REMOTE));
RlvUtil::sendBusyMessage(idSender, RlvStrings::getString(RlvStringKeys::StopIm::EndSessionRemote));
if (RlvActions::hasOpenP2PSession(idSender))
{
LLAvatarActions::endIM(idSender);
RlvUtil::notifyBlocked(RLV_STRING_STOPIM_ENDSESSION_LOCAL, LLSD().with("NAME", LLSLURL("agent", idSender, "about").getSLURLString()), true);
RlvUtil::notifyBlocked(RlvStringKeys::StopIm::EndSessionLocal, LLSD().with("NAME", LLSLURL("agent", idSender, "about").getSLURLString()), true);
}
return true;
}
@ -643,7 +643,7 @@ bool RlvHandler::processIMQuery(const LLUUID& idSender, const std::string& strMe
// User can start an IM session so we do nothing - notify and hide it from the user only if IM queries are enabled
if (!RlvSettings::getEnableIMQuery())
return false;
RlvUtil::sendBusyMessage(idSender, RlvStrings::getString(RLV_STRING_STOPIM_NOSESSION));
RlvUtil::sendBusyMessage(idSender, RlvStrings::getString(RlvStringKeys::StopIm::NoSession));
return true;
}
else if (RlvSettings::getEnableIMQuery())
@ -766,7 +766,7 @@ void RlvHandler::onActiveGroupChanged()
// Notify them about the change
const LLSD sdArgs = LLSD().with("GROUP_SLURL", (m_idAgentGroup.notNull()) ? llformat("secondlife:///app/group/%s/about", m_idAgentGroup.asString().c_str()) : "(none)");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_GROUPCHANGE, sdArgs);
RlvUtil::notifyBlocked(RlvStringKeys::Blocked::GroupChange, sdArgs);
setActiveGroup(m_idAgentGroup);
}