aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs27
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs128
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs14
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs23
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs109
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs64
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs34
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs202
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs56
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs82
16 files changed, 490 insertions, 280 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
index ac2ad7a..1f60e36 100644
--- a/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Assets/GetTextureModule.cs
@@ -226,7 +226,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
226 } 226 }
227 else 227 else
228 { 228 {
229 AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.CreatorID); 229 AssetBase newTexture = new AssetBase(texture.ID + "-" + format, texture.Name, (sbyte)AssetType.Texture, texture.Metadata.CreatorID);
230 newTexture.Data = ConvertTextureData(texture, format); 230 newTexture.Data = ConvertTextureData(texture, format);
231 if (newTexture.Data.Length == 0) 231 if (newTexture.Data.Length == 0)
232 return false; // !!! Caller try another codec, please! 232 return false; // !!! Caller try another codec, please!
@@ -336,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps
336 336
337 try 337 try
338 { 338 {
339 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular jpeg data 339 // Taking our jpeg2000 data, decoding it, then saving it to a byte array with regular data
340 340
341 imgstream = new MemoryStream(); 341 imgstream = new MemoryStream();
342 342
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 1f49a01..360a014 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -484,6 +484,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
484 } 484 }
485 } 485 }
486 486
487 public void UpdateAttachmentPosition(SceneObjectGroup sog, Vector3 pos)
488 {
489 // First we save the
490 // attachment point information, then we update the relative
491 // positioning. Then we have to mark the object as NOT an
492 // attachment. This is necessary in order to correctly save
493 // and retrieve GroupPosition information for the attachment.
494 // Finally, we restore the object's attachment status.
495 byte attachmentPoint = sog.GetAttachmentPoint();
496 sog.UpdateGroupPosition(pos);
497 sog.RootPart.IsAttachment = false;
498 sog.AbsolutePosition = sog.RootPart.AttachedPos;
499 sog.SetAttachmentPoint(attachmentPoint);
500 sog.HasGroupChanged = true;
501 }
502
487 /// <summary> 503 /// <summary>
488 /// Update the attachment asset for the new sog details if they have changed. 504 /// Update the attachment asset for the new sog details if they have changed.
489 /// </summary> 505 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index cab341d..5e5f6c0 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -156,7 +156,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
156 /// <param name="inventoryFolder">The inventory folder to save</param> 156 /// <param name="inventoryFolder">The inventory folder to save</param>
157 /// <param name="path">The path to which the folder should be saved</param> 157 /// <param name="path">The path to which the folder should be saved</param>
158 /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param> 158 /// <param name="saveThisFolderItself">If true, save this folder itself. If false, only saves contents</param>
159 protected void SaveInvFolder(InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, Dictionary<string, object> options, IUserAccountService userAccountService) 159 /// <param name="options"></param>
160 /// <param name="userAccountService"></param>
161 protected void SaveInvFolder(
162 InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself,
163 Dictionary<string, object> options, IUserAccountService userAccountService)
160 { 164 {
161 if (saveThisFolderItself) 165 if (saveThisFolderItself)
162 { 166 {
@@ -249,7 +253,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
249 253
250 // Write out control file. This has to be done first so that subsequent loaders will see this file first 254 // Write out control file. This has to be done first so that subsequent loaders will see this file first
251 // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this 255 // XXX: I know this is a weak way of doing it since external non-OAR aware tar executables will not do this
252 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); 256 // not sure how to fix this though, short of going with a completely different file format.
257 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile(options));
253 m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive."); 258 m_log.InfoFormat("[INVENTORY ARCHIVER]: Added control file to archive.");
254 259
255 if (inventoryFolder != null) 260 if (inventoryFolder != null)
@@ -372,12 +377,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
372 } 377 }
373 378
374 /// <summary> 379 /// <summary>
375 /// Create the control file for a 0.1 version archive 380 /// Create the control file for the archive
376 /// </summary> 381 /// </summary>
382 /// <param name="options"></param>
377 /// <returns></returns> 383 /// <returns></returns>
378 public static string Create0p1ControlFile() 384 public static string CreateControlFile(Dictionary<string, object> options)
379 { 385 {
380 int majorVersion = 0, minorVersion = 1; 386 int majorVersion, minorVersion;
387
388 if (options.ContainsKey("profile"))
389 {
390 majorVersion = 1;
391 minorVersion = 0;
392 }
393 else
394 {
395 majorVersion = 0;
396 minorVersion = 1;
397 }
381 398
382 m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion); 399 m_log.InfoFormat("[INVENTORY ARCHIVER]: Creating version {0}.{1} IAR", majorVersion, minorVersion);
383 400
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index b33c2b1..1e18095 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
55 /// <value> 55 /// <value>
56 /// Enable or disable checking whether the iar user is actually logged in 56 /// Enable or disable checking whether the iar user is actually logged in
57 /// </value> 57 /// </value>
58 public bool DisablePresenceChecks { get; set; } 58// public bool DisablePresenceChecks { get; set; }
59 59
60 public event InventoryArchiveSaved OnInventoryArchiveSaved; 60 public event InventoryArchiveSaved OnInventoryArchiveSaved;
61 61
@@ -95,10 +95,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
95 95
96 public InventoryArchiverModule() {} 96 public InventoryArchiverModule() {}
97 97
98 public InventoryArchiverModule(bool disablePresenceChecks) 98// public InventoryArchiverModule(bool disablePresenceChecks)
99 { 99// {
100 DisablePresenceChecks = disablePresenceChecks; 100// DisablePresenceChecks = disablePresenceChecks;
101 } 101// }
102 102
103 public void Initialise(Scene scene, IConfigSource source) 103 public void Initialise(Scene scene, IConfigSource source)
104 { 104 {
@@ -172,8 +172,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
172 172
173 if (userInfo != null) 173 if (userInfo != null)
174 { 174 {
175 if (CheckPresence(userInfo.PrincipalID)) 175// if (CheckPresence(userInfo.PrincipalID))
176 { 176// {
177 try 177 try
178 { 178 {
179 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); 179 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService);
@@ -189,13 +189,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
189 } 189 }
190 190
191 return true; 191 return true;
192 } 192// }
193 else 193// else
194 { 194// {
195 m_log.ErrorFormat( 195// m_log.ErrorFormat(
196 "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", 196// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
197 userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); 197// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
198 } 198// }
199 } 199 }
200 } 200 }
201 201
@@ -212,8 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
212 212
213 if (userInfo != null) 213 if (userInfo != null)
214 { 214 {
215 if (CheckPresence(userInfo.PrincipalID)) 215// if (CheckPresence(userInfo.PrincipalID))
216 { 216// {
217 try 217 try
218 { 218 {
219 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); 219 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService);
@@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
229 } 229 }
230 230
231 return true; 231 return true;
232 } 232// }
233 else 233// else
234 { 234// {
235 m_log.ErrorFormat( 235// m_log.ErrorFormat(
236 "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", 236// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
237 userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); 237// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
238 } 238// }
239 } 239 }
240 } 240 }
241 241
@@ -257,9 +257,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
257 257
258 if (userInfo != null) 258 if (userInfo != null)
259 { 259 {
260 if (CheckPresence(userInfo.PrincipalID)) 260// if (CheckPresence(userInfo.PrincipalID))
261 { 261// {
262
263 InventoryArchiveReadRequest request; 262 InventoryArchiveReadRequest request;
264 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 263 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
265 264
@@ -280,13 +279,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
280 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 279 UpdateClientWithLoadedNodes(userInfo, request.Execute());
281 280
282 return true; 281 return true;
283 } 282// }
284 else 283// else
285 { 284// {
286 m_log.ErrorFormat( 285// m_log.ErrorFormat(
287 "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", 286// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
288 userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); 287// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
289 } 288// }
290 } 289 }
291 else 290 else
292 m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", 291 m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found",
@@ -306,8 +305,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
306 305
307 if (userInfo != null) 306 if (userInfo != null)
308 { 307 {
309 if (CheckPresence(userInfo.PrincipalID)) 308// if (CheckPresence(userInfo.PrincipalID))
310 { 309// {
311 InventoryArchiveReadRequest request; 310 InventoryArchiveReadRequest request;
312 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 311 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
313 312
@@ -328,13 +327,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
328 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 327 UpdateClientWithLoadedNodes(userInfo, request.Execute());
329 328
330 return true; 329 return true;
331 } 330// }
332 else 331// else
333 { 332// {
334 m_log.ErrorFormat( 333// m_log.ErrorFormat(
335 "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator", 334// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
336 userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID); 335// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
337 } 336// }
338 } 337 }
339 } 338 }
340 339
@@ -529,28 +528,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
529 } 528 }
530 } 529 }
531 530
532 /// <summary> 531// /// <summary>
533 /// Check if the given user is present in any of the scenes. 532// /// Check if the given user is present in any of the scenes.
534 /// </summary> 533// /// </summary>
535 /// <param name="userId">The user to check</param> 534// /// <param name="userId">The user to check</param>
536 /// <returns>true if the user is in any of the scenes, false otherwise</returns> 535// /// <returns>true if the user is in any of the scenes, false otherwise</returns>
537 protected bool CheckPresence(UUID userId) 536// protected bool CheckPresence(UUID userId)
538 { 537// {
539 if (DisablePresenceChecks) 538// if (DisablePresenceChecks)
540 return true; 539// return true;
541 540//
542 foreach (Scene scene in m_scenes.Values) 541// foreach (Scene scene in m_scenes.Values)
543 { 542// {
544 ScenePresence p; 543// ScenePresence p;
545 if ((p = scene.GetScenePresence(userId)) != null) 544// if ((p = scene.GetScenePresence(userId)) != null)
546 { 545// {
547 p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false); 546// p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false);
548 return true; 547// return true;
549 } 548// }
550 } 549// }
551 550//
552 return false; 551// return false;
553 } 552// }
554
555 } 553 }
556} 554}
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 2747e15..76d0b85 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -120,7 +120,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
120 TestHelper.InMethod(); 120 TestHelper.InMethod();
121// log4net.Config.XmlConfigurator.Configure(); 121// log4net.Config.XmlConfigurator.Configure();
122 122
123 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 123 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
124 124
125 Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 125 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
126 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 126 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
@@ -238,7 +238,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
238 TestHelper.InMethod(); 238 TestHelper.InMethod();
239// log4net.Config.XmlConfigurator.Configure(); 239// log4net.Config.XmlConfigurator.Configure();
240 240
241 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 241 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
242 242
243 Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 243 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
244 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 244 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
@@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
355// log4net.Config.XmlConfigurator.Configure(); 355// log4net.Config.XmlConfigurator.Configure();
356 356
357 SerialiserModule serialiserModule = new SerialiserModule(); 357 SerialiserModule serialiserModule = new SerialiserModule();
358 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 358 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
359 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 359 Scene scene = SceneSetupHelpers.SetupScene("inventory");
360 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 360 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
361 361
@@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
382 //log4net.Config.XmlConfigurator.Configure(); 382 //log4net.Config.XmlConfigurator.Configure();
383 383
384 SerialiserModule serialiserModule = new SerialiserModule(); 384 SerialiserModule serialiserModule = new SerialiserModule();
385 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 385 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
386 386
387 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 387 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
388 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 388 Scene scene = SceneSetupHelpers.SetupScene("inventory");
@@ -443,7 +443,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
443 string humanEscapedItemName = @"You & you are a mean\/man\/"; 443 string humanEscapedItemName = @"You & you are a mean\/man\/";
444 string userPassword = "meowfood"; 444 string userPassword = "meowfood";
445 445
446 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 446 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
447 447
448 Scene scene = SceneSetupHelpers.SetupScene("Inventory"); 448 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
449 SceneSetupHelpers.SetupSceneModules(scene, archiverModule); 449 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
@@ -558,7 +558,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
558 558
559 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 559 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
560 SerialiserModule serialiserModule = new SerialiserModule(); 560 SerialiserModule serialiserModule = new SerialiserModule();
561 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 561 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
562 562
563 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 563 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
564 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 564 Scene scene = SceneSetupHelpers.SetupScene("inventory");
@@ -619,7 +619,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
619 619
620 // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); 620 // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
621 // SerialiserModule serialiserModule = new SerialiserModule(); 621 // SerialiserModule serialiserModule = new SerialiserModule();
622 // InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 622 // InventoryArchiverModule archiverModule = new InventoryArchiverModule();
623 623
624 // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene 624 // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
625 // Scene scene = SceneSetupHelpers.SetupScene(); 625 // Scene scene = SceneSetupHelpers.SetupScene();
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index fd28ba0..a3251aa 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -1299,7 +1299,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1299 #region Agent Arrived 1299 #region Agent Arrived
1300 public void AgentArrivedAtDestination(UUID id) 1300 public void AgentArrivedAtDestination(UUID id)
1301 { 1301 {
1302 //m_log.Debug(" >>> ReleaseAgent called <<< "); 1302 m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Agent {0} released", id);
1303 ResetFromTransit(id); 1303 ResetFromTransit(id);
1304 } 1304 }
1305 1305
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index 3291be4..7316e5b 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
165 int width = 256; 165 int width = 256;
166 int height = 256; 166 int height = 256;
167 int alpha = 255; // 0 is transparent 167 int alpha = 255; // 0 is transparent
168 Color bgColour = Color.White; // Default background color 168 Color bgColor = Color.White; // Default background color
169 char altDataDelim = ';'; 169 char altDataDelim = ';';
170 170
171 char[] paramDelimiter = { ',' }; 171 char[] paramDelimiter = { ',' };
@@ -253,15 +253,16 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
253 alpha = 256; 253 alpha = 256;
254 } 254 }
255 break; 255 break;
256 case "bgcolor":
256 case "bgcolour": 257 case "bgcolour":
257 int hex = 0; 258 int hex = 0;
258 if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 259 if (Int32.TryParse(value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
259 { 260 {
260 bgColour = Color.FromArgb(hex); 261 bgColor = Color.FromArgb(hex);
261 } 262 }
262 else 263 else
263 { 264 {
264 bgColour = Color.FromName(value); 265 bgColor = Color.FromName(value);
265 } 266 }
266 break; 267 break;
267 case "altdatadelim": 268 case "altdatadelim":
@@ -315,7 +316,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
315 // background color in their scripts, only do when fully opaque 316 // background color in their scripts, only do when fully opaque
316 if (alpha >= 255) 317 if (alpha >= 255)
317 { 318 {
318 graph.FillRectangle(new SolidBrush(bgColour), 0, 0, width, height); 319 graph.FillRectangle(new SolidBrush(bgColor), 0, 0, width, height);
319 } 320 }
320 321
321 for (int w = 0; w < bitmap.Width; w++) 322 for (int w = 0; w < bitmap.Width; w++)
@@ -616,25 +617,25 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
616 } 617 }
617 } 618 }
618 } 619 }
619 else if (nextLine.StartsWith("PenColour")) 620 else if (nextLine.StartsWith("PenColour") || nextLine.StartsWith("PenColor"))
620 { 621 {
621 nextLine = nextLine.Remove(0, 9); 622 nextLine = nextLine.Remove(0, 9);
622 nextLine = nextLine.Trim(); 623 nextLine = nextLine.Trim();
623 int hex = 0; 624 int hex = 0;
624 625
625 Color newColour; 626 Color newColor;
626 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) 627 if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex))
627 { 628 {
628 newColour = Color.FromArgb(hex); 629 newColor = Color.FromArgb(hex);
629 } 630 }
630 else 631 else
631 { 632 {
632 // this doesn't fail, it just returns black if nothing is found 633 // this doesn't fail, it just returns black if nothing is found
633 newColour = Color.FromName(nextLine); 634 newColor = Color.FromName(nextLine);
634 } 635 }
635 636
636 myBrush.Color = newColour; 637 myBrush.Color = newColor;
637 drawPen.Color = newColour; 638 drawPen.Color = newColor;
638 } 639 }
639 } 640 }
640 } 641 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
index 16e25e6..dfba0d6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs
@@ -41,8 +41,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
41 41
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
43{ 43{
44 public class RemoteGridServicesConnector : 44 public class RemoteGridServicesConnector : ISharedRegionModule, IGridService
45 GridServicesConnector, ISharedRegionModule, IGridService
46 { 45 {
47 private static readonly ILog m_log = 46 private static readonly ILog m_log =
48 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -51,6 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
51 private bool m_Enabled = false; 50 private bool m_Enabled = false;
52 51
53 private IGridService m_LocalGridService; 52 private IGridService m_LocalGridService;
53 private IGridService m_RemoteGridService;
54 54
55 public RemoteGridServicesConnector() 55 public RemoteGridServicesConnector()
56 { 56 {
@@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
73 get { return "RemoteGridServicesConnector"; } 73 get { return "RemoteGridServicesConnector"; }
74 } 74 }
75 75
76 public override void Initialise(IConfigSource source) 76 public void Initialise(IConfigSource source)
77 { 77 {
78 IConfig moduleConfig = source.Configs["Modules"]; 78 IConfig moduleConfig = source.Configs["Modules"];
79 if (moduleConfig != null) 79 if (moduleConfig != null)
@@ -97,9 +97,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
97 return; 97 return;
98 } 98 }
99 99
100 base.Initialise(source);
101
102 m_LocalGridService = new LocalGridServicesConnector(source); 100 m_LocalGridService = new LocalGridServicesConnector(source);
101 m_RemoteGridService = new GridServicesConnector(source);
103 } 102 }
104 103
105 public void PostInitialise() 104 public void PostInitialise()
@@ -135,61 +134,61 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
135 134
136 #region IGridService 135 #region IGridService
137 136
138 public override string RegisterRegion(UUID scopeID, GridRegion regionInfo) 137 public string RegisterRegion(UUID scopeID, GridRegion regionInfo)
139 { 138 {
140 string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo); 139 string msg = m_LocalGridService.RegisterRegion(scopeID, regionInfo);
141 140
142 if (msg == String.Empty) 141 if (msg == String.Empty)
143 return base.RegisterRegion(scopeID, regionInfo); 142 return m_RemoteGridService.RegisterRegion(scopeID, regionInfo);
144 143
145 return msg; 144 return msg;
146 } 145 }
147 146
148 public override bool DeregisterRegion(UUID regionID) 147 public bool DeregisterRegion(UUID regionID)
149 { 148 {
150 if (m_LocalGridService.DeregisterRegion(regionID)) 149 if (m_LocalGridService.DeregisterRegion(regionID))
151 return base.DeregisterRegion(regionID); 150 return m_RemoteGridService.DeregisterRegion(regionID);
152 151
153 return false; 152 return false;
154 } 153 }
155 154
156 public override List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) 155 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
157 { 156 {
158 return base.GetNeighbours(scopeID, regionID); 157 return m_RemoteGridService.GetNeighbours(scopeID, regionID);
159 } 158 }
160 159
161 public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) 160 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
162 { 161 {
163 GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID); 162 GridRegion rinfo = m_LocalGridService.GetRegionByUUID(scopeID, regionID);
164 if (rinfo == null) 163 if (rinfo == null)
165 rinfo = base.GetRegionByUUID(scopeID, regionID); 164 rinfo = m_RemoteGridService.GetRegionByUUID(scopeID, regionID);
166 165
167 return rinfo; 166 return rinfo;
168 } 167 }
169 168
170 public override GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 169 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
171 { 170 {
172 GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); 171 GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y);
173 if (rinfo == null) 172 if (rinfo == null)
174 rinfo = base.GetRegionByPosition(scopeID, x, y); 173 rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y);
175 174
176 return rinfo; 175 return rinfo;
177 } 176 }
178 177
179 public override GridRegion GetRegionByName(UUID scopeID, string regionName) 178 public GridRegion GetRegionByName(UUID scopeID, string regionName)
180 { 179 {
181 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName); 180 GridRegion rinfo = m_LocalGridService.GetRegionByName(scopeID, regionName);
182 if (rinfo == null) 181 if (rinfo == null)
183 rinfo = base.GetRegionByName(scopeID, regionName); 182 rinfo = m_RemoteGridService.GetRegionByName(scopeID, regionName);
184 183
185 return rinfo; 184 return rinfo;
186 } 185 }
187 186
188 public override List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) 187 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
189 { 188 {
190 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); 189 List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber);
191 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); 190 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count);
192 List<GridRegion> grinfo = base.GetRegionsByName(scopeID, name, maxNumber); 191 List<GridRegion> grinfo = m_RemoteGridService.GetRegionsByName(scopeID, name, maxNumber);
193 192
194 if (grinfo != null) 193 if (grinfo != null)
195 { 194 {
@@ -202,13 +201,79 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
202 return rinfo; 201 return rinfo;
203 } 202 }
204 203
205 // Let's not override GetRegionRange -- let's get them all from the grid server 204 public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
205 {
206 List<GridRegion> rinfo = m_LocalGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
207 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionRange {0} found {1} regions", name, rinfo.Count);
208 List<GridRegion> grinfo = m_RemoteGridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
209
210 if (grinfo != null)
211 {
212 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionRange {0} found {1} regions", name, grinfo.Count);
213 foreach (GridRegion r in grinfo)
214 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
215 rinfo.Add(r);
216 }
217
218 return rinfo;
219 }
220
221 public List<GridRegion> GetDefaultRegions(UUID scopeID)
222 {
223 List<GridRegion> rinfo = m_LocalGridService.GetDefaultRegions(scopeID);
224 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetDefaultRegions {0} found {1} regions", name, rinfo.Count);
225 List<GridRegion> grinfo = m_RemoteGridService.GetDefaultRegions(scopeID);
226
227 if (grinfo != null)
228 {
229 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetDefaultRegions {0} found {1} regions", name, grinfo.Count);
230 foreach (GridRegion r in grinfo)
231 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
232 rinfo.Add(r);
233 }
234
235 return rinfo;
236 }
237
238 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
239 {
240 List<GridRegion> rinfo = m_LocalGridService.GetFallbackRegions(scopeID, x, y);
241 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetFallbackRegions {0} found {1} regions", name, rinfo.Count);
242 List<GridRegion> grinfo = m_RemoteGridService.GetFallbackRegions(scopeID, x, y);
243
244 if (grinfo != null)
245 {
246 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetFallbackRegions {0} found {1} regions", name, grinfo.Count);
247 foreach (GridRegion r in grinfo)
248 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
249 rinfo.Add(r);
250 }
251
252 return rinfo;
253 }
254
255 public List<GridRegion> GetHyperlinks(UUID scopeID)
256 {
257 List<GridRegion> rinfo = m_LocalGridService.GetHyperlinks(scopeID);
258 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetHyperlinks {0} found {1} regions", name, rinfo.Count);
259 List<GridRegion> grinfo = m_RemoteGridService.GetHyperlinks(scopeID);
260
261 if (grinfo != null)
262 {
263 //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetHyperlinks {0} found {1} regions", name, grinfo.Count);
264 foreach (GridRegion r in grinfo)
265 if (rinfo.Find(delegate(GridRegion gr) { return gr.RegionID == r.RegionID; }) == null)
266 rinfo.Add(r);
267 }
268
269 return rinfo;
270 }
206 271
207 public override int GetRegionFlags(UUID scopeID, UUID regionID) 272 public int GetRegionFlags(UUID scopeID, UUID regionID)
208 { 273 {
209 int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID); 274 int flags = m_LocalGridService.GetRegionFlags(scopeID, regionID);
210 if (flags == -1) 275 if (flags == -1)
211 flags = base.GetRegionFlags(scopeID, regionID); 276 flags = m_RemoteGridService.GetRegionFlags(scopeID, regionID);
212 277
213 return flags; 278 return flags;
214 } 279 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index f8a599a..9ec4ebe 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -136,14 +136,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
136 ms.Close(); 136 ms.Close();
137 137
138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive."); 138 m_log.InfoFormat("[ARCHIVER]: Added terrain information to archive.");
139
140 139
141 // Write out scene object metadata 140 // Write out scene object metadata
142 foreach (SceneObjectGroup sceneObject in m_sceneObjects) 141 foreach (SceneObjectGroup sceneObject in m_sceneObjects)
143 { 142 {
144 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); 143 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
145 144
146 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options); 145 string serializedObject = m_serialiser.SerializeGroupToXml2(sceneObject, m_options);
147 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject); 146 m_archiveWriter.WriteFile(ArchiveHelpers.CreateObjectPath(sceneObject), serializedObject);
148 } 147 }
149 148
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index 0699407..f2d487e 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
58 /// <summary> 58 /// <summary>
59 /// The maximum major version of OAR that we can write. 59 /// The maximum major version of OAR that we can write.
60 /// </summary> 60 /// </summary>
61 public static int MAX_MAJOR_VERSION = 1; 61 public static int MAX_MAJOR_VERSION = 0;
62 62
63 protected Scene m_scene; 63 protected Scene m_scene;
64 protected Stream m_saveStream; 64 protected Stream m_saveStream;
@@ -206,37 +206,37 @@ namespace OpenSim.Region.CoreModules.World.Archiver
206 /// <returns></returns> 206 /// <returns></returns>
207 public static string CreateControlFile(Dictionary<string, object> options) 207 public static string CreateControlFile(Dictionary<string, object> options)
208 { 208 {
209 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 0; 209 int majorVersion = MAX_MAJOR_VERSION, minorVersion = 5;
210 210//
211 if (options.ContainsKey("version")) 211// if (options.ContainsKey("version"))
212 { 212// {
213 string[] parts = options["version"].ToString().Split('.'); 213// string[] parts = options["version"].ToString().Split('.');
214 if (parts.Length >= 1) 214// if (parts.Length >= 1)
215 { 215// {
216 majorVersion = Int32.Parse(parts[0]); 216// majorVersion = Int32.Parse(parts[0]);
217 217//
218 if (parts.Length >= 2) 218// if (parts.Length >= 2)
219 minorVersion = Int32.Parse(parts[1]); 219// minorVersion = Int32.Parse(parts[1]);
220 } 220// }
221 } 221// }
222 222//
223 if (majorVersion < MIN_MAJOR_VERSION || majorVersion > MAX_MAJOR_VERSION) 223// if (majorVersion < MIN_MAJOR_VERSION || majorVersion > MAX_MAJOR_VERSION)
224 { 224// {
225 throw new Exception( 225// throw new Exception(
226 string.Format( 226// string.Format(
227 "OAR version number for save must be between {0} and {1}", 227// "OAR version number for save must be between {0} and {1}",
228 MIN_MAJOR_VERSION, MAX_MAJOR_VERSION)); 228// MIN_MAJOR_VERSION, MAX_MAJOR_VERSION));
229 } 229// }
230 else if (majorVersion == MAX_MAJOR_VERSION) 230// else if (majorVersion == MAX_MAJOR_VERSION)
231 { 231// {
232 // Force 1.0 232// // Force 1.0
233 minorVersion = 0; 233// minorVersion = 0;
234 } 234// }
235 else if (majorVersion == MIN_MAJOR_VERSION) 235// else if (majorVersion == MIN_MAJOR_VERSION)
236 { 236// {
237 // Force 0.4 237// // Force 0.4
238 minorVersion = 4; 238// minorVersion = 4;
239 } 239// }
240 240
241 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion); 241 m_log.InfoFormat("[ARCHIVER]: Creating version {0}.{1} OAR", majorVersion, minorVersion);
242 //if (majorVersion == 1) 242 //if (majorVersion == 1)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 2d7244e..9277c59 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
125 Dictionary<string, object> options = new Dictionary<string, object>(); 125 Dictionary<string, object> options = new Dictionary<string, object>();
126 126
127 OptionSet ops = new OptionSet(); 127 OptionSet ops = new OptionSet();
128 ops.Add("v|version=", delegate(string v) { options["version"] = v; }); 128// ops.Add("v|version=", delegate(string v) { options["version"] = v; });
129 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); 129 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
130 130
131 List<string> mainParams = ops.Parse(cmdparams); 131 List<string> mainParams = ops.Parse(cmdparams);
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 695202f..ac4705c 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.World.Land
159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects; 159 client.OnParcelSelectObjects += ClientOnParcelSelectObjects;
160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest; 160 client.OnParcelObjectOwnerRequest += ClientOnParcelObjectOwnerRequest;
161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest; 161 client.OnParcelAccessListRequest += ClientOnParcelAccessListRequest;
162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessUpdateListRequest; 162 client.OnParcelAccessListUpdateRequest += ClientOnParcelAccessListUpdateRequest;
163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest; 163 client.OnParcelAbandonRequest += ClientOnParcelAbandonRequest;
164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner; 164 client.OnParcelGodForceOwner += ClientOnParcelGodForceOwner;
165 client.OnParcelReclaim += ClientOnParcelReclaim; 165 client.OnParcelReclaim += ClientOnParcelReclaim;
@@ -508,14 +508,22 @@ namespace OpenSim.Region.CoreModules.World.Land
508 508
509 if (land != null) 509 if (land != null)
510 { 510 {
511 m_landList[landLocalID].SendAccessList(agentID, sessionID, flags, sequenceID, remote_client); 511 land.SendAccessList(agentID, sessionID, flags, sequenceID, remote_client);
512 } 512 }
513 } 513 }
514 514
515 public void ClientOnParcelAccessUpdateListRequest(UUID agentID, UUID sessionID, uint flags, int landLocalID, 515 public void ClientOnParcelAccessListUpdateRequest(UUID agentID,
516 List<ParcelManager.ParcelAccessEntry> entries, 516 uint flags, int landLocalID, UUID transactionID, int sequenceID,
517 IClientAPI remote_client) 517 int sections, List<ParcelManager.ParcelAccessEntry> entries,
518 IClientAPI remote_client)
518 { 519 {
520 // Flags is the list to update, it can mean either the ban or
521 // the access list (WTH is a pass list? Mentioned in ParcelFlags)
522 //
523 // There may be multiple packets, because these can get LONG.
524 // Use transactionID to determine a new chain of packets since
525 // packets may have come in out of sequence and that would be
526 // a big mess if using the sequenceID
519 ILandObject land; 527 ILandObject land;
520 lock (m_landList) 528 lock (m_landList)
521 { 529 {
@@ -524,9 +532,15 @@ namespace OpenSim.Region.CoreModules.World.Land
524 532
525 if (land != null) 533 if (land != null)
526 { 534 {
527 if (agentID == land.LandData.OwnerID) 535 GroupPowers requiredPowers = GroupPowers.LandManageAllowed;
536 if (flags == (uint)AccessList.Ban)
537 requiredPowers = GroupPowers.LandManageBanned;
538
539 if (m_scene.Permissions.CanEditParcelProperties(agentID,
540 land, requiredPowers))
528 { 541 {
529 land.UpdateAccessList(flags, entries, remote_client); 542 land.UpdateAccessList(flags, transactionID, sequenceID,
543 sections, entries, remote_client);
530 } 544 }
531 } 545 }
532 else 546 else
@@ -854,7 +868,7 @@ namespace OpenSim.Region.CoreModules.World.Land
854 868
855 //If we are still here, then they are subdividing within one piece of land 869 //If we are still here, then they are subdividing within one piece of land
856 //Check owner 870 //Check owner
857 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, startLandObject)) 871 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, startLandObject, GroupPowers.LandDivideJoin))
858 { 872 {
859 return; 873 return;
860 } 874 }
@@ -922,7 +936,7 @@ namespace OpenSim.Region.CoreModules.World.Land
922 { 936 {
923 return; 937 return;
924 } 938 }
925 if (!m_scene.Permissions.CanEditParcel(attempting_user_id, masterLandObject)) 939 if (!m_scene.Permissions.CanEditParcelProperties(attempting_user_id, masterLandObject, GroupPowers.LandDivideJoin))
926 { 940 {
927 return; 941 return;
928 } 942 }
@@ -1570,7 +1584,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1570 1584
1571 if (land == null) return; 1585 if (land == null) return;
1572 1586
1573 if (!m_scene.Permissions.CanEditParcel(remoteClient.AgentId, land)) 1587 if (!m_scene.Permissions.CanEditParcelProperties(remoteClient.AgentId, land, GroupPowers.LandOptions))
1574 return; 1588 return;
1575 1589
1576 land.LandData.OtherCleanTime = otherCleanTime; 1590 land.LandData.OtherCleanTime = otherCleanTime;
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index d87352f..3e41c55 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Region.CoreModules.World.Land
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 protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
57 58
58 public bool[,] LandBitmap 59 public bool[,] LandBitmap
59 { 60 {
@@ -199,36 +200,81 @@ namespace OpenSim.Region.CoreModules.World.Land
199 200
200 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) 201 public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client)
201 { 202 {
202 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId,this)) 203 //Needs later group support
204 bool snap_selection = false;
205 LandData newData = LandData.Copy();
206
207 uint allowedDelta = 0;
208
209 // These two are always blocked as no client can set them anyway
210 // ParcelFlags.ForSaleObjects
211 // ParcelFlags.LindenHome
212
213 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
203 { 214 {
204 //Needs later group support 215 allowedDelta |= (uint)(ParcelFlags.AllowLandmark |
205 bool snap_selection = false; 216 ParcelFlags.AllowTerraform |
206 LandData newData = LandData.Copy(); 217 ParcelFlags.AllowDamage |
218 ParcelFlags.CreateObjects |
219 ParcelFlags.RestrictPushObject |
220 ParcelFlags.AllowGroupScripts |
221 ParcelFlags.CreateGroupObjects |
222 ParcelFlags.AllowAPrimitiveEntry |
223 ParcelFlags.AllowGroupObjectEntry);
224 }
207 225
208 if (args.AuthBuyerID != newData.AuthBuyerID || args.SalePrice != newData.SalePrice) 226 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale))
227 {
228 if (args.AuthBuyerID != newData.AuthBuyerID ||
229 args.SalePrice != newData.SalePrice)
209 { 230 {
210 if (m_scene.Permissions.CanSellParcel(remote_client.AgentId, this)) 231 snap_selection = true;
211 { 232 }
212 newData.AuthBuyerID = args.AuthBuyerID; 233
213 newData.SalePrice = args.SalePrice; 234 newData.AuthBuyerID = args.AuthBuyerID;
214 snap_selection = true; 235 newData.SalePrice = args.SalePrice;
215 } 236
237 if (!LandData.IsGroupOwned)
238 {
239 newData.GroupID = args.GroupID;
240
241 allowedDelta |= (uint)(ParcelFlags.AllowDeedToGroup |
242 ParcelFlags.ContributeWithDeed |
243 ParcelFlags.SellParcelObjects);
216 } 244 }
245
246 allowedDelta |= (uint)ParcelFlags.ForSale;
247 }
248
249 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.FindPlaces))
250 {
217 newData.Category = args.Category; 251 newData.Category = args.Category;
252
253 allowedDelta |= (uint)(ParcelFlags.ShowDirectory |
254 ParcelFlags.AllowPublish |
255 ParcelFlags.MaturePublish);
256 }
257
258 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity))
259 {
218 newData.Description = args.Desc; 260 newData.Description = args.Desc;
219 newData.GroupID = args.GroupID; 261 newData.Name = args.Name;
262 newData.SnapshotID = args.SnapshotID;
263 }
264
265 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.SetLandingPoint))
266 {
220 newData.LandingType = args.LandingType; 267 newData.LandingType = args.LandingType;
268 newData.UserLocation = args.UserLocation;
269 newData.UserLookAt = args.UserLookAt;
270 }
271
272 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.ChangeMedia))
273 {
221 newData.MediaAutoScale = args.MediaAutoScale; 274 newData.MediaAutoScale = args.MediaAutoScale;
222 newData.MediaID = args.MediaID; 275 newData.MediaID = args.MediaID;
223 newData.MediaURL = args.MediaURL; 276 newData.MediaURL = args.MediaURL;
224 newData.MusicURL = args.MusicURL; 277 newData.MusicURL = args.MusicURL;
225 newData.Name = args.Name;
226 newData.Flags = args.ParcelFlags;
227 newData.PassHours = args.PassHours;
228 newData.PassPrice = args.PassPrice;
229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType; 278 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription; 279 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth; 280 newData.MediaWidth = args.MediaWidth;
@@ -237,10 +283,40 @@ namespace OpenSim.Region.CoreModules.World.Land
237 newData.ObscureMusic = args.ObscureMusic; 283 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia; 284 newData.ObscureMedia = args.ObscureMedia;
239 285
240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 286 allowedDelta |= (uint)(ParcelFlags.SoundLocal |
287 ParcelFlags.UrlWebPage |
288 ParcelFlags.UrlRawHtml |
289 ParcelFlags.AllowVoiceChat |
290 ParcelFlags.UseEstateVoiceChan);
291 }
292
293 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandManagePasses))
294 {
295 newData.PassHours = args.PassHours;
296 newData.PassPrice = args.PassPrice;
297
298 allowedDelta |= (uint)ParcelFlags.UsePassList;
299 }
300
301 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageAllowed))
302 {
303 allowedDelta |= (uint)(ParcelFlags.UseAccessGroup |
304 ParcelFlags.UseAccessList);
305 }
241 306
242 SendLandUpdateToAvatarsOverMe(snap_selection); 307 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandManageBanned))
308 {
309 allowedDelta |= (uint)(ParcelFlags.UseBanList |
310 ParcelFlags.DenyAnonymous |
311 ParcelFlags.DenyAgeUnverified);
243 } 312 }
313
314 uint preserve = LandData.Flags & ~allowedDelta;
315 newData.Flags = preserve | (args.ParcelFlags & allowedDelta);
316
317 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
318
319 SendLandUpdateToAvatarsOverMe(snap_selection);
244 } 320 }
245 321
246 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area) 322 public void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area)
@@ -295,14 +371,14 @@ namespace OpenSim.Region.CoreModules.World.Land
295 371
296 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) 372 if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0)
297 { 373 {
298 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 374 if (LandData.ParcelAccessList.FindIndex(
299 entry.AgentID = avatar; 375 delegate(ParcelManager.ParcelAccessEntry e)
300 entry.Flags = AccessList.Ban; 376 {
301 entry.Time = new DateTime(); 377 if (e.AgentID == avatar && e.Flags == AccessList.Ban)
302 //See if they are on the list, but make sure the owner isn't banned 378 return true;
303 if (LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 379 return false;
380 }) != -1 && LandData.OwnerID != avatar)
304 { 381 {
305 //They are banned, so lets send them a notice about this parcel
306 return true; 382 return true;
307 } 383 }
308 } 384 }
@@ -316,15 +392,14 @@ namespace OpenSim.Region.CoreModules.World.Land
316 392
317 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) 393 if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0)
318 { 394 {
319 ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); 395 if (LandData.ParcelAccessList.FindIndex(
320 entry.AgentID = avatar; 396 delegate(ParcelManager.ParcelAccessEntry e)
321 entry.Flags = AccessList.Access; 397 {
322 entry.Time = new DateTime(); 398 if (e.AgentID == avatar && e.Flags == AccessList.Access)
323 399 return true;
324 //If they are not on the access list and are not the owner 400 return false;
325 if (!LandData.ParcelAccessList.Contains(entry) && LandData.OwnerID != avatar) 401 }) == -1 && LandData.OwnerID != avatar)
326 { 402 {
327 //They are not allowed in this parcel, but not banned, so lets send them a notice about this parcel
328 return true; 403 return true;
329 } 404 }
330 } 405 }
@@ -421,39 +496,52 @@ namespace OpenSim.Region.CoreModules.World.Land
421 } 496 }
422 } 497 }
423 498
424 public void UpdateAccessList(uint flags, List<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client) 499 public void UpdateAccessList(uint flags, UUID transactionID,
500 int sequenceID, int sections,
501 List<ParcelManager.ParcelAccessEntry> entries,
502 IClientAPI remote_client)
425 { 503 {
426 LandData newData = LandData.Copy(); 504 LandData newData = LandData.Copy();
427 505
428 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero) 506 if ((!m_listTransactions.ContainsKey(flags)) ||
507 m_listTransactions[flags] != transactionID)
429 { 508 {
430 entries.Clear(); 509 m_listTransactions[flags] = transactionID;
431 }
432 510
433 List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>(); 511 List<ParcelManager.ParcelAccessEntry> toRemove =
434 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) 512 new List<ParcelManager.ParcelAccessEntry>();
435 { 513
436 if (entry.Flags == (AccessList)flags) 514 foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList)
437 { 515 {
438 toRemove.Add(entry); 516 if (entry.Flags == (AccessList)flags)
517 toRemove.Add(entry);
439 } 518 }
440 }
441 519
442 foreach (ParcelManager.ParcelAccessEntry entry in toRemove) 520 foreach (ParcelManager.ParcelAccessEntry entry in toRemove)
443 { 521 {
444 newData.ParcelAccessList.Remove(entry); 522 newData.ParcelAccessList.Remove(entry);
523 }
524
525 // Checked here because this will always be the first
526 // and only packet in a transaction
527 if (entries.Count == 1 && entries[0].AgentID == UUID.Zero)
528 {
529 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
530
531 return;
532 }
445 } 533 }
534
446 foreach (ParcelManager.ParcelAccessEntry entry in entries) 535 foreach (ParcelManager.ParcelAccessEntry entry in entries)
447 { 536 {
448 ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); 537 ParcelManager.ParcelAccessEntry temp =
538 new ParcelManager.ParcelAccessEntry();
539
449 temp.AgentID = entry.AgentID; 540 temp.AgentID = entry.AgentID;
450 temp.Time = new DateTime(); //Pointless? Yes. 541 temp.Time = entry.Time;
451 temp.Flags = (AccessList)flags; 542 temp.Flags = (AccessList)flags;
452 543
453 if (!newData.ParcelAccessList.Contains(temp)) 544 newData.ParcelAccessList.Add(temp);
454 {
455 newData.ParcelAccessList.Add(temp);
456 }
457 } 545 }
458 546
459 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 547 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
@@ -711,7 +799,7 @@ namespace OpenSim.Region.CoreModules.World.Land
711 799
712 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client) 800 public void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client)
713 { 801 {
714 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 802 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
715 { 803 {
716 List<uint> resultLocalIDs = new List<uint>(); 804 List<uint> resultLocalIDs = new List<uint>();
717 try 805 try
@@ -761,7 +849,7 @@ namespace OpenSim.Region.CoreModules.World.Land
761 /// </param> 849 /// </param>
762 public void SendLandObjectOwners(IClientAPI remote_client) 850 public void SendLandObjectOwners(IClientAPI remote_client)
763 { 851 {
764 if (m_scene.Permissions.CanEditParcel(remote_client.AgentId, this)) 852 if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandOptions))
765 { 853 {
766 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>(); 854 Dictionary<UUID, int> primCount = new Dictionary<UUID, int>();
767 List<UUID> groups = new List<UUID>(); 855 List<UUID> groups = new List<UUID>();
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f5f3839..364dd6c 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -37,56 +37,6 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40// Temporary fix of wrong GroupPowers constants in OpenMetaverse library
41enum GroupPowers : long
42 {
43 None = 0,
44 LandEjectAndFreeze = 1,
45 Invite = 2,
46 ReturnGroupSet = 2,
47 Eject = 4,
48 ReturnNonGroup = 4,
49 ChangeOptions = 8,
50 LandGardening = 8,
51 CreateRole = 16,
52 DeedObject = 16,
53 ModerateChat = 32,
54 DeleteRole = 32,
55 RoleProperties = 64,
56 ObjectManipulate = 64,
57 ObjectSetForSale = 128,
58 AssignMemberLimited = 128,
59 AssignMember = 256,
60 Accountable = 256,
61 RemoveMember = 512,
62 SendNotices = 1024,
63 ChangeActions = 1024,
64 ChangeIdentity = 2048,
65 ReceiveNotices = 2048,
66 StartProposal = 4096,
67 LandDeed = 4096,
68 VoteOnProposal = 8192,
69 LandRelease = 8192,
70 LandSetSale = 16384,
71 LandDivideJoin = 32768,
72 ReturnGroupOwned = 65536,
73 JoinChat = 65536,
74 FindPlaces = 131072,
75 LandChangeIdentity = 262144,
76 SetLandingPoint = 524288,
77 ChangeMedia = 1048576,
78 LandEdit = 2097152,
79 LandOptions = 4194304,
80 AllowEditLand = 8388608,
81 AllowFly = 16777216,
82 AllowRez = 33554432,
83 AllowLandmark = 67108864,
84 AllowVoiceChat = 134217728,
85 AllowSetHome = 268435456,
86 LandManageAllowed = 536870912,
87 LandManageBanned = 1073741824
88 }
89
90namespace OpenSim.Region.CoreModules.World.Permissions 40namespace OpenSim.Region.CoreModules.World.Permissions
91{ 41{
92 public class PermissionsModule : IRegionModule 42 public class PermissionsModule : IRegionModule
@@ -214,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
214 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 164 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
215 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 165 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED
216 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 166 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED
217 m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED 167 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED
218 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 168 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
219 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED 169 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED
220 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 170 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED
@@ -1005,12 +955,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1005 return GenericObjectPermission(editorID, objectID, false); 955 return GenericObjectPermission(editorID, objectID, false);
1006 } 956 }
1007 957
1008 private bool CanEditParcel(UUID user, ILandObject parcel, Scene scene) 958 private bool CanEditParcelProperties(UUID user, ILandObject parcel, GroupPowers p, Scene scene)
1009 { 959 {
1010 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 960 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
1011 if (m_bypassPermissions) return m_bypassPermissionsValue; 961 if (m_bypassPermissions) return m_bypassPermissionsValue;
1012 962
1013 return GenericParcelOwnerPermission(user, parcel, (ulong)GroupPowers.LandDivideJoin); 963 return GenericParcelOwnerPermission(user, parcel, (ulong)p);
1014 } 964 }
1015 965
1016 /// <summary> 966 /// <summary>
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index 9f88517..bdd1a0b 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -93,13 +93,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
93 } 93 }
94 94
95 // try to fetch from GridServer 95 // try to fetch from GridServer
96 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(UUID.Zero, mapName, 20); 96 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
97 if (regionInfos == null) 97 if (regionInfos == null)
98 { 98 {
99 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?"); 99 m_log.Warn("[MAPSEARCHMODULE]: RequestNamedRegions returned null. Old gridserver?");
100 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region 100 // service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
101 regionInfos = new List<GridRegion>(); 101 regionInfos = new List<GridRegion>();
102 GridRegion info = m_scene.GridService.GetRegionByName(UUID.Zero, mapName); 102 GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName);
103 if (info != null) regionInfos.Add(info); 103 if (info != null) regionInfos.Add(info);
104 } 104 }
105 105
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 9869f4a..e3ba190 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -33,6 +33,7 @@ using System.Drawing.Imaging;
33using System.IO; 33using System.IO;
34using System.Net; 34using System.Net;
35using System.Reflection; 35using System.Reflection;
36using System.Runtime.Remoting.Messaging;
36using System.Threading; 37using System.Threading;
37using log4net; 38using log4net;
38using Nini.Config; 39using Nini.Config;
@@ -413,11 +414,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
413 } 414 }
414 } 415 }
415 416
417 private int nAsyncRequests = 0;
416 /// <summary> 418 /// <summary>
417 /// Processing thread main() loop for doing remote mapitem requests 419 /// Processing thread main() loop for doing remote mapitem requests
418 /// </summary> 420 /// </summary>
419 public void process() 421 public void process()
420 { 422 {
423 const int MAX_ASYNC_REQUESTS = 20;
421 try 424 try
422 { 425 {
423 while (true) 426 while (true)
@@ -437,10 +440,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
437 dorequest = false; 440 dorequest = false;
438 } 441 }
439 442
440 if (dorequest) 443 if (dorequest && !m_blacklistedregions.ContainsKey(st.regionhandle))
441 { 444 {
442 OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); 445 while (nAsyncRequests >= MAX_ASYNC_REQUESTS) // hit the break
443 RequestMapItemsCompleted(response); 446 Thread.Sleep(80);
447
448 RequestMapItemsDelegate d = RequestMapItemsAsync;
449 d.BeginInvoke(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle, RequestMapItemsCompleted, null);
450 //OSDMap response = RequestMapItemsAsync(st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
451 //RequestMapItemsCompleted(response);
452 Interlocked.Increment(ref nAsyncRequests);
444 } 453 }
445 } 454 }
446 455
@@ -469,8 +478,18 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
469 /// Sends the mapitem response to the IClientAPI 478 /// Sends the mapitem response to the IClientAPI
470 /// </summary> 479 /// </summary>
471 /// <param name="response">The OSDMap Response for the mapitem</param> 480 /// <param name="response">The OSDMap Response for the mapitem</param>
472 private void RequestMapItemsCompleted(OSDMap response) 481 private void RequestMapItemsCompleted(IAsyncResult iar)
473 { 482 {
483 AsyncResult result = (AsyncResult)iar;
484 RequestMapItemsDelegate icon = (RequestMapItemsDelegate)result.AsyncDelegate;
485
486 OSDMap response = (OSDMap)icon.EndInvoke(iar);
487
488 Interlocked.Decrement(ref nAsyncRequests);
489
490 if (!response.ContainsKey("requestID"))
491 return;
492
474 UUID requestID = response["requestID"].AsUUID(); 493 UUID requestID = response["requestID"].AsUUID();
475 494
476 if (requestID != UUID.Zero) 495 if (requestID != UUID.Zero)
@@ -538,6 +557,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
538 EnqueueMapItemRequest(st); 557 EnqueueMapItemRequest(st);
539 } 558 }
540 559
560 private delegate OSDMap RequestMapItemsDelegate(UUID id, uint flags,
561 uint EstateID, bool godlike, uint itemtype, ulong regionhandle);
541 /// <summary> 562 /// <summary>
542 /// Does the actual remote mapitem request 563 /// Does the actual remote mapitem request
543 /// This should be called from an asynchronous thread 564 /// This should be called from an asynchronous thread
@@ -552,9 +573,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
552 /// <param name="itemtype">passed in from packet</param> 573 /// <param name="itemtype">passed in from packet</param>
553 /// <param name="regionhandle">Region we're looking up</param> 574 /// <param name="regionhandle">Region we're looking up</param>
554 /// <returns></returns> 575 /// <returns></returns>
555 private OSDMap RequestMapItemsAsync(string httpserver, UUID id, uint flags, 576 private OSDMap RequestMapItemsAsync(UUID id, uint flags,
556 uint EstateID, bool godlike, uint itemtype, ulong regionhandle) 577 uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
557 { 578 {
579 string httpserver = "";
558 bool blacklisted = false; 580 bool blacklisted = false;
559 lock (m_blacklistedregions) 581 lock (m_blacklistedregions)
560 { 582 {
@@ -593,7 +615,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
593 if (!m_blacklistedregions.ContainsKey(regionhandle)) 615 if (!m_blacklistedregions.ContainsKey(regionhandle))
594 m_blacklistedregions.Add(regionhandle, Environment.TickCount); 616 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
595 } 617 }
596 m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString()); 618 //m_log.InfoFormat("[WORLD MAP]: Blacklisted region {0}", regionhandle.ToString());
597 } 619 }
598 } 620 }
599 621
@@ -638,7 +660,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
638 os = mapitemsrequest.GetRequestStream(); 660 os = mapitemsrequest.GetRequestStream();
639 os.Write(buffer, 0, buffer.Length); //Send it 661 os.Write(buffer, 0, buffer.Length); //Send it
640 os.Close(); 662 os.Close();
641 //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from Sim {0}", httpserver); 663 //m_log.DebugFormat("[WORLD MAP]: Getting MapItems from {0}", httpserver);
642 } 664 }
643 catch (WebException ex) 665 catch (WebException ex)
644 { 666 {
@@ -654,15 +676,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
654 676
655 return responseMap; 677 return responseMap;
656 } 678 }
679 catch
680 {
681 m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver);
682 responseMap["connect"] = OSD.FromBoolean(false);
683 return responseMap;
684 }
657 685
658 string response_mapItems_reply = null; 686 string response_mapItems_reply = null;
659 { // get the response 687 { // get the response
688 StreamReader sr = null;
660 try 689 try
661 { 690 {
662 WebResponse webResponse = mapitemsrequest.GetResponse(); 691 WebResponse webResponse = mapitemsrequest.GetResponse();
663 if (webResponse != null) 692 if (webResponse != null)
664 { 693 {
665 StreamReader sr = new StreamReader(webResponse.GetResponseStream()); 694 sr = new StreamReader(webResponse.GetResponseStream());
666 response_mapItems_reply = sr.ReadToEnd().Trim(); 695 response_mapItems_reply = sr.ReadToEnd().Trim();
667 } 696 }
668 else 697 else
@@ -683,6 +712,24 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
683 712
684 return responseMap; 713 return responseMap;
685 } 714 }
715 catch
716 {
717 m_log.DebugFormat("[WORLD MAP]: RequestMapItems failed for {0}", httpserver);
718 responseMap["connect"] = OSD.FromBoolean(false);
719 lock (m_blacklistedregions)
720 {
721 if (!m_blacklistedregions.ContainsKey(regionhandle))
722 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
723 }
724
725 return responseMap;
726 }
727 finally
728 {
729 if (sr != null)
730 sr.Close();
731 }
732
686 OSD rezResponse = null; 733 OSD rezResponse = null;
687 try 734 try
688 { 735 {
@@ -691,14 +738,29 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
691 responseMap = (OSDMap)rezResponse; 738 responseMap = (OSDMap)rezResponse;
692 responseMap["requestID"] = OSD.FromUUID(requestID); 739 responseMap["requestID"] = OSD.FromUUID(requestID);
693 } 740 }
694 catch (Exception) 741 catch (Exception ex)
695 { 742 {
696 //m_log.InfoFormat("[OGP]: exception on parse of rez reply {0}", ex.Message); 743 m_log.InfoFormat("[WORLD MAP]: exception on parse of RequestMapItems reply from {0}: {1}", httpserver, ex.Message);
697 responseMap["connect"] = OSD.FromBoolean(false); 744 responseMap["connect"] = OSD.FromBoolean(false);
745 lock (m_blacklistedregions)
746 {
747 if (!m_blacklistedregions.ContainsKey(regionhandle))
748 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
749 }
698 750
699 return responseMap; 751 return responseMap;
700 } 752 }
701 } 753 }
754
755 if (!responseMap.ContainsKey(itemtype.ToString())) // remote sim doesnt have the stated region handle
756 {
757 if (!m_blacklistedregions.ContainsKey(regionhandle))
758 {
759 m_log.DebugFormat("[WORLD MAP]: Remote sim does not have the stated region. Blacklisting.");
760 m_blacklistedregions.Add(regionhandle, Environment.TickCount);
761 }
762 }
763
702 return responseMap; 764 return responseMap;
703 } 765 }
704 766