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