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/Scene.Inventory.cs | |
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/Scene.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 81 |
1 files changed, 81 insertions, 0 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. |