* First draft implementation of copying prim inventory items back to agent inventory
* Now, if you own an item in a prim, you should be able to successfully drag it back into your inventory * Temporarily, users which are not owners of the item cannot copy it, even if 'everyone can copy' is set * This is pending fixes/implementation of upstream permission implementation0.6.0-stable
parent
323038ceb9
commit
accd89b3f1
|
@ -92,7 +92,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does this folder contain the given item?
|
/// Does this folder or any of its subfolders contain the given item?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="itemID"></param>
|
/// <param name="itemID"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
|
@ -408,6 +408,8 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
|
public delegate void UpdateTaskInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID folderID, uint localID);
|
||||||
|
|
||||||
|
public delegate void MoveTaskInventory(IClientAPI remoteClient, LLUUID folderID, uint localID, LLUUID itemID);
|
||||||
|
|
||||||
public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID);
|
public delegate void RemoveTaskInventory(IClientAPI remoteClient, LLUUID itemID, uint localID);
|
||||||
|
|
||||||
public delegate void UDPAssetUploadRequest(
|
public delegate void UDPAssetUploadRequest(
|
||||||
|
@ -530,6 +532,7 @@ namespace OpenSim.Framework
|
||||||
event ConfirmXfer OnConfirmXfer;
|
event ConfirmXfer OnConfirmXfer;
|
||||||
event RezScript OnRezScript;
|
event RezScript OnRezScript;
|
||||||
event UpdateTaskInventory OnUpdateTaskInventory;
|
event UpdateTaskInventory OnUpdateTaskInventory;
|
||||||
|
event MoveTaskInventory OnMoveTaskItem;
|
||||||
event RemoveTaskInventory OnRemoveTaskItem;
|
event RemoveTaskInventory OnRemoveTaskItem;
|
||||||
event RequestAsset OnRequestAsset;
|
event RequestAsset OnRequestAsset;
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
private RemoveInventoryFolder handlerRemoveInventoryFolder = null;
|
private RemoveInventoryFolder handlerRemoveInventoryFolder = null;
|
||||||
private RequestTaskInventory handlerRequestTaskInventory = null; //OnRequestTaskInventory;
|
private RequestTaskInventory handlerRequestTaskInventory = null; //OnRequestTaskInventory;
|
||||||
private UpdateTaskInventory handlerUpdateTaskInventory = null; //OnUpdateTaskInventory;
|
private UpdateTaskInventory handlerUpdateTaskInventory = null; //OnUpdateTaskInventory;
|
||||||
|
private MoveTaskInventory handlerMoveTaskItem = null;
|
||||||
private RemoveTaskInventory handlerRemoveTaskItem = null; //OnRemoveTaskItem;
|
private RemoveTaskInventory handlerRemoveTaskItem = null; //OnRemoveTaskItem;
|
||||||
private RezScript handlerRezScript = null; //OnRezScript;
|
private RezScript handlerRezScript = null; //OnRezScript;
|
||||||
private RequestMapBlocks handlerRequestMapBlocks = null; //OnRequestMapBlocks;
|
private RequestMapBlocks handlerRequestMapBlocks = null; //OnRequestMapBlocks;
|
||||||
|
@ -762,6 +763,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
public event ConfirmXfer OnConfirmXfer;
|
public event ConfirmXfer OnConfirmXfer;
|
||||||
public event RezScript OnRezScript;
|
public event RezScript OnRezScript;
|
||||||
public event UpdateTaskInventory OnUpdateTaskInventory;
|
public event UpdateTaskInventory OnUpdateTaskInventory;
|
||||||
|
public event MoveTaskInventory OnMoveTaskItem;
|
||||||
public event RemoveTaskInventory OnRemoveTaskItem;
|
public event RemoveTaskInventory OnRemoveTaskItem;
|
||||||
public event RequestAsset OnRequestAsset;
|
public event RequestAsset OnRequestAsset;
|
||||||
|
|
||||||
|
@ -4250,8 +4252,11 @@ namespace OpenSim.Region.ClientStack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketType.RemoveTaskInventory:
|
case PacketType.RemoveTaskInventory:
|
||||||
|
|
||||||
RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack;
|
RemoveTaskInventoryPacket removeTask = (RemoveTaskInventoryPacket)Pack;
|
||||||
|
|
||||||
handlerRemoveTaskItem = OnRemoveTaskItem;
|
handlerRemoveTaskItem = OnRemoveTaskItem;
|
||||||
|
@ -4260,11 +4265,27 @@ namespace OpenSim.Region.ClientStack
|
||||||
{
|
{
|
||||||
handlerRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
|
handlerRemoveTaskItem(this, removeTask.InventoryData.ItemID, removeTask.InventoryData.LocalID);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketType.MoveTaskInventory:
|
case PacketType.MoveTaskInventory:
|
||||||
m_log.Warn("[CLIENT]: unhandled MoveTaskInventory packet");
|
|
||||||
|
MoveTaskInventoryPacket moveTaskInventoryPacket = (MoveTaskInventoryPacket)Pack;
|
||||||
|
|
||||||
|
handlerMoveTaskItem = OnMoveTaskItem;
|
||||||
|
|
||||||
|
if (handlerMoveTaskItem != null)
|
||||||
|
{
|
||||||
|
handlerMoveTaskItem(
|
||||||
|
this, moveTaskInventoryPacket.AgentData.FolderID,
|
||||||
|
moveTaskInventoryPacket.InventoryData.LocalID,
|
||||||
|
moveTaskInventoryPacket.InventoryData.ItemID);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketType.RezScript:
|
case PacketType.RezScript:
|
||||||
|
|
||||||
//Console.WriteLine(Pack.ToString());
|
//Console.WriteLine(Pack.ToString());
|
||||||
RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
|
RezScriptPacket rezScriptx = (RezScriptPacket)Pack;
|
||||||
|
|
||||||
|
@ -4275,6 +4296,7 @@ namespace OpenSim.Region.ClientStack
|
||||||
handlerRezScript(this, rezScriptx.InventoryBlock.ItemID, rezScriptx.UpdateBlock.ObjectLocalID);
|
handlerRezScript(this, rezScriptx.InventoryBlock.ItemID, rezScriptx.UpdateBlock.ObjectLocalID);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketType.MapLayerRequest:
|
case PacketType.MapLayerRequest:
|
||||||
RequestMapLayer();
|
RequestMapLayer();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -83,6 +83,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
EventManager.TriggerOnNewInventoryItemUploadComplete(remoteClient.AgentId, item.AssetID, item.Name, userlevel);
|
EventManager.TriggerOnNewInventoryItemUploadComplete(remoteClient.AgentId, item.AssetID, item.Name, userlevel);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat(
|
||||||
|
"[AGENT INVENTORY]: Agent {0} {1} was not found for add of item {2} {3}",
|
||||||
|
remoteClient.Name, remoteClient.AgentId, item.Name, item.ID);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -697,6 +705,79 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Move the given item in the given prim to a folder in the client's inventory
|
||||||
|
/// </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)
|
||||||
|
{
|
||||||
|
SceneObjectGroup group = GetGroupByPrim(primLocalId);
|
||||||
|
|
||||||
|
if (null == group)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat(
|
||||||
|
"[PRIM INVENTORY]: " +
|
||||||
|
"Move of inventory item {0} from prim with local id {1} failed because the prim could not be found",
|
||||||
|
itemId, primLocalId);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TaskInventoryItem taskItem = group.GetInventoryItem(primLocalId, itemId);
|
||||||
|
|
||||||
|
if (null == taskItem)
|
||||||
|
{
|
||||||
|
// Console already notified of error in GetInventoryItem
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// bool permission;
|
||||||
|
// permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId,
|
||||||
|
// ((SceneObjectGroup) selectedEnt).UUID);
|
||||||
|
|
||||||
|
// Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner
|
||||||
|
// to copy
|
||||||
|
if (remoteClient.AgentId != taskItem.OwnerID)
|
||||||
|
{
|
||||||
|
m_log.InfoFormat(
|
||||||
|
"[PRIM INVENTORY]: Attempt made by {0} {1} to copy inventory item {2} {3} in prim {4} {5},"
|
||||||
|
+ " but temporarily not allowed pending upstream bugfixes/feature implementation",
|
||||||
|
remoteClient.Name, remoteClient.AgentId, taskItem.Name, taskItem.ItemID, group.Name, group.UUID);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryItemBase agentItem = new InventoryItemBase();
|
||||||
|
|
||||||
|
agentItem.ID = LLUUID.Random();
|
||||||
|
agentItem.Creator = taskItem.CreatorID;
|
||||||
|
agentItem.Owner = remoteClient.AgentId;
|
||||||
|
agentItem.AssetID = taskItem.AssetID;
|
||||||
|
agentItem.Description = taskItem.Description;
|
||||||
|
agentItem.Name = taskItem.Name;
|
||||||
|
agentItem.AssetType = taskItem.Type;
|
||||||
|
agentItem.InvType = taskItem.InvType;
|
||||||
|
agentItem.Folder = folderId;
|
||||||
|
agentItem.EveryOnePermissions = taskItem.EveryoneMask;
|
||||||
|
|
||||||
|
if (remoteClient.AgentId != taskItem.OwnerID) {
|
||||||
|
agentItem.BasePermissions = taskItem.NextOwnerMask;
|
||||||
|
agentItem.CurrentPermissions = taskItem.NextOwnerMask;
|
||||||
|
agentItem.NextPermissions = taskItem.NextOwnerMask;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
agentItem.BasePermissions = taskItem.BaseMask;
|
||||||
|
agentItem.CurrentPermissions = taskItem.OwnerMask;
|
||||||
|
agentItem.NextPermissions = taskItem.NextOwnerMask;
|
||||||
|
}
|
||||||
|
|
||||||
|
AddInventoryItem(remoteClient, agentItem);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an item in a prim (task) inventory.
|
/// Update an item in a prim (task) inventory.
|
||||||
/// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see>
|
/// This method does not handle scripts, <see>RezScript(IClientAPI, LLUUID, unit)</see>
|
||||||
|
|
|
@ -1608,6 +1608,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
client.OnRequestTaskInventory += RequestTaskInventory;
|
client.OnRequestTaskInventory += RequestTaskInventory;
|
||||||
client.OnRemoveTaskItem += RemoveTaskInventory;
|
client.OnRemoveTaskItem += RemoveTaskInventory;
|
||||||
client.OnUpdateTaskInventory += UpdateTaskInventory;
|
client.OnUpdateTaskInventory += UpdateTaskInventory;
|
||||||
|
client.OnMoveTaskItem += MoveTaskInventoryItem;
|
||||||
|
|
||||||
client.OnGrabObject += ProcessObjectGrab;
|
client.OnGrabObject += ProcessObjectGrab;
|
||||||
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
|
client.OnMoneyTransferRequest += ProcessMoneyTransferRequest;
|
||||||
|
|
|
@ -198,6 +198,13 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
taskItem.CreatorID = item.Creator;
|
taskItem.CreatorID = item.Creator;
|
||||||
taskItem.Type = item.AssetType;
|
taskItem.Type = item.AssetType;
|
||||||
taskItem.InvType = item.InvType;
|
taskItem.InvType = item.InvType;
|
||||||
|
|
||||||
|
taskItem.BaseMask = item.BasePermissions;
|
||||||
|
taskItem.OwnerMask = item.CurrentPermissions;
|
||||||
|
// FIXME: ignoring group permissions for now as they aren't stored in item
|
||||||
|
taskItem.EveryoneMask = item.EveryOnePermissions;
|
||||||
|
taskItem.NextOwnerMask = item.NextPermissions;
|
||||||
|
|
||||||
part.AddInventoryItem(taskItem);
|
part.AddInventoryItem(taskItem);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1904,7 +1904,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Return metadata about a prim (name, description, sale price, etc.)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="client"></param>
|
/// <param name="client"></param>
|
||||||
public void GetProperties(IClientAPI client)
|
public void GetProperties(IClientAPI client)
|
||||||
|
|
|
@ -482,8 +482,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public void RequestInventoryFile(IXfer xferManager)
|
public void RequestInventoryFile(IXfer xferManager)
|
||||||
{
|
{
|
||||||
byte[] fileData = new byte[0];
|
byte[] fileData = new byte[0];
|
||||||
InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
|
//InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
|
||||||
//InventoryStringBuilder invString = new InventoryStringBuilder(UUID, LLUUID.Zero);
|
// InventoryStringBuilder invString = new InventoryStringBuilder(UUID, LLUUID.Zero);
|
||||||
|
InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, LLUUID.Zero);
|
||||||
|
|
||||||
lock (m_taskInventory)
|
lock (m_taskInventory)
|
||||||
{
|
{
|
||||||
|
@ -492,20 +493,28 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
invString.AddItemStart();
|
invString.AddItemStart();
|
||||||
invString.AddNameValueLine("item_id", item.ItemID.ToString());
|
invString.AddNameValueLine("item_id", item.ItemID.ToString());
|
||||||
|
|
||||||
invString.AddNameValueLine("parent_id", item.ParentID.ToString());
|
//invString.AddNameValueLine("parent_id", item.ParentID.ToString());
|
||||||
// invString.AddNameValueLine("parent_id", UUID.ToString());
|
invString.AddNameValueLine("parent_id", m_folderID.ToString());
|
||||||
|
|
||||||
invString.AddPermissionsStart();
|
invString.AddPermissionsStart();
|
||||||
|
|
||||||
|
// FIXME: Temporary until permissions are properly sorted.
|
||||||
invString.AddNameValueLine("base_mask", "7fffffff");
|
invString.AddNameValueLine("base_mask", "7fffffff");
|
||||||
invString.AddNameValueLine("owner_mask", "7fffffff");
|
invString.AddNameValueLine("owner_mask", "7fffffff");
|
||||||
|
|
||||||
invString.AddNameValueLine("group_mask", "7fffffff");
|
invString.AddNameValueLine("group_mask", "7fffffff");
|
||||||
invString.AddNameValueLine("everyone_mask", "7fffffff");
|
invString.AddNameValueLine("everyone_mask", "7fffffff");
|
||||||
invString.AddNameValueLine("next_owner_mask", "7fffffff");
|
invString.AddNameValueLine("next_owner_mask", "7fffffff");
|
||||||
|
|
||||||
// invString.AddNameValueLine("group_mask", "00000000");
|
// invString.AddNameValueLine("group_mask", "00000000");
|
||||||
// invString.AddNameValueLine("everyone_mask", "00000000");
|
// invString.AddNameValueLine("everyone_mask", "00000000");
|
||||||
// invString.AddNameValueLine("next_owner_mask", "00086000");
|
// invString.AddNameValueLine("next_owner_mask", "00086000");
|
||||||
|
|
||||||
|
// invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask));
|
||||||
|
// invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask));
|
||||||
|
// invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(item.GroupMask));
|
||||||
|
// invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(item.EveryoneMask));
|
||||||
|
// invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask));
|
||||||
|
|
||||||
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
|
invString.AddNameValueLine("creator_id", item.CreatorID.ToString());
|
||||||
invString.AddNameValueLine("owner_id", item.OwnerID.ToString());
|
invString.AddNameValueLine("owner_id", item.OwnerID.ToString());
|
||||||
|
|
||||||
|
@ -537,8 +546,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
fileData = Helpers.StringToField(invString.BuildString);
|
fileData = Helpers.StringToField(invString.BuildString);
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
//m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Helpers.FieldToUTF8String(fileData));
|
||||||
// "[PRIM INVENTORY]: RequestInventoryFile fileData: {0}", Helpers.FieldToUTF8String(fileData));
|
|
||||||
|
|
||||||
if (fileData.Length > 2)
|
if (fileData.Length > 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -747,13 +747,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
Acceleration = new LLVector3(0, 0, 0);
|
Acceleration = new LLVector3(0, 0, 0);
|
||||||
m_TextureAnimation = new byte[0];
|
m_TextureAnimation = new byte[0];
|
||||||
m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp";
|
m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp";
|
||||||
m_folderID = LLUUID.Random();
|
|
||||||
|
// Prims currently only contain a single folder (Contents). From looking at the Second Life protocol,
|
||||||
|
// this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from
|
||||||
|
// the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log
|
||||||
|
m_folderID = UUID;
|
||||||
|
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
Flags |= LLObject.ObjectFlags.AllowInventoryDrop |
|
Flags |= LLObject.ObjectFlags.AllowInventoryDrop |
|
||||||
LLObject.ObjectFlags.CreateSelected;
|
LLObject.ObjectFlags.CreateSelected;
|
||||||
|
|
||||||
|
|
||||||
TrimPermissions();
|
TrimPermissions();
|
||||||
|
|
||||||
ScheduleFullUpdate();
|
ScheduleFullUpdate();
|
||||||
|
|
|
@ -134,6 +134,7 @@ namespace OpenSim.Region.Examples.SimpleModule
|
||||||
public event ConfirmXfer OnConfirmXfer;
|
public event ConfirmXfer OnConfirmXfer;
|
||||||
public event RezScript OnRezScript;
|
public event RezScript OnRezScript;
|
||||||
public event UpdateTaskInventory OnUpdateTaskInventory;
|
public event UpdateTaskInventory OnUpdateTaskInventory;
|
||||||
|
public event MoveTaskInventory OnMoveTaskItem;
|
||||||
public event RemoveTaskInventory OnRemoveTaskItem;
|
public event RemoveTaskInventory OnRemoveTaskItem;
|
||||||
public event RequestAsset OnRequestAsset;
|
public event RequestAsset OnRequestAsset;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue