Mantis#1587. Thank you kindly, Melanie for a patch that:
Add permissions magling to llGiveInventoryItem, correct some corner case functionality0.6.0-stable
parent
dc0d089bf5
commit
f6bf4c39be
|
@ -882,12 +882,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
// Only owner can copy
|
||||
if (remoteClient.AgentId != taskItem.OwnerID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
InventoryItemBase agentItem = new InventoryItemBase();
|
||||
|
||||
agentItem.ID = LLUUID.Random();
|
||||
|
@ -925,13 +919,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see>MoveTaskInventoryItem</see>
|
||||
/// <see>ClientMoveTaskInventoryItem</see>
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="primLocalID"></param>
|
||||
/// <param name="itemID"></param>
|
||||
public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
|
||||
public void ClientMoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(primLocalId);
|
||||
|
||||
|
@ -944,6 +938,15 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
TaskInventoryItem taskItem = part.GetInventoryItem(itemId);
|
||||
|
||||
// Only owner can copy
|
||||
if (remoteClient.AgentId != taskItem.OwnerID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MoveTaskInventoryItem(remoteClient, folderId, part, itemId);
|
||||
}
|
||||
|
||||
|
@ -977,7 +980,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
/// <param name="destId"></param>
|
||||
/// <param name="part"></param>
|
||||
/// <param name="itemId"></param>
|
||||
public void CopyTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId)
|
||||
public void MoveTaskInventoryItem(LLUUID destId, SceneObjectPart part, LLUUID itemId)
|
||||
{
|
||||
TaskInventoryItem srcTaskItem = part.GetInventoryItem(itemId);
|
||||
|
||||
|
@ -1003,23 +1006,43 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
destTaskItem.ItemID = LLUUID.Random();
|
||||
destTaskItem.CreatorID = srcTaskItem.CreatorID;
|
||||
destTaskItem.AssetID = srcTaskItem.AssetID;
|
||||
destTaskItem.GroupID = srcTaskItem.GroupID;
|
||||
destTaskItem.OwnerID = srcTaskItem.OwnerID;
|
||||
destTaskItem.ParentID = srcTaskItem.ParentID;
|
||||
destTaskItem.ParentPartID = srcTaskItem.ParentPartID;
|
||||
destTaskItem.GroupID = destPart.GroupID;
|
||||
destTaskItem.OwnerID = destPart.OwnerID;
|
||||
destTaskItem.ParentID = destPart.UUID;
|
||||
destTaskItem.ParentPartID = destPart.UUID;
|
||||
|
||||
destTaskItem.BaseMask = srcTaskItem.BaseMask;
|
||||
destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask;
|
||||
destTaskItem.GroupMask = srcTaskItem.GroupMask;
|
||||
destTaskItem.OwnerMask = srcTaskItem.OwnerMask;
|
||||
destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask;
|
||||
destTaskItem.Flags = srcTaskItem.Flags;
|
||||
|
||||
if(destPart.OwnerID != part.OwnerID)
|
||||
{
|
||||
if (ExternalChecks.ExternalChecksPropagatePermissions())
|
||||
{
|
||||
destTaskItem.OwnerMask = srcTaskItem.OwnerMask &
|
||||
srcTaskItem.NextOwnerMask;
|
||||
destTaskItem.GroupMask = srcTaskItem.GroupMask &
|
||||
srcTaskItem.NextOwnerMask;
|
||||
destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask &
|
||||
srcTaskItem.NextOwnerMask;
|
||||
destTaskItem.BaseMask = srcTaskItem.BaseMask &
|
||||
srcTaskItem.NextOwnerMask;
|
||||
destTaskItem.OwnerMask |= 8; // Slam!
|
||||
}
|
||||
}
|
||||
|
||||
destTaskItem.Description = srcTaskItem.Description;
|
||||
destTaskItem.Name = srcTaskItem.Name;
|
||||
destTaskItem.InvType = srcTaskItem.InvType;
|
||||
destTaskItem.Type = srcTaskItem.Type;
|
||||
|
||||
destPart.AddInventoryItem(destTaskItem);
|
||||
|
||||
if((srcTaskItem.OwnerMask & (uint)PermissionMask.Copy) == 0)
|
||||
part.RemoveInventoryItem(itemId);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2010,7 +2010,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
client.OnRequestTaskInventory += RequestTaskInventory;
|
||||
client.OnRemoveTaskItem += RemoveTaskInventory;
|
||||
client.OnUpdateTaskInventory += UpdateTaskInventory;
|
||||
client.OnMoveTaskItem += MoveTaskInventoryItem;
|
||||
client.OnMoveTaskItem += ClientMoveTaskInventoryItem;
|
||||
client.OnGrabObject += ProcessObjectGrab;
|
||||
client.OnDeGrabObject += ProcessObjectDeGrab;
|
||||
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
|
||||
|
@ -3628,4 +3628,4 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2729,7 +2729,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
else
|
||||
{
|
||||
// destination is an object
|
||||
World.CopyTaskInventoryItem(destId, m_host, objId);
|
||||
World.MoveTaskInventoryItem(destId, m_host, objId);
|
||||
}
|
||||
|
||||
if (!found)
|
||||
|
|
|
@ -36,6 +36,7 @@ using Axiom.Math;
|
|||
using libsecondlife;
|
||||
using OpenSim;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Environment;
|
||||
using OpenSim.Region.Environment.Interfaces;
|
||||
using OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney;
|
||||
|
@ -2549,7 +2550,43 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
public void llGiveInventory(string destination, string inventory)
|
||||
{
|
||||
m_host.AddScriptLPS(1);
|
||||
NotImplemented("llGiveInventory");
|
||||
bool found = false;
|
||||
LLUUID destId = LLUUID.Zero;
|
||||
LLUUID objId = LLUUID.Zero;
|
||||
|
||||
if(!LLUUID.TryParse(destination, out destId))
|
||||
{
|
||||
llSay(0, "Could not parse key " + destination);
|
||||
return;
|
||||
}
|
||||
|
||||
// move the first object found with this inventory name
|
||||
foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||
{
|
||||
if (inv.Value.Name == inventory)
|
||||
{
|
||||
found = true;
|
||||
objId = inv.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check if destination is an avatar
|
||||
if (World.GetScenePresence(destId) != null)
|
||||
{
|
||||
// destination is an avatar
|
||||
CachedUserInfo userInfo =
|
||||
World.CommsManager.UserProfileCacheService.GetUserDetails(destId);
|
||||
World.MoveTaskInventoryItem(destId,userInfo.RootFolder.ID, m_host, objId);
|
||||
}
|
||||
else
|
||||
{
|
||||
// destination is an object
|
||||
World.MoveTaskInventoryItem(destId, m_host, objId);
|
||||
}
|
||||
|
||||
if (!found)
|
||||
llSay(0, "Could not find object " + inventory);
|
||||
}
|
||||
|
||||
public void llRemoveInventory(string item)
|
||||
|
|
Loading…
Reference in New Issue