aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/InventoryAccess
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/CoreModules/Framework/InventoryAccess
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/InventoryAccess')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs263
1 files changed, 205 insertions, 58 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 5a9efb8..dff9126 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -178,27 +178,36 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
178 sbyte assetType, 178 sbyte assetType,
179 byte wearableType, uint nextOwnerMask, int creationDate) 179 byte wearableType, uint nextOwnerMask, int creationDate)
180 { 180 {
181 m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}", name, folderID); 181 m_log.DebugFormat("[INVENTORY ACCESS MODULE]: Received request to create inventory item {0} in folder {1}, transactionID {2}", name,
182 folderID, transactionID);
182 183
183 if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) 184 if (!m_Scene.Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
184 return; 185 return;
185 186
186 if (transactionID == UUID.Zero) 187 InventoryFolderBase f = new InventoryFolderBase(folderID, remoteClient.AgentId);
188 InventoryFolderBase folder = m_Scene.InventoryService.GetFolder(f);
189
190 if (folder == null || folder.Owner != remoteClient.AgentId)
191 return;
192
193 if (transactionID != UUID.Zero)
187 { 194 {
188 ScenePresence presence; 195 IAgentAssetTransactions agentTransactions = m_Scene.AgentTransactionsModule;
189 if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 196 if (agentTransactions != null)
190 { 197 {
191 byte[] data = null; 198 if (agentTransactions.HandleItemCreationFromTransaction(
199 remoteClient, transactionID, folderID, callbackID, description,
200 name, invType, assetType, wearableType, nextOwnerMask))
201 return;
202 }
203 }
192 204
193 if (invType == (sbyte)InventoryType.Landmark && presence != null) 205 ScenePresence presence;
194 { 206 if (m_Scene.TryGetScenePresence(remoteClient.AgentId, out presence))
195 string suffix = string.Empty, prefix = string.Empty; 207 {
196 string strdata = GenerateLandmark(presence, out prefix, out suffix); 208 byte[] data = null;
197 data = Encoding.ASCII.GetBytes(strdata);
198 name = prefix + name;
199 description += suffix;
200 }
201 209
210<<<<<<< HEAD
202 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); 211 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
203 m_Scene.AssetService.Store(asset); 212 m_Scene.AssetService.Store(asset);
204 m_Scene.CreateNewInventoryItem( 213 m_Scene.CreateNewInventoryItem(
@@ -206,21 +215,28 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
206 name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate); 215 name, description, 0, callbackID, asset.FullID, asset.Type, invType, nextOwnerMask, creationDate);
207 } 216 }
208 else 217 else
218=======
219 if (invType == (sbyte)InventoryType.Landmark && presence != null)
220>>>>>>> avn/ubitvar
209 { 221 {
210 m_log.ErrorFormat( 222 string suffix = string.Empty, prefix = string.Empty;
211 "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem", 223 string strdata = GenerateLandmark(presence, out prefix, out suffix);
212 remoteClient.AgentId); 224 data = Encoding.ASCII.GetBytes(strdata);
225 name = prefix + name;
226 description += suffix;
213 } 227 }
228
229 AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
230 m_Scene.AssetService.Store(asset);
231 m_Scene.CreateNewInventoryItem(
232 remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
233 name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate,transactionID);
214 } 234 }
215 else 235 else
216 { 236 {
217 IAgentAssetTransactions agentTransactions = m_Scene.AgentTransactionsModule; 237 m_log.ErrorFormat(
218 if (agentTransactions != null) 238 "[INVENTORY ACCESS MODULE]: ScenePresence for agent uuid {0} unexpectedly not found in CreateNewInventoryItem",
219 { 239 remoteClient.AgentId);
220 agentTransactions.HandleItemCreationFromTransaction(
221 remoteClient, transactionID, folderID, callbackID, description,
222 name, invType, assetType, wearableType, nextOwnerMask);
223 }
224 } 240 }
225 } 241 }
226 242
@@ -272,6 +288,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
272 288
273 remoteClient.SendAlertMessage("Script saved"); 289 remoteClient.SendAlertMessage("Script saved");
274 } 290 }
291 else if ((CustomInventoryType)item.InvType == CustomInventoryType.AnimationSet)
292 {
293 AnimationSet animSet = new AnimationSet(data);
294 if (!animSet.Validate(x => {
295 int perms = m_Scene.InventoryService.GetAssetPermissions(remoteClient.AgentId, x);
296 int required = (int)(PermissionMask.Transfer | PermissionMask.Copy);
297 if ((perms & required) != required)
298 return false;
299 return true;
300 }))
301 {
302 data = animSet.ToBytes();
303 }
304 }
275 305
276 AssetBase asset = 306 AssetBase asset =
277 CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString()); 307 CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data, remoteClient.AgentId.ToString());
@@ -380,7 +410,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
380 bool asAttachment) 410 bool asAttachment)
381 { 411 {
382 CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero); 412 CoalescedSceneObjects coa = new CoalescedSceneObjects(UUID.Zero);
383// Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); 413 Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
414 // this possible is not needed if keyframes are saved
415 Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>();
384 416
385 Dictionary<SceneObjectGroup, KeyframeMotion> group2Keyframe = new Dictionary<SceneObjectGroup, KeyframeMotion>(); 417 Dictionary<SceneObjectGroup, KeyframeMotion> group2Keyframe = new Dictionary<SceneObjectGroup, KeyframeMotion>();
386 418
@@ -388,6 +420,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
388 { 420 {
389 if (objectGroup.RootPart.KeyframeMotion != null) 421 if (objectGroup.RootPart.KeyframeMotion != null)
390 { 422 {
423<<<<<<< HEAD
391 objectGroup.RootPart.KeyframeMotion.Pause(); 424 objectGroup.RootPart.KeyframeMotion.Pause();
392 group2Keyframe.Add(objectGroup, objectGroup.RootPart.KeyframeMotion); 425 group2Keyframe.Add(objectGroup, objectGroup.RootPart.KeyframeMotion);
393 objectGroup.RootPart.KeyframeMotion = null; 426 objectGroup.RootPart.KeyframeMotion = null;
@@ -406,6 +439,48 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
406// originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition; 439// originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
407// 440//
408// objectGroup.AbsolutePosition = inventoryStoredPosition; 441// objectGroup.AbsolutePosition = inventoryStoredPosition;
442=======
443 objectGroup.RootPart.KeyframeMotion.Suspend();
444 }
445 objectGroup.RootPart.SetForce(Vector3.Zero);
446 objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false);
447
448 originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion;
449 objectGroup.RootPart.KeyframeMotion = null;
450
451 Vector3 inventoryStoredPosition = new Vector3
452 (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
453 ? 250
454 : objectGroup.AbsolutePosition.X)
455 ,
456 (objectGroup.AbsolutePosition.Y > (int)Constants.RegionSize)
457 ? 250
458 : objectGroup.AbsolutePosition.Y,
459 objectGroup.AbsolutePosition.Z);
460
461 Quaternion inventoryStoredRotation = objectGroup.GroupRotation;
462 originalPositions[objectGroup.UUID] = objectGroup.AbsolutePosition;
463
464 // Restore attachment data after trip through the sim
465 if (objectGroup.RootPart.AttachPoint > 0)
466 {
467 inventoryStoredPosition = objectGroup.RootPart.AttachedPos;
468 inventoryStoredRotation = objectGroup.RootPart.AttachRotation;
469 }
470
471 // Trees could be attached and it's been done, but it makes
472 // no sense. State must be preserved because it's the tree type
473 if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree &&
474 objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree)
475 {
476 objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint;
477 if (objectGroup.RootPart.AttachPoint > 0)
478 objectGroup.RootPart.Shape.LastAttachPoint = objectGroup.RootPart.AttachPoint;
479 }
480
481 objectGroup.AbsolutePosition = inventoryStoredPosition;
482 objectGroup.RootPart.RotationOffset = inventoryStoredRotation;
483>>>>>>> avn/ubitvar
409 484
410 // Make sure all bits but the ones we want are clear 485 // Make sure all bits but the ones we want are clear
411 // on take. 486 // on take.
@@ -433,9 +508,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
433 else 508 else
434 itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment); 509 itemXml = SceneObjectSerializer.ToOriginalXmlFormat(objlist[0], !asAttachment);
435 510
436// // Restore the position of each group now that it has been stored to inventory. 511 // Restore the position of each group now that it has been stored to inventory.
437// foreach (SceneObjectGroup objectGroup in objlist) 512 foreach (SceneObjectGroup objectGroup in objlist)
438// objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; 513 {
514 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
515 objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID];
516 if (objectGroup.RootPart.KeyframeMotion != null)
517 objectGroup.RootPart.KeyframeMotion.Resume();
518 }
439 519
440 InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID); 520 InventoryItemBase item = CreateItemForObject(action, remoteClient, objlist[0], folderID);
441 521
@@ -492,7 +572,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
492 item.Name = asset.Name; 572 item.Name = asset.Name;
493 item.AssetType = asset.Type; 573 item.AssetType = asset.Type;
494 574
495 AddPermissions(item, objlist[0], objlist, remoteClient); 575 //preserve perms on return
576 if(DeRezAction.Return == action)
577 AddPermissions(item, objlist[0], objlist, null);
578 else
579 AddPermissions(item, objlist[0], objlist, remoteClient);
496 580
497 m_Scene.AddInventoryItem(item); 581 m_Scene.AddInventoryItem(item);
498 582
@@ -542,16 +626,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
542 IClientAPI remoteClient) 626 IClientAPI remoteClient)
543 { 627 {
544 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7; 628 uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move | PermissionMask.Export) | 7;
545 uint allObjectsNextOwnerPerms = 0x7fffffff; 629 // For the porposes of inventory, an object is modify if the prims
546 uint allObjectsEveryOnePerms = 0x7fffffff; 630 // are modify. This allows renaming an object that contains no
547 uint allObjectsGroupPerms = 0x7fffffff; 631 // mod items.
548
549 foreach (SceneObjectGroup grp in objsForEffectivePermissions) 632 foreach (SceneObjectGroup grp in objsForEffectivePermissions)
550 { 633 {
551 effectivePerms &= grp.GetEffectivePermissions(); 634 uint groupPerms = grp.GetEffectivePermissions(true);
552 allObjectsNextOwnerPerms &= grp.RootPart.NextOwnerMask; 635 if ((grp.RootPart.BaseMask & (uint)PermissionMask.Modify) != 0)
553 allObjectsEveryOnePerms &= grp.RootPart.EveryoneMask; 636 groupPerms |= (uint)PermissionMask.Modify;
554 allObjectsGroupPerms &= grp.RootPart.GroupMask; 637
638 effectivePerms &= groupPerms;
555 } 639 }
556 effectivePerms |= (uint)PermissionMask.Move; 640 effectivePerms |= (uint)PermissionMask.Move;
557 641
@@ -565,11 +649,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
565 uint perms = effectivePerms; 649 uint perms = effectivePerms;
566 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms); 650 PermissionsUtil.ApplyFoldedPermissions(effectivePerms, ref perms);
567 651
568 item.BasePermissions = perms & allObjectsNextOwnerPerms; 652 item.BasePermissions = perms & so.RootPart.NextOwnerMask;
569 item.CurrentPermissions = item.BasePermissions; 653 item.CurrentPermissions = item.BasePermissions;
570 item.NextPermissions = perms & allObjectsNextOwnerPerms; 654 item.NextPermissions = perms & so.RootPart.NextOwnerMask;
571 item.EveryOnePermissions = allObjectsEveryOnePerms & allObjectsNextOwnerPerms; 655 item.EveryOnePermissions = so.RootPart.EveryoneMask & so.RootPart.NextOwnerMask;
572 item.GroupPermissions = allObjectsGroupPerms & allObjectsNextOwnerPerms; 656 item.GroupPermissions = so.RootPart.GroupMask & so.RootPart.NextOwnerMask;
573 657
574 // apply next owner perms on rez 658 // apply next owner perms on rez
575 item.CurrentPermissions |= SceneObjectGroup.SLAM; 659 item.CurrentPermissions |= SceneObjectGroup.SLAM;
@@ -585,9 +669,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
585 669
586 item.BasePermissions = effectivePerms; 670 item.BasePermissions = effectivePerms;
587 item.CurrentPermissions = effectivePerms; 671 item.CurrentPermissions = effectivePerms;
588 item.NextPermissions = allObjectsNextOwnerPerms & effectivePerms; 672 item.NextPermissions = so.RootPart.NextOwnerMask & effectivePerms;
589 item.EveryOnePermissions = allObjectsEveryOnePerms & effectivePerms; 673 item.EveryOnePermissions = so.RootPart.EveryoneMask & effectivePerms;
590 item.GroupPermissions = allObjectsGroupPerms & effectivePerms; 674 item.GroupPermissions = so.RootPart.GroupMask & effectivePerms;
591 675
592 item.CurrentPermissions &= 676 item.CurrentPermissions &=
593 ((uint)PermissionMask.Copy | 677 ((uint)PermissionMask.Copy |
@@ -743,7 +827,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
743 if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId) 827 if (so.FromFolderID != UUID.Zero && so.RootPart.OwnerID == remoteClient.AgentId)
744 { 828 {
745 InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); 829 InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID);
746 folder = m_Scene.InventoryService.GetFolder(f); 830 if (f != null)
831 folder = m_Scene.InventoryService.GetFolder(f);
747 832
748 if(folder.Type == 14 || folder.Type == 16) 833 if(folder.Type == 14 || folder.Type == 16)
749 { 834 {
@@ -779,16 +864,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
779 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) 864 bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
780 { 865 {
781// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); 866// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
782
783 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 867 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
784 item = m_Scene.InventoryService.GetItem(item); 868 item = m_Scene.InventoryService.GetItem(item);
785 869
786 if (item == null) 870 if (item == null)
787 { 871 {
788 m_log.WarnFormat(
789 "[INVENTORY ACCESS MODULE]: Could not find item {0} for {1} in RezObject()",
790 itemID, remoteClient.Name);
791
792 return null; 872 return null;
793 } 873 }
794 874
@@ -856,12 +936,35 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
856 pos -= bbox / 2; 936 pos -= bbox / 2;
857 } 937 }
858 938
939 int primcount = 0;
940 foreach (SceneObjectGroup g in objlist)
941 primcount += g.PrimCount;
942
943 if (!m_Scene.Permissions.CanRezObject(
944 primcount, remoteClient.AgentId, pos)
945 && !attachment)
946 {
947 // The client operates in no fail mode. It will
948 // have already removed the item from the folder
949 // if it's no copy.
950 // Put it back if it's not an attachment
951 //
952 if (item != null)
953 {
954 if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment))
955 remoteClient.SendBulkUpdateInventory(item);
956 }
957
958 return null;
959 }
960
859 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, veclist, attachment)) 961 if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, veclist, attachment))
860 return null; 962 return null;
861 963
862 for (int i = 0; i < objlist.Count; i++) 964 for (int i = 0; i < objlist.Count; i++)
863 { 965 {
864 group = objlist[i]; 966 group = objlist[i];
967 SceneObjectPart rootPart = group.RootPart;
865 968
866// m_log.DebugFormat( 969// m_log.DebugFormat(
867// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", 970// "[INVENTORY ACCESS MODULE]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
@@ -909,7 +1012,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
909 1012
910 if (attachment) 1013 if (attachment)
911 { 1014 {
912 group.RootPart.Flags |= PrimFlags.Phantom; 1015// group.RootPart.Flags |= PrimFlags.Phantom;
913 group.IsAttachment = true; 1016 group.IsAttachment = true;
914 } 1017 }
915 1018
@@ -934,8 +1037,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
934 1037
935 if (!attachment) 1038 if (!attachment)
936 { 1039 {
937 SceneObjectPart rootPart = group.RootPart;
938
939 if (rootPart.Shape.PCode == (byte)PCode.Prim) 1040 if (rootPart.Shape.PCode == (byte)PCode.Prim)
940 group.ClearPartAttachmentData(); 1041 group.ClearPartAttachmentData();
941 1042
@@ -953,6 +1054,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
953// remoteClient.Name); 1054// remoteClient.Name);
954 } 1055 }
955 1056
1057 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
1058
956 if (item != null) 1059 if (item != null)
957 DoPostRezWhenFromItem(item, attachment); 1060 DoPostRezWhenFromItem(item, attachment);
958 1061
@@ -1033,10 +1136,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
1033 // object itself before we rez. 1136 // object itself before we rez.
1034 // 1137 //
1035 // Only do these for the first object if we are rezzing a coalescence. 1138 // Only do these for the first object if we are rezzing a coalescence.
1036 if (i == 0) 1139 // nahh dont mess with coalescence objects,
1140 // the name in inventory can be change for inventory purpuses only
1141 if (objlist.Count == 1)
1037 { 1142 {
1038 rootPart.Name = item.Name; 1143 rootPart.Name = item.Name;
1039 rootPart.Description = item.Description; 1144 rootPart.Description = item.Description;
1145 }
1146
1147 if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0)
1148 {
1040 rootPart.ObjectSaleType = item.SaleType; 1149 rootPart.ObjectSaleType = item.SaleType;
1041 rootPart.SalePrice = item.SalePrice; 1150 rootPart.SalePrice = item.SalePrice;
1042 } 1151 }
@@ -1047,17 +1156,55 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
1047// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", 1156// "[INVENTORY ACCESS MODULE]: rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
1048// rootPart.OwnerID, item.Owner, item.CurrentPermissions); 1157// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
1049 1158
1050 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & SceneObjectGroup.SLAM) != 0) 1159 if ((rootPart.OwnerID != item.Owner) ||
1160 (item.CurrentPermissions & 16) != 0 ||
1161 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
1051 { 1162 {
1052 //Need to kill the for sale here 1163 //Need to kill the for sale here
1053 rootPart.ObjectSaleType = 0; 1164 rootPart.ObjectSaleType = 0;
1054 rootPart.SalePrice = 10; 1165 rootPart.SalePrice = 10;
1055 } 1166
1167 if (m_Scene.Permissions.PropagatePermissions())
1168 {
1169 foreach (SceneObjectPart part in so.Parts)
1170 {
1171 part.GroupMask = 0; // DO NOT propagate here
1056 1172
1057 foreach (SceneObjectPart part in so.Parts) 1173 part.LastOwnerID = part.OwnerID;
1174 part.OwnerID = item.Owner;
1175 part.Inventory.ChangeInventoryOwner(item.Owner);
1176 }
1177
1178 so.ApplyNextOwnerPermissions();
1179
1180 // In case the user has changed flags on a received item
1181 // we have to apply those changes after the slam. Else we
1182 // get a net loss of permissions
1183 foreach (SceneObjectPart part in so.Parts)
1184 {
1185 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
1186 {
1187 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
1188 part.EveryoneMask = item.EveryOnePermissions & part.BaseMask;
1189 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
1190 part.NextOwnerMask = item.NextPermissions & part.BaseMask;
1191 }
1192 }
1193 }
1194 }
1195 else
1058 { 1196 {
1059 part.FromUserInventoryItemID = fromUserInventoryItemId; 1197 foreach (SceneObjectPart part in so.Parts)
1060 part.ApplyPermissionsOnRez(item, true, m_Scene); 1198 {
1199 part.FromUserInventoryItemID = fromUserInventoryItemId;
1200
1201 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
1202 part.EveryoneMask = item.EveryOnePermissions;
1203 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
1204 part.NextOwnerMask = item.NextPermissions;
1205 if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
1206 part.GroupMask = item.GroupPermissions;
1207 }
1061 } 1208 }
1062 1209
1063 rootPart.TrimPermissions(); 1210 rootPart.TrimPermissions();