Skip to content

Commit

Permalink
[OPENSIM] Only show the adv perms export flag (X) when in OS
Browse files Browse the repository at this point in the history
  • Loading branch information
beqjanus committed Jul 18, 2023
1 parent b4c8f9c commit a073df9
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 44 deletions.
26 changes: 16 additions & 10 deletions indra/llinventory/llpermissions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ std::ostream& operator<<(std::ostream &s, const LLAggregatePermissions &perm)
}

// This converts a permissions mask into a string for debugging use.
void mask_to_string(U32 mask, char* str)
void mask_to_string(U32 mask, char* str, bool isOpenSim /*=false*/) // <FS:Beq/> remove misleading X for export when not in OpenSim
{
if (mask & PERM_MOVE)
{
Expand Down Expand Up @@ -990,23 +990,29 @@ void mask_to_string(U32 mask, char* str)
str++;

// <FS:CR> OpenSim export permission
if (mask & PERM_EXPORT)
#ifdef OPENSIM
// The export permission is only available in OpenSim.
if (isOpenSim)
{
*str = 'X';
}
else
{
*str = ' ';
if (mask & PERM_EXPORT)
{
*str = 'X';
}
else
{
*str = ' ';
}
str++;
}
str++;
#endif
// </FS:CR>
*str = '\0';
}

std::string mask_to_string(U32 mask)
std::string mask_to_string(U32 mask, bool isOpenSim /*=false*/) // <FS:Beq/> remove misleading X for export when not in OpenSim
{
char str[16];
mask_to_string(mask, str);
mask_to_string(mask, str, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
return std::string(str);
}

Expand Down
4 changes: 2 additions & 2 deletions indra/llinventory/llpermissions.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

// prototypes
class LLMessageSystem;
extern void mask_to_string(U32 mask, char* str);
extern std::string mask_to_string(U32 mask);
extern void mask_to_string(U32 mask, char* str, bool isOpenSim=false);
extern std::string mask_to_string(U32 mask, bool isOpenSim=false);
template<class T> class LLMetaClassT;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
20 changes: 14 additions & 6 deletions indra/newview/llfloaterproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,32 +453,40 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
}

std::string perm_string;

// <FS:Beq> remove misleading X for export when not in OpenSim
bool isOpenSim {false};
#ifdef OPENSIM
if( LLGridManager::instance().isInOpenSim() )
{
isOpenSim = true;
}
#endif
// </FS:Beq>
perm_string = "B: ";
perm_string += mask_to_string(base_mask);
perm_string += mask_to_string(base_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string);
getChildView("BaseMaskDebug")->setVisible(TRUE);

perm_string = "O: ";
perm_string += mask_to_string(owner_mask);
perm_string += mask_to_string(owner_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string);
getChildView("OwnerMaskDebug")->setVisible(TRUE);

perm_string = "G";
perm_string += overwrite_group ? "*: " : ": ";
perm_string += mask_to_string(group_mask);
perm_string += mask_to_string(group_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string);
getChildView("GroupMaskDebug")->setVisible(TRUE);

perm_string = "E";
perm_string += overwrite_everyone ? "*: " : ": ";
perm_string += mask_to_string(everyone_mask);
perm_string += mask_to_string(everyone_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string);
getChildView("EveryoneMaskDebug")->setVisible(TRUE);

perm_string = "N";
perm_string += slam_perm ? "*: " : ": ";
perm_string += mask_to_string(next_owner_mask);
perm_string += mask_to_string(next_owner_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string);
getChildView("NextMaskDebug")->setVisible(TRUE);
}
Expand Down
39 changes: 24 additions & 15 deletions indra/newview/llpanelpermissions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include "rlvcommon.h"
// [/RLVa:KB]
// <FS:CR> For OpenSim export permisson
#include "llviewernetwork.h" // <FS:Beq/> for gridmanager
#include "lfsimfeaturehandler.h"
#include "llinventoryfunctions.h"

Expand Down Expand Up @@ -630,7 +631,7 @@ void LLPanelPermissions::refresh()
}
else
{
// FIRE-777: allow batch edit for name and description
// FIRE-777:allow batch edit for name and description
// getChild<LLUICtrl>("Object Name")->setValue(LLStringUtil::null);
// LineEditorObjectDesc->setText(LLStringUtil::null);
if (keyboard_focus_view != LineEditorObjectName)
Expand All @@ -650,7 +651,7 @@ void LLPanelPermissions::refresh()

// figure out the contents of the name, description, & category
BOOL edit_name_desc = FALSE;
// FIRE-777: allow batch edit for name and description
// FIRE-777:allow batch edit for name and description
// if (is_one_object && objectp->permModify() && !objectp->isPermanentEnforced())
if (objectp->permModify())
// /FIRE-777
Expand Down Expand Up @@ -811,20 +812,28 @@ void LLPanelPermissions::refresh()
&next_owner_mask_on,
&next_owner_mask_off);


if (gSavedSettings.getBOOL("DebugPermissions") )
{
// <FS:Beq> remove misleading X for export when not in OpenSim
bool isOpenSim {false};
#ifdef OPENSIM
if( LLGridManager::instance().isInOpenSim() )
{
isOpenSim = true;
}
#endif
// </FS:Beq>
if (valid_base_perms)
{
getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string(base_mask_on));
getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string(base_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("B:")->setVisible(TRUE);
getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(owner_mask_on));
getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(owner_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("O:")->setVisible(TRUE);
getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on));
getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("G:")->setVisible(TRUE);
getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(everyone_mask_on));
getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(everyone_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("E:")->setVisible(TRUE);
getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on));
getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("N:")->setVisible(TRUE);
}
else if(!root_selected)
Expand All @@ -834,15 +843,15 @@ void LLPanelPermissions::refresh()
LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode();
if (node && node->mValid)
{
getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string( node->mPermissions->getMaskBase()));
getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string( node->mPermissions->getMaskBase(), isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("B:")->setVisible(TRUE);
getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(node->mPermissions->getMaskOwner()));
getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(node->mPermissions->getMaskOwner(), isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("O:")->setVisible(TRUE);
getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(node->mPermissions->getMaskGroup()));
getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(node->mPermissions->getMaskGroup(), isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("G:")->setVisible(TRUE);
getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(node->mPermissions->getMaskEveryone()));
getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(node->mPermissions->getMaskEveryone(), isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("E:")->setVisible(TRUE);
getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(node->mPermissions->getMaskNextOwner()));
getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(node->mPermissions->getMaskNextOwner(), isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("N:")->setVisible(TRUE);
}
}
Expand All @@ -864,7 +873,7 @@ void LLPanelPermissions::refresh()

//if (objectp->permExport()) flag_mask |= PERM_EXPORT; // <FS:CR> OpenSim export permissions

getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask));
getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("F:")->setVisible( TRUE);
}
else
Expand Down Expand Up @@ -910,7 +919,7 @@ void LLPanelPermissions::refresh()
getChildView("checkbox allow everyone copy")->setEnabled(FALSE);
}

// <FS:CR> Opensim export permissions - Codeblock courtesy of Liru Færs.
// <FS:CR> Opensim export permissions - Codeblock courtesy of Liru F�rs.
// Is this user allowed to toggle export on this object?
if (LFSimFeatureHandler::instance().simSupportsExport()
&& self_owned && mCreatorID == mOwnerID
Expand Down
21 changes: 16 additions & 5 deletions indra/newview/llsidepaneliteminfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "llexperiencecache.h"
#include "lltrans.h"
#include "llviewerregion.h"
#include "llviewernetwork.h" // <FS:Beq/> for gridmanager
// [RLVa:KB] - Checked: RLVa-2.0.1
#include "rlvactions.h"
#include "rlvcommon.h"
Expand Down Expand Up @@ -586,31 +587,41 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)

std::string perm_string;

// <FS:Beq> remove misleading X for export when not in OpenSim
bool isOpenSim {false};
#ifdef OPENSIM
if( LLGridManager::instance().isInOpenSim() )
{
isOpenSim = true;
}
#endif
// </FS:Beq>

perm_string = "B: ";
perm_string += mask_to_string(base_mask);
perm_string += mask_to_string(base_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("BaseMaskDebug")->setValue(perm_string);
getChildView("BaseMaskDebug")->setVisible(TRUE);

perm_string = "O: ";
perm_string += mask_to_string(owner_mask);
perm_string += mask_to_string(owner_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("OwnerMaskDebug")->setValue(perm_string);
getChildView("OwnerMaskDebug")->setVisible(TRUE);

perm_string = "G";
perm_string += overwrite_group ? "*: " : ": ";
perm_string += mask_to_string(group_mask);
perm_string += mask_to_string(group_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("GroupMaskDebug")->setValue(perm_string);
getChildView("GroupMaskDebug")->setVisible(TRUE);

perm_string = "E";
perm_string += overwrite_everyone ? "*: " : ": ";
perm_string += mask_to_string(everyone_mask);
perm_string += mask_to_string(everyone_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("EveryoneMaskDebug")->setValue(perm_string);
getChildView("EveryoneMaskDebug")->setVisible(TRUE);

perm_string = "N";
perm_string += slam_perm ? "*: " : ": ";
perm_string += mask_to_string(next_owner_mask);
perm_string += mask_to_string(next_owner_mask, isOpenSim); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChild<LLUICtrl>("NextMaskDebug")->setValue(perm_string);
getChildView("NextMaskDebug")->setVisible(TRUE);
}
Expand Down
22 changes: 16 additions & 6 deletions indra/newview/llsidepaneltaskinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "lltextbase.h"
#include "llstring.h"
#include "lltrans.h"
#include "llviewernetwork.h" // <FS:Beq/> for gridmanager
// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a)
#include "llslurl.h"
#include "rlvhandler.h"
Expand Down Expand Up @@ -635,21 +636,30 @@ void LLSidepanelTaskInfo::refresh()

if (gSavedSettings.getBOOL("DebugPermissions") )
{
// <FS:Beq> remove misleading X for export when not in OpenSim
bool isOpenSim {false};
#ifdef OPENSIM
if( LLGridManager::instance().isInOpenSim() )
{
isOpenSim = true;
}
#endif
// </FS:Beq>
if (valid_base_perms)
{
getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string(base_mask_on));
getChild<LLUICtrl>("B:")->setValue("B: " + mask_to_string(base_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("B:")->setVisible( TRUE);

getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(owner_mask_on));
getChild<LLUICtrl>("O:")->setValue("O: " + mask_to_string(owner_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("O:")->setVisible( TRUE);

getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on));
getChild<LLUICtrl>("G:")->setValue("G: " + mask_to_string(group_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("G:")->setVisible( TRUE);

getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(everyone_mask_on));
getChild<LLUICtrl>("E:")->setValue("E: " + mask_to_string(everyone_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("E:")->setVisible( TRUE);

getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on));
getChild<LLUICtrl>("N:")->setValue("N: " + mask_to_string(next_owner_mask_on, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("N:")->setVisible( TRUE);
}

Expand All @@ -659,7 +669,7 @@ void LLSidepanelTaskInfo::refresh()
if (objectp->permCopy()) flag_mask |= PERM_COPY;
if (objectp->permTransfer()) flag_mask |= PERM_TRANSFER;

getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask));
getChild<LLUICtrl>("F:")->setValue("F:" + mask_to_string(flag_mask, isOpenSim)); // <FS:Beq/> remove misleading X for export when not in OpenSim
getChildView("F:")->setVisible( TRUE);
}
else
Expand Down

0 comments on commit a073df9

Please sign in to comment.