diff options
author | Justin Clarke Casey | 2008-04-26 20:31:01 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-04-26 20:31:01 +0000 |
commit | accd89b3f1c7729e6bb34b52e8095baf9c1f440a (patch) | |
tree | eb2b485edb92d5349463ec3626f76e005905bdba /OpenSim/Region/Environment/Scenes | |
parent | * Ooops, attachments now teleport/cross region borders along with your avatar... (diff) | |
download | opensim-SC-accd89b3f1c7729e6bb34b52e8095baf9c1f440a.zip opensim-SC-accd89b3f1c7729e6bb34b52e8095baf9c1f440a.tar.gz opensim-SC-accd89b3f1c7729e6bb34b52e8095baf9c1f440a.tar.bz2 opensim-SC-accd89b3f1c7729e6bb34b52e8095baf9c1f440a.tar.xz |
* 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 implementation
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
6 files changed, 112 insertions, 12 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 40650f3..67d3dfb 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -83,6 +83,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
83 | } | 83 | } |
84 | EventManager.TriggerOnNewInventoryItemUploadComplete(remoteClient.AgentId, item.AssetID, item.Name, userlevel); | 84 | EventManager.TriggerOnNewInventoryItemUploadComplete(remoteClient.AgentId, item.AssetID, item.Name, userlevel); |
85 | } | 85 | } |
86 | else | ||
87 | { | ||
88 | m_log.ErrorFormat( | ||
89 | "[AGENT INVENTORY]: Agent {0} {1} was not found for add of item {2} {3}", | ||
90 | remoteClient.Name, remoteClient.AgentId, item.Name, item.ID); | ||
91 | |||
92 | return; | ||
93 | } | ||
86 | } | 94 | } |
87 | 95 | ||
88 | /// <summary> | 96 | /// <summary> |
@@ -696,6 +704,79 @@ namespace OpenSim.Region.Environment.Scenes | |||
696 | localID); | 704 | localID); |
697 | } | 705 | } |
698 | } | 706 | } |
707 | |||
708 | /// <summary> | ||
709 | /// Move the given item in the given prim to a folder in the client's inventory | ||
710 | /// </summary> | ||
711 | /// <param name="remoteClient"></param> | ||
712 | /// <param name="folderID"></param> | ||
713 | /// <param name="primLocalID"></param> | ||
714 | /// <param name="itemID"></param> | ||
715 | public void MoveTaskInventoryItem(IClientAPI remoteClient, LLUUID folderId, uint primLocalId, LLUUID itemId) | ||
716 | { | ||
717 | SceneObjectGroup group = GetGroupByPrim(primLocalId); | ||
718 | |||
719 | if (null == group) | ||
720 | { | ||
721 | m_log.WarnFormat( | ||
722 | "[PRIM INVENTORY]: " + | ||
723 | "Move of inventory item {0} from prim with local id {1} failed because the prim could not be found", | ||
724 | itemId, primLocalId); | ||
725 | |||
726 | return; | ||
727 | } | ||
728 | |||
729 | TaskInventoryItem taskItem = group.GetInventoryItem(primLocalId, itemId); | ||
730 | |||
731 | if (null == taskItem) | ||
732 | { | ||
733 | // Console already notified of error in GetInventoryItem | ||
734 | return; | ||
735 | } | ||
736 | |||
737 | // bool permission; | ||
738 | // permission = PermissionsMngr.CanCopyObject(remoteClient.AgentId, | ||
739 | // ((SceneObjectGroup) selectedEnt).UUID); | ||
740 | |||
741 | // Pending resolving upstream problems with permissions, we just won't allow anybody who is not the owner | ||
742 | // to copy | ||
743 | if (remoteClient.AgentId != taskItem.OwnerID) | ||
744 | { | ||
745 | m_log.InfoFormat( | ||
746 | "[PRIM INVENTORY]: Attempt made by {0} {1} to copy inventory item {2} {3} in prim {4} {5}," | ||
747 | + " but temporarily not allowed pending upstream bugfixes/feature implementation", | ||
748 | remoteClient.Name, remoteClient.AgentId, taskItem.Name, taskItem.ItemID, group.Name, group.UUID); | ||
749 | |||
750 | return; | ||
751 | } | ||
752 | |||
753 | InventoryItemBase agentItem = new InventoryItemBase(); | ||
754 | |||
755 | agentItem.ID = LLUUID.Random(); | ||
756 | agentItem.Creator = taskItem.CreatorID; | ||
757 | agentItem.Owner = remoteClient.AgentId; | ||
758 | agentItem.AssetID = taskItem.AssetID; | ||
759 | agentItem.Description = taskItem.Description; | ||
760 | agentItem.Name = taskItem.Name; | ||
761 | agentItem.AssetType = taskItem.Type; | ||
762 | agentItem.InvType = taskItem.InvType; | ||
763 | agentItem.Folder = folderId; | ||
764 | agentItem.EveryOnePermissions = taskItem.EveryoneMask; | ||
765 | |||
766 | if (remoteClient.AgentId != taskItem.OwnerID) { | ||
767 | agentItem.BasePermissions = taskItem.NextOwnerMask; | ||
768 | agentItem.CurrentPermissions = taskItem.NextOwnerMask; | ||
769 | agentItem.NextPermissions = taskItem.NextOwnerMask; | ||
770 | } | ||
771 | else | ||
772 | { | ||
773 | agentItem.BasePermissions = taskItem.BaseMask; | ||
774 | agentItem.CurrentPermissions = taskItem.OwnerMask; | ||
775 | agentItem.NextPermissions = taskItem.NextOwnerMask; | ||
776 | } | ||
777 | |||
778 | AddInventoryItem(remoteClient, agentItem); | ||
779 | } | ||
699 | 780 | ||
700 | /// <summary> | 781 | /// <summary> |
701 | /// Update an item in a prim (task) inventory. | 782 | /// Update an item in a prim (task) inventory. |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 9ca845f..b16b4aa 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1608,6 +1608,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1608 | client.OnRequestTaskInventory += RequestTaskInventory; | 1608 | client.OnRequestTaskInventory += RequestTaskInventory; |
1609 | client.OnRemoveTaskItem += RemoveTaskInventory; | 1609 | client.OnRemoveTaskItem += RemoveTaskInventory; |
1610 | client.OnUpdateTaskInventory += UpdateTaskInventory; | 1610 | client.OnUpdateTaskInventory += UpdateTaskInventory; |
1611 | client.OnMoveTaskItem += MoveTaskInventoryItem; | ||
1611 | 1612 | ||
1612 | client.OnGrabObject += ProcessObjectGrab; | 1613 | client.OnGrabObject += ProcessObjectGrab; |
1613 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; | 1614 | client.OnMoneyTransferRequest += ProcessMoneyTransferRequest; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index efb40dd..2d0c636 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -198,6 +198,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
198 | taskItem.CreatorID = item.Creator; | 198 | taskItem.CreatorID = item.Creator; |
199 | taskItem.Type = item.AssetType; | 199 | taskItem.Type = item.AssetType; |
200 | taskItem.InvType = item.InvType; | 200 | taskItem.InvType = item.InvType; |
201 | |||
202 | taskItem.BaseMask = item.BasePermissions; | ||
203 | taskItem.OwnerMask = item.CurrentPermissions; | ||
204 | // FIXME: ignoring group permissions for now as they aren't stored in item | ||
205 | taskItem.EveryoneMask = item.EveryOnePermissions; | ||
206 | taskItem.NextOwnerMask = item.NextPermissions; | ||
207 | |||
201 | part.AddInventoryItem(taskItem); | 208 | part.AddInventoryItem(taskItem); |
202 | 209 | ||
203 | return true; | 210 | return true; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 7020eb8..7596e24 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1904,7 +1904,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1904 | } | 1904 | } |
1905 | 1905 | ||
1906 | /// <summary> | 1906 | /// <summary> |
1907 | /// | 1907 | /// Return metadata about a prim (name, description, sale price, etc.) |
1908 | /// </summary> | 1908 | /// </summary> |
1909 | /// <param name="client"></param> | 1909 | /// <param name="client"></param> |
1910 | public void GetProperties(IClientAPI client) | 1910 | public void GetProperties(IClientAPI client) |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index 63cfcbd..89c93fd 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -482,8 +482,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
482 | public void RequestInventoryFile(IXfer xferManager) | 482 | public void RequestInventoryFile(IXfer xferManager) |
483 | { | 483 | { |
484 | byte[] fileData = new byte[0]; | 484 | byte[] fileData = new byte[0]; |
485 | InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID); | 485 | //InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID); |
486 | //InventoryStringBuilder invString = new InventoryStringBuilder(UUID, LLUUID.Zero); | 486 | // InventoryStringBuilder invString = new InventoryStringBuilder(UUID, LLUUID.Zero); |
487 | InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, LLUUID.Zero); | ||
487 | 488 | ||
488 | lock (m_taskInventory) | 489 | lock (m_taskInventory) |
489 | { | 490 | { |
@@ -492,20 +493,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
492 | invString.AddItemStart(); | 493 | invString.AddItemStart(); |
493 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 494 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); |
494 | 495 | ||
495 | invString.AddNameValueLine("parent_id", item.ParentID.ToString()); | 496 | //invString.AddNameValueLine("parent_id", item.ParentID.ToString()); |
496 | // invString.AddNameValueLine("parent_id", UUID.ToString()); | 497 | invString.AddNameValueLine("parent_id", m_folderID.ToString()); |
497 | 498 | ||
498 | invString.AddPermissionsStart(); | 499 | invString.AddPermissionsStart(); |
500 | |||
501 | // FIXME: Temporary until permissions are properly sorted. | ||
499 | invString.AddNameValueLine("base_mask", "7fffffff"); | 502 | invString.AddNameValueLine("base_mask", "7fffffff"); |
500 | invString.AddNameValueLine("owner_mask", "7fffffff"); | 503 | invString.AddNameValueLine("owner_mask", "7fffffff"); |
501 | |||
502 | invString.AddNameValueLine("group_mask", "7fffffff"); | 504 | invString.AddNameValueLine("group_mask", "7fffffff"); |
503 | invString.AddNameValueLine("everyone_mask", "7fffffff"); | 505 | invString.AddNameValueLine("everyone_mask", "7fffffff"); |
504 | invString.AddNameValueLine("next_owner_mask", "7fffffff"); | 506 | invString.AddNameValueLine("next_owner_mask", "7fffffff"); |
507 | |||
505 | // invString.AddNameValueLine("group_mask", "00000000"); | 508 | // invString.AddNameValueLine("group_mask", "00000000"); |
506 | // invString.AddNameValueLine("everyone_mask", "00000000"); | 509 | // invString.AddNameValueLine("everyone_mask", "00000000"); |
507 | // invString.AddNameValueLine("next_owner_mask", "00086000"); | 510 | // invString.AddNameValueLine("next_owner_mask", "00086000"); |
508 | 511 | ||
512 | // invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask)); | ||
513 | // invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask)); | ||
514 | // invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(item.GroupMask)); | ||
515 | // invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(item.EveryoneMask)); | ||
516 | // invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask)); | ||
517 | |||
509 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); | 518 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); |
510 | invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); | 519 | invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); |
511 | 520 | ||
@@ -537,8 +546,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
537 | 546 | ||
538 | fileData = Helpers.StringToField(invString.BuildString); | 547 | fileData = Helpers.StringToField(invString.BuildString); |
539 | 548 | ||
540 | // m_log.DebugFormat( | 549 | //m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Helpers.FieldToUTF8String(fileData)); |
541 | // "[PRIM INVENTORY]: RequestInventoryFile fileData: {0}", Helpers.FieldToUTF8String(fileData)); | ||
542 | 550 | ||
543 | if (fileData.Length > 2) | 551 | if (fileData.Length > 2) |
544 | { | 552 | { |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index b7e72ef..50c96e1 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -747,12 +747,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
747 | Acceleration = new LLVector3(0, 0, 0); | 747 | Acceleration = new LLVector3(0, 0, 0); |
748 | m_TextureAnimation = new byte[0]; | 748 | m_TextureAnimation = new byte[0]; |
749 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; | 749 | m_inventoryFileName = "inventory_" + LLUUID.Random().ToString() + ".tmp"; |
750 | m_folderID = LLUUID.Random(); | 750 | |
751 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, | ||
752 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | ||
753 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | ||
754 | m_folderID = UUID; | ||
751 | 755 | ||
752 | Flags = 0; | 756 | Flags = 0; |
753 | Flags |= LLObject.ObjectFlags.AllowInventoryDrop | | 757 | Flags |= LLObject.ObjectFlags.AllowInventoryDrop | |
754 | LLObject.ObjectFlags.CreateSelected; | 758 | LLObject.ObjectFlags.CreateSelected; |
755 | |||
756 | 759 | ||
757 | TrimPermissions(); | 760 | TrimPermissions(); |
758 | 761 | ||