aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-09-02 00:25:05 +0100
committerJustin Clark-Casey (justincc)2011-09-02 00:25:05 +0100
commit15ea82e925af419f811a3c8c603bdc1e9103d22c (patch)
treec6367311b296aa174e9a7cbdd6a663a12b3e9ed9
parentfactor out a section of IAM.RezObject() into DoPreRezWhenFromItem() (diff)
downloadopensim-SC_OLD-15ea82e925af419f811a3c8c603bdc1e9103d22c.zip
opensim-SC_OLD-15ea82e925af419f811a3c8c603bdc1e9103d22c.tar.gz
opensim-SC_OLD-15ea82e925af419f811a3c8c603bdc1e9103d22c.tar.bz2
opensim-SC_OLD-15ea82e925af419f811a3c8c603bdc1e9103d22c.tar.xz
move more of IAM.RezObject() into DoPreRezWhenFromItem()
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs148
1 files changed, 85 insertions, 63 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 9bc7a09..e94d059 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -803,24 +803,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
803 } 803 }
804 } 804 }
805 805
806 int primcount = 0; 806 if (!DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment))
807 foreach (SceneObjectGroup g in objlist)
808 primcount += g.PrimCount;
809
810 if (!m_Scene.Permissions.CanRezObject(
811 primcount, remoteClient.AgentId, pos)
812 && !attachment)
813 {
814 // The client operates in no fail mode. It will
815 // have already removed the item from the folder
816 // if it's no copy.
817 // Put it back if it's not an attachment
818 //
819 if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!attachment))
820 remoteClient.SendBulkUpdateInventory(item);
821
822 return null; 807 return null;
823 }
824 808
825 for (int i = 0; i < objlist.Count; i++) 809 for (int i = 0; i < objlist.Count; i++)
826 { 810 {
@@ -829,7 +813,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
829// Vector3 storedPosition = group.AbsolutePosition; 813// Vector3 storedPosition = group.AbsolutePosition;
830 if (group.UUID == UUID.Zero) 814 if (group.UUID == UUID.Zero)
831 { 815 {
832 m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3"); 816 m_log.Debug("[InventoryAccessModule]: Object has UUID.Zero! Position 3");
833 } 817 }
834 818
835 // If it's rezzed in world, select it. Much easier to 819 // If it's rezzed in world, select it. Much easier to
@@ -873,24 +857,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
873 857
874 SceneObjectPart rootPart = group.RootPart; 858 SceneObjectPart rootPart = group.RootPart;
875 859
876 // Since renaming the item in the inventory does not
877 // affect the name stored in the serialization, transfer
878 // the correct name from the inventory to the
879 // object itself before we rez.
880 //
881 // Only do these for the first object if we are rezzing a coalescence.
882 if (i == 0)
883 {
884 rootPart.Name = item.Name;
885 rootPart.Description = item.Description;
886 rootPart.ObjectSaleType = item.SaleType;
887 rootPart.SalePrice = item.SalePrice;
888 }
889
890 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 860 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
891 861
892 DoPreRezWhenFromItem(item, group);
893
894 if (!attachment) 862 if (!attachment)
895 { 863 {
896 if (group.RootPart.Shape.PCode == (byte)PCode.Prim) 864 if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
@@ -913,52 +881,106 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
913 return group; 881 return group;
914 } 882 }
915 883
916 private void DoPreRezWhenFromItem(InventoryItemBase item, SceneObjectGroup so) 884 /// <summary>
885 /// Do pre-rez processing when the object comes from an item.
886 /// </summary>
887 /// <param name="remoteClient"></param>
888 /// <param name="item"></param>
889 /// <param name="objlist"></param>
890 /// <param name="pos"></param>
891 /// <param name="isAttachment"></param>
892 /// <returns>true if we can processed with rezzing, false if we need to abort</returns>
893 private bool DoPreRezWhenFromItem(
894 IClientAPI remoteClient, InventoryItemBase item, List<SceneObjectGroup> objlist, Vector3 pos, bool isAttachment)
917 { 895 {
918 so.RootPart.FromFolderID = item.Folder; 896 int primcount = 0;
897 foreach (SceneObjectGroup g in objlist)
898 primcount += g.PrimCount;
899
900 if (!m_Scene.Permissions.CanRezObject(
901 primcount, remoteClient.AgentId, pos)
902 && !isAttachment)
903 {
904 // The client operates in no fail mode. It will
905 // have already removed the item from the folder
906 // if it's no copy.
907 // Put it back if it's not an attachment
908 //
909 if (((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) && (!isAttachment))
910 remoteClient.SendBulkUpdateInventory(item);
919 911
920 SceneObjectPart rootPart = so.RootPart; 912 return false;
913 }
921 914
922 if ((rootPart.OwnerID != item.Owner) || 915 for (int i = 0; i < objlist.Count; i++)
923 (item.CurrentPermissions & 16) != 0)
924 { 916 {
925 //Need to kill the for sale here 917 SceneObjectGroup so = objlist[i];
926 rootPart.ObjectSaleType = 0; 918 SceneObjectPart rootPart = so.RootPart;
927 rootPart.SalePrice = 10; 919
920 // Since renaming the item in the inventory does not
921 // affect the name stored in the serialization, transfer
922 // the correct name from the inventory to the
923 // object itself before we rez.
924 //
925 // Only do these for the first object if we are rezzing a coalescence.
926 if (i == 0)
927 {
928 rootPart.Name = item.Name;
929 rootPart.Description = item.Description;
930 rootPart.ObjectSaleType = item.SaleType;
931 rootPart.SalePrice = item.SalePrice;
932 }
928 933
929 if (m_Scene.Permissions.PropagatePermissions()) 934 rootPart.FromFolderID = item.Folder;
935
936 if ((rootPart.OwnerID != item.Owner) ||
937 (item.CurrentPermissions & 16) != 0)
930 { 938 {
931 foreach (SceneObjectPart part in so.Parts) 939 //Need to kill the for sale here
940 rootPart.ObjectSaleType = 0;
941 rootPart.SalePrice = 10;
942
943 if (m_Scene.Permissions.PropagatePermissions())
932 { 944 {
933 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) 945 foreach (SceneObjectPart part in so.Parts)
934 { 946 {
935 part.EveryoneMask = item.EveryOnePermissions; 947 if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
936 part.NextOwnerMask = item.NextPermissions; 948 {
949 part.EveryoneMask = item.EveryOnePermissions;
950 part.NextOwnerMask = item.NextPermissions;
951 }
952 part.GroupMask = 0; // DO NOT propagate here
937 } 953 }
938 part.GroupMask = 0; // DO NOT propagate here 954
955 so.ApplyNextOwnerPermissions();
939 } 956 }
940
941 so.ApplyNextOwnerPermissions();
942 } 957 }
943 } 958
944 959 foreach (SceneObjectPart part in so.Parts)
945 foreach (SceneObjectPart part in so.Parts)
946 {
947 if ((part.OwnerID != item.Owner) ||
948 (item.CurrentPermissions & 16) != 0)
949 { 960 {
950 part.LastOwnerID = part.OwnerID; 961 if ((part.OwnerID != item.Owner) ||
951 part.OwnerID = item.Owner; 962 (item.CurrentPermissions & 16) != 0)
952 part.Inventory.ChangeInventoryOwner(item.Owner); 963 {
953 part.GroupMask = 0; // DO NOT propagate here 964 part.LastOwnerID = part.OwnerID;
965 part.OwnerID = item.Owner;
966 part.Inventory.ChangeInventoryOwner(item.Owner);
967 part.GroupMask = 0; // DO NOT propagate here
968 }
969 part.EveryoneMask = item.EveryOnePermissions;
970 part.NextOwnerMask = item.NextPermissions;
954 } 971 }
955 part.EveryoneMask = item.EveryOnePermissions; 972
956 part.NextOwnerMask = item.NextPermissions; 973 rootPart.TrimPermissions();
957 } 974 }
958 975
959 rootPart.TrimPermissions(); 976 return true;
960 } 977 }
961 978
979 /// <summary>
980 /// Do post-rez processing when the object comes from an item.
981 /// </summary>
982 /// <param name="item"></param>
983 /// <param name="isAttachment"></param>
962 private void DoPostRezWhenFromItem(InventoryItemBase item, bool isAttachment) 984 private void DoPostRezWhenFromItem(InventoryItemBase item, bool isAttachment)
963 { 985 {
964 if (!m_Scene.Permissions.BypassPermissions()) 986 if (!m_Scene.Permissions.BypassPermissions())