diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 79 |
2 files changed, 29 insertions, 52 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index d30ce72..a116f0f 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -203,7 +203,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
203 | m_Scene.AssetService.Store(asset); | 203 | m_Scene.AssetService.Store(asset); |
204 | m_Scene.CreateNewInventoryItem( | 204 | m_Scene.CreateNewInventoryItem( |
205 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 205 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
206 | name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate); | 206 | name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate); |
207 | } | 207 | } |
208 | else | 208 | else |
209 | { | 209 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 3c3d077..71e3032 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -879,50 +879,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
879 | return; | 879 | return; |
880 | } | 880 | } |
881 | 881 | ||
882 | AssetBase asset = AssetService.Get(item.AssetID.ToString()); | 882 | if (newName == String.Empty) |
883 | newName = item.Name; | ||
883 | 884 | ||
884 | if (asset != null) | 885 | if (remoteClient.AgentId == oldAgentID |
886 | || (LibraryService != null | ||
887 | && LibraryService.LibraryRootFolder != null | ||
888 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | ||
885 | { | 889 | { |
886 | if (newName != String.Empty) | 890 | CreateNewInventoryItem( |
887 | { | 891 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, |
888 | asset.Name = newName; | 892 | newName, item.Description, item.Flags, callbackID, item.AssetID, (sbyte)item.AssetType, (sbyte)item.InvType, |
889 | } | 893 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, |
890 | else | 894 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); |
891 | { | 895 | } |
892 | newName = item.Name; | 896 | else |
893 | } | 897 | { |
894 | 898 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. | |
895 | if (remoteClient.AgentId == oldAgentID | 899 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) |
896 | || (LibraryService != null | 900 | && (m_permissions.BypassPermissions() |
897 | && LibraryService.LibraryRootFolder != null | 901 | || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) |
898 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | ||
899 | { | 902 | { |
900 | CreateNewInventoryItem( | 903 | CreateNewInventoryItem( |
901 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, | 904 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID, |
902 | newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType, | 905 | item.AssetID, (sbyte)item.AssetType, (sbyte) item.InvType, |
903 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, | 906 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, |
904 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | 907 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); |
905 | } | 908 | } |
906 | else | ||
907 | { | ||
908 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. | ||
909 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) | ||
910 | && (m_permissions.BypassPermissions() | ||
911 | || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) | ||
912 | { | ||
913 | CreateNewInventoryItem( | ||
914 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID, | ||
915 | asset, (sbyte) item.InvType, | ||
916 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, | ||
917 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | ||
918 | } | ||
919 | } | ||
920 | } | ||
921 | else | ||
922 | { | ||
923 | m_log.ErrorFormat( | ||
924 | "[AGENT INVENTORY]: Could not copy item {0} since asset {1} could not be found", | ||
925 | item.Name, item.AssetID); | ||
926 | } | 909 | } |
927 | } | 910 | } |
928 | 911 | ||
@@ -973,10 +956,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
973 | public void CreateNewInventoryItem( | 956 | public void CreateNewInventoryItem( |
974 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 957 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
975 | string name, string description, uint flags, uint callbackID, | 958 | string name, string description, uint flags, uint callbackID, |
976 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 959 | UUID assetID, sbyte assetType, sbyte invType, uint nextOwnerMask, int creationDate) |
977 | { | 960 | { |
978 | CreateNewInventoryItem( | 961 | CreateNewInventoryItem( |
979 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, | 962 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, assetID, assetType, invType, |
980 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); | 963 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, 0, nextOwnerMask, 0, creationDate); |
981 | } | 964 | } |
982 | 965 | ||
@@ -1001,7 +984,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1001 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> | 984 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> |
1002 | private void CreateNewInventoryItem( | 985 | private void CreateNewInventoryItem( |
1003 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | 986 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
1004 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 987 | string name, string description, uint flags, uint callbackID, UUID assetID, sbyte assetType, sbyte invType, |
1005 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 988 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) |
1006 | { | 989 | { |
1007 | InventoryItemBase item = new InventoryItemBase(); | 990 | InventoryItemBase item = new InventoryItemBase(); |
@@ -1009,11 +992,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1009 | item.CreatorId = creatorID; | 992 | item.CreatorId = creatorID; |
1010 | item.CreatorData = creatorData; | 993 | item.CreatorData = creatorData; |
1011 | item.ID = UUID.Random(); | 994 | item.ID = UUID.Random(); |
1012 | item.AssetID = asset.FullID; | 995 | item.AssetID = assetID; |
1013 | item.Name = name; | 996 | item.Name = name; |
1014 | item.Description = description; | 997 | item.Description = description; |
1015 | item.Flags = flags; | 998 | item.Flags = flags; |
1016 | item.AssetType = asset.Type; | 999 | item.AssetType = assetType; |
1017 | item.InvType = invType; | 1000 | item.InvType = invType; |
1018 | item.Folder = folderID; | 1001 | item.Folder = folderID; |
1019 | item.CurrentPermissions = currentMask; | 1002 | item.CurrentPermissions = currentMask; |
@@ -1086,15 +1069,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1086 | // return; | 1069 | // return; |
1087 | // } | 1070 | // } |
1088 | 1071 | ||
1089 | AssetBase asset = new AssetBase(); | ||
1090 | asset.FullID = olditemID; | ||
1091 | asset.Type = type; | ||
1092 | asset.Name = name; | ||
1093 | asset.Description = description; | ||
1094 | |||
1095 | CreateNewInventoryItem( | 1072 | CreateNewInventoryItem( |
1096 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | 1073 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
1097 | name, description, 0, callbackID, asset, invType, | 1074 | name, description, 0, callbackID, olditemID, type, invType, |
1098 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, | 1075 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All, |
1099 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch()); | 1076 | (uint)PermissionMask.All | (uint)PermissionMask.Export, (uint)PermissionMask.All | (uint)PermissionMask.Export, Util.UnixTimeSinceEpoch()); |
1100 | } | 1077 | } |