diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 186 |
1 files changed, 128 insertions, 58 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 8b34c28..50f5f68 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -186,44 +186,43 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
186 | if (folder == null || folder.Owner != remoteClient.AgentId) | 186 | if (folder == null || folder.Owner != remoteClient.AgentId) |
187 | return; | 187 | return; |
188 | 188 | ||
189 | if (transactionID == UUID.Zero) | 189 | if (transactionID != UUID.Zero) |
190 | { | 190 | { |
191 | ScenePresence presence; | 191 | IAgentAssetTransactions agentTransactions = m_Scene.AgentTransactionsModule; |
192 | if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence)) | 192 | if (agentTransactions != null) |
193 | { | 193 | { |
194 | byte[] data = null; | 194 | if (agentTransactions.HandleItemCreationFromTransaction( |
195 | remoteClient, transactionID, folderID, callbackID, description, | ||
196 | name, invType, assetType, wearableType, nextOwnerMask)) | ||
197 | return; | ||
198 | } | ||
199 | } | ||
195 | 200 | ||
196 | if (invType == (sbyte)InventoryType.Landmark && presence != null) | 201 | ScenePresence presence; |
197 | { | 202 | if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence)) |
198 | string suffix = string.Empty, prefix = string.Empty; | 203 | { |
199 | string strdata = GenerateLandmark(presence, out prefix, out suffix); | 204 | byte[] data = null; |
200 | data = Encoding.ASCII.GetBytes(strdata); | ||
201 | name = prefix + name; | ||
202 | description += suffix; | ||
203 | } | ||
204 | 205 | ||
205 | AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); | 206 | if (invType == (sbyte)InventoryType.Landmark && presence != null) |
206 | m_Scene.AssetService.Store(asset); | ||
207 | m_Scene.CreateNewInventoryItem( | ||
208 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | ||
209 | name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate); | ||
210 | } | ||
211 | else | ||
212 | { | 207 | { |
213 | m_log.ErrorFormat( | 208 | string suffix = string.Empty, prefix = string.Empty; |
214 | "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", | 209 | string strdata = GenerateLandmark(presence, out prefix, out suffix); |
215 | remoteClient.AgentId); | 210 | data = Encoding.ASCII.GetBytes(strdata); |
211 | name = prefix + name; | ||
212 | description += suffix; | ||
216 | } | 213 | } |
214 | |||
215 | AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); | ||
216 | m_Scene.AssetService.Store(asset); | ||
217 | m_Scene.CreateNewInventoryItem( | ||
218 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, | ||
219 | name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate,transactionID); | ||
217 | } | 220 | } |
218 | else | 221 | else |
219 | { | 222 | { |
220 | IAgentAssetTransactions agentTransactions = m_Scene.AgentTransactionsModule; | 223 | m_log.ErrorFormat( |
221 | if (agentTransactions != null) | 224 | "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", |
222 | { | 225 | remoteClient.AgentId); |
223 | agentTransactions.HandleItemCreationFromTransaction( | ||
224 | remoteClient, transactionID, folderID, callbackID, description, | ||
225 | name, invType, assetType, wearableType, nextOwnerMask); | ||
226 | } | ||
227 | } | 226 | } |
228 | } | 227 | } |
229 | 228 | ||
@@ -360,6 +359,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
360 | 359 | ||
361 | foreach (SceneObjectGroup objectGroup in objlist) | 360 | foreach (SceneObjectGroup objectGroup in objlist) |
362 | { | 361 | { |
362 | if (objectGroup.RootPart.KeyframeMotion != null) | ||
363 | objectGroup.RootPart.KeyframeMotion.Stop(); | ||
364 | objectGroup.RootPart.SetForce(Vector3.Zero); | ||
365 | objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); | ||
366 | objectGroup.RootPart.KeyframeMotion = null; | ||
367 | |||
363 | Vector3 inventoryStoredPosition = new Vector3 | 368 | Vector3 inventoryStoredPosition = new Vector3 |
364 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | 369 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) |
365 | ? 250 | 370 | ? 250 |
@@ -370,9 +375,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
370 | : objectGroup.AbsolutePosition.Y, | 375 | : objectGroup.AbsolutePosition.Y, |
371 | objectGroup.AbsolutePosition.Z); | 376 | objectGroup.AbsolutePosition.Z); |
372 | 377 | ||
378 | Quaternion inventoryStoredRotation = objectGroup.GroupRotation; | ||
373 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; | 379 | originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; |
374 | 380 | ||
381 | // Restore attachment data after trip through the sim | ||
382 | if (objectGroup.RootPart.AttachPoint > 0) | ||
383 | { | ||
384 | inventoryStoredPosition = objectGroup.RootPart.AttachOffset; | ||
385 | inventoryStoredRotation = objectGroup.RootPart.AttachRotation; | ||
386 | } | ||
387 | objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; | ||
388 | |||
375 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 389 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
390 | objectGroup.RootPart.RotationOffset = inventoryStoredRotation; | ||
376 | 391 | ||
377 | // Make sure all bits but the ones we want are clear | 392 | // Make sure all bits but the ones we want are clear |
378 | // on take. | 393 | // on take. |
@@ -490,8 +505,17 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
490 | IClientAPI remoteClient) | 505 | IClientAPI remoteClient) |
491 | { | 506 | { |
492 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; | 507 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
508 | // For the porposes of inventory, an object is modify if the prims | ||
509 | // are modify. This allows renaming an object that contains no | ||
510 | // mod items. | ||
493 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) | 511 | foreach (SceneObjectGroup grp in objsForEffectivePermissions) |
494 | effectivePerms &= grp.GetEffectivePermissions(); | 512 | { |
513 | uint groupPerms = grp.GetEffectivePermissions(true); | ||
514 | if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0) | ||
515 | groupPerms |= (uint)PermissionMask.Modify; | ||
516 | |||
517 | effectivePerms &= groupPerms; | ||
518 | } | ||
495 | effectivePerms |= (uint)PermissionMask.Move; | 519 | effectivePerms |= (uint)PermissionMask.Move; |
496 | 520 | ||
497 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 521 | if (remoteClient != null && (remoteClient.AgentId != so.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
@@ -670,7 +694,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
670 | if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) | 694 | if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) |
671 | { | 695 | { |
672 | InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); | 696 | InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); |
673 | folder = m_Scene.InventoryService.GetFolder(f); | 697 | if (f != null) |
698 | folder = m_Scene.InventoryService.GetFolder(f); | ||
674 | } | 699 | } |
675 | } | 700 | } |
676 | 701 | ||
@@ -700,16 +725,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
700 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 725 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
701 | { | 726 | { |
702 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 727 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); |
703 | |||
704 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 728 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
705 | item = m_Scene.InventoryService.GetItem(item); | 729 | item = m_Scene.InventoryService.GetItem(item); |
706 | 730 | ||
707 | if (item == null) | 731 | if (item == null) |
708 | { | 732 | { |
709 | m_log.WarnFormat( | ||
710 | "[INVENTORY ACCESS MODULE]: Could not find item {0} for {1} in RezObject()", | ||
711 | itemID, remoteClient.Name); | ||
712 | |||
713 | return null; | 733 | return null; |
714 | } | 734 | } |
715 | 735 | ||
@@ -760,6 +780,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
760 | if (e == null || attachment) // Single | 780 | if (e == null || attachment) // Single |
761 | { | 781 | { |
762 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | 782 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); |
783 | if (!attachment) | ||
784 | { | ||
785 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
786 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
787 | g.RootPart.AttachRotation = g.GroupRotation; | ||
788 | g.RootPart.Shape.State = 0; | ||
789 | } | ||
763 | 790 | ||
764 | objlist.Add(g); | 791 | objlist.Add(g); |
765 | veclist.Add(new Vector3(0, 0, 0)); | 792 | veclist.Add(new Vector3(0, 0, 0)); |
@@ -789,6 +816,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
789 | foreach (XmlNode n in groups) | 816 | foreach (XmlNode n in groups) |
790 | { | 817 | { |
791 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); | 818 | SceneObjectGroup g = SceneObjectSerializer.FromOriginalXmlFormat(n.OuterXml); |
819 | g.RootPart.AttachPoint = g.RootPart.Shape.State; | ||
820 | g.RootPart.AttachOffset = g.AbsolutePosition; | ||
821 | g.RootPart.AttachRotation = g.GroupRotation; | ||
822 | g.RootPart.Shape.State = 0; | ||
792 | 823 | ||
793 | objlist.Add(g); | 824 | objlist.Add(g); |
794 | XmlElement el = (XmlElement)n; | 825 | XmlElement el = (XmlElement)n; |
@@ -808,12 +839,35 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
808 | } | 839 | } |
809 | } | 840 | } |
810 | 841 | ||
842 | int primcount = 0; | ||
843 | foreach (SceneObjectGroup g in objlist) | ||
844 | primcount += g.PrimCount; | ||
845 | |||
846 | if (!m_Scene.Permissions.CanRezObject( | ||
847 | primcount, remoteClient.AgentId, pos) | ||
848 | && !attachment) | ||
849 | { | ||
850 | // The client operates in no fail mode. It will | ||
851 | // have already removed the item from the folder | ||
852 | // if it's no copy. | ||
853 | // Put it back if it's not an attachment | ||
854 | // | ||
855 | if (item != null) | ||
856 | { | ||
857 | if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment)) | ||
858 | remoteClient.SendBulkUpdateInventory(item); | ||
859 | } | ||
860 | |||
861 | return null; | ||
862 | } | ||
863 | |||
811 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) | 864 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) |
812 | return null; | 865 | return null; |
813 | 866 | ||
814 | for (int i = 0; i < objlist.Count; i++) | 867 | for (int i = 0; i < objlist.Count; i++) |
815 | { | 868 | { |
816 | group = objlist[i]; | 869 | group = objlist[i]; |
870 | SceneObjectPart rootPart = group.RootPart; | ||
817 | 871 | ||
818 | // m_log.DebugFormat( | 872 | // m_log.DebugFormat( |
819 | // "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", | 873 | // "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", |
@@ -874,8 +928,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
874 | 928 | ||
875 | if (!attachment) | 929 | if (!attachment) |
876 | { | 930 | { |
877 | SceneObjectPart rootPart = group.RootPart; | ||
878 | |||
879 | if (rootPart.Shape.PCode == (byte)PCode.Prim) | 931 | if (rootPart.Shape.PCode == (byte)PCode.Prim) |
880 | group.ClearPartAttachmentData(); | 932 | group.ClearPartAttachmentData(); |
881 | 933 | ||
@@ -893,6 +945,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
893 | // remoteClient.Name); | 945 | // remoteClient.Name); |
894 | } | 946 | } |
895 | 947 | ||
948 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
949 | |||
896 | if (item != null) | 950 | if (item != null) |
897 | DoPostRezWhenFromItem(item, attachment); | 951 | DoPostRezWhenFromItem(item, attachment); |
898 | 952 | ||
@@ -971,8 +1025,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
971 | { | 1025 | { |
972 | rootPart.Name = item.Name; | 1026 | rootPart.Name = item.Name; |
973 | rootPart.Description = item.Description; | 1027 | rootPart.Description = item.Description; |
974 | rootPart.ObjectSaleType = item.SaleType; | 1028 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) |
975 | rootPart.SalePrice = item.SalePrice; | 1029 | { |
1030 | rootPart.ObjectSaleType = item.SaleType; | ||
1031 | rootPart.SalePrice = item.SalePrice; | ||
1032 | } | ||
976 | } | 1033 | } |
977 | 1034 | ||
978 | so.FromFolderID = item.Folder; | 1035 | so.FromFolderID = item.Folder; |
@@ -982,7 +1039,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
982 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); | 1039 | // rootPart.OwnerID, item.Owner, item.CurrentPermissions); |
983 | 1040 | ||
984 | if ((rootPart.OwnerID != item.Owner) || | 1041 | if ((rootPart.OwnerID != item.Owner) || |
985 | (item.CurrentPermissions & 16) != 0) | 1042 | (item.CurrentPermissions & 16) != 0 || |
1043 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
986 | { | 1044 | { |
987 | //Need to kill the for sale here | 1045 | //Need to kill the for sale here |
988 | rootPart.ObjectSaleType = 0; | 1046 | rootPart.ObjectSaleType = 0; |
@@ -992,31 +1050,43 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
992 | { | 1050 | { |
993 | foreach (SceneObjectPart part in so.Parts) | 1051 | foreach (SceneObjectPart part in so.Parts) |
994 | { | 1052 | { |
995 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
996 | { | ||
997 | part.EveryoneMask = item.EveryOnePermissions; | ||
998 | part.NextOwnerMask = item.NextPermissions; | ||
999 | } | ||
1000 | part.GroupMask = 0; // DO NOT propagate here | 1053 | part.GroupMask = 0; // DO NOT propagate here |
1054 | |||
1055 | part.LastOwnerID = part.OwnerID; | ||
1056 | part.OwnerID = item.Owner; | ||
1057 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
1001 | } | 1058 | } |
1002 | 1059 | ||
1003 | so.ApplyNextOwnerPermissions(); | 1060 | so.ApplyNextOwnerPermissions(); |
1061 | |||
1062 | // In case the user has changed flags on a received item | ||
1063 | // we have to apply those changes after the slam. Else we | ||
1064 | // get a net loss of permissions | ||
1065 | foreach (SceneObjectPart part in so.Parts) | ||
1066 | { | ||
1067 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
1068 | { | ||
1069 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
1070 | part.EveryoneMask = item.EveryOnePermissions & part.BaseMask; | ||
1071 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
1072 | part.NextOwnerMask = item.NextPermissions & part.BaseMask; | ||
1073 | } | ||
1074 | } | ||
1004 | } | 1075 | } |
1005 | } | 1076 | } |
1006 | 1077 | else | |
1007 | foreach (SceneObjectPart part in so.Parts) | ||
1008 | { | 1078 | { |
1009 | part.FromUserInventoryItemID = fromUserInventoryItemId; | 1079 | foreach (SceneObjectPart part in so.Parts) |
1010 | |||
1011 | if ((part.OwnerID != item.Owner) || | ||
1012 | (item.CurrentPermissions & 16) != 0) | ||
1013 | { | 1080 | { |
1014 | part.Inventory.ChangeInventoryOwner(item.Owner); | 1081 | part.FromUserInventoryItemID = fromUserInventoryItemId; |
1015 | part.GroupMask = 0; // DO NOT propagate here | 1082 | |
1083 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
1084 | part.EveryoneMask = item.EveryOnePermissions; | ||
1085 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
1086 | part.NextOwnerMask = item.NextPermissions; | ||
1087 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
1088 | part.GroupMask = item.GroupPermissions; | ||
1016 | } | 1089 | } |
1017 | |||
1018 | part.EveryoneMask = item.EveryOnePermissions; | ||
1019 | part.NextOwnerMask = item.NextPermissions; | ||
1020 | } | 1090 | } |
1021 | 1091 | ||
1022 | rootPart.TrimPermissions(); | 1092 | rootPart.TrimPermissions(); |
@@ -1154,4 +1224,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1154 | 1224 | ||
1155 | #endregion | 1225 | #endregion |
1156 | } | 1226 | } |
1157 | } \ No newline at end of file | 1227 | } |