Do not allow no copy items to be restored to last position. FIRE-13672

ziree 2014-05-09 14:03:37 +02:00
parent 677a87c083
commit 6cdbc879d5
4 changed files with 81 additions and 0 deletions

View File

@ -22039,6 +22039,19 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<!-- <FS:Zi> Do not allow "Restore To Last Position" for no-copy items -->
<key>AllowNoCopyRezRestoreToWorld</key>
<map>
<key>Comment</key>
<string>Allow Restore to Last Position for no-copy objects on Second Life grids. This can lead to content loss, and is only meant to be used for testing a potential server side fix.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<!-- </FS:Zi> -->
</map>
</llsd>

View File

@ -4013,6 +4013,38 @@ void LLAgent::processAgentDataUpdate(LLMessageSystem *msg, void **)
{
//This fires if we're trying to restore an item to world using the correct group.
bool remove_from_inventory = false;
// <FS:Zi> Do not allow "Restore To Last Position" for no-copy items
#ifdef OPENSIM
if(LLGridManager::instance().isInSecondLife())
{
#endif
// protect from restoring to last position when the item is no-copy to prevent
// inventory loss
if(!gAgent.restoreToWorldItem->getPermissions().allowCopyBy(gAgent.getID()))
{
if(!gSavedSettings.getBOOL("AllowNoCopyRezRestoreToWorld"))
{
// for some reason, we still came this far, even though we should not have
// allowed RezRestoreToWorld on a no copy item on Second Life grids, so
// log this message and stop proceeding. This will result in the user wearing
// the land group, but hopefully this problem will not come up ever.
LL_WARNS("Avatar") << "Tried RezRestoreToWorld on a no-copy item! Attempt blocked." << LL_ENDL;
// copied from the end of this function to here, to avoid indention mess
gAgent.restoreToWorld = false;
update_group_floaters(active_id);
// <FS:Ansariel> Fire event for group title overview
gAgent.fireEvent(new LLOldEvents::LLEvent(&gAgent, "update grouptitle list"), "");
return;
}
}
#ifdef OPENSIM
}
#endif
// </FS:Zi>
msg->newMessage("RezRestoreToWorld");
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());

View File

@ -88,6 +88,12 @@
#include "llparcel.h"
#include "llviewerparcelmgr.h"
// <FS:Zi> Do not allow "Restore To Last Postiion" for no-copy items
#ifdef OPENSIM
#include "fsgridhandler.h"
#endif
// </FS:Zi>
void copy_slurl_to_clipboard_callback_inv(const std::string& slurl);
// Marketplace outbox current disabled
@ -1629,6 +1635,27 @@ void LLItemBridge::restoreToWorld()
LLViewerInventoryItem* itemp = static_cast<LLViewerInventoryItem*>(getItem());
if (itemp)
{
// <FS:Zi> Do not allow "Restore To Last Position" for no-copy items
#ifdef OPENSIM
if(LLGridManager::instance().isInSecondLife())
{
#endif
// do not restore to last position when the item is no-copy to prevent
// inventory loss
if(!itemp->getPermissions().allowCopyBy(gAgent.getID()))
{
// debug guard for future testing of a server side fix
if(!gSavedSettings.getBOOL("AllowNoCopyRezRestoreToWorld"))
{
LLNotificationsUtil::add("CantRestoreToWorldNoCopy");
return;
}
}
#ifdef OPENSIM
}
#endif
// </FS:Zi>
LLMessageSystem* msg = gMessageSystem;
if (gSavedSettings.getBOOL("RezUnderLandGroup"))

View File

@ -11835,4 +11835,13 @@ Enter a domain name to be added to the [LIST]:
</form>
</notification>
<!-- <FS:Zi> Do not allow "Restore To Last Position" for no-copy items -->
<notification
icon="alertmodal.tga"
name="CantRestoreToWorldNoCopy"
type="alertmodal">
Restore to Last Position is not allowed for no copy items to prevent possible content loss.
</notification>
<!-- <FS:Zi> Do not allow "Restore To Last Position" for no-copy items -->
</notifications>