aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs80
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs3
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs131
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs11
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs120
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs7
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs38
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs29
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs32
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs65
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs2097
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs9
23 files changed, 1436 insertions, 1255 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index c802490..38152cc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -427,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
427 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) 427 if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
428 { 428 {
429 if (!m_scene.Permissions.CanRezObject( 429 if (!m_scene.Permissions.CanRezObject(
430 part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) 430 part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
431 return; 431 return;
432 432
433 presence.Appearance.DetachAttachment(itemID); 433 presence.Appearance.DetachAttachment(itemID);
@@ -471,12 +471,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
471 SceneObjectSerializer.ToOriginalXmlFormat(group); 471 SceneObjectSerializer.ToOriginalXmlFormat(group);
472 group.DetachToInventoryPrep(); 472 group.DetachToInventoryPrep();
473 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); 473 m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
474 m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); 474 UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
475 m_scene.DeleteSceneObject(group, false); 475 m_scene.DeleteSceneObject(group, false);
476 return; 476 return;
477 } 477 }
478 } 478 }
479 } 479 }
480 } 480 }
481
482 public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos)
483 {
484 // If this is an attachment, then we need to save the modified
485 // object back into the avatar's inventory. First we save the
486 // attachment point information, then we update the relative
487 // positioning (which caused this method to get driven in the
488 // first place. Then we have to mark the object as NOT an
489 // attachment. This is necessary in order to correctly save
490 // and retrieve GroupPosition information for the attachment.
491 // Then we save the asset back into the appropriate inventory
492 // entry. Finally, we restore the object's attachment status.
493 byte attachmentPoint = sog.GetAttachmentPoint();
494 sog.UpdateGroupPosition(pos);
495 sog.RootPart.IsAttachment = false;
496 sog.AbsolutePosition = sog.RootPart.AttachedPos;
497 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
498 sog.SetAttachmentPoint(attachmentPoint);
499 }
500
501 /// <summary>
502 /// Update the attachment asset for the new sog details if they have changed.
503 /// </summary>
504 ///
505 /// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
506 /// these details are not stored on the region.
507 ///
508 /// <param name="remoteClient"></param>
509 /// <param name="grp"></param>
510 /// <param name="itemID"></param>
511 /// <param name="agentID"></param>
512 protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
513 {
514 if (grp != null)
515 {
516 if (!grp.HasGroupChanged)
517 {
518 m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
519 return;
520 }
521
522 m_log.DebugFormat(
523 "[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
524 grp.UUID, grp.GetAttachmentPoint());
525
526 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
527
528 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
529 item = m_scene.InventoryService.GetItem(item);
530
531 if (item != null)
532 {
533 AssetBase asset = m_scene.CreateAsset(
534 grp.GetPartName(grp.LocalId),
535 grp.GetPartDescription(grp.LocalId),
536 (sbyte)AssetType.Object,
537 Utils.StringToBytes(sceneObjectXml),
538 remoteClient.AgentId);
539 m_scene.AssetService.Store(asset);
540
541 item.AssetID = asset.FullID;
542 item.Description = asset.Description;
543 item.Name = asset.Name;
544 item.AssetType = asset.Type;
545 item.InvType = (int)InventoryType.Object;
546
547 m_scene.InventoryService.UpdateItem(item);
548
549 // this gets called when the agent logs off!
550 if (remoteClient != null)
551 remoteClient.SendInventoryItemCreateUpdate(item, 0);
552 }
553 }
554 }
481 } 555 }
482} 556} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
index 1603c07..fc1afaf 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs
@@ -223,4 +223,4 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
223 OnInstantMessage(null, msg); 223 OnInstantMessage(null, msg);
224 } 224 }
225 } 225 }
226} 226} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index e1ee0b1..a49faec 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -132,8 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
132 { 132 {
133 UUID toAgentID = new UUID(im.toAgentID); 133 UUID toAgentID = new UUID(im.toAgentID);
134 134
135 //m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString());
136
137 // Try root avatar only first 135 // Try root avatar only first
138 foreach (Scene scene in m_Scenes) 136 foreach (Scene scene in m_Scenes)
139 { 137 {
@@ -176,6 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
176 } 174 }
177 } 175 }
178 176
177 m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
179 SendGridInstantMessageViaXMLRPC(im, result); 178 SendGridInstantMessageViaXMLRPC(im, result);
180 179
181 return; 180 return;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 7683288..22c84e9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
261 261
262 while (archivePath.Length > 0) 262 while (archivePath.Length > 0)
263 { 263 {
264 m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); 264// m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
265 265
266 if (resolvedFolders.ContainsKey(archivePath)) 266 if (resolvedFolders.ContainsKey(archivePath))
267 { 267 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 84afb40..8343091 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
41 /// </summary> 41 /// </summary>
42 public static class InventoryArchiveUtils 42 public static class InventoryArchiveUtils
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 45
46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings 46 // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
47 public static readonly char ESCAPE_CHARACTER = '\\'; 47 public static readonly char ESCAPE_CHARACTER = '\\';
@@ -120,6 +120,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
120 foundFolders.Add(startFolder); 120 foundFolders.Add(startFolder);
121 return foundFolders; 121 return foundFolders;
122 } 122 }
123
124 // If the path isn't just / then trim any starting extraneous slashes
125 path = path.TrimStart(new char[] { PATH_DELIMITER });
126
127// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path);
123 128
124 string[] components = SplitEscapedPath(path); 129 string[] components = SplitEscapedPath(path);
125 components[0] = UnescapePath(components[0]); 130 components[0] = UnescapePath(components[0]);
@@ -199,6 +204,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
199 public static InventoryItemBase FindItemByPath( 204 public static InventoryItemBase FindItemByPath(
200 IInventoryService inventoryService, InventoryFolderBase startFolder, string path) 205 IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
201 { 206 {
207 // If the path isn't just / then trim any starting extraneous slashes
208 path = path.TrimStart(new char[] { PATH_DELIMITER });
209
202 string[] components = SplitEscapedPath(path); 210 string[] components = SplitEscapedPath(path);
203 components[0] = UnescapePath(components[0]); 211 components[0] = UnescapePath(components[0]);
204 212
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 25a78ff..9908018 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
221 InventoryItemBase inventoryItem = null; 221 InventoryItemBase inventoryItem = null;
222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); 222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
223 223
224 bool foundStar = false; 224 bool saveFolderContentsOnly = false;
225 225
226 // Eliminate double slashes and any leading / on the path. 226 // Eliminate double slashes and any leading / on the path.
227 string[] components 227 string[] components
@@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
234 // folder itself. This may get more sophisicated later on 234 // folder itself. This may get more sophisicated later on
235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) 235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
236 { 236 {
237 foundStar = true; 237 saveFolderContentsOnly = true;
238 maxComponentIndex--; 238 maxComponentIndex--;
239 } 239 }
240 240
@@ -281,10 +281,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
281 { 281 {
282 m_log.DebugFormat( 282 m_log.DebugFormat(
283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", 283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
284 inventoryFolder.Name, inventoryFolder.ID, m_invPath); 284 inventoryFolder.Name,
285 inventoryFolder.ID,
286 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath );
285 287
286 //recurse through all dirs getting dirs and files 288 //recurse through all dirs getting dirs and files
287 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); 289 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
288 } 290 }
289 else if (inventoryItem != null) 291 else if (inventoryItem != null)
290 { 292 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 3fb2c8c..0218f86 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -55,12 +55,58 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
55 { 55 {
56 protected ManualResetEvent mre = new ManualResetEvent(false); 56 protected ManualResetEvent mre = new ManualResetEvent(false);
57 57
58 /// <summary>
59 /// Stream of data representing a common IAR that can be reused in load tests.
60 /// </summary>
61 protected MemoryStream m_iarStream;
62
63 protected UserAccount m_ua1
64 = new UserAccount {
65 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
66 FirstName = "Mr",
67 LastName = "Tiddles" };
68 protected UserAccount m_ua2
69 = new UserAccount {
70 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
71 FirstName = "Lord",
72 LastName = "Lucan" };
73 string m_item1Name = "b.lsl";
74
58 private void SaveCompleted( 75 private void SaveCompleted(
59 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, 76 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
60 Exception reportedException) 77 Exception reportedException)
61 { 78 {
62 mre.Set(); 79 mre.Set();
63 } 80 }
81
82 [SetUp]
83 public void Init()
84 {
85 ConstructDefaultIarForTestLoad();
86 }
87
88 protected void ConstructDefaultIarForTestLoad()
89 {
90 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
91
92 MemoryStream archiveWriteStream = new MemoryStream();
93 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
94
95 InventoryItemBase item1 = new InventoryItemBase();
96 item1.Name = m_item1Name;
97 item1.AssetID = UUID.Random();
98 item1.GroupID = UUID.Random();
99 item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
100 //item1.CreatorId = userUuid.ToString();
101 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
102 item1.Owner = UUID.Zero;
103
104 string item1FileName
105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
107 tar.Close();
108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
109 }
64 110
65 /// <summary> 111 /// <summary>
66 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive 112 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
@@ -122,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
122 MemoryStream archiveWriteStream = new MemoryStream(); 168 MemoryStream archiveWriteStream = new MemoryStream();
123 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 169 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
124 170
171 // Test saving a particular path
125 mre.Reset(); 172 mre.Reset();
126 archiverModule.ArchiveInventory( 173 archiverModule.ArchiveInventory(
127 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); 174 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
@@ -148,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
148 195
149 while (tar.ReadEntry(out filePath, out tarEntryType) != null) 196 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
150 { 197 {
151 Console.WriteLine("Got {0}", filePath); 198// Console.WriteLine("Got {0}", filePath);
152 199
153// if (ArchiveConstants.CONTROL_FILE_PATH == filePath) 200// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
154// { 201// {
@@ -297,6 +344,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
297 } 344 }
298 345
299 /// <summary> 346 /// <summary>
347 /// Test that things work when the load path specified starts with a slash
348 /// </summary>
349 [Test]
350 public void TestLoadIarPathStartsWithSlash()
351 {
352 TestHelper.InMethod();
353// log4net.Config.XmlConfigurator.Configure();
354
355 SerialiserModule serialiserModule = new SerialiserModule();
356 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
357 Scene scene = SceneSetupHelpers.SetupScene("inventory");
358 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
359
360 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
361 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
362
363 InventoryItemBase foundItem1
364 = InventoryArchiveUtils.FindItemByPath(
365 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
366
367 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
368 }
369
370 /// <summary>
300 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 371 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
301 /// an account exists with the creator name. 372 /// an account exists with the creator name.
302 /// </summary> 373 /// </summary>
@@ -308,34 +379,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
308 TestHelper.InMethod(); 379 TestHelper.InMethod();
309 //log4net.Config.XmlConfigurator.Configure(); 380 //log4net.Config.XmlConfigurator.Configure();
310 381
311 string userFirstName = "Mr";
312 string userLastName = "Tiddles";
313 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
314 string userItemCreatorFirstName = "Lord";
315 string userItemCreatorLastName = "Lucan";
316 UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
317
318 string item1Name = "b.lsl";
319 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
320
321 MemoryStream archiveWriteStream = new MemoryStream();
322 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
323
324 InventoryItemBase item1 = new InventoryItemBase();
325 item1.Name = item1Name;
326 item1.AssetID = UUID.Random();
327 item1.GroupID = UUID.Random();
328 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
329 //item1.CreatorId = userUuid.ToString();
330 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
331 item1.Owner = UUID.Zero;
332
333 string item1FileName
334 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
335 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
336 tar.Close();
337
338 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
339 SerialiserModule serialiserModule = new SerialiserModule(); 382 SerialiserModule serialiserModule = new SerialiserModule();
340 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 383 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
341 384
@@ -344,15 +387,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
344 387
345 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 388 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
346 389
347 UserProfileTestUtils.CreateUserWithInventory( 390 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
348 scene, userFirstName, userLastName, userUuid, "meowfood"); 391 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
349 UserProfileTestUtils.CreateUserWithInventory(
350 scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire");
351 392
352 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 393 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
353 394
354 InventoryItemBase foundItem1 395 InventoryItemBase foundItem1
355 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name); 396 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
356 397
357 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 398 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
358 399
@@ -362,31 +403,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
362// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), 403// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
363// "Loaded item non-uuid creator doesn't match original"); 404// "Loaded item non-uuid creator doesn't match original");
364 Assert.That( 405 Assert.That(
365 foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), 406 foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()),
366 "Loaded item non-uuid creator doesn't match original"); 407 "Loaded item non-uuid creator doesn't match original");
367 408
368 Assert.That( 409 Assert.That(
369 foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), 410 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID),
370 "Loaded item uuid creator doesn't match original"); 411 "Loaded item uuid creator doesn't match original");
371 Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), 412 Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID),
372 "Loaded item owner doesn't match inventory reciever"); 413 "Loaded item owner doesn't match inventory reciever");
373 414
374 // Now try loading to a root child folder 415 // Now try loading to a root child folder
375 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA"); 416 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
376 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 417 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
377 archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); 418 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);
378 419
379 InventoryItemBase foundItem2 420 InventoryItemBase foundItem2
380 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name); 421 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);
381 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); 422 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
382 423
383 // Now try loading to a more deeply nested folder 424 // Now try loading to a more deeply nested folder
384 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xB/xC"); 425 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
385 archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); 426 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
386 archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); 427 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);
387 428
388 InventoryItemBase foundItem3 429 InventoryItemBase foundItem3
389 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name); 430 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);
390 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); 431 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
391 } 432 }
392 433
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 4465e8a..a08a628 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -32,7 +32,6 @@ using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35
36using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
@@ -92,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
92 m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>(); 91 m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
93 if (m_TransferModule == null) 92 if (m_TransferModule == null)
94 { 93 {
95 m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); 94 m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only");
96 m_Enabled = false; 95 m_Enabled = false;
97 96
98 m_Scenelist.Clear(); 97 m_Scenelist.Clear();
@@ -185,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
185 { 184 {
186 UUID folderID = new UUID(im.binaryBucket, 1); 185 UUID folderID = new UUID(im.binaryBucket, 1);
187 186
188 m_log.DebugFormat("[AGENT INVENTORY]: Inserting original folder {0} "+ 187 m_log.DebugFormat("[INVENTORY TRANSFER]: Inserting original folder {0} "+
189 "into agent {1}'s inventory", 188 "into agent {1}'s inventory",
190 folderID, new UUID(im.toAgentID)); 189 folderID, new UUID(im.toAgentID));
191 190
@@ -221,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
221 220
222 UUID itemID = new UUID(im.binaryBucket, 1); 221 UUID itemID = new UUID(im.binaryBucket, 1);
223 222
224 m_log.DebugFormat("[AGENT INVENTORY]: (giving) Inserting item {0} "+ 223 m_log.DebugFormat("[INVENTORY TRANSFER]: (giving) Inserting item {0} "+
225 "into agent {1}'s inventory", 224 "into agent {1}'s inventory",
226 itemID, new UUID(im.toAgentID)); 225 itemID, new UUID(im.toAgentID));
227 226
@@ -288,10 +287,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
288 // inventory is loaded. Courtesy of the above bulk update, 287 // inventory is loaded. Courtesy of the above bulk update,
289 // It will have been pushed to the client, too 288 // It will have been pushed to the client, too
290 // 289 //
291
292 //CachedUserInfo userInfo =
293 // scene.CommsManager.UserProfileCacheService.
294 // GetUserDetails(client.AgentId);
295 IInventoryService invService = scene.InventoryService; 290 IInventoryService invService = scene.InventoryService;
296 291
297 InventoryFolderBase trashFolder = 292 InventoryFolderBase trashFolder =
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index d6f37ae..1cd2ff4 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -200,6 +200,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", 200 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); 201 finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
202 202
203 // Check that these are not the same coordinates
204 if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
205 finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
206 {
207 // Can't do. Viewer crashes
208 sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
209 return;
210 }
211
203 // 212 //
204 // This is it 213 // This is it
205 // 214 //
@@ -446,6 +455,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
446 // Now let's make it officially a child agent 455 // Now let's make it officially a child agent
447 sp.MakeChildAgent(); 456 sp.MakeChildAgent();
448 457
458 sp.Scene.CleanDroppedAttachments();
459
449 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 460 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
450 461
451 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 462 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 0c6cb1b..35b70de 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -34,6 +34,7 @@ using System.Threading;
34using log4net; 34using log4net;
35using Nini.Config; 35using Nini.Config;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.Messages.Linden;
37using OpenMetaverse.Packets; 38using OpenMetaverse.Packets;
38using OpenMetaverse.StructuredData; 39using OpenMetaverse.StructuredData;
39using OpenSim.Framework; 40using OpenSim.Framework;
@@ -137,10 +138,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
137 { 138 {
138 if (!queues.ContainsKey(agentId)) 139 if (!queues.ContainsKey(agentId))
139 { 140 {
141 /*
140 m_log.DebugFormat( 142 m_log.DebugFormat(
141 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", 143 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
142 agentId, m_scene.RegionInfo.RegionName); 144 agentId, m_scene.RegionInfo.RegionName);
143 145 */
144 queues[agentId] = new Queue<OSD>(); 146 queues[agentId] = new Queue<OSD>();
145 } 147 }
146 148
@@ -200,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
200 202
201 private void ClientClosed(UUID AgentID, Scene scene) 203 private void ClientClosed(UUID AgentID, Scene scene)
202 { 204 {
203 m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); 205 //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName);
204 206
205 int count = 0; 207 int count = 0;
206 while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) 208 while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5)
@@ -284,7 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
284 // Reuse open queues. The client does! 286 // Reuse open queues. The client does!
285 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) 287 if (m_AvatarQueueUUIDMapping.ContainsKey(agentID))
286 { 288 {
287 m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); 289 //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
288 EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; 290 EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
289 } 291 }
290 else 292 else
@@ -365,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
365 { 367 {
366 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! 368 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
367 array.Add(EventQueueHelper.KeepAliveEvent()); 369 array.Add(EventQueueHelper.KeepAliveEvent());
368 m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName); 370 //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName);
369 } 371 }
370 else 372 else
371 { 373 {
@@ -394,8 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
394 responsedata["keepalive"] = false; 396 responsedata["keepalive"] = false;
395 responsedata["reusecontext"] = false; 397 responsedata["reusecontext"] = false;
396 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); 398 responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
399 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
397 return responsedata; 400 return responsedata;
398 //m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
399 } 401 }
400 402
401 public Hashtable NoEvents(UUID requestID, UUID agentID) 403 public Hashtable NoEvents(UUID requestID, UUID agentID)
@@ -461,7 +463,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
461 { 463 {
462 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! 464 // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
463 array.Add(EventQueueHelper.KeepAliveEvent()); 465 array.Add(EventQueueHelper.KeepAliveEvent());
464 m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); 466 //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
465 } 467 }
466 else 468 else
467 { 469 {
@@ -697,9 +699,9 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
697 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); 699 //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
698 } 700 }
699 701
700 public void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID) 702 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
701 { 703 {
702 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesPacket); 704 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
703 Enqueue(item, avatarID); 705 Enqueue(item, avatarID);
704 } 706 }
705 707
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index e9bcae3..6294935 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -30,6 +30,7 @@ using System.Net;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenMetaverse.Packets; 31using OpenMetaverse.Packets;
32using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33using OpenMetaverse.Messages.Linden;
33 34
34namespace OpenSim.Region.CoreModules.Framework.EventQueue 35namespace OpenSim.Region.CoreModules.Framework.EventQueue
35{ 36{
@@ -309,116 +310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
309 return chatterBoxSessionAgentListUpdates; 310 return chatterBoxSessionAgentListUpdates;
310 } 311 }
311 312
312 public static OSD ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket)
313 {
314 OSDMap parcelProperties = new OSDMap();
315 OSDMap body = new OSDMap();
316
317 OSDArray ageVerificationBlock = new OSDArray();
318 OSDMap ageVerificationMap = new OSDMap();
319 ageVerificationMap.Add("RegionDenyAgeUnverified",
320 OSD.FromBoolean(parcelPropertiesPacket.AgeVerificationBlock.RegionDenyAgeUnverified));
321 ageVerificationBlock.Add(ageVerificationMap);
322 body.Add("AgeVerificationBlock", ageVerificationBlock);
323
324 // LL sims send media info in this event queue message but it's not in the UDP
325 // packet we construct this event queue message from. This should be refactored in
326 // other areas of the code so it can all be send in the same message. Until then we will
327 // still send the media info via UDP
328
329 //OSDArray mediaData = new OSDArray();
330 //OSDMap mediaDataMap = new OSDMap();
331 //mediaDataMap.Add("MediaDesc", OSD.FromString(""));
332 //mediaDataMap.Add("MediaHeight", OSD.FromInteger(0));
333 //mediaDataMap.Add("MediaLoop", OSD.FromInteger(0));
334 //mediaDataMap.Add("MediaType", OSD.FromString("type/type"));
335 //mediaDataMap.Add("MediaWidth", OSD.FromInteger(0));
336 //mediaDataMap.Add("ObscureMedia", OSD.FromInteger(0));
337 //mediaDataMap.Add("ObscureMusic", OSD.FromInteger(0));
338 //mediaData.Add(mediaDataMap);
339 //body.Add("MediaData", mediaData);
340
341 OSDArray parcelData = new OSDArray();
342 OSDMap parcelDataMap = new OSDMap();
343 OSDArray AABBMax = new OSDArray(3);
344 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.X));
345 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Y));
346 AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Z));
347 parcelDataMap.Add("AABBMax", AABBMax);
348
349 OSDArray AABBMin = new OSDArray(3);
350 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.X));
351 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Y));
352 AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Z));
353 parcelDataMap.Add("AABBMin", AABBMin);
354
355 parcelDataMap.Add("Area", OSD.FromInteger(parcelPropertiesPacket.ParcelData.Area));
356 parcelDataMap.Add("AuctionID", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.AuctionID)));
357 parcelDataMap.Add("AuthBuyerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.AuthBuyerID));
358 parcelDataMap.Add("Bitmap", OSD.FromBinary(parcelPropertiesPacket.ParcelData.Bitmap));
359 parcelDataMap.Add("Category", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Category));
360 parcelDataMap.Add("ClaimDate", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimDate));
361 parcelDataMap.Add("ClaimPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimPrice));
362 parcelDataMap.Add("Desc", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc)));
363 parcelDataMap.Add("GroupID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.GroupID));
364 parcelDataMap.Add("GroupPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.GroupPrims));
365 parcelDataMap.Add("IsGroupOwned", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.IsGroupOwned));
366 parcelDataMap.Add("LandingType", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LandingType));
367 parcelDataMap.Add("LocalID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LocalID));
368 parcelDataMap.Add("MaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.MaxPrims));
369 parcelDataMap.Add("MediaAutoScale", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.MediaAutoScale));
370 parcelDataMap.Add("MediaID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.MediaID));
371 parcelDataMap.Add("MediaURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL)));
372 parcelDataMap.Add("MusicURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL)));
373 parcelDataMap.Add("Name", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name)));
374 parcelDataMap.Add("OtherCleanTime", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCleanTime));
375 parcelDataMap.Add("OtherCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCount));
376 parcelDataMap.Add("OtherPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherPrims));
377 parcelDataMap.Add("OwnerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.OwnerID));
378 parcelDataMap.Add("OwnerPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OwnerPrims));
379 parcelDataMap.Add("ParcelFlags", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.ParcelFlags)));
380 parcelDataMap.Add("ParcelPrimBonus", OSD.FromReal(parcelPropertiesPacket.ParcelData.ParcelPrimBonus));
381 parcelDataMap.Add("PassHours", OSD.FromReal(parcelPropertiesPacket.ParcelData.PassHours));
382 parcelDataMap.Add("PassPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PassPrice));
383 parcelDataMap.Add("PublicCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PublicCount));
384 parcelDataMap.Add("RegionDenyAnonymous", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyAnonymous));
385 parcelDataMap.Add("RegionDenyIdentified", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyIdentified));
386 parcelDataMap.Add("RegionDenyTransacted", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyTransacted));
387
388 parcelDataMap.Add("RegionPushOverride", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionPushOverride));
389 parcelDataMap.Add("RentPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RentPrice));
390 parcelDataMap.Add("RequestResult", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RequestResult));
391 parcelDataMap.Add("SalePrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SalePrice));
392 parcelDataMap.Add("SelectedPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelectedPrims));
393 parcelDataMap.Add("SelfCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelfCount));
394 parcelDataMap.Add("SequenceID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SequenceID));
395 parcelDataMap.Add("SimWideMaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideMaxPrims));
396 parcelDataMap.Add("SimWideTotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideTotalPrims));
397 parcelDataMap.Add("SnapSelection", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.SnapSelection));
398 parcelDataMap.Add("SnapshotID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.SnapshotID));
399 parcelDataMap.Add("Status", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Status));
400 parcelDataMap.Add("TotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.TotalPrims));
401
402 OSDArray UserLocation = new OSDArray(3);
403 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.X));
404 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Y));
405 UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Z));
406 parcelDataMap.Add("UserLocation", UserLocation);
407
408 OSDArray UserLookAt = new OSDArray(3);
409 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.X));
410 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Y));
411 UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Z));
412 parcelDataMap.Add("UserLookAt", UserLookAt);
413
414 parcelData.Add(parcelDataMap);
415 body.Add("ParcelData", parcelData);
416 parcelProperties.Add("body", body);
417 parcelProperties.Add("message", OSD.FromString("ParcelProperties"));
418
419 return parcelProperties;
420 }
421
422 public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket) 313 public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket)
423 { 314 {
424 OSDMap groupUpdate = new OSDMap(); 315 OSDMap groupUpdate = new OSDMap();
@@ -495,5 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
495 return placesReply; 386 return placesReply;
496 } 387 }
497 388
389 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
390 {
391 OSDMap message = new OSDMap();
392 message.Add("message", OSD.FromString("ParcelProperties"));
393 OSD message_body = parcelPropertiesMessage.Serialize();
394 message.Add("body", message_body);
395 return message;
396 }
397
498 } 398 }
499} 399}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index cc12df0..2a36362 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
549 } 549 }
550 550
551 if (!m_Scene.Permissions.CanRezObject( 551 if (!m_Scene.Permissions.CanRezObject(
552 group.Children.Count, remoteClient.AgentId, pos) 552 group.PrimCount, remoteClient.AgentId, pos)
553 && !attachment) 553 && !attachment)
554 { 554 {
555 // The client operates in no fail mode. It will 555 // The client operates in no fail mode. It will
@@ -629,7 +629,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
629 rootPart.Name = item.Name; 629 rootPart.Name = item.Name;
630 rootPart.Description = item.Description; 630 rootPart.Description = item.Description;
631 631
632 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 632 List<SceneObjectPart> partList = null;
633 lock (group.Children)
634 partList = new List<SceneObjectPart>(group.Children.Values);
633 635
634 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 636 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
635 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) 637 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index 1e51187..dcf08e3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -27,15 +27,12 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30
31using OpenMetaverse; 30using OpenMetaverse;
32using Nini.Config; 31using Nini.Config;
33using log4net; 32using log4net;
34
35using OpenSim.Framework; 33using OpenSim.Framework;
36using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
37 35
38
39namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 36namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
40{ 37{
41 public abstract class BaseInventoryConnector : IInventoryService 38 public abstract class BaseInventoryConnector : IInventoryService
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index c97ab9e..4e2f602 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -161,6 +161,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
161 /// <returns></returns> 161 /// <returns></returns>
162 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 162 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
163 { 163 {
164 m_log.DebugFormat("[INVENTORY CACHE]: Getting folder for asset type {0} for user {1}", type, userID);
165
164 Dictionary<AssetType, InventoryFolderBase> folders = null; 166 Dictionary<AssetType, InventoryFolderBase> folders = null;
165 167
166 lock (m_InventoryCache) 168 lock (m_InventoryCache)
@@ -177,8 +179,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
177 179
178 if ((folders != null) && folders.ContainsKey(type)) 180 if ((folders != null) && folders.ContainsKey(type))
179 { 181 {
182 m_log.DebugFormat(
183 "[INVENTORY CACHE]: Returning folder {0} as type {1} for {2}", folders[type], type, userID);
184
180 return folders[type]; 185 return folders[type];
181 } 186 }
187
188 m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
182 189
183 return null; 190 return null;
184 } 191 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index 22bd04c..915b59e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -216,13 +216,40 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
216 return m_InventoryService.PurgeFolder(folder); 216 return m_InventoryService.PurgeFolder(folder);
217 } 217 }
218 218
219 /// <summary>
220 /// Add a new item to the user's inventory
221 /// </summary>
222 /// <param name="item"></param>
223 /// <returns>true if the item was successfully added</returns>
224 public bool AddItem(InventoryItemBase item) 219 public bool AddItem(InventoryItemBase item)
225 { 220 {
221// m_log.DebugFormat(
222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
223// item.Name, item.Owner, item.Folder);
224
225 if (UUID.Zero == item.Folder)
226 {
227 InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
228 if (f != null)
229 {
230// m_log.DebugFormat(
231// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
232// f.Name, (AssetType)f.Type, item.Name);
233
234 item.Folder = f.ID;
235 }
236 else
237 {
238 f = m_InventoryService.GetRootFolder(item.Owner);
239 if (f != null)
240 {
241 item.Folder = f.ID;
242 }
243 else
244 {
245// m_log.WarnFormat(
246// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
247// item.Owner, item.Name);
248 return false;
249 }
250 }
251 }
252
226 return m_InventoryService.AddItem(item); 253 return m_InventoryService.AddItem(item);
227 } 254 }
228 255
@@ -236,7 +263,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
236 return m_InventoryService.UpdateItem(item); 263 return m_InventoryService.UpdateItem(item);
237 } 264 }
238 265
239
240 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) 266 public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
241 { 267 {
242 return m_InventoryService.MoveItems(ownerID, items); 268 return m_InventoryService.MoveItems(ownerID, items);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index 153aeec..17d80c7 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
75 base.Init(source); 75 base.Init(source);
76 } 76 }
77 77
78
79 #region ISharedRegionModule 78 #region ISharedRegionModule
80 79
81 public void Initialise(IConfigSource source) 80 public void Initialise(IConfigSource source)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index ada26cc..4211fa9 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -228,6 +228,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
228 { 228 {
229 if (item == null) 229 if (item == null)
230 return false; 230 return false;
231
232 if (UUID.Zero == item.Folder)
233 {
234 InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
235 if (f != null)
236 {
237 item.Folder = f.ID;
238 }
239 else
240 {
241 f = m_RemoteConnector.GetRootFolder(item.Owner);
242 if (f != null)
243 {
244 item.Folder = f.ID;
245 }
246 else
247 {
248 m_log.WarnFormat(
249 "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
250 item.Owner, item.Name);
251 return false;
252 }
253 }
254 }
231 255
232 return m_RemoteConnector.AddItem(item); 256 return m_RemoteConnector.AddItem(item);
233 } 257 }
@@ -294,9 +318,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
294 return m_RemoteConnector.GetAssetPermissions(userID, assetID); 318 return m_RemoteConnector.GetAssetPermissions(userID, assetID);
295 } 319 }
296 320
297
298 #endregion 321 #endregion
299
300
301 } 322 }
302} 323} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 57b7672..e51f118 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -243,7 +243,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
243 // to the same scene (when this is possible). 243 // to the same scene (when this is possible).
244 sceneObject.ResetIDs(); 244 sceneObject.ResetIDs();
245 245
246 foreach (SceneObjectPart part in sceneObject.Children.Values) 246 List<SceneObjectPart> partList = null;
247 lock (sceneObject.Children)
248 partList = new List<SceneObjectPart>(sceneObject.Children.Values);
249
250 foreach (SceneObjectPart part in partList)
247 { 251 {
248 if (!ResolveUserUuid(part.CreatorID)) 252 if (!ResolveUserUuid(part.CreatorID))
249 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 253 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -261,11 +265,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver
261 // Fix ownership/creator of inventory items 265 // Fix ownership/creator of inventory items
262 // Not doing so results in inventory items 266 // Not doing so results in inventory items
263 // being no copy/no mod for everyone 267 // being no copy/no mod for everyone
264 part.TaskInventory.LockItemsForRead(true); 268 lock (part.TaskInventory)
265 TaskInventoryDictionary inv = part.TaskInventory;
266 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
267 { 269 {
268 if (!ResolveUserUuid(kvp.Value.OwnerID)) 270 if (!ResolveUserUuid(part.CreatorID))
271 part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
272
273 if (!ResolveUserUuid(part.OwnerID))
274 part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
275
276 if (!ResolveUserUuid(part.LastOwnerID))
277 part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
278
279 // And zap any troublesome sit target information
280 part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
281 part.SitTargetPosition = new Vector3(0, 0, 0);
282
283 // Fix ownership/creator of inventory items
284 // Not doing so results in inventory items
285 // being no copy/no mod for everyone
286 part.TaskInventory.LockItemsForRead(true);
287 TaskInventoryDictionary inv = part.TaskInventory;
288 foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
269 { 289 {
270 if (!ResolveUserUuid(kvp.Value.OwnerID)) 290 if (!ResolveUserUuid(kvp.Value.OwnerID))
271 { 291 {
@@ -276,8 +296,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
276 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; 296 kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
277 } 297 }
278 } 298 }
299 part.TaskInventory.LockItemsForRead(false);
279 } 300 }
280 part.TaskInventory.LockItemsForRead(false);
281 } 301 }
282 302
283 if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) 303 if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 8411d04..fb15d91 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -684,6 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
684 args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; 684 args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun;
685 args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; 685 args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
686 args.simName = m_scene.RegionInfo.RegionName; 686 args.simName = m_scene.RegionInfo.RegionName;
687 args.regionType = m_scene.RegionInfo.RegionType;
687 688
688 remote_client.SendRegionInfoToEstateMenu(args); 689 remote_client.SendRegionInfoToEstateMenu(args);
689 } 690 }
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index d00cb07..776fe30 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -33,6 +33,8 @@ using System.Reflection;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenMetaverse.StructuredData;
37using OpenMetaverse.Messages.Linden;
36using OpenSim.Framework; 38using OpenSim.Framework;
37using OpenSim.Framework.Capabilities; 39using OpenSim.Framework.Capabilities;
38using OpenSim.Framework.Servers; 40using OpenSim.Framework.Servers;
@@ -1078,7 +1080,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1078 { 1080 {
1079 for (int y = 0; y < inc_y; y++) 1081 for (int y = 0; y < inc_y; y++)
1080 { 1082 {
1081
1082 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); 1083 ILandObject currentParcel = GetLandObject(start_x + x, start_y + y);
1083 1084
1084 if (currentParcel != null) 1085 if (currentParcel != null)
@@ -1378,8 +1379,68 @@ namespace OpenSim.Region.CoreModules.World.Land
1378 { 1379 {
1379 return RemoteParcelRequest(request, path, param, agentID, caps); 1380 return RemoteParcelRequest(request, path, param, agentID, caps);
1380 })); 1381 }));
1381 } 1382 UUID parcelCapID = UUID.Random();
1383 caps.RegisterHandler("ParcelPropertiesUpdate",
1384 new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
1385 delegate(string request, string path, string param,
1386 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
1387 {
1388 return ProcessPropertiesUpdate(request, path, param, agentID, caps);
1389 }));
1390 }
1391 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
1392 {
1393 IClientAPI client;
1394 if ( ! m_scene.TryGetClient(agentID, out client) ) {
1395 m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() );
1396 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1397 }
1398
1399 ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
1400 OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
1401
1402 properties.Deserialize(args);
1403
1404 LandUpdateArgs land_update = new LandUpdateArgs();
1405 int parcelID = properties.LocalID;
1406 land_update.AuthBuyerID = properties.AuthBuyerID;
1407 land_update.Category = properties.Category;
1408 land_update.Desc = properties.Desc;
1409 land_update.GroupID = properties.GroupID;
1410 land_update.LandingType = (byte) properties.Landing;
1411 land_update.MediaAutoScale = (byte) Convert.ToInt32(properties.MediaAutoScale);
1412 land_update.MediaID = properties.MediaID;
1413 land_update.MediaURL = properties.MediaURL;
1414 land_update.MusicURL = properties.MusicURL;
1415 land_update.Name = properties.Name;
1416 land_update.ParcelFlags = (uint) properties.ParcelFlags;
1417 land_update.PassHours = (int) properties.PassHours;
1418 land_update.PassPrice = (int) properties.PassPrice;
1419 land_update.SalePrice = (int) properties.SalePrice;
1420 land_update.SnapshotID = properties.SnapshotID;
1421 land_update.UserLocation = properties.UserLocation;
1422 land_update.UserLookAt = properties.UserLookAt;
1423 land_update.MediaDescription = properties.MediaDesc;
1424 land_update.MediaType = properties.MediaType;
1425 land_update.MediaWidth = properties.MediaWidth;
1426 land_update.MediaHeight = properties.MediaHeight;
1427 land_update.MediaLoop = properties.MediaLoop;
1428 land_update.ObscureMusic = properties.ObscureMusic;
1429 land_update.ObscureMedia = properties.ObscureMedia;
1430
1431 ILandObject land;
1432 lock (m_landList)
1433 {
1434 m_landList.TryGetValue(parcelID, out land);
1435 }
1382 1436
1437 if (land != null) {
1438 land.UpdateLandProperties(land_update, client);
1439 } else {
1440 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
1441 }
1442 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1443 }
1383 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the 1444 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
1384 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. 1445 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
1385 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x 1446 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index fcd993c..1b2cabb 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -1,1045 +1,1052 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36 36
37namespace OpenSim.Region.CoreModules.World.Land 37namespace OpenSim.Region.CoreModules.World.Land
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// Keeps track of a specific piece of land's information 40 /// Keeps track of a specific piece of land's information
41 /// </summary> 41 /// </summary>
42 public class LandObject : ILandObject 42 public class LandObject : ILandObject
43 { 43 {
44 #region Member Variables 44 #region Member Variables
45 45
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 #pragma warning disable 0429 47 #pragma warning disable 0429
48 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; 48 private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64;
49 #pragma warning restore 0429 49 #pragma warning restore 0429
50 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax]; 50 private bool[,] m_landBitmap = new bool[landArrayMax,landArrayMax];
51 51
52 private int m_lastSeqId = 0; 52 private int m_lastSeqId = 0;
53 53
54 protected LandData m_landData = new LandData(); 54 protected LandData m_landData = new LandData();
55 protected Scene m_scene; 55 protected Scene m_scene;
56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); 56 protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
57 57
58 public bool[,] LandBitmap 58 public bool[,] LandBitmap
59 { 59 {
60 get { return m_landBitmap; } 60 get { return m_landBitmap; }
61 set { m_landBitmap = value; } 61 set { m_landBitmap = value; }
62 } 62 }
63 63
64 #endregion 64 #endregion
65 65
66 #region ILandObject Members 66 #region ILandObject Members
67 67
68 public LandData LandData 68 public LandData LandData
69 { 69 {
70 get { return m_landData; } 70 get { return m_landData; }
71 71
72 set { m_landData = value; } 72 set { m_landData = value; }
73 } 73 }
74 74
75 public UUID RegionUUID 75 public UUID RegionUUID
76 { 76 {
77 get { return m_scene.RegionInfo.RegionID; } 77 get { return m_scene.RegionInfo.RegionID; }
78 } 78 }
79 79
80 #region Constructors 80 #region Constructors
81 81
82 public LandObject(UUID owner_id, bool is_group_owned, Scene scene) 82 public LandObject(UUID owner_id, bool is_group_owned, Scene scene)
83 { 83 {
84 m_scene = scene; 84 m_scene = scene;
85 LandData.OwnerID = owner_id; 85 LandData.OwnerID = owner_id;
86 if (is_group_owned) 86 if (is_group_owned)
87 LandData.GroupID = owner_id; 87 LandData.GroupID = owner_id;
88 else 88 else
89 LandData.GroupID = UUID.Zero; 89 LandData.GroupID = UUID.Zero;
90 LandData.IsGroupOwned = is_group_owned; 90 LandData.IsGroupOwned = is_group_owned;
91 } 91 }
92 92
93 #endregion 93 #endregion
94 94
95 #region Member Functions 95 #region Member Functions
96 96
97 #region General Functions 97 #region General Functions
98 98
99 /// <summary> 99 /// <summary>
100 /// Checks to see if this land object contains a point 100 /// Checks to see if this land object contains a point
101 /// </summary> 101 /// </summary>
102 /// <param name="x"></param> 102 /// <param name="x"></param>
103 /// <param name="y"></param> 103 /// <param name="y"></param>
104 /// <returns>Returns true if the piece of land contains the specified point</returns> 104 /// <returns>Returns true if the piece of land contains the specified point</returns>
105 public bool ContainsPoint(int x, int y) 105 public bool ContainsPoint(int x, int y)
106 { 106 {
107 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize) 107 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && y <= Constants.RegionSize)
108 { 108 {
109 return (LandBitmap[x / 4, y / 4] == true); 109 return (LandBitmap[x / 4, y / 4] == true);
110 } 110 }
111 else 111 else
112 { 112 {
113 return false; 113 return false;
114 } 114 }
115 } 115 }
116 116
117 public ILandObject Copy() 117 public ILandObject Copy()
118 { 118 {
119 ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene); 119 ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene);
120 120
121 //Place all new variables here! 121 //Place all new variables here!
122 newLand.LandBitmap = (bool[,]) (LandBitmap.Clone()); 122 newLand.LandBitmap = (bool[,]) (LandBitmap.Clone());
123 newLand.LandData = LandData.Copy(); 123 newLand.LandData = LandData.Copy();
124 124
125 return newLand; 125 return newLand;
126 } 126 }
127 127
128 static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; 128 static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount;
129 static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; 129 static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount;
130 130
131 public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) 131 public void SetParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
132 { 132 {
133 overrideParcelMaxPrimCount = overrideDel; 133 overrideParcelMaxPrimCount = overrideDel;
134 } 134 }
135 public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) 135 public void SetSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
136 { 136 {
137 overrideSimulatorMaxPrimCount = overrideDel; 137 overrideSimulatorMaxPrimCount = overrideDel;
138 } 138 }
139 139
140 public int GetParcelMaxPrimCount(ILandObject thisObject) 140 public int GetParcelMaxPrimCount(ILandObject thisObject)
141 { 141 {
142 if (overrideParcelMaxPrimCount != null) 142 if (overrideParcelMaxPrimCount != null)
143 { 143 {
144 return overrideParcelMaxPrimCount(thisObject); 144 return overrideParcelMaxPrimCount(thisObject);
145 } 145 }
146 else 146 else
147 { 147 {
148 // Normal Calculations 148 // Normal Calculations
149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
150 } 150 }
151 } 151 }
152 public int GetSimulatorMaxPrimCount(ILandObject thisObject) 152 public int GetSimulatorMaxPrimCount(ILandObject thisObject)
153 { 153 {
154 if (overrideSimulatorMaxPrimCount != null) 154 if (overrideSimulatorMaxPrimCount != null)
155 { 155 {
156 return overrideSimulatorMaxPrimCount(thisObject); 156 return overrideSimulatorMaxPrimCount(thisObject);
157 } 157 }
158 else 158 else
159 { 159 {
160 //Normal Calculations 160 //Normal Calculations
161 return m_scene.RegionInfo.ObjectCapacity; 161 return m_scene.RegionInfo.ObjectCapacity;
162 } 162 }
163 } 163 }
164 #endregion 164 #endregion
165 165
166 #region Packet Request Handling 166 #region Packet Request Handling
167 167
168 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) 168 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
169 { 169 {
170 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 170 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
171 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome)); 171 uint regionFlags = 336723974 & ~((uint)(RegionFlags.AllowLandmark | RegionFlags.AllowSetHome));
172 if (estateModule != null) 172 if (estateModule != null)
173 regionFlags = estateModule.GetRegionFlags(); 173 regionFlags = estateModule.GetRegionFlags();
174 174
175 // In a perfect world, this would have worked. 175 // In a perfect world, this would have worked.
176 // 176 //
177// if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0) 177// if ((landData.Flags & (uint)ParcelFlags.AllowLandmark) != 0)
178// regionFlags |= (uint)RegionFlags.AllowLandmark; 178// regionFlags |= (uint)RegionFlags.AllowLandmark;
179// if (landData.OwnerID == remote_client.AgentId) 179// if (landData.OwnerID == remote_client.AgentId)
180// regionFlags |= (uint)RegionFlags.AllowSetHome; 180// regionFlags |= (uint)RegionFlags.AllowSetHome;
181 181
182 int seq_id; 182 int seq_id;
183 if (snap_selection && (sequence_id == 0)) 183 if (snap_selection && (sequence_id == 0))
184 { 184 {
185 seq_id = m_lastSeqId; 185 seq_id = m_lastSeqId;
186 } 186 }
187 else 187 else
188 { 188 {
189 seq_id = sequence_id; 189 seq_id = sequence_id;
190 m_lastSeqId = seq_id; 190 m_lastSeqId = seq_id;
191 } 191 }
192 192
193 remote_client.SendLandProperties(seq_id, 193 remote_client.SendLandProperties(seq_id,
194 snap_selection, request_result, LandData, 194 snap_selection, request_result, LandData,
195 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, 195 (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
196 GetParcelMaxPrimCount(this), 196 GetParcelMaxPrimCount(this),
197 GetSimulatorMaxPrimCount(this), regionFlags); 197 GetSimulatorMaxPrimCount(this), regionFlags);
198 } 198 }
199 199
200 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 200 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
201 { 201 {
202 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 202 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this))
203 { 203 {
204 //Needs later group support 204 //Needs later group support
205 bool snap_selection = false; 205 bool snap_selection = false;
206 LandData newData = LandData.Copy(); 206 LandData newData = LandData.Copy();
207 207
208 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 208 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice)
209 { 209 {
210 if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) 210 if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this))
211 { 211 {
212 newData.AuthBuyerID = args.AuthBuyerID; 212 newData.AuthBuyerID = args.AuthBuyerID;
213 newData.SalePrice = args.SalePrice; 213 newData.SalePrice = args.SalePrice;
214 snap_selection = true; 214 snap_selection = true;
215 } 215 }
216 } 216 }
217 newData.Category = args.Category; 217 newData.Category = args.Category;
218 newData.Description = args.Desc; 218 newData.Description = args.Desc;
219 newData.GroupID = args.GroupID; 219 newData.GroupID = args.GroupID;
220 newData.LandingType = args.LandingType; 220 newData.LandingType = args.LandingType;
221 newData.MediaAutoScale = args.MediaAutoScale; 221 newData.MediaAutoScale = args.MediaAutoScale;
222 newData.MediaID = args.MediaID; 222 newData.MediaID = args.MediaID;
223 newData.MediaURL = args.MediaURL; 223 newData.MediaURL = args.MediaURL;
224 newData.MusicURL = args.MusicURL; 224 newData.MusicURL = args.MusicURL;
225 newData.Name = args.Name; 225 newData.Name = args.Name;
226 newData.Flags = args.ParcelFlags; 226 newData.Flags = args.ParcelFlags;
227 newData.PassHours = args.PassHours; 227 newData.PassHours = args.PassHours;
228 newData.PassPrice = args.PassPrice; 228 newData.PassPrice = args.PassPrice;
229 newData.SnapshotID = args.SnapshotID; 229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation; 230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt; 231 newData.UserLookAt = args.UserLookAt;
232 232 newData.MediaType = args.MediaType;
233 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 233 newData.MediaDescription = args.MediaDescription;
234 234 newData.MediaWidth = args.MediaWidth;
235 SendLandUpdateToAvatarsOverMe(snap_selection); 235 newData.MediaHeight = args.MediaHeight;
236 } 236 newData.MediaLoop = args.MediaLoop;
237 } 237 newData.ObscureMusic = args.ObscureMusic;
238 238 newData.ObscureMedia = args.ObscureMedia;
239 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 239
240 { 240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
241 LandData newData = LandData.Copy(); 241
242 newData.OwnerID = avatarID; 242 SendLandUpdateToAvatarsOverMe(snap_selection);
243 newData.GroupID = groupID; 243 }
244 newData.IsGroupOwned = groupOwned; 244 }
245 //newData.auctionID = AuctionID; 245
246 newData.ClaimDate = Util.UnixTimeSinceEpoch(); 246 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
247 newData.ClaimPrice = claimprice; 247 {
248 newData.SalePrice = 0; 248 LandData newData = LandData.Copy();
249 newData.AuthBuyerID = UUID.Zero; 249 newData.OwnerID = avatarID;
250 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 250 newData.GroupID = groupID;
251 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 251 newData.IsGroupOwned = groupOwned;
252 252 //newData.auctionID = AuctionID;
253 SendLandUpdateToAvatarsOverMe(true); 253 newData.ClaimDate = Util.UnixTimeSinceEpoch();
254 } 254 newData.ClaimPrice = claimprice;
255 255 newData.SalePrice = 0;
256 public void DeedToGroup(UUID groupID) 256 newData.AuthBuyerID = UUID.Zero;
257 { 257 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
258 LandData newData = LandData.Copy(); 258 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
259 newData.OwnerID = groupID; 259
260 newData.GroupID = groupID; 260 SendLandUpdateToAvatarsOverMe(true);
261 newData.IsGroupOwned = true; 261 }
262 262
263 // Reset show in directory flag on deed 263 public void DeedToGroup(UUID groupID)
264 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory); 264 {
265 265 LandData newData = LandData.Copy();
266 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 266 newData.OwnerID = groupID;
267 267 newData.GroupID = groupID;
268 SendLandUpdateToAvatarsOverMe(true); 268 newData.IsGroupOwned = true;
269 } 269
270 270 // Reset show in directory flag on deed
271 public bool IsEitherBannedOrRestricted(UUID avatar) 271 newData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
272 { 272
273 if (IsBannedFromLand(avatar)) 273 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
274 { 274
275 return true; 275 SendLandUpdateToAvatarsOverMe(true);
276 } 276 }
277 else if (IsRestrictedFromLand(avatar)) 277
278 { 278 public bool IsEitherBannedOrRestricted(UUID avatar)
279 return true; 279 {
280 } 280 if (IsBannedFromLand(avatar))
281 return false; 281 {
282 } 282 return true;
283 283 }
284 public bool HasGroupAccess(UUID avatar) 284 else if (IsRestrictedFromLand(avatar))
285 { 285 {
286 if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) 286 return true;
287 { 287 }
288 IGroupsModule groupsModule = 288 return false;
289 m_scene.RequestModuleInterface<IGroupsModule>(); 289 }
290 290
291 List<UUID> agentGroups = new List<UUID>(); 291 public bool HasGroupAccess(UUID avatar)
292 if (groupsModule != null) 292 {
293 { 293 if ((LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup)
294 GroupMembershipData[] GroupMembership = 294 {
295 groupsModule.GetMembershipData(avatar); 295 IGroupsModule groupsModule =
296 296 m_scene.RequestModuleInterface<IGroupsModule>();
297 if (GroupMembership != null) 297
298 { 298 List<UUID> agentGroups = new List<UUID>();
299 for (int i = 0; i < GroupMembership.Length; i++) 299 if (groupsModule != null)
300 { 300 {
301 if (LandData.GroupID == GroupMembership[i].GroupID) 301 GroupMembershipData[] GroupMembership =
302 { 302 groupsModule.GetMembershipData(avatar);
303 return true; 303
304 } 304 if (GroupMembership != null)
305 } 305 {
306 } 306 for (int i = 0; i < GroupMembership.Length; i++)
307 } 307 {
308 } 308 if (LandData.GroupID == GroupMembership[i].GroupID)
309 return false; 309 {
310 } 310 return true;
311 311 }
312 public bool IsBannedFromLand(UUID avatar) 312 }
313 { 313 }
314 if (m_scene.Permissions.IsAdministrator(avatar)) 314 }
315 return false; 315 }
316 316 return false;
317 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 317 }
318 { 318
319 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 319 public bool IsBannedFromLand(UUID avatar)
320 entry.AgentID = avatar; 320 {
321 entry.Flags = AccessList.Ban; 321 if (m_scene.Permissions.IsAdministrator(avatar))
322 entry.Time = new DateTime(); 322 return false;
323 //See if they are on the list, but make sure the owner isn't banned 323
324 if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 324 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
325 { 325 {
326 //They are banned, so lets send them a notice about this parcel 326 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
327 return true; 327 entry.AgentID = avatar;
328 } 328 entry.Flags = AccessList.Ban;
329 } 329 entry.Time = new DateTime();
330 return false; 330 //See if they are on the list, but make sure the owner isn't banned
331 } 331 if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
332 332 {
333 public bool IsRestrictedFromLand(UUID avatar) 333 //They are banned, so lets send them a notice about this parcel
334 { 334 return true;
335 if (m_scene.Permissions.IsAdministrator(avatar)) 335 }
336 return false; 336 }
337 337 return false;
338 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 338 }
339 { 339
340 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 340 public bool IsRestrictedFromLand(UUID avatar)
341 entry.AgentID = avatar; 341 {
342 entry.Flags = AccessList.Access; 342 if (m_scene.Permissions.IsAdministrator(avatar))
343 entry.Time = new DateTime(); 343 return false;
344 344
345 //If they are not on the access list and are not the owner 345 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
346 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 346 {
347 { 347 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
348 if (!HasGroupAccess(avatar)) 348 entry.AgentID = avatar;
349 { 349 entry.Flags = AccessList.Access;
350 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel 350 entry.Time = new DateTime();
351 return true; 351
352 } 352 //If they are not on the access list and are not the owner
353 } 353 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar)
354 } 354 {
355 355 if (!HasGroupAccess(avatar))
356 return false; 356 {
357 } 357 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
358 358 return true;
359 public void SendLandUpdateToClient(IClientAPI remote_client) 359 }
360 { 360 }
361 SendLandProperties(0, false, 0, remote_client); 361 }
362 } 362
363 363 return false;
364 public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client) 364 }
365 { 365
366 SendLandProperties(0, snap_selection, 0, remote_client); 366 public void SendLandUpdateToClient(IClientAPI remote_client)
367 } 367 {
368 368 SendLandProperties(0, false, 0, remote_client);
369 public void SendLandUpdateToAvatarsOverMe() 369 }
370 { 370
371 SendLandUpdateToAvatarsOverMe(false); 371 public void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client)
372 } 372 {
373 373 SendLandProperties(0, snap_selection, 0, remote_client);
374 public void SendLandUpdateToAvatarsOverMe(bool snap_selection) 374 }
375 { 375
376 m_scene.ForEachScenePresence(delegate(ScenePresence avatar) 376 public void SendLandUpdateToAvatarsOverMe()
377 { 377 {
378 if (avatar.IsChildAgent) 378 SendLandUpdateToAvatarsOverMe(false);
379 return; 379 }
380 380
381 ILandObject over = null; 381 public void SendLandUpdateToAvatarsOverMe(bool snap_selection)
382 try 382 {
383 { 383 m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
384 over = 384 {
385 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), 385 if (avatar.IsChildAgent)
386 Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); 386 return;
387 } 387
388 catch (Exception) 388 ILandObject over = null;
389 { 389 try
390 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " + 390 {
391 Math.Round(avatar.AbsolutePosition.Y)); 391 over =
392 } 392 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)),
393 393 Util.Clamp<int>((int)Math.Round(avatar.AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1)));
394 if (over != null) 394 }
395 { 395 catch (Exception)
396 if (over.LandData.LocalID == LandData.LocalID) 396 {
397 { 397 m_log.Warn("[LAND]: " + "unable to get land at x: " + Math.Round(avatar.AbsolutePosition.X) + " y: " +
398 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) && 398 Math.Round(avatar.AbsolutePosition.Y));
399 m_scene.RegionInfo.RegionSettings.AllowDamage) 399 }
400 avatar.Invulnerable = false; 400
401 else 401 if (over != null)
402 avatar.Invulnerable = true; 402 {
403 403 if (over.LandData.LocalID == LandData.LocalID)
404 SendLandUpdateToClient(snap_selection, avatar.ControllingClient); 404 {
405 } 405 if (((over.LandData.Flags & (uint)ParcelFlags.AllowDamage) != 0) &&
406 } 406 m_scene.RegionInfo.RegionSettings.AllowDamage)
407 }); 407 avatar.Invulnerable = false;
408 } 408 else
409 409 avatar.Invulnerable = true;
410 #endregion 410
411 411 SendLandUpdateToClient(snap_selection, avatar.ControllingClient);
412 #region AccessList Functions 412 }
413 413 }
414 public List<UUID> CreateAccessListArrayByFlag(AccessList flag) 414 });
415 { 415 }
416 List<UUID> list = new List<UUID>(); 416
417 foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) 417 #endregion
418 { 418
419 if (entry.Flags == flag) 419 #region AccessList Functions
420 { 420
421 list.Add(entry.AgentID); 421 public List<UUID> CreateAccessListArrayByFlag(AccessList flag)
422 } 422 {
423 } 423 List<UUID> list = new List<UUID>();
424 if (list.Count == 0) 424 foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList)
425 { 425 {
426 list.Add(UUID.Zero); 426 if (entry.Flags == flag)
427 } 427 {
428 428 list.Add(entry.AgentID);
429 return list; 429 }
430 } 430 }
431 431 if (list.Count == 0)
432 public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID, 432 {
433 IClientAPI remote_client) 433 list.Add(UUID.Zero);
434 { 434 }
435 435
436 if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) 436 return list;
437 { 437 }
438 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); 438
439 remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); 439 public void SendAccessList(UUID agentID, UUID sessionID, uint flags, int sequenceID,
440 } 440 IClientAPI remote_client)
441 441 {
442 if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) 442
443 { 443 if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both)
444 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); 444 {
445 remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); 445 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access);
446 } 446 remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID);
447 } 447 }
448 448
449 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 449 if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both)
450 { 450 {
451 LandData newData = LandData.Copy(); 451 List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban);
452 452 remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID);
453 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) 453 }
454 { 454 }
455 entries.Clear(); 455
456 } 456 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
457 457 {
458 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); 458 LandData newData = LandData.Copy();
459 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) 459
460 { 460 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
461 if (entry.Flags == (AccessList)flags) 461 {
462 { 462 entries.Clear();
463 toRemove.Add(entry); 463 }
464 } 464
465 } 465 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>();
466 466 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
467 foreach (ParcelManager.ParcelAccessEntry entry in toRemove) 467 {
468 { 468 if (entry.Flags == (AccessList)flags)
469 newData.ParcelAccessList.Remove(entry); 469 {
470 } 470 toRemove.Add(entry);
471 foreach (ParcelManager.ParcelAccessEntry entry in entries) 471 }
472 { 472 }
473 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); 473
474 temp.AgentID = entry.AgentID; 474 foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
475 temp.Time = new DateTime(); //Pointless? Yes. 475 {
476 temp.Flags = (AccessList)flags; 476 newData.ParcelAccessList.Remove(entry);
477 477 }
478 if (!newData.ParcelAccessList.Contains(temp)) 478 foreach (ParcelManager.ParcelAccessEntry entry in entries)
479 { 479 {
480 newData.ParcelAccessList.Add(temp); 480 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry();
481 } 481 temp.AgentID = entry.AgentID;
482 } 482 temp.Time = new DateTime(); //Pointless? Yes.
483 483 temp.Flags = (AccessList)flags;
484 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 484
485 } 485 if (!newData.ParcelAccessList.Contains(temp))
486 486 {
487 #endregion 487 newData.ParcelAccessList.Add(temp);
488 488 }
489 #region Update Functions 489 }
490 490
491 public void UpdateLandBitmapByteArray() 491 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
492 { 492 }
493 LandData.Bitmap = ConvertLandBitmapToBytes(); 493
494 } 494 #endregion
495 495
496 /// <summary> 496 #region Update Functions
497 /// Update all settings in land such as area, bitmap byte array, etc 497
498 /// </summary> 498 public void UpdateLandBitmapByteArray()
499 public void ForceUpdateLandInfo() 499 {
500 { 500 LandData.Bitmap = ConvertLandBitmapToBytes();
501 UpdateAABBAndAreaValues(); 501 }
502 UpdateLandBitmapByteArray(); 502
503 } 503 /// <summary>
504 504 /// Update all settings in land such as area, bitmap byte array, etc
505 public void SetLandBitmapFromByteArray() 505 /// </summary>
506 { 506 public void ForceUpdateLandInfo()
507 LandBitmap = ConvertBytesToLandBitmap(); 507 {
508 } 508 UpdateAABBAndAreaValues();
509 509 UpdateLandBitmapByteArray();
510 /// <summary> 510 }
511 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object 511
512 /// </summary> 512 public void SetLandBitmapFromByteArray()
513 private void UpdateAABBAndAreaValues() 513 {
514 { 514 LandBitmap = ConvertBytesToLandBitmap();
515 int min_x = 64; 515 }
516 int min_y = 64; 516
517 int max_x = 0; 517 /// <summary>
518 int max_y = 0; 518 /// Updates the AABBMin and AABBMax values after area/shape modification of the land object
519 int tempArea = 0; 519 /// </summary>
520 int x, y; 520 private void UpdateAABBAndAreaValues()
521 for (x = 0; x < 64; x++) 521 {
522 { 522 int min_x = 64;
523 for (y = 0; y < 64; y++) 523 int min_y = 64;
524 { 524 int max_x = 0;
525 if (LandBitmap[x, y] == true) 525 int max_y = 0;
526 { 526 int tempArea = 0;
527 if (min_x > x) min_x = x; 527 int x, y;
528 if (min_y > y) min_y = y; 528 for (x = 0; x < 64; x++)
529 if (max_x < x) max_x = x; 529 {
530 if (max_y < y) max_y = y; 530 for (y = 0; y < 64; y++)
531 tempArea += 16; //16sqm peice of land 531 {
532 } 532 if (LandBitmap[x, y] == true)
533 } 533 {
534 } 534 if (min_x > x) min_x = x;
535 int tx = min_x * 4; 535 if (min_y > y) min_y = y;
536 if (tx > ((int)Constants.RegionSize - 1)) 536 if (max_x < x) max_x = x;
537 tx = ((int)Constants.RegionSize - 1); 537 if (max_y < y) max_y = y;
538 int ty = min_y * 4; 538 tempArea += 16; //16sqm peice of land
539 if (ty > ((int)Constants.RegionSize - 1)) 539 }
540 ty = ((int)Constants.RegionSize - 1); 540 }
541 LandData.AABBMin = 541 }
542 new Vector3((float) (min_x * 4), (float) (min_y * 4), 542 int tx = min_x * 4;
543 (float) m_scene.Heightmap[tx, ty]); 543 if (tx > ((int)Constants.RegionSize - 1))
544 544 tx = ((int)Constants.RegionSize - 1);
545 tx = max_x * 4; 545 int ty = min_y * 4;
546 if (tx > ((int)Constants.RegionSize - 1)) 546 if (ty > ((int)Constants.RegionSize - 1))
547 tx = ((int)Constants.RegionSize - 1); 547 ty = ((int)Constants.RegionSize - 1);
548 ty = max_y * 4; 548 LandData.AABBMin =
549 if (ty > ((int)Constants.RegionSize - 1)) 549 new Vector3((float) (min_x * 4), (float) (min_y * 4),
550 ty = ((int)Constants.RegionSize - 1); 550 (float) m_scene.Heightmap[tx, ty]);
551 LandData.AABBMax = 551
552 new Vector3((float) (max_x * 4), (float) (max_y * 4), 552 tx = max_x * 4;
553 (float) m_scene.Heightmap[tx, ty]); 553 if (tx > ((int)Constants.RegionSize - 1))
554 LandData.Area = tempArea; 554 tx = ((int)Constants.RegionSize - 1);
555 } 555 ty = max_y * 4;
556 556 if (ty > ((int)Constants.RegionSize - 1))
557 #endregion 557 ty = ((int)Constants.RegionSize - 1);
558 558 LandData.AABBMax =
559 #region Land Bitmap Functions 559 new Vector3((float) (max_x * 4), (float) (max_y * 4),
560 560 (float) m_scene.Heightmap[tx, ty]);
561 /// <summary> 561 LandData.Area = tempArea;
562 /// Sets the land's bitmap manually 562 }
563 /// </summary> 563
564 /// <param name="bitmap">64x64 block representing where this land is on a map</param> 564 #endregion
565 public void SetLandBitmap(bool[,] bitmap) 565
566 { 566 #region Land Bitmap Functions
567 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2) 567
568 { 568 /// <summary>
569 //Throw an exception - The bitmap is not 64x64 569 /// Sets the land's bitmap manually
570 //throw new Exception("Error: Invalid Parcel Bitmap"); 570 /// </summary>
571 } 571 /// <param name="bitmap">64x64 block representing where this land is on a map</param>
572 else 572 public void SetLandBitmap(bool[,] bitmap)
573 { 573 {
574 //Valid: Lets set it 574 if (bitmap.GetLength(0) != 64 || bitmap.GetLength(1) != 64 || bitmap.Rank != 2)
575 LandBitmap = bitmap; 575 {
576 ForceUpdateLandInfo(); 576 //Throw an exception - The bitmap is not 64x64
577 } 577 //throw new Exception("Error: Invalid Parcel Bitmap");
578 } 578 }
579 579 else
580 /// <summary> 580 {
581 /// Gets the land's bitmap manually 581 //Valid: Lets set it
582 /// </summary> 582 LandBitmap = bitmap;
583 /// <returns></returns> 583 ForceUpdateLandInfo();
584 public bool[,] GetLandBitmap() 584 }
585 { 585 }
586 return LandBitmap; 586
587 } 587 /// <summary>
588 588 /// Gets the land's bitmap manually
589 /// <summary> 589 /// </summary>
590 /// Full sim land object creation 590 /// <returns></returns>
591 /// </summary> 591 public bool[,] GetLandBitmap()
592 /// <returns></returns> 592 {
593 public bool[,] BasicFullRegionLandBitmap() 593 return LandBitmap;
594 { 594 }
595 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); 595
596 } 596 /// <summary>
597 597 /// Full sim land object creation
598 /// <summary> 598 /// </summary>
599 /// Used to modify the bitmap between the x and y points. Points use 64 scale 599 /// <returns></returns>
600 /// </summary> 600 public bool[,] BasicFullRegionLandBitmap()
601 /// <param name="start_x"></param> 601 {
602 /// <param name="start_y"></param> 602 return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
603 /// <param name="end_x"></param> 603 }
604 /// <param name="end_y"></param> 604
605 /// <returns></returns> 605 /// <summary>
606 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) 606 /// Used to modify the bitmap between the x and y points. Points use 64 scale
607 { 607 /// </summary>
608 bool[,] tempBitmap = new bool[64,64]; 608 /// <param name="start_x"></param>
609 tempBitmap.Initialize(); 609 /// <param name="start_y"></param>
610 610 /// <param name="end_x"></param>
611 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true); 611 /// <param name="end_y"></param>
612 return tempBitmap; 612 /// <returns></returns>
613 } 613 public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
614 614 {
615 /// <summary> 615 bool[,] tempBitmap = new bool[64,64];
616 /// Change a land bitmap at within a square and set those points to a specific value 616 tempBitmap.Initialize();
617 /// </summary> 617
618 /// <param name="land_bitmap"></param> 618 tempBitmap = ModifyLandBitmapSquare(tempBitmap, start_x, start_y, end_x, end_y, true);
619 /// <param name="start_x"></param> 619 return tempBitmap;
620 /// <param name="start_y"></param> 620 }
621 /// <param name="end_x"></param> 621
622 /// <param name="end_y"></param> 622 /// <summary>
623 /// <param name="set_value"></param> 623 /// Change a land bitmap at within a square and set those points to a specific value
624 /// <returns></returns> 624 /// </summary>
625 public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, 625 /// <param name="land_bitmap"></param>
626 bool set_value) 626 /// <param name="start_x"></param>
627 { 627 /// <param name="start_y"></param>
628 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2) 628 /// <param name="end_x"></param>
629 { 629 /// <param name="end_y"></param>
630 //Throw an exception - The bitmap is not 64x64 630 /// <param name="set_value"></param>
631 //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()"); 631 /// <returns></returns>
632 } 632 public bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y,
633 633 bool set_value)
634 int x, y; 634 {
635 for (y = 0; y < 64; y++) 635 if (land_bitmap.GetLength(0) != 64 || land_bitmap.GetLength(1) != 64 || land_bitmap.Rank != 2)
636 { 636 {
637 for (x = 0; x < 64; x++) 637 //Throw an exception - The bitmap is not 64x64
638 { 638 //throw new Exception("Error: Invalid Parcel Bitmap in modifyLandBitmapSquare()");
639 if (x >= start_x / 4 && x < end_x / 4 639 }
640 && y >= start_y / 4 && y < end_y / 4) 640
641 { 641 int x, y;
642 land_bitmap[x, y] = set_value; 642 for (y = 0; y < 64; y++)
643 } 643 {
644 } 644 for (x = 0; x < 64; x++)
645 } 645 {
646 return land_bitmap; 646 if (x >= start_x / 4 && x < end_x / 4
647 } 647 && y >= start_y / 4 && y < end_y / 4)
648 648 {
649 /// <summary> 649 land_bitmap[x, y] = set_value;
650 /// Join the true values of 2 bitmaps together 650 }
651 /// </summary> 651 }
652 /// <param name="bitmap_base"></param> 652 }
653 /// <param name="bitmap_add"></param> 653 return land_bitmap;
654 /// <returns></returns> 654 }
655 public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add) 655
656 { 656 /// <summary>
657 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2) 657 /// Join the true values of 2 bitmaps together
658 { 658 /// </summary>
659 //Throw an exception - The bitmap is not 64x64 659 /// <param name="bitmap_base"></param>
660 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps"); 660 /// <param name="bitmap_add"></param>
661 } 661 /// <returns></returns>
662 if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2) 662 public bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add)
663 { 663 {
664 //Throw an exception - The bitmap is not 64x64 664 if (bitmap_base.GetLength(0) != 64 || bitmap_base.GetLength(1) != 64 || bitmap_base.Rank != 2)
665 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps"); 665 {
666 } 666 //Throw an exception - The bitmap is not 64x64
667 667 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_base in mergeLandBitmaps");
668 int x, y; 668 }
669 for (y = 0; y < 64; y++) 669 if (bitmap_add.GetLength(0) != 64 || bitmap_add.GetLength(1) != 64 || bitmap_add.Rank != 2)
670 { 670 {
671 for (x = 0; x < 64; x++) 671 //Throw an exception - The bitmap is not 64x64
672 { 672 throw new Exception("Error: Invalid Parcel Bitmap - Bitmap_add in mergeLandBitmaps");
673 if (bitmap_add[x, y]) 673 }
674 { 674
675 bitmap_base[x, y] = true; 675 int x, y;
676 } 676 for (y = 0; y < 64; y++)
677 } 677 {
678 } 678 for (x = 0; x < 64; x++)
679 return bitmap_base; 679 {
680 } 680 if (bitmap_add[x, y])
681 681 {
682 /// <summary> 682 bitmap_base[x, y] = true;
683 /// Converts the land bitmap to a packet friendly byte array 683 }
684 /// </summary> 684 }
685 /// <returns></returns> 685 }
686 private byte[] ConvertLandBitmapToBytes() 686 return bitmap_base;
687 { 687 }
688 byte[] tempConvertArr = new byte[512]; 688
689 byte tempByte = 0; 689 /// <summary>
690 int x, y, i, byteNum = 0; 690 /// Converts the land bitmap to a packet friendly byte array
691 i = 0; 691 /// </summary>
692 for (y = 0; y < 64; y++) 692 /// <returns></returns>
693 { 693 private byte[] ConvertLandBitmapToBytes()
694 for (x = 0; x < 64; x++) 694 {
695 { 695 byte[] tempConvertArr = new byte[512];
696 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8)); 696 byte tempByte = 0;
697 if (i % 8 == 0) 697 int x, y, i, byteNum = 0;
698 { 698 i = 0;
699 tempConvertArr[byteNum] = tempByte; 699 for (y = 0; y < 64; y++)
700 tempByte = (byte) 0; 700 {
701 i = 0; 701 for (x = 0; x < 64; x++)
702 byteNum++; 702 {
703 } 703 tempByte = Convert.ToByte(tempByte | Convert.ToByte(LandBitmap[x, y]) << (i++ % 8));
704 } 704 if (i % 8 == 0)
705 } 705 {
706 return tempConvertArr; 706 tempConvertArr[byteNum] = tempByte;
707 } 707 tempByte = (byte) 0;
708 708 i = 0;
709 private bool[,] ConvertBytesToLandBitmap() 709 byteNum++;
710 { 710 }
711 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax]; 711 }
712 tempConvertMap.Initialize(); 712 }
713 byte tempByte = 0; 713 return tempConvertArr;
714 int x = 0, y = 0, i = 0, bitNum = 0; 714 }
715 for (i = 0; i < 512; i++) 715
716 { 716 private bool[,] ConvertBytesToLandBitmap()
717 tempByte = LandData.Bitmap[i]; 717 {
718 for (bitNum = 0; bitNum < 8; bitNum++) 718 bool[,] tempConvertMap = new bool[landArrayMax, landArrayMax];
719 { 719 tempConvertMap.Initialize();
720 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1); 720 byte tempByte = 0;
721 tempConvertMap[x, y] = bit; 721 int x = 0, y = 0, i = 0, bitNum = 0;
722 x++; 722 for (i = 0; i < 512; i++)
723 if (x > 63) 723 {
724 { 724 tempByte = LandData.Bitmap[i];
725 x = 0; 725 for (bitNum = 0; bitNum < 8; bitNum++)
726 y++; 726 {
727 } 727 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte) 1);
728 } 728 tempConvertMap[x, y] = bit;
729 } 729 x++;
730 return tempConvertMap; 730 if (x > 63)
731 } 731 {
732 732 x = 0;
733 #endregion 733 y++;
734 734 }
735 #region Object Select and Object Owner Listing 735 }
736 736 }
737 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 737 return tempConvertMap;
738 { 738 }
739 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 739
740 { 740 #endregion
741 List<uint> resultLocalIDs = new List<uint>(); 741
742 try 742 #region Object Select and Object Owner Listing
743 { 743
744 lock (primsOverMe) 744 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
745 { 745 {
746 foreach (SceneObjectGroup obj in primsOverMe) 746 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
747 { 747 {
748 if (obj.LocalId > 0) 748 List<uint> resultLocalIDs = new List<uint>();
749 { 749 try
750 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID) 750 {
751 { 751 lock (primsOverMe)
752 resultLocalIDs.Add(obj.LocalId); 752 {
753 } 753 foreach (SceneObjectGroup obj in primsOverMe)
754 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero) 754 {
755 { 755 if (obj.LocalId > 0)
756 resultLocalIDs.Add(obj.LocalId); 756 {
757 } 757 if (request_type == LandChannel.LAND_SELECT_OBJECTS_OWNER && obj.OwnerID == LandData.OwnerID)
758 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER && 758 {
759 obj.OwnerID != remote_client.AgentId) 759 resultLocalIDs.Add(obj.LocalId);
760 { 760 }
761 resultLocalIDs.Add(obj.LocalId); 761 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_GROUP && obj.GroupID == LandData.GroupID && LandData.GroupID != UUID.Zero)
762 } 762 {
763 else if (request_type == (int)ObjectReturnType.List && returnIDs.Contains(obj.OwnerID)) 763 resultLocalIDs.Add(obj.LocalId);
764 { 764 }
765 resultLocalIDs.Add(obj.LocalId); 765 else if (request_type == LandChannel.LAND_SELECT_OBJECTS_OTHER &&
766 } 766 obj.OwnerID != remote_client.AgentId)
767 } 767 {
768 } 768 resultLocalIDs.Add(obj.LocalId);
769 } 769 }
770 } catch (InvalidOperationException) 770 else if (request_type == (int)ObjectReturnType.List && returnIDs.Contains(obj.OwnerID))
771 { 771 {
772 m_log.Error("[LAND]: Unable to force select the parcel objects. Arr."); 772 resultLocalIDs.Add(obj.LocalId);
773 } 773 }
774 774 }
775 remote_client.SendForceClientSelectObjects(resultLocalIDs); 775 }
776 } 776 }
777 } 777 } catch (InvalidOperationException)
778 778 {
779 /// <summary> 779 m_log.Error("[LAND]: Unable to force select the parcel objects. Arr.");
780 /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes 780 }
781 /// aggreagete details such as the number of prims. 781
782 /// 782 remote_client.SendForceClientSelectObjects(resultLocalIDs);
783 /// </summary> 783 }
784 /// <param name="remote_client"> 784 }
785 /// A <see cref="IClientAPI"/> 785
786 /// </param> 786 /// <summary>
787 public void SendLandObjectOwners(IClientAPI remote_client) 787 /// Notify the parcel owner each avatar that owns prims situated on their land. This notification includes
788 { 788 /// aggreagete details such as the number of prims.
789 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 789 ///
790 { 790 /// </summary>
791 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 791 /// <param name="remote_client">
792 List<UUID> groups = new List<UUID>(); 792 /// A <see cref="IClientAPI"/>
793 793 /// </param>
794 lock (primsOverMe) 794 public void SendLandObjectOwners(IClientAPI remote_client)
795 { 795 {
796 try 796 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this))
797 { 797 {
798 798 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
799 foreach (SceneObjectGroup obj in primsOverMe) 799 List<UUID> groups = new List<UUID>();
800 { 800
801 try 801 lock (primsOverMe)
802 { 802 {
803 if (!primCount.ContainsKey(obj.OwnerID)) 803 try
804 { 804 {
805 primCount.Add(obj.OwnerID, 0); 805
806 } 806 foreach (SceneObjectGroup obj in primsOverMe)
807 } 807 {
808 catch (NullReferenceException) 808 try
809 { 809 {
810 m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); 810 if (!primCount.ContainsKey(obj.OwnerID))
811 } 811 {
812 try 812 primCount.Add(obj.OwnerID, 0);
813 { 813 }
814 primCount[obj.OwnerID] += obj.PrimCount; 814 }
815 } 815 catch (NullReferenceException)
816 catch (KeyNotFoundException) 816 {
817 { 817 m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel");
818 m_log.Error("[LAND]: Unable to match a prim with it's owner."); 818 }
819 } 819 try
820 if (obj.OwnerID == obj.GroupID && (!groups.Contains(obj.OwnerID))) 820 {
821 groups.Add(obj.OwnerID); 821 primCount[obj.OwnerID] += obj.PrimCount;
822 } 822 }
823 } 823 catch (KeyNotFoundException)
824 catch (InvalidOperationException) 824 {
825 { 825 m_log.Error("[LAND]: Unable to match a prim with it's owner.");
826 m_log.Error("[LAND]: Unable to Enumerate Land object arr."); 826 }
827 } 827 if (obj.OwnerID == obj.GroupID && (!groups.Contains(obj.OwnerID)))
828 } 828 groups.Add(obj.OwnerID);
829 829 }
830 remote_client.SendLandObjectOwners(LandData, groups, primCount); 830 }
831 } 831 catch (InvalidOperationException)
832 } 832 {
833 833 m_log.Error("[LAND]: Unable to Enumerate Land object arr.");
834 public Dictionary<UUID, int> GetLandObjectOwners() 834 }
835 { 835 }
836 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); 836
837 lock (primsOverMe) 837 remote_client.SendLandObjectOwners(LandData, groups, primCount);
838 { 838 }
839 try 839 }
840 { 840
841 841 public Dictionary<UUID, int> GetLandObjectOwners()
842 foreach (SceneObjectGroup obj in primsOverMe) 842 {
843 { 843 Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>();
844 if (!ownersAndCount.ContainsKey(obj.OwnerID)) 844 lock (primsOverMe)
845 { 845 {
846 ownersAndCount.Add(obj.OwnerID, 0); 846 try
847 } 847 {
848 ownersAndCount[obj.OwnerID] += obj.PrimCount; 848
849 } 849 foreach (SceneObjectGroup obj in primsOverMe)
850 } 850 {
851 catch (InvalidOperationException) 851 if (!ownersAndCount.ContainsKey(obj.OwnerID))
852 { 852 {
853 m_log.Error("[LAND]: Unable to enumerate land owners. arr."); 853 ownersAndCount.Add(obj.OwnerID, 0);
854 } 854 }
855 855 ownersAndCount[obj.OwnerID] += obj.PrimCount;
856 } 856 }
857 return ownersAndCount; 857 }
858 } 858 catch (InvalidOperationException)
859 859 {
860 #endregion 860 m_log.Error("[LAND]: Unable to enumerate land owners. arr.");
861 861 }
862 #region Object Returning 862
863 863 }
864 public void ReturnObject(SceneObjectGroup obj) 864 return ownersAndCount;
865 { 865 }
866 SceneObjectGroup[] objs = new SceneObjectGroup[1]; 866
867 objs[0] = obj; 867 #endregion
868 m_scene.returnObjects(objs, obj.OwnerID); 868
869 } 869 #region Object Returning
870 870
871 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) 871 public void ReturnObject(SceneObjectGroup obj)
872 { 872 {
873 Dictionary<UUID,List<SceneObjectGroup>> returns = 873 SceneObjectGroup[] objs = new SceneObjectGroup[1];
874 new Dictionary<UUID,List<SceneObjectGroup>>(); 874 objs[0] = obj;
875 875 m_scene.returnObjects(objs, obj.OwnerID);
876 lock (primsOverMe) 876 }
877 { 877
878 if (type == (uint)ObjectReturnType.Owner) 878 public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
879 { 879 {
880 foreach (SceneObjectGroup obj in primsOverMe) 880 Dictionary<UUID,List<SceneObjectGroup>> returns =
881 { 881 new Dictionary<UUID,List<SceneObjectGroup>>();
882 if (obj.OwnerID == m_landData.OwnerID) 882
883 { 883 lock (primsOverMe)
884 if (!returns.ContainsKey(obj.OwnerID)) 884 {
885 returns[obj.OwnerID] = 885 if (type == (uint)ObjectReturnType.Owner)
886 new List<SceneObjectGroup>(); 886 {
887 returns[obj.OwnerID].Add(obj); 887 foreach (SceneObjectGroup obj in primsOverMe)
888 } 888 {
889 } 889 if (obj.OwnerID == m_landData.OwnerID)
890 } 890 {
891 else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero) 891 if (!returns.ContainsKey(obj.OwnerID))
892 { 892 returns[obj.OwnerID] =
893 foreach (SceneObjectGroup obj in primsOverMe) 893 new List<SceneObjectGroup>();
894 { 894 returns[obj.OwnerID].Add(obj);
895 if (obj.GroupID == m_landData.GroupID) 895 }
896 { 896 }
897 if (!returns.ContainsKey(obj.OwnerID)) 897 }
898 returns[obj.OwnerID] = 898 else if (type == (uint)ObjectReturnType.Group && m_landData.GroupID != UUID.Zero)
899 new List<SceneObjectGroup>(); 899 {
900 returns[obj.OwnerID].Add(obj); 900 foreach (SceneObjectGroup obj in primsOverMe)
901 } 901 {
902 } 902 if (obj.GroupID == m_landData.GroupID)
903 } 903 {
904 else if (type == (uint)ObjectReturnType.Other) 904 if (!returns.ContainsKey(obj.OwnerID))
905 { 905 returns[obj.OwnerID] =
906 foreach (SceneObjectGroup obj in primsOverMe) 906 new List<SceneObjectGroup>();
907 { 907 returns[obj.OwnerID].Add(obj);
908 if (obj.OwnerID != m_landData.OwnerID && 908 }
909 (obj.GroupID != m_landData.GroupID || 909 }
910 m_landData.GroupID == UUID.Zero)) 910 }
911 { 911 else if (type == (uint)ObjectReturnType.Other)
912 if (!returns.ContainsKey(obj.OwnerID)) 912 {
913 returns[obj.OwnerID] = 913 foreach (SceneObjectGroup obj in primsOverMe)
914 new List<SceneObjectGroup>(); 914 {
915 returns[obj.OwnerID].Add(obj); 915 if (obj.OwnerID != m_landData.OwnerID &&
916 } 916 (obj.GroupID != m_landData.GroupID ||
917 } 917 m_landData.GroupID == UUID.Zero))
918 } 918 {
919 else if (type == (uint)ObjectReturnType.List) 919 if (!returns.ContainsKey(obj.OwnerID))
920 { 920 returns[obj.OwnerID] =
921 List<UUID> ownerlist = new List<UUID>(owners); 921 new List<SceneObjectGroup>();
922 922 returns[obj.OwnerID].Add(obj);
923 foreach (SceneObjectGroup obj in primsOverMe) 923 }
924 { 924 }
925 if (ownerlist.Contains(obj.OwnerID)) 925 }
926 { 926 else if (type == (uint)ObjectReturnType.List)
927 if (!returns.ContainsKey(obj.OwnerID)) 927 {
928 returns[obj.OwnerID] = 928 List<UUID> ownerlist = new List<UUID>(owners);
929 new List<SceneObjectGroup>(); 929
930 returns[obj.OwnerID].Add(obj); 930 foreach (SceneObjectGroup obj in primsOverMe)
931 } 931 {
932 } 932 if (ownerlist.Contains(obj.OwnerID))
933 } 933 {
934 } 934 if (!returns.ContainsKey(obj.OwnerID))
935 935 returns[obj.OwnerID] =
936 foreach (List<SceneObjectGroup> ol in returns.Values) 936 new List<SceneObjectGroup>();
937 { 937 returns[obj.OwnerID].Add(obj);
938 if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol)) 938 }
939 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId); 939 }
940 } 940 }
941 } 941 }
942 942
943 #endregion 943 foreach (List<SceneObjectGroup> ol in returns.Values)
944 944 {
945 #region Object Adding/Removing from Parcel 945 if (m_scene.Permissions.CanReturnObjects(this, remote_client.AgentId, ol))
946 946 m_scene.returnObjects(ol.ToArray(), remote_client.AgentId);
947 public void ResetLandPrimCounts() 947 }
948 { 948 }
949 LandData.GroupPrims = 0; 949
950 LandData.OwnerPrims = 0; 950 #endregion
951 LandData.OtherPrims = 0; 951
952 LandData.SelectedPrims = 0; 952 #region Object Adding/Removing from Parcel
953 953
954 954 public void ResetLandPrimCounts()
955 lock (primsOverMe) 955 {
956 primsOverMe.Clear(); 956 LandData.GroupPrims = 0;
957 } 957 LandData.OwnerPrims = 0;
958 958 LandData.OtherPrims = 0;
959 public void AddPrimToCount(SceneObjectGroup obj) 959 LandData.SelectedPrims = 0;
960 { 960
961 961
962 UUID prim_owner = obj.OwnerID; 962 lock (primsOverMe)
963 int prim_count = obj.PrimCount; 963 primsOverMe.Clear();
964 964 }
965 if (obj.IsSelected) 965
966 { 966 public void AddPrimToCount(SceneObjectGroup obj)
967 LandData.SelectedPrims += prim_count; 967 {
968 } 968
969 else 969 UUID prim_owner = obj.OwnerID;
970 { 970 int prim_count = obj.PrimCount;
971 if (prim_owner == LandData.OwnerID) 971
972 { 972 if (obj.IsSelected)
973 LandData.OwnerPrims += prim_count; 973 {
974 } 974 LandData.SelectedPrims += prim_count;
975 else if ((obj.GroupID == LandData.GroupID || 975 }
976 prim_owner == LandData.GroupID) && 976 else
977 LandData.GroupID != UUID.Zero) 977 {
978 { 978 if (prim_owner == LandData.OwnerID)
979 LandData.GroupPrims += prim_count; 979 {
980 } 980 LandData.OwnerPrims += prim_count;
981 else 981 }
982 { 982 else if ((obj.GroupID == LandData.GroupID ||
983 LandData.OtherPrims += prim_count; 983 prim_owner == LandData.GroupID) &&
984 } 984 LandData.GroupID != UUID.Zero)
985 } 985 {
986 986 LandData.GroupPrims += prim_count;
987 lock (primsOverMe) 987 }
988 primsOverMe.Add(obj); 988 else
989 } 989 {
990 990 LandData.OtherPrims += prim_count;
991 public void RemovePrimFromCount(SceneObjectGroup obj) 991 }
992 { 992 }
993 lock (primsOverMe) 993
994 { 994 lock (primsOverMe)
995 if (primsOverMe.Contains(obj)) 995 primsOverMe.Add(obj);
996 { 996 }
997 UUID prim_owner = obj.OwnerID; 997
998 int prim_count = obj.PrimCount; 998 public void RemovePrimFromCount(SceneObjectGroup obj)
999 999 {
1000 if (prim_owner == LandData.OwnerID) 1000 lock (primsOverMe)
1001 { 1001 {
1002 LandData.OwnerPrims -= prim_count; 1002 if (primsOverMe.Contains(obj))
1003 } 1003 {
1004 else if (obj.GroupID == LandData.GroupID || 1004 UUID prim_owner = obj.OwnerID;
1005 prim_owner == LandData.GroupID) 1005 int prim_count = obj.PrimCount;
1006 { 1006
1007 LandData.GroupPrims -= prim_count; 1007 if (prim_owner == LandData.OwnerID)
1008 } 1008 {
1009 else 1009 LandData.OwnerPrims -= prim_count;
1010 { 1010 }
1011 LandData.OtherPrims -= prim_count; 1011 else if (obj.GroupID == LandData.GroupID ||
1012 } 1012 prim_owner == LandData.GroupID)
1013 1013 {
1014 primsOverMe.Remove(obj); 1014 LandData.GroupPrims -= prim_count;
1015 } 1015 }
1016 } 1016 else
1017 } 1017 {
1018 1018 LandData.OtherPrims -= prim_count;
1019 #endregion 1019 }
1020 1020
1021 #endregion 1021 primsOverMe.Remove(obj);
1022 1022 }
1023 #endregion 1023 }
1024 1024 }
1025 /// <summary> 1025
1026 /// Set the media url for this land parcel 1026 #endregion
1027 /// </summary> 1027
1028 /// <param name="url"></param> 1028 #endregion
1029 public void SetMediaUrl(string url) 1029
1030 { 1030 #endregion
1031 LandData.MediaURL = url; 1031
1032 SendLandUpdateToAvatarsOverMe(); 1032 /// <summary>
1033 } 1033 /// Set the media url for this land parcel
1034 1034 /// </summary>
1035 /// <summary> 1035 /// <param name="url"></param>
1036 /// Set the music url for this land parcel 1036 public void SetMediaUrl(string url)
1037 /// </summary> 1037 {
1038 /// <param name="url"></param> 1038 LandData.MediaURL = url;
1039 public void SetMusicUrl(string url) 1039 SendLandUpdateToAvatarsOverMe();
1040 { 1040 }
1041 LandData.MusicURL = url; 1041
1042 SendLandUpdateToAvatarsOverMe(); 1042 /// <summary>
1043 } 1043 /// Set the music url for this land parcel
1044 } 1044 /// </summary>
1045} 1045 /// <param name="url"></param>
1046 public void SetMusicUrl(string url)
1047 {
1048 LandData.MusicURL = url;
1049 SendLandUpdateToAvatarsOverMe();
1050 }
1051 }
1052}
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 62abd4c..8ce6daf 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -128,7 +128,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
128 group.SetOwnerId(remoteClient.AgentId); 128 group.SetOwnerId(remoteClient.AgentId);
129 group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); 129 group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);
130 130
131 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 131 List<SceneObjectPart> partList = null;
132
133 lock (group.Children)
134 partList = new List<SceneObjectPart>(group.Children.Values);
132 135
133 if (m_scene.Permissions.PropagatePermissions()) 136 if (m_scene.Permissions.PropagatePermissions())
134 { 137 {
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index b96d95a..57eff8a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -227,8 +227,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
227 { 227 {
228 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 228 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
229 Color mapdotspot = Color.Gray; // Default color when prim color is white 229 Color mapdotspot = Color.Gray; // Default color when prim color is white
230 // Loop over prim in group 230
231 foreach (SceneObjectPart part in mapdot.Children.Values) 231 // Loop over prim in group
232 List<SceneObjectPart> partList = null;
233 lock (mapdot.Children)
234 partList = new List<SceneObjectPart>(mapdot.Children.Values);
235
236 foreach (SceneObjectPart part in partList)
232 { 237 {
233 if (part == null) 238 if (part == null)
234 continue; 239 continue;