aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs9
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs10
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs2
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs17
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs30
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs23
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs3
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs8
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs11
15 files changed, 123 insertions, 33 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index cf0c28b..be699db 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -422,7 +422,7 @@ namespace OpenSim.Region.ClientStack.Linden
422 string assetType) 422 string assetType)
423 { 423 {
424 m_log.DebugFormat( 424 m_log.DebugFormat(
425 "Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}", 425 "[BUNCH OF CAPS]: Uploaded asset {0} for inventory item {1}, inv type {2}, asset type {3}",
426 assetID, inventoryItem, inventoryType, assetType); 426 assetID, inventoryItem, inventoryType, assetType);
427 427
428 sbyte assType = 0; 428 sbyte assType = 0;
@@ -625,7 +625,12 @@ namespace OpenSim.Region.ClientStack.Linden
625 item.AssetType = assType; 625 item.AssetType = assType;
626 item.InvType = inType; 626 item.InvType = inType;
627 item.Folder = parentFolder; 627 item.Folder = parentFolder;
628 item.CurrentPermissions = (uint)PermissionMask.All; 628
629 // If we set PermissionMask.All then when we rez the item the next permissions will replace the current
630 // (owner) permissions. This becomes a problem if next permissions are changed.
631 item.CurrentPermissions
632 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
633
629 item.BasePermissions = (uint)PermissionMask.All; 634 item.BasePermissions = (uint)PermissionMask.All;
630 item.EveryOnePermissions = 0; 635 item.EveryOnePermissions = 0;
631 item.NextPermissions = (uint)PermissionMask.All; 636 item.NextPermissions = (uint)PermissionMask.All;
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
index aed03b3..1117f2a 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/NewFileAgentInventoryVariablePriceModule.cs
@@ -50,8 +50,7 @@ namespace OpenSim.Region.ClientStack.Linden
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule 51 public class NewFileAgentInventoryVariablePriceModule : INonSharedRegionModule
52 { 52 {
53// private static readonly ILog m_log = 53// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 54
56 private Scene m_scene; 55 private Scene m_scene;
57// private IAssetService m_assetService; 56// private IAssetService m_assetService;
@@ -210,6 +209,9 @@ namespace OpenSim.Region.ClientStack.Linden
210 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, 209 UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType,
211 string assetType,UUID AgentID) 210 string assetType,UUID AgentID)
212 { 211 {
212// m_log.DebugFormat(
213// "[NEW FILE AGENT INVENTORY VARIABLE PRICE MODULE]: Upload complete for {0}", inventoryItem);
214
213 sbyte assType = 0; 215 sbyte assType = 0;
214 sbyte inType = 0; 216 sbyte inType = 0;
215 217
@@ -259,13 +261,13 @@ namespace OpenSim.Region.ClientStack.Linden
259 item.AssetType = assType; 261 item.AssetType = assType;
260 item.InvType = inType; 262 item.InvType = inType;
261 item.Folder = parentFolder; 263 item.Folder = parentFolder;
262 item.CurrentPermissions = (uint)PermissionMask.All; 264 item.CurrentPermissions
265 = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
263 item.BasePermissions = (uint)PermissionMask.All; 266 item.BasePermissions = (uint)PermissionMask.All;
264 item.EveryOnePermissions = 0; 267 item.EveryOnePermissions = 0;
265 item.NextPermissions = (uint)PermissionMask.All; 268 item.NextPermissions = (uint)PermissionMask.All;
266 item.CreationDate = Util.UnixTimeSinceEpoch(); 269 item.CreationDate = Util.UnixTimeSinceEpoch();
267 m_scene.AddInventoryItem(item); 270 m_scene.AddInventoryItem(item);
268
269 } 271 }
270 } 272 }
271} 273}
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
index e4bacd4..7a3d97e 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/ObjectCaps/UploadObjectAssetModule.cs
@@ -339,7 +339,7 @@ namespace OpenSim.Region.ClientStack.Linden
339 m_scene.AddSceneObject(grp); 339 m_scene.AddSceneObject(grp);
340 grp.AbsolutePosition = obj.Position; 340 grp.AbsolutePosition = obj.Position;
341 } 341 }
342 342
343 allparts[i] = grp; 343 allparts[i] = grp;
344 } 344 }
345 345
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index f019a83..c20f7b2 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -5168,7 +5168,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5168 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false); 5168 AddLocalPacketHandler(PacketType.ImprovedInstantMessage, HandlerImprovedInstantMessage, false);
5169 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship); 5169 AddLocalPacketHandler(PacketType.AcceptFriendship, HandlerAcceptFriendship);
5170 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship); 5170 AddLocalPacketHandler(PacketType.DeclineFriendship, HandlerDeclineFriendship);
5171 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFrendship); 5171 AddLocalPacketHandler(PacketType.TerminateFriendship, HandlerTerminateFriendship);
5172 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject); 5172 AddLocalPacketHandler(PacketType.RezObject, HandlerRezObject);
5173 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject); 5173 AddLocalPacketHandler(PacketType.DeRezObject, HandlerDeRezObject);
5174 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand); 5174 AddLocalPacketHandler(PacketType.ModifyLand, HandlerModifyLand);
@@ -5891,7 +5891,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5891 return true; 5891 return true;
5892 } 5892 }
5893 5893
5894 private bool HandlerTerminateFrendship(IClientAPI sender, Packet Pack) 5894 private bool HandlerTerminateFriendship(IClientAPI sender, Packet Pack)
5895 { 5895 {
5896 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; 5896 TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
5897 5897
@@ -5906,13 +5906,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5906 5906
5907 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID; 5907 UUID listOwnerAgentID = tfriendpack.AgentData.AgentID;
5908 UUID exFriendID = tfriendpack.ExBlock.OtherID; 5908 UUID exFriendID = tfriendpack.ExBlock.OtherID;
5909 5909 FriendshipTermination TerminateFriendshipHandler = OnTerminateFriendship;
5910 FriendshipTermination handlerTerminateFriendship = OnTerminateFriendship; 5910 if (TerminateFriendshipHandler != null)
5911 if (handlerTerminateFriendship != null)
5912 { 5911 {
5913 handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); 5912 TerminateFriendshipHandler(this, listOwnerAgentID, exFriendID);
5913 return true;
5914 } 5914 }
5915 return true; 5915 return false;
5916 } 5916 }
5917 5917
5918 private bool HandleFindAgent(IClientAPI client, Packet Packet) 5918 private bool HandleFindAgent(IClientAPI client, Packet Packet)
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index fe75271..a47bc9a 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -830,6 +830,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
830 group = objlist[i]; 830 group = objlist[i];
831 SceneObjectPart rootPart = group.RootPart; 831 SceneObjectPart rootPart = group.RootPart;
832 832
833// m_log.DebugFormat(
834// "[InventoryAccessModule]: Preparing to rez {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
835// group.Name, group.LocalId, group.UUID,
836// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
837// remoteClient.Name);
838
833// Vector3 storedPosition = group.AbsolutePosition; 839// Vector3 storedPosition = group.AbsolutePosition;
834 if (group.UUID == UUID.Zero) 840 if (group.UUID == UUID.Zero)
835 { 841 {
@@ -892,6 +898,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
892 898
893 rootPart.ScheduleFullUpdate(); 899 rootPart.ScheduleFullUpdate();
894 } 900 }
901
902// m_log.DebugFormat(
903// "[InventoryAccessModule]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
904// group.Name, group.LocalId, group.UUID,
905// group.RootPart.OwnerMask, group.RootPart.NextOwnerMask, group.RootPart.GroupMask, group.RootPart.EveryoneMask,
906// remoteClient.Name);
895 } 907 }
896 908
897 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 909 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
@@ -958,7 +970,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
958 } 970 }
959 971
960 rootPart.FromFolderID = item.Folder; 972 rootPart.FromFolderID = item.Folder;
961 973
974// Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}",
975// rootPart.OwnerID, item.Owner, item.CurrentPermissions);
976
962 if ((rootPart.OwnerID != item.Owner) || 977 if ((rootPart.OwnerID != item.Owner) ||
963 (item.CurrentPermissions & 16) != 0 || 978 (item.CurrentPermissions & 16) != 0 ||
964 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) 979 (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 2731291..dc3ff89 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Framework.Interfaces
58 /// </param> 58 /// </param>
59 /// <param name="scene"></param> 59 /// <param name="scene"></param>
60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param> 60 /// <param name="appearance">The avatar appearance to use for the new NPC.</param>
61 /// <returns>The UUID of the ScenePresence created.</returns> 61 /// <returns>The UUID of the ScenePresence created. UUID.Zero if there was a failure.</returns>
62 UUID CreateNPC( 62 UUID CreateNPC(
63 string firstname, 63 string firstname,
64 string lastname, 64 string lastname,
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 58de44e..fff39fb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -330,6 +330,12 @@ namespace OpenSim.Region.Framework.Scenes
330 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255); 330 item.Flags = (item.Flags & ~(uint)255) | (itemUpd.Flags & (uint)255);
331 item.Name = itemUpd.Name; 331 item.Name = itemUpd.Name;
332 item.Description = itemUpd.Description; 332 item.Description = itemUpd.Description;
333
334// m_log.DebugFormat(
335// "[USER INVENTORY]: itemUpd {0} {1} {2} {3}, item {4} {5} {6} {7}",
336// itemUpd.NextPermissions, itemUpd.GroupPermissions, itemUpd.EveryOnePermissions, item.Flags,
337// item.NextPermissions, item.GroupPermissions, item.EveryOnePermissions, item.CurrentPermissions);
338
333 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions)) 339 if (item.NextPermissions != (itemUpd.NextPermissions & item.BasePermissions))
334 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner; 340 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteNextOwner;
335 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; 341 item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions;
@@ -338,6 +344,9 @@ namespace OpenSim.Region.Framework.Scenes
338 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; 344 item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions;
339 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions)) 345 if (item.GroupPermissions != (itemUpd.GroupPermissions & item.BasePermissions))
340 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup; 346 item.Flags |= (uint)InventoryItemFlags.ObjectOverwriteGroup;
347
348// m_log.DebugFormat("[USER INVENTORY]: item.Flags {0}", item.Flags);
349
341 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; 350 item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions;
342 item.GroupID = itemUpd.GroupID; 351 item.GroupID = itemUpd.GroupID;
343 item.GroupOwned = itemUpd.GroupOwned; 352 item.GroupOwned = itemUpd.GroupOwned;
@@ -2310,8 +2319,25 @@ namespace OpenSim.Region.Framework.Scenes
2310 m_sceneGraph.DelinkObjects(parts); 2319 m_sceneGraph.DelinkObjects(parts);
2311 } 2320 }
2312 2321
2322 /// <summary>
2323 /// Link the scene objects containing the indicated parts to a root object.
2324 /// </summary>
2325 /// <param name="client"></param>
2326 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2327 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2313 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) 2328 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
2314 { 2329 {
2330 LinkObjects(client.AgentId, parentPrimId, childPrimIds);
2331 }
2332
2333 /// <summary>
2334 /// Link the scene objects containing the indicated parts to a root object.
2335 /// </summary>
2336 /// <param name="agentId">The ID of the user linking.</param>
2337 /// <param name="parentPrimId">A root prim id of the object which will be the root prim of the resulting linkset.</param>
2338 /// <param name="childPrimIds">A list of child prims for the objects that should be linked in.</param>
2339 public void LinkObjects(UUID agentId, uint parentPrimId, List<uint> childPrimIds)
2340 {
2315 List<UUID> owners = new List<UUID>(); 2341 List<UUID> owners = new List<UUID>();
2316 2342
2317 List<SceneObjectPart> children = new List<SceneObjectPart>(); 2343 List<SceneObjectPart> children = new List<SceneObjectPart>();
@@ -2323,7 +2349,7 @@ namespace OpenSim.Region.Framework.Scenes
2323 return; 2349 return;
2324 } 2350 }
2325 2351
2326 if (!Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) 2352 if (!Permissions.CanLinkObject(agentId, root.ParentGroup.RootPart.UUID))
2327 { 2353 {
2328 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim"); 2354 m_log.DebugFormat("[LINK]: Refusing link. No permissions on root prim");
2329 return; 2355 return;
@@ -2339,7 +2365,7 @@ namespace OpenSim.Region.Framework.Scenes
2339 if (!owners.Contains(part.OwnerID)) 2365 if (!owners.Contains(part.OwnerID))
2340 owners.Add(part.OwnerID); 2366 owners.Add(part.OwnerID);
2341 2367
2342 if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) 2368 if (Permissions.CanLinkObject(agentId, part.ParentGroup.RootPart.UUID))
2343 children.Add(part); 2369 children.Add(part);
2344 } 2370 }
2345 2371
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 17563bd..6dd42dd 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1751,6 +1751,10 @@ namespace OpenSim.Region.Framework.Scenes
1751 { 1751 {
1752 SceneObjectGroup child = children[i].ParentGroup; 1752 SceneObjectGroup child = children[i].ParentGroup;
1753 1753
1754 // Don't try and add a group to itself - this will only cause severe problems later on.
1755 if (child == parentGroup)
1756 continue;
1757
1754 // Make sure no child prim is set for sale 1758 // Make sure no child prim is set for sale
1755 // So that, on delink, no prims are unwittingly 1759 // So that, on delink, no prims are unwittingly
1756 // left for sale and sold off 1760 // left for sale and sold off
@@ -1777,8 +1781,13 @@ namespace OpenSim.Region.Framework.Scenes
1777 1781
1778 // We need to explicitly resend the newly link prim's object properties since no other actions 1782 // We need to explicitly resend the newly link prim's object properties since no other actions
1779 // occur on link to invoke this elsewhere (such as object selection) 1783 // occur on link to invoke this elsewhere (such as object selection)
1780 parentGroup.RootPart.CreateSelected = true; 1784 if (childGroups.Count > 0)
1781 parentGroup.TriggerScriptChangedEvent(Changed.LINK); 1785 {
1786 parentGroup.RootPart.CreateSelected = true;
1787 parentGroup.TriggerScriptChangedEvent(Changed.LINK);
1788 parentGroup.HasGroupChanged = true;
1789 parentGroup.ScheduleGroupForFullUpdate();
1790 }
1782 } 1791 }
1783 finally 1792 finally
1784 { 1793 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index b56d3fc..f3660a5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -269,6 +269,8 @@ namespace OpenSim.Region.Framework.Scenes
269 269
270 public void ApplyNextOwnerPermissions() 270 public void ApplyNextOwnerPermissions()
271 { 271 {
272// m_log.DebugFormat("[PRIM INVENTORY]: Applying next owner permissions to {0} {1}", Name, UUID);
273
272 SceneObjectPart[] parts = m_parts.GetArray(); 274 SceneObjectPart[] parts = m_parts.GetArray();
273 for (int i = 0; i < parts.Length; i++) 275 for (int i = 0; i < parts.Length; i++)
274 parts[i].ApplyNextOwnerPermissions(); 276 parts[i].ApplyNextOwnerPermissions();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 2a3d735..9961438 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2377,6 +2377,10 @@ namespace OpenSim.Region.Framework.Scenes
2377// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}", 2377// "[SCENE OBJECT GROUP]: Linking group with root part {0}, {1} to group with root part {2}, {3}",
2378// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID); 2378// objectGroup.RootPart.Name, objectGroup.RootPart.UUID, RootPart.Name, RootPart.UUID);
2379 2379
2380 // Linking to ourselves is not a valid operation.
2381 if (objectGroup == this)
2382 return;
2383
2380 SceneObjectPart linkPart = objectGroup.m_rootPart; 2384 SceneObjectPart linkPart = objectGroup.m_rootPart;
2381 2385
2382 Vector3 oldGroupPosition = linkPart.GroupPosition; 2386 Vector3 oldGroupPosition = linkPart.GroupPosition;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index a2332bb..be5b4a8 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -39,14 +39,31 @@ using log4net;
39 39
40namespace OpenSim.Region.Framework.Scenes.Tests 40namespace OpenSim.Region.Framework.Scenes.Tests
41{ 41{
42 /// <summary>
43 /// Linking tests
44 /// </summary>
45 [TestFixture] 42 [TestFixture]
46 public class SceneObjectLinkingTests 43 public class SceneObjectLinkingTests
47 { 44 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 46
47 /// <summary>
48 /// Links to self should be ignored.
49 /// </summary>
50 [Test]
51 public void TestLinkToSelf()
52 {
53 TestHelpers.InMethod();
54
55 UUID ownerId = TestHelpers.ParseTail(0x1);
56 int nParts = 3;
57
58 TestScene scene = SceneHelpers.SetupScene();
59 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(nParts, ownerId, "TestLinkToSelf_", 0x10);
60 scene.AddSceneObject(sog1);
61 scene.LinkObjects(ownerId, sog1.LocalId, new List<uint>() { sog1.Parts[1].LocalId });
62// sog1.LinkToGroup(sog1);
63
64 Assert.That(sog1.Parts.Length, Is.EqualTo(nParts));
65 }
66
50 [Test] 67 [Test]
51 public void TestLinkDelink2SceneObjects() 68 public void TestLinkDelink2SceneObjects()
52 { 69 {
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 03b52c0..d0b822c 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
44 private readonly string m_firstname; 44 private readonly string m_firstname;
45 private readonly string m_lastname; 45 private readonly string m_lastname;
46 private readonly Vector3 m_startPos; 46 private readonly Vector3 m_startPos;
47 private readonly UUID m_uuid = UUID.Random(); 47 private UUID m_uuid = UUID.Random();
48 private readonly Scene m_scene; 48 private readonly Scene m_scene;
49 private readonly UUID m_ownerID; 49 private readonly UUID m_ownerID;
50 50
@@ -444,6 +444,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
444 public virtual UUID AgentId 444 public virtual UUID AgentId
445 { 445 {
446 get { return m_uuid; } 446 get { return m_uuid; }
447 set { m_uuid = value; }
447 } 448 }
448 449
449 public UUID SessionId 450 public UUID SessionId
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 3ea7352..6803644 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -155,20 +155,21 @@ namespace OpenSim.Region.OptionalModules.World.NPC
155 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); 155 "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID);
156 156
157 sp.CompleteMovement(npcAvatar, false); 157 sp.CompleteMovement(npcAvatar, false);
158 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
158 } 159 }
159 else 160 else
160 { 161 {
161 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); 162 m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID);
163 npcAvatar.AgentId = UUID.Zero;
162 } 164 }
163 165
164 m_avatars.Add(npcAvatar.AgentId, npcAvatar);
165 } 166 }
166 ev.Set(); 167 ev.Set();
167 }); 168 });
168 169
169 ev.WaitOne(); 170 ev.WaitOne();
170 171
171 m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); 172// m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId);
172 173
173 return npcAvatar.AgentId; 174 return npcAvatar.AgentId;
174 } 175 }
@@ -299,13 +300,16 @@ namespace OpenSim.Region.OptionalModules.World.NPC
299 NPCAvatar av; 300 NPCAvatar av;
300 if (m_avatars.TryGetValue(agentID, out av)) 301 if (m_avatars.TryGetValue(agentID, out av))
301 { 302 {
303// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name);
302 scene.RemoveClient(agentID, false); 304 scene.RemoveClient(agentID, false);
303 m_avatars.Remove(agentID); 305 m_avatars.Remove(agentID);
304 306
307// m_log.DebugFormat("[NPC MODULE]: Removed {0} {1}", agentID, av.Name);
305 return true; 308 return true;
306 } 309 }
307 } 310 }
308 311
312// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID);
309 return false; 313 return false;
310 } 314 }
311 315
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 34f2cc7..da2ef7b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -538,6 +538,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
538 538
539 public bool Stop(int timeout) 539 public bool Stop(int timeout)
540 { 540 {
541// m_log.DebugFormat(
542// "[SCRIPT INSTANCE]: Stopping script {0} {1} with timeout {2}", ScriptName, ItemID, timeout);
543
541 IScriptWorkItem result; 544 IScriptWorkItem result;
542 545
543 lock (m_EventQueue) 546 lock (m_EventQueue)
@@ -772,7 +775,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
772 } 775 }
773 catch (Exception e) 776 catch (Exception e)
774 { 777 {
775 // m_log.DebugFormat("[SCRIPT] Exception: {0}", e.Message); 778// m_log.DebugFormat(
779// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
780// ScriptName, ItemID, e.Message, e.StackTrace);
781
776 m_InEvent = false; 782 m_InEvent = false;
777 m_CurrentEvent = String.Empty; 783 m_CurrentEvent = String.Empty;
778 784
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 24a9418..f627e37 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -301,7 +301,7 @@ namespace OpenSim.Region.UserStatistics
301 301
302 public void OnRegisterCaps(UUID agentID, Caps caps) 302 public void OnRegisterCaps(UUID agentID, Caps caps)
303 { 303 {
304 m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); 304 m_log.DebugFormat("[WEB STATS MODULE]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps);
305 string capsPath = "/CAPS/VS/" + UUID.Random(); 305 string capsPath = "/CAPS/VS/" + UUID.Random();
306 caps.RegisterHandler("ViewerStats", 306 caps.RegisterHandler("ViewerStats",
307 new RestStreamHandler("POST", capsPath, 307 new RestStreamHandler("POST", capsPath,
@@ -462,7 +462,7 @@ namespace OpenSim.Region.UserStatistics
462 462
463 if (!m_sessions.ContainsKey(agentID)) 463 if (!m_sessions.ContainsKey(agentID))
464 { 464 {
465 m_log.Warn("[VS]: no session for stat disclosure"); 465 m_log.Warn("[WEB STATS MODULE]: no session for stat disclosure");
466 return new UserSessionID(); 466 return new UserSessionID();
467 } 467 }
468 uid = m_sessions[agentID]; 468 uid = m_sessions[agentID];
@@ -667,14 +667,13 @@ namespace OpenSim.Region.UserStatistics
667 { 667 {
668 updatecmd.ExecuteNonQuery(); 668 updatecmd.ExecuteNonQuery();
669 } 669 }
670 catch 670 catch (SqliteExecutionException)
671 (SqliteExecutionException)
672 { 671 {
673 m_log.Warn("[WEBSTATS]: failed to write stats to storage Execution Exception"); 672 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage Execution Exception");
674 } 673 }
675 catch (SqliteSyntaxException) 674 catch (SqliteSyntaxException)
676 { 675 {
677 m_log.Warn("[WEBSTATS]: failed to write stats to storage SQL Syntax Exception"); 676 m_log.Warn("[WEB STATS MODULE]: failed to write stats to storage SQL Syntax Exception");
678 } 677 }
679 678
680 } 679 }