diff options
author | BlueWall | 2011-04-13 09:53:44 -0400 |
---|---|---|
committer | BlueWall | 2011-04-13 09:53:44 -0400 |
commit | d3457eae7a33f01a8fa906c4040792cdc4a67857 (patch) | |
tree | f92e60733b8397576b86c486e05aa5219f27d034 /OpenSim/Region/CoreModules | |
parent | Merge branch 'master' of /home/opensim/src/OpenSim/Core (diff) | |
parent | Move example HttpProxy setting to OpenSim.ini.example and tidy (diff) | |
download | opensim-SC-d3457eae7a33f01a8fa906c4040792cdc4a67857.zip opensim-SC-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.gz opensim-SC-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.bz2 opensim-SC-d3457eae7a33f01a8fa906c4040792cdc4a67857.tar.xz |
Merge branch 'master' of /home/git/repo/OpenSim
Diffstat (limited to 'OpenSim/Region/CoreModules')
15 files changed, 1334 insertions, 525 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index a5fcb49..0babeb5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Nini.Config; | 30 | using Nini.Config; |
31 | using OpenSim.Framework; | ||
31 | using OpenSim.Region.Framework.Interfaces; | 32 | using OpenSim.Region.Framework.Interfaces; |
32 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenMetaverse; | 34 | using OpenMetaverse; |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 9b98de3..01170aa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -77,7 +77,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
77 | /// </value> | 77 | /// </value> |
78 | private Stream m_loadStream; | 78 | private Stream m_loadStream; |
79 | 79 | ||
80 | protected bool m_controlFileLoaded; | 80 | /// <summary> |
81 | /// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | ||
82 | /// (I thought they weren't). We will need to bump the version number and perform this check on all | ||
83 | /// subsequent IAR versions only | ||
84 | /// </summary> | ||
85 | protected bool m_controlFileLoaded = true; | ||
81 | protected bool m_assetsLoaded; | 86 | protected bool m_assetsLoaded; |
82 | protected bool m_inventoryNodesLoaded; | 87 | protected bool m_inventoryNodesLoaded; |
83 | 88 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 798547a..73b0a35 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Xml; | ||
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Threading; | 33 | using System.Threading; |
33 | 34 | ||
@@ -205,11 +206,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
205 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, | 206 | public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, |
206 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) | 207 | List<SceneObjectGroup> objectGroups, IClientAPI remoteClient) |
207 | { | 208 | { |
208 | // HACK: This is only working for lists containing a single item! | ||
209 | // It's just a hack to make this WIP compile and run. Nothing | ||
210 | // currently calls this with multiple items. | ||
211 | UUID ret = UUID.Zero; | 209 | UUID ret = UUID.Zero; |
212 | 210 | ||
211 | // The following code groups the SOG's by owner. No objects | ||
212 | // belonging to different people can be coalesced, for obvious | ||
213 | // reasons. | ||
213 | Dictionary<UUID, List<SceneObjectGroup>> deletes = | 214 | Dictionary<UUID, List<SceneObjectGroup>> deletes = |
214 | new Dictionary<UUID, List<SceneObjectGroup>>(); | 215 | new Dictionary<UUID, List<SceneObjectGroup>>(); |
215 | 216 | ||
@@ -221,262 +222,329 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
221 | deletes[g.OwnerID].Add(g); | 222 | deletes[g.OwnerID].Add(g); |
222 | } | 223 | } |
223 | 224 | ||
225 | // This is pethod scoped and will be returned. It will be the | ||
226 | // last created asset id | ||
227 | UUID assetID = UUID.Zero; | ||
228 | |||
229 | // Each iteration is really a separate asset being created, | ||
230 | // with distinct destinations as well. | ||
224 | foreach (List<SceneObjectGroup> objlist in deletes.Values) | 231 | foreach (List<SceneObjectGroup> objlist in deletes.Values) |
225 | { | 232 | { |
226 | foreach (SceneObjectGroup g in objlist) | 233 | Dictionary<UUID, string> xmlStrings = |
227 | ret = DeleteToInventory(action, folderID, g, remoteClient); | 234 | new Dictionary<UUID, string>(); |
228 | } | ||
229 | 235 | ||
230 | return ret; | 236 | foreach (SceneObjectGroup objectGroup in objlist) |
231 | } | 237 | { |
238 | Vector3 inventoryStoredPosition = new Vector3 | ||
239 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
240 | ? 250 | ||
241 | : objectGroup.AbsolutePosition.X) | ||
242 | , | ||
243 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
244 | ? 250 | ||
245 | : objectGroup.AbsolutePosition.X, | ||
246 | objectGroup.AbsolutePosition.Z); | ||
232 | 247 | ||
233 | private UUID DeleteToInventory(DeRezAction action, UUID folderID, | 248 | Vector3 originalPosition = objectGroup.AbsolutePosition; |
234 | SceneObjectGroup objectGroup, IClientAPI remoteClient) | ||
235 | { | ||
236 | UUID assetID = UUID.Zero; | ||
237 | 249 | ||
238 | Vector3 inventoryStoredPosition = new Vector3 | 250 | objectGroup.AbsolutePosition = inventoryStoredPosition; |
239 | (((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
240 | ? 250 | ||
241 | : objectGroup.AbsolutePosition.X) | ||
242 | , | ||
243 | (objectGroup.AbsolutePosition.X > (int)Constants.RegionSize) | ||
244 | ? 250 | ||
245 | : objectGroup.AbsolutePosition.X, | ||
246 | objectGroup.AbsolutePosition.Z); | ||
247 | 251 | ||
248 | Vector3 originalPosition = objectGroup.AbsolutePosition; | 252 | // Make sure all bits but the ones we want are clear |
253 | // on take. | ||
254 | // This will be applied to the current perms, so | ||
255 | // it will do what we want. | ||
256 | objectGroup.RootPart.NextOwnerMask &= | ||
257 | ((uint)PermissionMask.Copy | | ||
258 | (uint)PermissionMask.Transfer | | ||
259 | (uint)PermissionMask.Modify); | ||
260 | objectGroup.RootPart.NextOwnerMask |= | ||
261 | (uint)PermissionMask.Move; | ||
249 | 262 | ||
250 | objectGroup.AbsolutePosition = inventoryStoredPosition; | 263 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); |
251 | 264 | ||
252 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); | 265 | objectGroup.AbsolutePosition = originalPosition; |
253 | 266 | ||
254 | objectGroup.AbsolutePosition = originalPosition; | 267 | xmlStrings[objectGroup.UUID] = sceneObjectXml; |
268 | } | ||
255 | 269 | ||
256 | // Get the user info of the item destination | 270 | string itemXml; |
257 | // | ||
258 | UUID userID = UUID.Zero; | ||
259 | 271 | ||
260 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | 272 | if (objlist.Count > 1) |
261 | action == DeRezAction.SaveToExistingUserInventoryItem) | 273 | { |
262 | { | 274 | float minX, minY, minZ; |
263 | // Take or take copy require a taker | 275 | float maxX, maxY, maxZ; |
264 | // Saving changes requires a local user | ||
265 | // | ||
266 | if (remoteClient == null) | ||
267 | return UUID.Zero; | ||
268 | 276 | ||
269 | userID = remoteClient.AgentId; | 277 | Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist, |
270 | } | 278 | out minX, out maxX, out minY, out maxY, |
271 | else | 279 | out minZ, out maxZ); |
272 | { | ||
273 | // All returns / deletes go to the object owner | ||
274 | // | ||
275 | 280 | ||
276 | userID = objectGroup.RootPart.OwnerID; | 281 | // CreateWrapper |
277 | } | 282 | XmlDocument itemDoc = new XmlDocument(); |
283 | XmlElement root = itemDoc.CreateElement("", "CoalescedObject", ""); | ||
284 | itemDoc.AppendChild(root); | ||
278 | 285 | ||
279 | if (userID == UUID.Zero) // Can't proceed | 286 | // Embed the offsets into the group XML |
280 | { | 287 | for ( int i = 0 ; i < objlist.Count ; i++ ) |
281 | return UUID.Zero; | 288 | { |
282 | } | 289 | XmlDocument doc = new XmlDocument(); |
290 | SceneObjectGroup g = objlist[i]; | ||
291 | doc.LoadXml(xmlStrings[g.UUID]); | ||
292 | XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup"); | ||
293 | e.SetAttribute("offsetx", offsets[i].X.ToString()); | ||
294 | e.SetAttribute("offsety", offsets[i].Y.ToString()); | ||
295 | e.SetAttribute("offsetz", offsets[i].Z.ToString()); | ||
296 | |||
297 | XmlNode objectNode = itemDoc.ImportNode(e, true); | ||
298 | root.AppendChild(objectNode); | ||
299 | } | ||
283 | 300 | ||
284 | // If we're returning someone's item, it goes back to the | 301 | float sizeX = maxX - minX; |
285 | // owner's Lost And Found folder. | 302 | float sizeY = maxY - minY; |
286 | // Delete is treated like return in this case | 303 | float sizeZ = maxZ - minZ; |
287 | // Deleting your own items makes them go to trash | ||
288 | // | ||
289 | 304 | ||
290 | InventoryFolderBase folder = null; | 305 | root.SetAttribute("x", sizeX.ToString()); |
291 | InventoryItemBase item = null; | 306 | root.SetAttribute("y", sizeY.ToString()); |
307 | root.SetAttribute("z", sizeZ.ToString()); | ||
292 | 308 | ||
293 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 309 | itemXml = itemDoc.InnerXml; |
294 | { | 310 | } |
295 | item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID); | 311 | else |
296 | item = m_Scene.InventoryService.GetItem(item); | 312 | { |
313 | itemXml = xmlStrings[objlist[0].UUID]; | ||
314 | } | ||
315 | |||
316 | // Get the user info of the item destination | ||
317 | // | ||
318 | UUID userID = UUID.Zero; | ||
319 | |||
320 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | ||
321 | action == DeRezAction.SaveToExistingUserInventoryItem) | ||
322 | { | ||
323 | // Take or take copy require a taker | ||
324 | // Saving changes requires a local user | ||
325 | // | ||
326 | if (remoteClient == null) | ||
327 | return UUID.Zero; | ||
328 | |||
329 | userID = remoteClient.AgentId; | ||
330 | } | ||
331 | else | ||
332 | { | ||
333 | // All returns / deletes go to the object owner | ||
334 | // | ||
297 | 335 | ||
298 | //item = userInfo.RootFolder.FindItem( | 336 | userID = objlist[0].RootPart.OwnerID; |
299 | // objectGroup.RootPart.FromUserInventoryItemID); | 337 | } |
300 | 338 | ||
301 | if (null == item) | 339 | if (userID == UUID.Zero) // Can't proceed |
302 | { | 340 | { |
303 | m_log.DebugFormat( | ||
304 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
305 | objectGroup.Name, objectGroup.UUID); | ||
306 | return UUID.Zero; | 341 | return UUID.Zero; |
307 | } | 342 | } |
308 | } | 343 | |
309 | else | 344 | // If we're returning someone's item, it goes back to the |
310 | { | 345 | // owner's Lost And Found folder. |
311 | // Folder magic | 346 | // Delete is treated like return in this case |
347 | // Deleting your own items makes them go to trash | ||
312 | // | 348 | // |
313 | if (action == DeRezAction.Delete) | 349 | |
350 | InventoryFolderBase folder = null; | ||
351 | InventoryItemBase item = null; | ||
352 | |||
353 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
314 | { | 354 | { |
315 | // Deleting someone else's item | 355 | item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID); |
316 | // | 356 | item = m_Scene.InventoryService.GetItem(item); |
317 | if (remoteClient == null || | ||
318 | objectGroup.OwnerID != remoteClient.AgentId) | ||
319 | { | ||
320 | 357 | ||
321 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 358 | //item = userInfo.RootFolder.FindItem( |
322 | } | 359 | // objectGroup.RootPart.FromUserInventoryItemID); |
323 | else | 360 | |
361 | if (null == item) | ||
324 | { | 362 | { |
325 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | 363 | m_log.DebugFormat( |
364 | "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", | ||
365 | objlist[0].Name, objlist[0].UUID); | ||
366 | return UUID.Zero; | ||
326 | } | 367 | } |
327 | } | 368 | } |
328 | else if (action == DeRezAction.Return) | 369 | else |
329 | { | 370 | { |
330 | 371 | // Folder magic | |
331 | // Dump to lost + found unconditionally | ||
332 | // | 372 | // |
333 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
334 | } | ||
335 | |||
336 | if (folderID == UUID.Zero && folder == null) | ||
337 | { | ||
338 | if (action == DeRezAction.Delete) | 373 | if (action == DeRezAction.Delete) |
339 | { | 374 | { |
340 | // Deletes go to trash by default | 375 | // Deleting someone else's item |
341 | // | 376 | // |
342 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
343 | } | ||
344 | else | ||
345 | { | ||
346 | if (remoteClient == null || | 377 | if (remoteClient == null || |
347 | objectGroup.OwnerID != remoteClient.AgentId) | 378 | objlist[0].OwnerID != remoteClient.AgentId) |
348 | { | 379 | { |
349 | // Taking copy of another person's item. Take to | 380 | |
350 | // Objects folder. | 381 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
351 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
352 | } | 382 | } |
353 | else | 383 | else |
354 | { | 384 | { |
355 | // Catch all. Use lost & found | 385 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
386 | } | ||
387 | } | ||
388 | else if (action == DeRezAction.Return) | ||
389 | { | ||
390 | |||
391 | // Dump to lost + found unconditionally | ||
392 | // | ||
393 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | ||
394 | } | ||
395 | |||
396 | if (folderID == UUID.Zero && folder == null) | ||
397 | { | ||
398 | if (action == DeRezAction.Delete) | ||
399 | { | ||
400 | // Deletes go to trash by default | ||
356 | // | 401 | // |
402 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.TrashFolder); | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | if (remoteClient == null || | ||
407 | objlist[0].OwnerID != remoteClient.AgentId) | ||
408 | { | ||
409 | // Taking copy of another person's item. Take to | ||
410 | // Objects folder. | ||
411 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.Object); | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | // Catch all. Use lost & found | ||
416 | // | ||
357 | 417 | ||
358 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); | 418 | folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
419 | } | ||
359 | } | 420 | } |
360 | } | 421 | } |
361 | } | ||
362 | 422 | ||
363 | // Override and put into where it came from, if it came | 423 | // Override and put into where it came from, if it came |
364 | // from anywhere in inventory | 424 | // from anywhere in inventory |
365 | // | 425 | // |
366 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) | 426 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) |
367 | { | ||
368 | if (objectGroup.RootPart.FromFolderID != UUID.Zero) | ||
369 | { | 427 | { |
370 | InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID); | 428 | if (objlist[0].RootPart.FromFolderID != UUID.Zero) |
371 | folder = m_Scene.InventoryService.GetFolder(f); | 429 | { |
430 | InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID); | ||
431 | folder = m_Scene.InventoryService.GetFolder(f); | ||
432 | } | ||
372 | } | 433 | } |
373 | } | ||
374 | 434 | ||
375 | if (folder == null) // None of the above | 435 | if (folder == null) // None of the above |
376 | { | 436 | { |
377 | folder = new InventoryFolderBase(folderID); | 437 | folder = new InventoryFolderBase(folderID); |
378 | 438 | ||
379 | if (folder == null) // Nowhere to put it | 439 | if (folder == null) // Nowhere to put it |
440 | { | ||
441 | return UUID.Zero; | ||
442 | } | ||
443 | } | ||
444 | |||
445 | item = new InventoryItemBase(); | ||
446 | // Can't know creator is the same, so null it in inventory | ||
447 | if (objlist.Count > 1) | ||
448 | item.CreatorId = UUID.Zero.ToString(); | ||
449 | else | ||
450 | item.CreatorId = objlist[0].RootPart.CreatorID.ToString(); | ||
451 | item.ID = UUID.Random(); | ||
452 | item.InvType = (int)InventoryType.Object; | ||
453 | item.Folder = folder.ID; | ||
454 | item.Owner = userID; | ||
455 | if (objlist.Count > 1) | ||
380 | { | 456 | { |
381 | return UUID.Zero; | 457 | item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems; |
458 | } | ||
459 | else | ||
460 | { | ||
461 | item.SaleType = objlist[0].RootPart.ObjectSaleType; | ||
462 | item.SalePrice = objlist[0].RootPart.SalePrice; | ||
382 | } | 463 | } |
383 | } | 464 | } |
384 | 465 | ||
385 | item = new InventoryItemBase(); | 466 | AssetBase asset = CreateAsset( |
386 | item.CreatorId = objectGroup.RootPart.CreatorID.ToString(); | 467 | objlist[0].GetPartName(objlist[0].RootPart.LocalId), |
387 | item.CreatorData = objectGroup.RootPart.CreatorData; | 468 | objlist[0].GetPartDescription(objlist[0].RootPart.LocalId), |
388 | item.ID = UUID.Random(); | 469 | (sbyte)AssetType.Object, |
389 | item.InvType = (int)InventoryType.Object; | 470 | Utils.StringToBytes(itemXml), |
390 | item.Folder = folder.ID; | 471 | objlist[0].OwnerID.ToString()); |
391 | item.Owner = userID; | 472 | m_Scene.AssetService.Store(asset); |
392 | } | 473 | assetID = asset.FullID; |
393 | |||
394 | AssetBase asset = CreateAsset( | ||
395 | objectGroup.GetPartName(objectGroup.RootPart.LocalId), | ||
396 | objectGroup.GetPartDescription(objectGroup.RootPart.LocalId), | ||
397 | (sbyte)AssetType.Object, | ||
398 | Utils.StringToBytes(sceneObjectXml), | ||
399 | objectGroup.OwnerID.ToString()); | ||
400 | m_Scene.AssetService.Store(asset); | ||
401 | assetID = asset.FullID; | ||
402 | |||
403 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | ||
404 | { | ||
405 | item.AssetID = asset.FullID; | ||
406 | m_Scene.InventoryService.UpdateItem(item); | ||
407 | } | ||
408 | else | ||
409 | { | ||
410 | item.AssetID = asset.FullID; | ||
411 | 474 | ||
412 | if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) | 475 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
413 | { | 476 | { |
414 | uint perms = objectGroup.GetEffectivePermissions(); | 477 | item.AssetID = asset.FullID; |
415 | uint nextPerms = (perms & 7) << 13; | 478 | m_Scene.InventoryService.UpdateItem(item); |
416 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | ||
417 | perms &= ~(uint)PermissionMask.Copy; | ||
418 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
419 | perms &= ~(uint)PermissionMask.Transfer; | ||
420 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
421 | perms &= ~(uint)PermissionMask.Modify; | ||
422 | |||
423 | // Make sure all bits but the ones we want are clear | ||
424 | // on take. | ||
425 | // This will be applied to the current perms, so | ||
426 | // it will do what we want. | ||
427 | objectGroup.RootPart.NextOwnerMask &= | ||
428 | ((uint)PermissionMask.Copy | | ||
429 | (uint)PermissionMask.Transfer | | ||
430 | (uint)PermissionMask.Modify); | ||
431 | objectGroup.RootPart.NextOwnerMask |= | ||
432 | (uint)PermissionMask.Move; | ||
433 | |||
434 | item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; | ||
435 | item.CurrentPermissions = item.BasePermissions; | ||
436 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
437 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; | ||
438 | item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; | ||
439 | |||
440 | item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm; | ||
441 | } | 479 | } |
442 | else | 480 | else |
443 | { | 481 | { |
444 | item.BasePermissions = objectGroup.GetEffectivePermissions(); | 482 | item.AssetID = asset.FullID; |
445 | item.CurrentPermissions = objectGroup.GetEffectivePermissions(); | ||
446 | item.NextPermissions = objectGroup.RootPart.NextOwnerMask; | ||
447 | item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; | ||
448 | item.GroupPermissions = objectGroup.RootPart.GroupMask; | ||
449 | 483 | ||
450 | item.CurrentPermissions &= | 484 | uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7; |
451 | ((uint)PermissionMask.Copy | | 485 | foreach (SceneObjectGroup grp in objlist) |
452 | (uint)PermissionMask.Transfer | | 486 | effectivePerms &= grp.GetEffectivePermissions(); |
453 | (uint)PermissionMask.Modify | | 487 | effectivePerms |= (uint)PermissionMask.Move; |
454 | (uint)PermissionMask.Move | | ||
455 | 7); // Preserve folded permissions | ||
456 | } | ||
457 | 488 | ||
458 | // TODO: add the new fields (Flags, Sale info, etc) | 489 | if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions()) |
459 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 490 | { |
460 | item.Description = asset.Description; | 491 | uint perms = effectivePerms; |
461 | item.Name = asset.Name; | 492 | uint nextPerms = (perms & 7) << 13; |
462 | item.AssetType = asset.Type; | 493 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) |
494 | perms &= ~(uint)PermissionMask.Copy; | ||
495 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | ||
496 | perms &= ~(uint)PermissionMask.Transfer; | ||
497 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | ||
498 | perms &= ~(uint)PermissionMask.Modify; | ||
499 | |||
500 | item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
501 | item.CurrentPermissions = item.BasePermissions; | ||
502 | item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask; | ||
503 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask; | ||
504 | item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask; | ||
505 | |||
506 | // Magic number badness. Maybe this deserves an enum. | ||
507 | // bit 4 (16) is the "Slam" bit, it means treat as passed | ||
508 | // and apply next owner perms on rez | ||
509 | item.CurrentPermissions |= 16; // Slam! | ||
510 | } | ||
511 | else | ||
512 | { | ||
513 | item.BasePermissions = effectivePerms; | ||
514 | item.CurrentPermissions = effectivePerms; | ||
515 | item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms; | ||
516 | item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms; | ||
517 | item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms; | ||
518 | |||
519 | item.CurrentPermissions &= | ||
520 | ((uint)PermissionMask.Copy | | ||
521 | (uint)PermissionMask.Transfer | | ||
522 | (uint)PermissionMask.Modify | | ||
523 | (uint)PermissionMask.Move | | ||
524 | 7); // Preserve folded permissions | ||
525 | } | ||
463 | 526 | ||
464 | m_Scene.AddInventoryItem(item); | 527 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
528 | item.Description = asset.Description; | ||
529 | item.Name = asset.Name; | ||
530 | item.AssetType = asset.Type; | ||
465 | 531 | ||
466 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 532 | m_Scene.AddInventoryItem(item); |
467 | { | 533 | |
468 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 534 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
469 | } | ||
470 | else | ||
471 | { | ||
472 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
473 | if (notifyUser != null) | ||
474 | { | 535 | { |
475 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | 536 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
537 | } | ||
538 | else | ||
539 | { | ||
540 | ScenePresence notifyUser = m_Scene.GetScenePresence(item.Owner); | ||
541 | if (notifyUser != null) | ||
542 | { | ||
543 | notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item, 0); | ||
544 | } | ||
476 | } | 545 | } |
477 | } | 546 | } |
478 | } | 547 | } |
479 | |||
480 | return assetID; | 548 | return assetID; |
481 | } | 549 | } |
482 | 550 | ||
@@ -484,8 +552,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
484 | /// <summary> | 552 | /// <summary> |
485 | /// Rez an object into the scene from the user's inventory | 553 | /// Rez an object into the scene from the user's inventory |
486 | /// </summary> | 554 | /// </summary> |
555 | /// <remarks> | ||
487 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing | 556 | /// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing |
488 | /// things to the scene. The caller should be doing that, I think. | 557 | /// things to the scene. The caller should be doing that, I think. |
558 | /// </remarks> | ||
489 | /// <param name="remoteClient"></param> | 559 | /// <param name="remoteClient"></param> |
490 | /// <param name="itemID"></param> | 560 | /// <param name="itemID"></param> |
491 | /// <param name="RayEnd"></param> | 561 | /// <param name="RayEnd"></param> |
@@ -502,21 +572,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
502 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 572 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
503 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 573 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
504 | { | 574 | { |
505 | // Work out position details | 575 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); |
506 | byte bRayEndIsIntersection = (byte)0; | 576 | |
507 | 577 | byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0); | |
508 | if (RayEndIsIntersection) | ||
509 | { | ||
510 | bRayEndIsIntersection = (byte)1; | ||
511 | } | ||
512 | else | ||
513 | { | ||
514 | bRayEndIsIntersection = (byte)0; | ||
515 | } | ||
516 | |||
517 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); | 578 | Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f); |
518 | |||
519 | |||
520 | Vector3 pos = m_Scene.GetNewRezLocation( | 579 | Vector3 pos = m_Scene.GetNewRezLocation( |
521 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 580 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
522 | BypassRayCast, bRayEndIsIntersection, true, scale, false); | 581 | BypassRayCast, bRayEndIsIntersection, true, scale, false); |
@@ -531,6 +590,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
531 | 590 | ||
532 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); | 591 | AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); |
533 | 592 | ||
593 | SceneObjectGroup group = null; | ||
594 | |||
534 | if (rezAsset != null) | 595 | if (rezAsset != null) |
535 | { | 596 | { |
536 | UUID itemId = UUID.Zero; | 597 | UUID itemId = UUID.Zero; |
@@ -539,34 +600,78 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
539 | // item that it came from. This allows us to enable 'save object to inventory' | 600 | // item that it came from. This allows us to enable 'save object to inventory' |
540 | if (!m_Scene.Permissions.BypassPermissions()) | 601 | if (!m_Scene.Permissions.BypassPermissions()) |
541 | { | 602 | { |
542 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) | 603 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
543 | { | 604 | { |
544 | itemId = item.ID; | 605 | itemId = item.ID; |
545 | } | 606 | } |
546 | } | 607 | } |
547 | else | 608 | else |
548 | { | 609 | { |
549 | // Brave new fullperm world | 610 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
550 | // | 611 | { |
551 | itemId = item.ID; | 612 | // Brave new fullperm world |
613 | itemId = item.ID; | ||
614 | } | ||
552 | } | 615 | } |
553 | 616 | ||
554 | string xmlData = Utils.BytesToString(rezAsset.Data); | 617 | string xmlData = Utils.BytesToString(rezAsset.Data); |
555 | SceneObjectGroup group | 618 | List<SceneObjectGroup> objlist = |
556 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | 619 | new List<SceneObjectGroup>(); |
620 | List<Vector3> veclist = new List<Vector3>(); | ||
621 | |||
622 | XmlDocument doc = new XmlDocument(); | ||
623 | doc.LoadXml(xmlData); | ||
624 | XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject"); | ||
625 | if (e == null || attachment) // Single | ||
626 | { | ||
627 | SceneObjectGroup g = | ||
628 | SceneObjectSerializer.FromOriginalXmlFormat( | ||
629 | itemId, xmlData); | ||
630 | objlist.Add(g); | ||
631 | veclist.Add(new Vector3(0, 0, 0)); | ||
557 | 632 | ||
558 | Util.FireAndForget(delegate { AddUserData(group); }); | 633 | float offsetHeight = 0; |
559 | 634 | pos = m_Scene.GetNewRezLocation( | |
560 | group.RootPart.FromFolderID = item.Folder; | 635 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, |
636 | BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
637 | pos.Z += offsetHeight; | ||
638 | } | ||
639 | else | ||
640 | { | ||
641 | XmlElement coll = (XmlElement)e; | ||
642 | float bx = Convert.ToSingle(coll.GetAttribute("x")); | ||
643 | float by = Convert.ToSingle(coll.GetAttribute("y")); | ||
644 | float bz = Convert.ToSingle(coll.GetAttribute("z")); | ||
645 | Vector3 bbox = new Vector3(bx, by, bz); | ||
561 | 646 | ||
562 | // If it's rezzed in world, select it. Much easier to | 647 | pos = m_Scene.GetNewRezLocation(RayStart, RayEnd, |
563 | // find small items. | 648 | RayTargetID, Quaternion.Identity, |
564 | // | 649 | BypassRayCast, bRayEndIsIntersection, true, |
565 | if (!attachment) | 650 | bbox, false); |
566 | group.RootPart.CreateSelected = true; | 651 | |
652 | pos -= bbox / 2; | ||
653 | |||
654 | XmlNodeList groups = e.SelectNodes("SceneObjectGroup"); | ||
655 | foreach (XmlNode n in groups) | ||
656 | { | ||
657 | SceneObjectGroup g = | ||
658 | SceneObjectSerializer.FromOriginalXmlFormat( | ||
659 | itemId, n.OuterXml); | ||
660 | objlist.Add(g); | ||
661 | XmlElement el = (XmlElement)n; | ||
662 | float x = Convert.ToSingle(el.GetAttribute("offsetx")); | ||
663 | float y = Convert.ToSingle(el.GetAttribute("offsety")); | ||
664 | float z = Convert.ToSingle(el.GetAttribute("offsetz")); | ||
665 | veclist.Add(new Vector3(x, y, z)); | ||
666 | } | ||
667 | } | ||
668 | |||
669 | int primcount = 0; | ||
670 | foreach (SceneObjectGroup g in objlist) | ||
671 | primcount += g.PrimCount; | ||
567 | 672 | ||
568 | if (!m_Scene.Permissions.CanRezObject( | 673 | if (!m_Scene.Permissions.CanRezObject( |
569 | group.PrimCount, remoteClient.AgentId, pos) | 674 | primcount, remoteClient.AgentId, pos) |
570 | && !attachment) | 675 | && !attachment) |
571 | { | 676 | { |
572 | // The client operates in no fail mode. It will | 677 | // The client operates in no fail mode. It will |
@@ -579,131 +684,131 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
579 | return null; | 684 | return null; |
580 | } | 685 | } |
581 | 686 | ||
582 | group.ResetIDs(); | 687 | for (int i = 0 ; i < objlist.Count ; i++ ) |
583 | |||
584 | if (attachment) | ||
585 | { | 688 | { |
586 | group.RootPart.Flags |= PrimFlags.Phantom; | 689 | group = objlist[i]; |
587 | group.RootPart.IsAttachment = true; | 690 | |
691 | Vector3 storedPosition = group.AbsolutePosition; | ||
692 | if (group.UUID == UUID.Zero) | ||
693 | { | ||
694 | m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3"); | ||
695 | } | ||
696 | group.RootPart.FromFolderID = item.Folder; | ||
697 | |||
698 | // If it's rezzed in world, select it. Much easier to | ||
699 | // find small items. | ||
700 | // | ||
701 | if (!attachment) | ||
702 | { | ||
703 | group.RootPart.CreateSelected = true; | ||
704 | foreach (SceneObjectPart child in group.Parts) | ||
705 | child.CreateSelected = true; | ||
706 | } | ||
707 | group.ResetIDs(); | ||
708 | |||
709 | if (attachment) | ||
710 | { | ||
711 | group.RootPart.Flags |= PrimFlags.Phantom; | ||
712 | group.RootPart.IsAttachment = true; | ||
713 | } | ||
588 | 714 | ||
589 | // If we're rezzing an attachment then don't ask | 715 | // If we're rezzing an attachment then don't ask |
590 | // AddNewSceneObject() to update the client since | 716 | // AddNewSceneObject() to update the client since |
591 | // we'll be doing that later on. Scheduling more | 717 | // we'll be doing that later on. Scheduling more than |
592 | // than one full update during the attachment | 718 | // one full update during the attachment |
593 | // process causes some clients to fail to display | 719 | // process causes some clients to fail to display the |
594 | // the attachment properly. | 720 | // attachment properly. |
595 | // Also, don't persist attachments. | ||
596 | m_Scene.AddNewSceneObject(group, false, false); | ||
597 | } | ||
598 | else | ||
599 | { | ||
600 | m_Scene.AddNewSceneObject(group, true, false); | 721 | m_Scene.AddNewSceneObject(group, true, false); |
601 | } | ||
602 | 722 | ||
603 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | 723 | // if attachment we set it's asset id so object updates |
604 | // if attachment we set it's asset id so object updates can reflect that | 724 | // can reflect that, if not, we set it's position in world. |
605 | // if not, we set it's position in world. | 725 | if (!attachment) |
606 | if (!attachment) | 726 | { |
607 | { | 727 | group.ScheduleGroupForFullUpdate(); |
608 | group.ScheduleGroupForFullUpdate(); | 728 | |
609 | 729 | group.AbsolutePosition = pos + veclist[i]; | |
610 | float offsetHeight = 0; | 730 | } |
611 | pos = m_Scene.GetNewRezLocation( | 731 | else |
612 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | 732 | { |
613 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); | 733 | group.SetFromItemID(itemID); |
614 | pos.Z += offsetHeight; | 734 | } |
615 | group.AbsolutePosition = pos; | ||
616 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
617 | |||
618 | } | ||
619 | else | ||
620 | { | ||
621 | group.SetFromItemID(itemID); | ||
622 | } | ||
623 | 735 | ||
624 | SceneObjectPart rootPart = null; | 736 | SceneObjectPart rootPart = null; |
625 | try | ||
626 | { | ||
627 | rootPart = group.GetChildPart(group.UUID); | ||
628 | } | ||
629 | catch (NullReferenceException) | ||
630 | { | ||
631 | string isAttachment = ""; | ||
632 | 737 | ||
633 | if (attachment) | 738 | try |
634 | isAttachment = " Object was an attachment"; | 739 | { |
740 | rootPart = group.GetChildPart(group.UUID); | ||
741 | } | ||
742 | catch (NullReferenceException) | ||
743 | { | ||
744 | string isAttachment = ""; | ||
635 | 745 | ||
636 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | 746 | if (attachment) |
637 | } | 747 | isAttachment = " Object was an attachment"; |
638 | 748 | ||
639 | // Since renaming the item in the inventory does not affect the name stored | 749 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); |
640 | // in the serialization, transfer the correct name from the inventory to the | 750 | } |
641 | // object itself before we rez. | ||
642 | rootPart.Name = item.Name; | ||
643 | rootPart.Description = item.Description; | ||
644 | 751 | ||
645 | if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0) | 752 | // Since renaming the item in the inventory does not |
646 | { | 753 | // affect the name stored in the serialization, transfer |
754 | // the correct name from the inventory to the | ||
755 | // object itself before we rez. | ||
756 | rootPart.Name = item.Name; | ||
757 | rootPart.Description = item.Description; | ||
647 | rootPart.ObjectSaleType = item.SaleType; | 758 | rootPart.ObjectSaleType = item.SaleType; |
648 | rootPart.SalePrice = item.SalePrice; | 759 | rootPart.SalePrice = item.SalePrice; |
649 | } | ||
650 | |||
651 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
652 | if ((rootPart.OwnerID != item.Owner) || | ||
653 | (item.CurrentPermissions & 16) != 0 || // Magic number | ||
654 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
655 | { | ||
656 | //Need to kill the for sale here | ||
657 | rootPart.ObjectSaleType = 0; | ||
658 | rootPart.SalePrice = 10; | ||
659 | 760 | ||
660 | if (m_Scene.Permissions.PropagatePermissions()) | 761 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
762 | if ((rootPart.OwnerID != item.Owner) || | ||
763 | (item.CurrentPermissions & 16) != 0) | ||
661 | { | 764 | { |
662 | foreach (SceneObjectPart part in group.Parts) | 765 | //Need to kill the for sale here |
766 | rootPart.ObjectSaleType = 0; | ||
767 | rootPart.SalePrice = 10; | ||
768 | |||
769 | if (m_Scene.Permissions.PropagatePermissions()) | ||
663 | { | 770 | { |
664 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 771 | foreach (SceneObjectPart part in group.Parts) |
665 | part.EveryoneMask = item.EveryOnePermissions; | 772 | { |
666 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | 773 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) |
667 | part.NextOwnerMask = item.NextPermissions; | 774 | { |
668 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 775 | part.EveryoneMask = item.EveryOnePermissions; |
669 | part.GroupMask = item.GroupPermissions; | 776 | part.NextOwnerMask = item.NextPermissions; |
777 | } | ||
778 | part.GroupMask = 0; // DO NOT propagate here | ||
779 | } | ||
780 | |||
781 | group.ApplyNextOwnerPermissions(); | ||
670 | } | 782 | } |
671 | |||
672 | group.ApplyNextOwnerPermissions(); | ||
673 | } | 783 | } |
674 | } | ||
675 | 784 | ||
676 | foreach (SceneObjectPart part in group.Parts) | 785 | foreach (SceneObjectPart part in group.Parts) |
677 | { | ||
678 | if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) | ||
679 | { | 786 | { |
680 | part.LastOwnerID = part.OwnerID; | 787 | if ((part.OwnerID != item.Owner) || |
681 | part.OwnerID = item.Owner; | 788 | (item.CurrentPermissions & 16) != 0) |
682 | part.Inventory.ChangeInventoryOwner(item.Owner); | 789 | { |
683 | part.GroupMask = 0; // DO NOT propagate here | 790 | part.LastOwnerID = part.OwnerID; |
684 | } | 791 | part.OwnerID = item.Owner; |
685 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | 792 | part.Inventory.ChangeInventoryOwner(item.Owner); |
793 | part.GroupMask = 0; // DO NOT propagate here | ||
794 | } | ||
686 | part.EveryoneMask = item.EveryOnePermissions; | 795 | part.EveryoneMask = item.EveryOnePermissions; |
687 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
688 | part.NextOwnerMask = item.NextPermissions; | 796 | part.NextOwnerMask = item.NextPermissions; |
689 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | 797 | } |
690 | part.GroupMask = item.GroupPermissions; | ||
691 | } | ||
692 | 798 | ||
693 | rootPart.TrimPermissions(); | 799 | rootPart.TrimPermissions(); |
694 | 800 | ||
695 | if (!attachment) | 801 | if (!attachment) |
696 | { | ||
697 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
698 | { | 802 | { |
699 | group.ClearPartAttachmentData(); | 803 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) |
700 | } | 804 | group.ClearPartAttachmentData(); |
701 | 805 | ||
702 | // Fire on_rez | 806 | // Fire on_rez |
703 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); | 807 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); |
704 | rootPart.ParentGroup.ResumeScripts(); | 808 | rootPart.ParentGroup.ResumeScripts(); |
705 | 809 | ||
706 | rootPart.ScheduleFullUpdate(); | 810 | rootPart.ScheduleFullUpdate(); |
811 | } | ||
707 | } | 812 | } |
708 | 813 | ||
709 | if (!m_Scene.Permissions.BypassPermissions()) | 814 | if (!m_Scene.Permissions.BypassPermissions()) |
@@ -721,9 +826,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
721 | } | 826 | } |
722 | } | 827 | } |
723 | } | 828 | } |
724 | |||
725 | return rootPart.ParentGroup; | ||
726 | } | 829 | } |
830 | return group; | ||
727 | } | 831 | } |
728 | 832 | ||
729 | return null; | 833 | return null; |
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 00b0aa9..2de8d7a 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | |||
@@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
148 | public void SendProfileToClient(ScenePresence presence) | 148 | public void SendProfileToClient(ScenePresence presence) |
149 | { | 149 | { |
150 | IClientAPI client = presence.ControllingClient; | 150 | IClientAPI client = presence.ControllingClient; |
151 | if (m_enableWindlight) | 151 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) |
152 | { | 152 | { |
153 | if (presence.IsChildAgent == false) | 153 | if (presence.IsChildAgent == false) |
154 | { | 154 | { |
@@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
165 | public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) | 165 | public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl) |
166 | { | 166 | { |
167 | IClientAPI client = presence.ControllingClient; | 167 | IClientAPI client = presence.ControllingClient; |
168 | if (m_enableWindlight) | 168 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) |
169 | { | 169 | { |
170 | if (presence.IsChildAgent == false) | 170 | if (presence.IsChildAgent == false) |
171 | { | 171 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index c0975ea..9255791 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs | |||
@@ -111,14 +111,12 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules | |||
111 | { | 111 | { |
112 | if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) | 112 | if ((SMTPConfig = m_Config.Configs["SMTP"]) == null) |
113 | { | 113 | { |
114 | m_log.InfoFormat("[SMTP] SMTP server not configured"); | ||
115 | m_Enabled = false; | 114 | m_Enabled = false; |
116 | return; | 115 | return; |
117 | } | 116 | } |
118 | 117 | ||
119 | if (!SMTPConfig.GetBoolean("enabled", false)) | 118 | if (!SMTPConfig.GetBoolean("enabled", false)) |
120 | { | 119 | { |
121 | m_log.InfoFormat("[SMTP] module disabled in configuration"); | ||
122 | m_Enabled = false; | 120 | m_Enabled = false; |
123 | return; | 121 | return; |
124 | } | 122 | } |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d78931a..4c8424d 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -29,8 +29,10 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Net.Security; | ||
32 | using System.Text; | 33 | using System.Text; |
33 | using System.Threading; | 34 | using System.Threading; |
35 | using System.Security.Cryptography.X509Certificates; | ||
34 | using Nini.Config; | 36 | using Nini.Config; |
35 | using OpenMetaverse; | 37 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
@@ -100,8 +102,24 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
100 | 102 | ||
101 | public HttpRequestModule() | 103 | public HttpRequestModule() |
102 | { | 104 | { |
105 | ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate; | ||
103 | } | 106 | } |
104 | 107 | ||
108 | public static bool ValidateServerCertificate( | ||
109 | object sender, | ||
110 | X509Certificate certificate, | ||
111 | X509Chain chain, | ||
112 | SslPolicyErrors sslPolicyErrors) | ||
113 | { | ||
114 | HttpWebRequest Request = (HttpWebRequest)sender; | ||
115 | |||
116 | if (Request.Headers.Get("NoVerifyCert") != null) | ||
117 | { | ||
118 | return true; | ||
119 | } | ||
120 | |||
121 | return chain.Build(new X509Certificate2(certificate)); | ||
122 | } | ||
105 | #region IHttpRequestModule Members | 123 | #region IHttpRequestModule Members |
106 | 124 | ||
107 | public UUID MakeHttpRequest(string url, string parameters, string body) | 125 | public UUID MakeHttpRequest(string url, string parameters, string body) |
@@ -141,8 +159,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
141 | break; | 159 | break; |
142 | 160 | ||
143 | case (int)HttpRequestConstants.HTTP_VERIFY_CERT: | 161 | case (int)HttpRequestConstants.HTTP_VERIFY_CERT: |
144 | 162 | htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); | |
145 | // TODO implement me | ||
146 | break; | 163 | break; |
147 | } | 164 | } |
148 | } | 165 | } |
@@ -189,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
189 | * Not sure how important ordering is is here - the next first | 206 | * Not sure how important ordering is is here - the next first |
190 | * one completed in the list is returned, based soley on its list | 207 | * one completed in the list is returned, based soley on its list |
191 | * position, not the order in which the request was started or | 208 | * position, not the order in which the request was started or |
192 | * finsihed. I thought about setting up a queue for this, but | 209 | * finished. I thought about setting up a queue for this, but |
193 | * it will need some refactoring and this works 'enough' right now | 210 | * it will need some refactoring and this works 'enough' right now |
194 | */ | 211 | */ |
195 | 212 | ||
@@ -237,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
237 | 254 | ||
238 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); | 255 | m_scene.RegisterModuleInterface<IHttpRequestModule>(this); |
239 | 256 | ||
240 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | 257 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); |
241 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | 258 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); |
242 | 259 | ||
243 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); | 260 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); |
244 | } | 261 | } |
@@ -282,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
282 | public string HttpMethod = "GET"; | 299 | public string HttpMethod = "GET"; |
283 | public string HttpMIMEType = "text/plain;charset=utf-8"; | 300 | public string HttpMIMEType = "text/plain;charset=utf-8"; |
284 | public int HttpTimeout; | 301 | public int HttpTimeout; |
285 | // public bool HttpVerifyCert = true; // not implemented | 302 | public bool HttpVerifyCert = true; |
286 | private Thread httpThread; | 303 | private Thread httpThread; |
287 | 304 | ||
288 | // Request info | 305 | // Request info |
@@ -344,6 +361,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
344 | Request.Method = HttpMethod; | 361 | Request.Method = HttpMethod; |
345 | Request.ContentType = HttpMIMEType; | 362 | Request.ContentType = HttpMIMEType; |
346 | 363 | ||
364 | if(!HttpVerifyCert) | ||
365 | { | ||
366 | // We could hijack Connection Group Name to identify | ||
367 | // a desired security exception. But at the moment we'll use a dummy header instead. | ||
368 | // Request.ConnectionGroupName = "NoVerify"; | ||
369 | Request.Headers.Add("NoVerifyCert", "true"); | ||
370 | } | ||
371 | // else | ||
372 | // { | ||
373 | // Request.ConnectionGroupName="Verify"; | ||
374 | // } | ||
347 | if (proxyurl != null && proxyurl.Length > 0) | 375 | if (proxyurl != null && proxyurl.Length > 0) |
348 | { | 376 | { |
349 | if (proxyexcepts != null && proxyexcepts.Length > 0) | 377 | if (proxyexcepts != null && proxyexcepts.Length > 0) |
@@ -436,4 +464,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
436 | } | 464 | } |
437 | } | 465 | } |
438 | } | 466 | } |
439 | } | 467 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 57ab135..b6d64ac 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -200,12 +200,13 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
200 | } | 200 | } |
201 | Scene.RegionInfo.RegionSettings.Save(); | 201 | Scene.RegionInfo.RegionSettings.Save(); |
202 | TriggerRegionInfoChange(); | 202 | TriggerRegionInfoChange(); |
203 | sendRegionHandshakeToAll(); | ||
203 | sendRegionInfoPacketToAll(); | 204 | sendRegionInfoPacketToAll(); |
204 | } | 205 | } |
205 | 206 | ||
206 | private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) | 207 | private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient) |
207 | { | 208 | { |
208 | sendRegionHandshakeToAll(); | 209 | // sendRegionHandshakeToAll(); |
209 | } | 210 | } |
210 | 211 | ||
211 | public void setRegionTerrainSettings(float WaterHeight, | 212 | public void setRegionTerrainSettings(float WaterHeight, |
@@ -274,8 +275,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
274 | { | 275 | { |
275 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 276 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
276 | { | 277 | { |
278 | if ((estateAccessType & 1) != 0) // All estates | ||
279 | { | ||
280 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
281 | EstateSettings estateSettings; | ||
282 | |||
283 | foreach (int estateID in estateIDs) | ||
284 | { | ||
285 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
286 | { | ||
287 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
288 | estateSettings.AddEstateUser(user); | ||
289 | estateSettings.Save(); | ||
290 | } | ||
291 | } | ||
292 | } | ||
293 | |||
277 | Scene.RegionInfo.EstateSettings.AddEstateUser(user); | 294 | Scene.RegionInfo.EstateSettings.AddEstateUser(user); |
278 | Scene.RegionInfo.EstateSettings.Save(); | 295 | Scene.RegionInfo.EstateSettings.Save(); |
296 | |||
279 | TriggerEstateInfoChange(); | 297 | TriggerEstateInfoChange(); |
280 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); | 298 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); |
281 | } | 299 | } |
@@ -289,10 +307,26 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
289 | { | 307 | { |
290 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 308 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
291 | { | 309 | { |
310 | if ((estateAccessType & 1) != 0) // All estates | ||
311 | { | ||
312 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
313 | EstateSettings estateSettings; | ||
314 | |||
315 | foreach (int estateID in estateIDs) | ||
316 | { | ||
317 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
318 | { | ||
319 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
320 | estateSettings.RemoveEstateUser(user); | ||
321 | estateSettings.Save(); | ||
322 | } | ||
323 | } | ||
324 | } | ||
325 | |||
292 | Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); | 326 | Scene.RegionInfo.EstateSettings.RemoveEstateUser(user); |
293 | Scene.RegionInfo.EstateSettings.Save(); | 327 | Scene.RegionInfo.EstateSettings.Save(); |
294 | TriggerEstateInfoChange(); | ||
295 | 328 | ||
329 | TriggerEstateInfoChange(); | ||
296 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); | 330 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID); |
297 | } | 331 | } |
298 | else | 332 | else |
@@ -304,8 +338,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
304 | { | 338 | { |
305 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 339 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
306 | { | 340 | { |
341 | if ((estateAccessType & 1) != 0) // All estates | ||
342 | { | ||
343 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
344 | EstateSettings estateSettings; | ||
345 | |||
346 | foreach (int estateID in estateIDs) | ||
347 | { | ||
348 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
349 | { | ||
350 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
351 | estateSettings.AddEstateGroup(user); | ||
352 | estateSettings.Save(); | ||
353 | } | ||
354 | } | ||
355 | } | ||
356 | |||
307 | Scene.RegionInfo.EstateSettings.AddEstateGroup(user); | 357 | Scene.RegionInfo.EstateSettings.AddEstateGroup(user); |
308 | Scene.RegionInfo.EstateSettings.Save(); | 358 | Scene.RegionInfo.EstateSettings.Save(); |
359 | |||
309 | TriggerEstateInfoChange(); | 360 | TriggerEstateInfoChange(); |
310 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); | 361 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); |
311 | } | 362 | } |
@@ -318,10 +369,26 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
318 | { | 369 | { |
319 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 370 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
320 | { | 371 | { |
372 | if ((estateAccessType & 1) != 0) // All estates | ||
373 | { | ||
374 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
375 | EstateSettings estateSettings; | ||
376 | |||
377 | foreach (int estateID in estateIDs) | ||
378 | { | ||
379 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
380 | { | ||
381 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
382 | estateSettings.RemoveEstateGroup(user); | ||
383 | estateSettings.Save(); | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | |||
321 | Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); | 388 | Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user); |
322 | Scene.RegionInfo.EstateSettings.Save(); | 389 | Scene.RegionInfo.EstateSettings.Save(); |
323 | TriggerEstateInfoChange(); | ||
324 | 390 | ||
391 | TriggerEstateInfoChange(); | ||
325 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); | 392 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID); |
326 | } | 393 | } |
327 | else | 394 | else |
@@ -349,6 +416,29 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
349 | if (!alreadyInList) | 416 | if (!alreadyInList) |
350 | { | 417 | { |
351 | 418 | ||
419 | if ((estateAccessType & 1) != 0) // All estates | ||
420 | { | ||
421 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
422 | EstateSettings estateSettings; | ||
423 | |||
424 | foreach (int estateID in estateIDs) | ||
425 | { | ||
426 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
427 | { | ||
428 | EstateBan bitem = new EstateBan(); | ||
429 | |||
430 | bitem.BannedUserID = user; | ||
431 | bitem.EstateID = (uint)estateID; | ||
432 | bitem.BannedHostAddress = "0.0.0.0"; | ||
433 | bitem.BannedHostIPMask = "0.0.0.0"; | ||
434 | |||
435 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
436 | estateSettings.AddBan(bitem); | ||
437 | estateSettings.Save(); | ||
438 | } | ||
439 | } | ||
440 | } | ||
441 | |||
352 | EstateBan item = new EstateBan(); | 442 | EstateBan item = new EstateBan(); |
353 | 443 | ||
354 | item.BannedUserID = user; | 444 | item.BannedUserID = user; |
@@ -358,6 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
358 | 448 | ||
359 | Scene.RegionInfo.EstateSettings.AddBan(item); | 449 | Scene.RegionInfo.EstateSettings.AddBan(item); |
360 | Scene.RegionInfo.EstateSettings.Save(); | 450 | Scene.RegionInfo.EstateSettings.Save(); |
451 | |||
361 | TriggerEstateInfoChange(); | 452 | TriggerEstateInfoChange(); |
362 | 453 | ||
363 | ScenePresence s = Scene.GetScenePresence(user); | 454 | ScenePresence s = Scene.GetScenePresence(user); |
@@ -403,8 +494,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
403 | 494 | ||
404 | if (alreadyInList && listitem != null) | 495 | if (alreadyInList && listitem != null) |
405 | { | 496 | { |
497 | if ((estateAccessType & 1) != 0) // All estates | ||
498 | { | ||
499 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
500 | EstateSettings estateSettings; | ||
501 | |||
502 | foreach (int estateID in estateIDs) | ||
503 | { | ||
504 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
505 | { | ||
506 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
507 | estateSettings.RemoveBan(user); | ||
508 | estateSettings.Save(); | ||
509 | } | ||
510 | } | ||
511 | } | ||
512 | |||
406 | Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); | 513 | Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID); |
407 | Scene.RegionInfo.EstateSettings.Save(); | 514 | Scene.RegionInfo.EstateSettings.Save(); |
515 | |||
408 | TriggerEstateInfoChange(); | 516 | TriggerEstateInfoChange(); |
409 | } | 517 | } |
410 | else | 518 | else |
@@ -424,8 +532,25 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
424 | { | 532 | { |
425 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 533 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
426 | { | 534 | { |
535 | if ((estateAccessType & 1) != 0) // All estates | ||
536 | { | ||
537 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
538 | EstateSettings estateSettings; | ||
539 | |||
540 | foreach (int estateID in estateIDs) | ||
541 | { | ||
542 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
543 | { | ||
544 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
545 | estateSettings.AddEstateManager(user); | ||
546 | estateSettings.Save(); | ||
547 | } | ||
548 | } | ||
549 | } | ||
550 | |||
427 | Scene.RegionInfo.EstateSettings.AddEstateManager(user); | 551 | Scene.RegionInfo.EstateSettings.AddEstateManager(user); |
428 | Scene.RegionInfo.EstateSettings.Save(); | 552 | Scene.RegionInfo.EstateSettings.Save(); |
553 | |||
429 | TriggerEstateInfoChange(); | 554 | TriggerEstateInfoChange(); |
430 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); | 555 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); |
431 | } | 556 | } |
@@ -438,10 +563,26 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
438 | { | 563 | { |
439 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) | 564 | if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) |
440 | { | 565 | { |
566 | if ((estateAccessType & 1) != 0) // All estates | ||
567 | { | ||
568 | List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner); | ||
569 | EstateSettings estateSettings; | ||
570 | |||
571 | foreach (int estateID in estateIDs) | ||
572 | { | ||
573 | if (estateID != Scene.RegionInfo.EstateSettings.EstateID) | ||
574 | { | ||
575 | estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID); | ||
576 | estateSettings.RemoveEstateManager(user); | ||
577 | estateSettings.Save(); | ||
578 | } | ||
579 | } | ||
580 | } | ||
581 | |||
441 | Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); | 582 | Scene.RegionInfo.EstateSettings.RemoveEstateManager(user); |
442 | Scene.RegionInfo.EstateSettings.Save(); | 583 | Scene.RegionInfo.EstateSettings.Save(); |
443 | TriggerEstateInfoChange(); | ||
444 | 584 | ||
585 | TriggerEstateInfoChange(); | ||
445 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); | 586 | remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID); |
446 | } | 587 | } |
447 | else | 588 | else |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 7d990c2..7fc358d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs | |||
@@ -133,16 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
133 | return new List<ILandObject>(); | 133 | return new List<ILandObject>(); |
134 | } | 134 | } |
135 | 135 | ||
136 | public bool IsLandPrimCountTainted() | ||
137 | { | ||
138 | if (m_landManagementModule != null) | ||
139 | { | ||
140 | return m_landManagementModule.IsLandPrimCountTainted(); | ||
141 | } | ||
142 | |||
143 | return false; | ||
144 | } | ||
145 | |||
146 | public bool IsForcefulBansAllowed() | 136 | public bool IsForcefulBansAllowed() |
147 | { | 137 | { |
148 | if (m_landManagementModule != null) | 138 | if (m_landManagementModule != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 98ba8c3..bfab7b8 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -62,8 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
62 | 62 | ||
63 | public class LandManagementModule : INonSharedRegionModule | 63 | public class LandManagementModule : INonSharedRegionModule |
64 | { | 64 | { |
65 | private static readonly ILog m_log = | 65 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
66 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
67 | 66 | ||
68 | private static readonly string remoteParcelRequestPath = "0009/"; | 67 | private static readonly string remoteParcelRequestPath = "0009/"; |
69 | 68 | ||
@@ -72,6 +71,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
72 | protected Commander m_commander = new Commander("land"); | 71 | protected Commander m_commander = new Commander("land"); |
73 | 72 | ||
74 | protected IUserManagement m_userManager; | 73 | protected IUserManagement m_userManager; |
74 | protected IPrimCountModule m_primCountModule; | ||
75 | 75 | ||
76 | // Minimum for parcels to work is 64m even if we don't actually use them. | 76 | // Minimum for parcels to work is 64m even if we don't actually use them. |
77 | #pragma warning disable 0429 | 77 | #pragma warning disable 0429 |
@@ -88,7 +88,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
88 | /// </value> | 88 | /// </value> |
89 | private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); | 89 | private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); |
90 | 90 | ||
91 | private bool m_landPrimCountTainted; | ||
92 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
93 | 92 | ||
94 | private bool m_allowedForcefulBans = true; | 93 | private bool m_allowedForcefulBans = true; |
@@ -121,18 +120,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
121 | 120 | ||
122 | m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; | 121 | m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd; |
123 | m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; | 122 | m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate; |
123 | m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; | ||
124 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; | ||
125 | |||
124 | m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; | 126 | m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel; |
125 | m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement; | 127 | m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement; |
126 | m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; | 128 | m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy; |
127 | m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; | 129 | m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy; |
128 | m_scene.EventManager.OnNewClient += EventManagerOnNewClient; | 130 | m_scene.EventManager.OnNewClient += EventManagerOnNewClient; |
129 | m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; | 131 | m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement; |
130 | m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene; | ||
131 | m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; | 132 | m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage; |
132 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; | 133 | m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage; |
133 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; | 134 | m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan; |
134 | m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate; | ||
135 | m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted; | ||
136 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; | 135 | m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps; |
137 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; | 136 | m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole; |
138 | 137 | ||
@@ -147,6 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
147 | public void RegionLoaded(Scene scene) | 146 | public void RegionLoaded(Scene scene) |
148 | { | 147 | { |
149 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); | 148 | m_userManager = m_scene.RequestModuleInterface<IUserManagement>(); |
149 | m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>(); | ||
150 | } | 150 | } |
151 | 151 | ||
152 | public void RemoveRegion(Scene scene) | 152 | public void RemoveRegion(Scene scene) |
@@ -306,10 +306,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
306 | /// <returns>The parcel created.</returns> | 306 | /// <returns>The parcel created.</returns> |
307 | protected ILandObject CreateDefaultParcel() | 307 | protected ILandObject CreateDefaultParcel() |
308 | { | 308 | { |
309 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | 309 | m_log.DebugFormat( |
310 | "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); | ||
311 | |||
312 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | ||
310 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | 313 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); |
311 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 314 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
312 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 315 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
316 | |||
313 | return AddLandObject(fullSimParcel); | 317 | return AddLandObject(fullSimParcel); |
314 | } | 318 | } |
315 | 319 | ||
@@ -579,7 +583,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
579 | } | 583 | } |
580 | else | 584 | else |
581 | { | 585 | { |
582 | m_log.WarnFormat("[LAND]: Invalid local land ID {0}", landLocalID); | 586 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID); |
583 | } | 587 | } |
584 | } | 588 | } |
585 | 589 | ||
@@ -590,6 +594,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
590 | public ILandObject AddLandObject(ILandObject land) | 594 | public ILandObject AddLandObject(ILandObject land) |
591 | { | 595 | { |
592 | ILandObject new_land = land.Copy(); | 596 | ILandObject new_land = land.Copy(); |
597 | |||
598 | // Only now can we add the prim counts to the land object - we rely on the global ID which is generated | ||
599 | // as a random UUID inside LandData initialization | ||
600 | if (m_primCountModule != null) | ||
601 | new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); | ||
593 | 602 | ||
594 | lock (m_landList) | 603 | lock (m_landList) |
595 | { | 604 | { |
@@ -603,6 +612,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
603 | { | 612 | { |
604 | if (landBitmap[x, y]) | 613 | if (landBitmap[x, y]) |
605 | { | 614 | { |
615 | // m_log.DebugFormat( | ||
616 | // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", | ||
617 | // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); | ||
618 | |||
606 | m_landIDList[x, y] = newLandLocalID; | 619 | m_landIDList[x, y] = newLandLocalID; |
607 | } | 620 | } |
608 | } | 621 | } |
@@ -630,7 +643,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
630 | { | 643 | { |
631 | if (m_landIDList[x, y] == local_id) | 644 | if (m_landIDList[x, y] == local_id) |
632 | { | 645 | { |
633 | m_log.WarnFormat("[LAND]: Not removing land object {0}; still being used at {1}, {2}", | 646 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}", |
634 | local_id, x, y); | 647 | local_id, x, y); |
635 | return; | 648 | return; |
636 | //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); | 649 | //throw new Exception("Could not remove land object. Still being used at " + x + ", " + y); |
@@ -732,8 +745,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
732 | // Corner case. If an autoreturn happens during sim startup | 745 | // Corner case. If an autoreturn happens during sim startup |
733 | // we will come here with the list uninitialized | 746 | // we will come here with the list uninitialized |
734 | // | 747 | // |
748 | int landId = m_landIDList[x, y]; | ||
749 | |||
750 | // if (landId == 0) | ||
751 | // m_log.DebugFormat( | ||
752 | // "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}", | ||
753 | // x, y, m_scene.RegionInfo.RegionName); | ||
754 | |||
735 | if (m_landList.ContainsKey(m_landIDList[x, y])) | 755 | if (m_landList.ContainsKey(m_landIDList[x, y])) |
736 | return m_landList[m_landIDList[x, y]]; | 756 | return m_landList[m_landIDList[x, y]]; |
757 | |||
737 | return null; | 758 | return null; |
738 | } | 759 | } |
739 | } | 760 | } |
@@ -751,13 +772,14 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
751 | { | 772 | { |
752 | try | 773 | try |
753 | { | 774 | { |
754 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) | 775 | return m_landList[m_landIDList[x / 4, y / 4]]; |
755 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
756 | //else | ||
757 | // return null; | ||
758 | } | 776 | } |
759 | catch (IndexOutOfRangeException) | 777 | catch (IndexOutOfRangeException) |
760 | { | 778 | { |
779 | // m_log.WarnFormat( | ||
780 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
781 | // x, y, m_scene.RegionInfo.RegionName); | ||
782 | |||
761 | return null; | 783 | return null; |
762 | } | 784 | } |
763 | } | 785 | } |
@@ -767,34 +789,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
767 | 789 | ||
768 | #region Parcel Modification | 790 | #region Parcel Modification |
769 | 791 | ||
770 | public void ResetAllLandPrimCounts() | 792 | public void ResetOverMeRecords() |
771 | { | 793 | { |
772 | lock (m_landList) | 794 | lock (m_landList) |
773 | { | 795 | { |
774 | foreach (LandObject p in m_landList.Values) | 796 | foreach (LandObject p in m_landList.Values) |
775 | { | 797 | { |
776 | p.ResetLandPrimCounts(); | 798 | p.ResetOverMeRecord(); |
777 | } | 799 | } |
778 | } | 800 | } |
779 | } | 801 | } |
780 | 802 | ||
781 | public void EventManagerOnParcelPrimCountTainted() | ||
782 | { | ||
783 | m_landPrimCountTainted = true; | ||
784 | } | ||
785 | |||
786 | public bool IsLandPrimCountTainted() | ||
787 | { | ||
788 | return m_landPrimCountTainted; | ||
789 | } | ||
790 | |||
791 | public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj) | 803 | public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj) |
792 | { | 804 | { |
793 | Vector3 position = obj.AbsolutePosition; | 805 | Vector3 position = obj.AbsolutePosition; |
794 | ILandObject landUnderPrim = GetLandObject(position.X, position.Y); | 806 | ILandObject landUnderPrim = GetLandObject(position.X, position.Y); |
795 | if (landUnderPrim != null) | 807 | if (landUnderPrim != null) |
796 | { | 808 | { |
797 | landUnderPrim.AddPrimToCount(obj); | 809 | ((LandObject)landUnderPrim).AddPrimOverMe(obj); |
798 | } | 810 | } |
799 | } | 811 | } |
800 | 812 | ||
@@ -804,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
804 | { | 816 | { |
805 | foreach (LandObject p in m_landList.Values) | 817 | foreach (LandObject p in m_landList.Values) |
806 | { | 818 | { |
807 | p.RemovePrimFromCount(obj); | 819 | p.RemovePrimFromOverMe(obj); |
808 | } | 820 | } |
809 | } | 821 | } |
810 | } | 822 | } |
@@ -837,8 +849,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
837 | foreach (LandObject p in landOwnersAndParcels[owner]) | 849 | foreach (LandObject p in landOwnersAndParcels[owner]) |
838 | { | 850 | { |
839 | simArea += p.LandData.Area; | 851 | simArea += p.LandData.Area; |
840 | simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims + | 852 | simPrims += p.PrimCounts.Total; |
841 | p.LandData.SelectedPrims; | ||
842 | } | 853 | } |
843 | 854 | ||
844 | foreach (LandObject p in landOwnersAndParcels[owner]) | 855 | foreach (LandObject p in landOwnersAndParcels[owner]) |
@@ -851,7 +862,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
851 | 862 | ||
852 | public void EventManagerOnParcelPrimCountUpdate() | 863 | public void EventManagerOnParcelPrimCountUpdate() |
853 | { | 864 | { |
854 | ResetAllLandPrimCounts(); | 865 | // m_log.DebugFormat( |
866 | // "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}", | ||
867 | // m_scene.RegionInfo.RegionName); | ||
868 | |||
869 | ResetOverMeRecords(); | ||
855 | EntityBase[] entities = m_scene.Entities.GetEntities(); | 870 | EntityBase[] entities = m_scene.Entities.GetEntities(); |
856 | foreach (EntityBase obj in entities) | 871 | foreach (EntityBase obj in entities) |
857 | { | 872 | { |
@@ -864,15 +879,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
864 | } | 879 | } |
865 | } | 880 | } |
866 | FinalizeLandPrimCountUpdate(); | 881 | FinalizeLandPrimCountUpdate(); |
867 | m_landPrimCountTainted = false; | ||
868 | } | 882 | } |
869 | 883 | ||
870 | public void EventManagerOnRequestParcelPrimCountUpdate() | 884 | public void EventManagerOnRequestParcelPrimCountUpdate() |
871 | { | 885 | { |
872 | ResetAllLandPrimCounts(); | 886 | ResetOverMeRecords(); |
873 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 887 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
874 | FinalizeLandPrimCountUpdate(); | 888 | FinalizeLandPrimCountUpdate(); |
875 | m_landPrimCountTainted = false; | ||
876 | } | 889 | } |
877 | 890 | ||
878 | /// <summary> | 891 | /// <summary> |
@@ -936,8 +949,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
936 | m_landList[startLandObjectIndex].ForceUpdateLandInfo(); | 949 | m_landList[startLandObjectIndex].ForceUpdateLandInfo(); |
937 | } | 950 | } |
938 | 951 | ||
939 | EventManagerOnParcelPrimCountTainted(); | ||
940 | |||
941 | //Now add the new land object | 952 | //Now add the new land object |
942 | ILandObject result = AddLandObject(newLand); | 953 | ILandObject result = AddLandObject(newLand); |
943 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); | 954 | UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData); |
@@ -1004,7 +1015,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1004 | performFinalLandJoin(masterLandObject, slaveLandObject); | 1015 | performFinalLandJoin(masterLandObject, slaveLandObject); |
1005 | } | 1016 | } |
1006 | } | 1017 | } |
1007 | EventManagerOnParcelPrimCountTainted(); | ||
1008 | 1018 | ||
1009 | masterLandObject.SendLandUpdateToAvatarsOverMe(); | 1019 | masterLandObject.SendLandUpdateToAvatarsOverMe(); |
1010 | } | 1020 | } |
@@ -1194,11 +1204,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1194 | 1204 | ||
1195 | if (land != null) | 1205 | if (land != null) |
1196 | { | 1206 | { |
1207 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | ||
1197 | m_landList[local_id].SendLandObjectOwners(remote_client); | 1208 | m_landList[local_id].SendLandObjectOwners(remote_client); |
1198 | } | 1209 | } |
1199 | else | 1210 | else |
1200 | { | 1211 | { |
1201 | m_log.WarnFormat("[PARCEL]: Invalid land object {0} passed for parcel object owner request", local_id); | 1212 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id); |
1202 | } | 1213 | } |
1203 | } | 1214 | } |
1204 | 1215 | ||
@@ -1361,7 +1372,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1361 | { | 1372 | { |
1362 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1373 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1363 | new_land.LandData = data.Copy(); | 1374 | new_land.LandData = data.Copy(); |
1364 | new_land.SetLandBitmapFromByteArray(); | 1375 | new_land.SetLandBitmapFromByteArray(); |
1365 | AddLandObject(new_land); | 1376 | AddLandObject(new_land); |
1366 | } | 1377 | } |
1367 | 1378 | ||
@@ -1425,8 +1436,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1425 | private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) | 1436 | private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) |
1426 | { | 1437 | { |
1427 | IClientAPI client; | 1438 | IClientAPI client; |
1428 | if (! m_scene.TryGetClient(agentID, out client)) { | 1439 | if (!m_scene.TryGetClient(agentID, out client)) |
1429 | m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString()); | 1440 | { |
1441 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID); | ||
1430 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | 1442 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); |
1431 | } | 1443 | } |
1432 | 1444 | ||
@@ -1475,7 +1487,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1475 | } | 1487 | } |
1476 | else | 1488 | else |
1477 | { | 1489 | { |
1478 | m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); | 1490 | m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID); |
1479 | } | 1491 | } |
1480 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); | 1492 | return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); |
1481 | } | 1493 | } |
@@ -1533,17 +1545,17 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1533 | } | 1545 | } |
1534 | catch (LLSD.LLSDParseException e) | 1546 | catch (LLSD.LLSDParseException e) |
1535 | { | 1547 | { |
1536 | m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message); | 1548 | m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message); |
1537 | m_log.ErrorFormat("[LAND] ... in request {0}", request); | 1549 | m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: ... in request {0}", request); |
1538 | } | 1550 | } |
1539 | catch(InvalidCastException) | 1551 | catch (InvalidCastException) |
1540 | { | 1552 | { |
1541 | m_log.ErrorFormat("[LAND] Wrong type in request {0}", request); | 1553 | m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request); |
1542 | } | 1554 | } |
1543 | 1555 | ||
1544 | LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse(); | 1556 | LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse(); |
1545 | response.parcel_id = parcelID; | 1557 | response.parcel_id = parcelID; |
1546 | m_log.DebugFormat("[LAND] got parcelID {0}", parcelID); | 1558 | m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID); |
1547 | 1559 | ||
1548 | return LLSDHelpers.SerialiseLLSDReply(response); | 1560 | return LLSDHelpers.SerialiseLLSDReply(response); |
1549 | } | 1561 | } |
@@ -1564,7 +1576,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1564 | ExtendedLandData extLandData = new ExtendedLandData(); | 1576 | ExtendedLandData extLandData = new ExtendedLandData(); |
1565 | Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, | 1577 | Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, |
1566 | out extLandData.X, out extLandData.Y); | 1578 | out extLandData.X, out extLandData.Y); |
1567 | m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", | 1579 | m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}", |
1568 | extLandData.RegionHandle, extLandData.X, extLandData.Y); | 1580 | extLandData.RegionHandle, extLandData.X, extLandData.Y); |
1569 | 1581 | ||
1570 | // for this region or for somewhere else? | 1582 | // for this region or for somewhere else? |
@@ -1605,7 +1617,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1605 | info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); | 1617 | info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y); |
1606 | } | 1618 | } |
1607 | // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. | 1619 | // we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark. |
1608 | m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...", | 1620 | m_log.DebugFormat("[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...", |
1609 | data.LandData.Name, data.RegionHandle); | 1621 | data.LandData.Name, data.RegionHandle); |
1610 | // HACK for now | 1622 | // HACK for now |
1611 | RegionInfo r = new RegionInfo(); | 1623 | RegionInfo r = new RegionInfo(); |
@@ -1616,7 +1628,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1616 | remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); | 1628 | remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); |
1617 | } | 1629 | } |
1618 | else | 1630 | else |
1619 | m_log.Debug("[LAND] got no parcelinfo; not sending"); | 1631 | m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending"); |
1620 | } | 1632 | } |
1621 | 1633 | ||
1622 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) | 1634 | public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 46c15ed..c2f104e 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
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 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); | 57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); |
@@ -64,8 +64,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
64 | 64 | ||
65 | #endregion | 65 | #endregion |
66 | 66 | ||
67 | #region ILandObject Members | ||
68 | |||
69 | public int GetPrimsFree() | 67 | public int GetPrimsFree() |
70 | { | 68 | { |
71 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); | 69 | m_scene.EventManager.TriggerParcelPrimCountUpdate(); |
@@ -79,6 +77,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
79 | 77 | ||
80 | set { m_landData = value; } | 78 | set { m_landData = value; } |
81 | } | 79 | } |
80 | |||
81 | public IPrimCounts PrimCounts { get; set; } | ||
82 | 82 | ||
83 | public UUID RegionUUID | 83 | public UUID RegionUUID |
84 | { | 84 | { |
@@ -211,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
211 | return simMax; | 211 | return simMax; |
212 | } | 212 | } |
213 | } | 213 | } |
214 | |||
214 | #endregion | 215 | #endregion |
215 | 216 | ||
216 | #region Packet Request Handling | 217 | #region Packet Request Handling |
@@ -241,7 +242,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
241 | } | 242 | } |
242 | 243 | ||
243 | remote_client.SendLandProperties(seq_id, | 244 | remote_client.SendLandProperties(seq_id, |
244 | snap_selection, request_result, LandData, | 245 | snap_selection, request_result, this, |
245 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 246 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
246 | GetParcelMaxPrimCount(this), | 247 | GetParcelMaxPrimCount(this), |
247 | GetSimulatorMaxPrimCount(this), regionFlags); | 248 | GetSimulatorMaxPrimCount(this), regionFlags); |
@@ -700,23 +701,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
700 | return LandBitmap; | 701 | return LandBitmap; |
701 | } | 702 | } |
702 | 703 | ||
703 | /// <summary> | ||
704 | /// Full sim land object creation | ||
705 | /// </summary> | ||
706 | /// <returns></returns> | ||
707 | public bool[,] BasicFullRegionLandBitmap() | 704 | public bool[,] BasicFullRegionLandBitmap() |
708 | { | 705 | { |
709 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); | 706 | return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize); |
710 | } | 707 | } |
711 | 708 | ||
712 | /// <summary> | ||
713 | /// Used to modify the bitmap between the x and y points. Points use 64 scale | ||
714 | /// </summary> | ||
715 | /// <param name="start_x"></param> | ||
716 | /// <param name="start_y"></param> | ||
717 | /// <param name="end_x"></param> | ||
718 | /// <param name="end_y"></param> | ||
719 | /// <returns></returns> | ||
720 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) | 709 | public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y) |
721 | { | 710 | { |
722 | bool[,] tempBitmap = new bool[64,64]; | 711 | bool[,] tempBitmap = new bool[64,64]; |
@@ -907,9 +896,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
907 | 896 | ||
908 | lock (primsOverMe) | 897 | lock (primsOverMe) |
909 | { | 898 | { |
899 | // m_log.DebugFormat( | ||
900 | // "[LAND OBJECT]: Request for SendLandObjectOwners() from {0} with {1} known prims on region", | ||
901 | // remote_client.Name, primsOverMe.Count); | ||
902 | |||
910 | try | 903 | try |
911 | { | 904 | { |
912 | |||
913 | foreach (SceneObjectGroup obj in primsOverMe) | 905 | foreach (SceneObjectGroup obj in primsOverMe) |
914 | { | 906 | { |
915 | try | 907 | try |
@@ -921,7 +913,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
921 | } | 913 | } |
922 | catch (NullReferenceException) | 914 | catch (NullReferenceException) |
923 | { | 915 | { |
924 | m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); | 916 | m_log.Error("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel"); |
925 | } | 917 | } |
926 | try | 918 | try |
927 | { | 919 | { |
@@ -948,6 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
948 | public Dictionary<UUID, int> GetLandObjectOwners() | 940 | public Dictionary<UUID, int> GetLandObjectOwners() |
949 | { | 941 | { |
950 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); | 942 | Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>(); |
943 | |||
951 | lock (primsOverMe) | 944 | lock (primsOverMe) |
952 | { | 945 | { |
953 | try | 946 | try |
@@ -984,8 +977,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
984 | 977 | ||
985 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) | 978 | public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client) |
986 | { | 979 | { |
987 | Dictionary<UUID,List<SceneObjectGroup>> returns = | 980 | // m_log.DebugFormat( |
988 | new Dictionary<UUID,List<SceneObjectGroup>>(); | 981 | // "[LAND OBJECT]: Request to return objects in {0} from {1}", LandData.Name, remote_client.Name); |
982 | |||
983 | Dictionary<UUID,List<SceneObjectGroup>> returns = new Dictionary<UUID,List<SceneObjectGroup>>(); | ||
989 | 984 | ||
990 | lock (primsOverMe) | 985 | lock (primsOverMe) |
991 | { | 986 | { |
@@ -1058,83 +1053,29 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1058 | 1053 | ||
1059 | #region Object Adding/Removing from Parcel | 1054 | #region Object Adding/Removing from Parcel |
1060 | 1055 | ||
1061 | public void ResetLandPrimCounts() | 1056 | public void ResetOverMeRecord() |
1062 | { | 1057 | { |
1063 | LandData.GroupPrims = 0; | ||
1064 | LandData.OwnerPrims = 0; | ||
1065 | LandData.OtherPrims = 0; | ||
1066 | LandData.SelectedPrims = 0; | ||
1067 | |||
1068 | |||
1069 | lock (primsOverMe) | 1058 | lock (primsOverMe) |
1070 | primsOverMe.Clear(); | 1059 | primsOverMe.Clear(); |
1071 | } | 1060 | } |
1072 | 1061 | ||
1073 | public void AddPrimToCount(SceneObjectGroup obj) | 1062 | public void AddPrimOverMe(SceneObjectGroup obj) |
1074 | { | 1063 | { |
1075 | 1064 | // m_log.DebugFormat("[LAND OBJECT]: Adding scene object {0} {1} over {2}", obj.Name, obj.LocalId, LandData.Name); | |
1076 | UUID prim_owner = obj.OwnerID; | 1065 | |
1077 | int prim_count = obj.PrimCount; | ||
1078 | |||
1079 | if (obj.IsSelected) | ||
1080 | { | ||
1081 | LandData.SelectedPrims += prim_count; | ||
1082 | } | ||
1083 | else | ||
1084 | { | ||
1085 | if (prim_owner == LandData.OwnerID) | ||
1086 | { | ||
1087 | LandData.OwnerPrims += prim_count; | ||
1088 | } | ||
1089 | else if ((obj.GroupID == LandData.GroupID || | ||
1090 | prim_owner == LandData.GroupID) && | ||
1091 | LandData.GroupID != UUID.Zero) | ||
1092 | { | ||
1093 | LandData.GroupPrims += prim_count; | ||
1094 | } | ||
1095 | else | ||
1096 | { | ||
1097 | LandData.OtherPrims += prim_count; | ||
1098 | } | ||
1099 | } | ||
1100 | |||
1101 | lock (primsOverMe) | 1066 | lock (primsOverMe) |
1102 | primsOverMe.Add(obj); | 1067 | primsOverMe.Add(obj); |
1103 | } | 1068 | } |
1104 | 1069 | ||
1105 | public void RemovePrimFromCount(SceneObjectGroup obj) | 1070 | public void RemovePrimFromOverMe(SceneObjectGroup obj) |
1106 | { | 1071 | { |
1072 | // m_log.DebugFormat("[LAND OBJECT]: Removing scene object {0} {1} from over {2}", obj.Name, obj.LocalId, LandData.Name); | ||
1073 | |||
1107 | lock (primsOverMe) | 1074 | lock (primsOverMe) |
1108 | { | 1075 | primsOverMe.Remove(obj); |
1109 | if (primsOverMe.Contains(obj)) | ||
1110 | { | ||
1111 | UUID prim_owner = obj.OwnerID; | ||
1112 | int prim_count = obj.PrimCount; | ||
1113 | |||
1114 | if (prim_owner == LandData.OwnerID) | ||
1115 | { | ||
1116 | LandData.OwnerPrims -= prim_count; | ||
1117 | } | ||
1118 | else if (obj.GroupID == LandData.GroupID || | ||
1119 | prim_owner == LandData.GroupID) | ||
1120 | { | ||
1121 | LandData.GroupPrims -= prim_count; | ||
1122 | } | ||
1123 | else | ||
1124 | { | ||
1125 | LandData.OtherPrims -= prim_count; | ||
1126 | } | ||
1127 | |||
1128 | primsOverMe.Remove(obj); | ||
1129 | } | ||
1130 | } | ||
1131 | } | 1076 | } |
1132 | 1077 | ||
1133 | #endregion | 1078 | #endregion |
1134 | |||
1135 | #endregion | ||
1136 | |||
1137 | #endregion | ||
1138 | 1079 | ||
1139 | /// <summary> | 1080 | /// <summary> |
1140 | /// Set the media url for this land parcel | 1081 | /// Set the media url for this land parcel |
@@ -1155,5 +1096,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1155 | LandData.MusicURL = url; | 1096 | LandData.MusicURL = url; |
1156 | SendLandUpdateToAvatarsOverMe(); | 1097 | SendLandUpdateToAvatarsOverMe(); |
1157 | } | 1098 | } |
1099 | |||
1100 | #endregion | ||
1158 | } | 1101 | } |
1159 | } | 1102 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index 34ef67f..dca842a 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -45,14 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
45 | public int Owner = 0; | 45 | public int Owner = 0; |
46 | public int Group = 0; | 46 | public int Group = 0; |
47 | public int Others = 0; | 47 | public int Others = 0; |
48 | public Dictionary <UUID, int> Users = | 48 | public int Selected = 0; |
49 | new Dictionary <UUID, int>(); | 49 | public Dictionary <UUID, int> Users = new Dictionary <UUID, int>(); |
50 | } | 50 | } |
51 | 51 | ||
52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule | 52 | public class PrimCountModule : IPrimCountModule, INonSharedRegionModule |
53 | { | 53 | { |
54 | private static readonly ILog m_log = | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | 55 | ||
57 | private Scene m_Scene; | 56 | private Scene m_Scene; |
58 | private Dictionary<UUID, PrimCounts> m_PrimCounts = | 57 | private Dictionary<UUID, PrimCounts> m_PrimCounts = |
@@ -64,10 +63,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
64 | private Dictionary<UUID, ParcelCounts> m_ParcelCounts = | 63 | private Dictionary<UUID, ParcelCounts> m_ParcelCounts = |
65 | new Dictionary<UUID, ParcelCounts>(); | 64 | new Dictionary<UUID, ParcelCounts>(); |
66 | 65 | ||
67 | // For now, a simple simwide taint to get this up. Later parcel based | 66 | /// <value> |
68 | // taint to allow recounting a parcel if only ownership has changed | 67 | /// For now, a simple simwide taint to get this up. Later parcel based |
69 | // without recounting the whole sim. | 68 | /// taint to allow recounting a parcel if only ownership has changed |
69 | /// without recounting the whole sim. | ||
70 | /// | ||
71 | /// We start out tainted so that the first get call resets the various prim counts. | ||
72 | /// <value> | ||
70 | private bool m_Tainted = true; | 73 | private bool m_Tainted = true; |
74 | |||
71 | private Object m_TaintLock = new Object(); | 75 | private Object m_TaintLock = new Object(); |
72 | 76 | ||
73 | public Type ReplaceableInterface | 77 | public Type ReplaceableInterface |
@@ -82,13 +86,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
82 | public void AddRegion(Scene scene) | 86 | public void AddRegion(Scene scene) |
83 | { | 87 | { |
84 | m_Scene = scene; | 88 | m_Scene = scene; |
89 | |||
90 | m_Scene.RegisterModuleInterface<IPrimCountModule>(this); | ||
85 | 91 | ||
86 | m_Scene.EventManager.OnParcelPrimCountAdd += | 92 | m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd; |
87 | OnParcelPrimCountAdd; | ||
88 | m_Scene.EventManager.OnObjectBeingRemovedFromScene += | 93 | m_Scene.EventManager.OnObjectBeingRemovedFromScene += |
89 | OnObjectBeingRemovedFromScene; | 94 | OnObjectBeingRemovedFromScene; |
90 | m_Scene.EventManager.OnParcelPrimCountTainted += | 95 | m_Scene.EventManager.OnParcelPrimCountTainted += |
91 | OnParcelPrimCountTainted; | 96 | OnParcelPrimCountTainted; |
97 | m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); }; | ||
92 | } | 98 | } |
93 | 99 | ||
94 | public void RegionLoaded(Scene scene) | 100 | public void RegionLoaded(Scene scene) |
@@ -116,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
116 | { | 122 | { |
117 | if (!m_Tainted) | 123 | if (!m_Tainted) |
118 | AddObject(obj); | 124 | AddObject(obj); |
125 | // else | ||
126 | // m_log.DebugFormat( | ||
127 | // "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", | ||
128 | // obj.Name, m_Scene.RegionInfo.RegionName); | ||
129 | |||
119 | } | 130 | } |
120 | } | 131 | } |
121 | 132 | ||
@@ -126,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
126 | { | 137 | { |
127 | if (!m_Tainted) | 138 | if (!m_Tainted) |
128 | RemoveObject(obj); | 139 | RemoveObject(obj); |
140 | // else | ||
141 | // m_log.DebugFormat( | ||
142 | // "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted", | ||
143 | // obj.Name, m_Scene.RegionInfo.RegionName); | ||
129 | } | 144 | } |
130 | } | 145 | } |
131 | 146 | ||
132 | private void OnParcelPrimCountTainted() | 147 | private void OnParcelPrimCountTainted() |
133 | { | 148 | { |
149 | // m_log.DebugFormat( | ||
150 | // "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName); | ||
151 | |||
134 | lock (m_TaintLock) | 152 | lock (m_TaintLock) |
135 | m_Tainted = true; | 153 | m_Tainted = true; |
136 | } | 154 | } |
@@ -155,15 +173,34 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
155 | 173 | ||
156 | // NOTE: Call under Taint Lock | 174 | // NOTE: Call under Taint Lock |
157 | private void AddObject(SceneObjectGroup obj) | 175 | private void AddObject(SceneObjectGroup obj) |
158 | { | 176 | { |
159 | if (obj.IsAttachment) | 177 | if (obj.IsAttachment) |
160 | return; | 178 | return; |
161 | if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) | 179 | if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0)) |
162 | return; | 180 | return; |
163 | 181 | ||
164 | Vector3 pos = obj.AbsolutePosition; | 182 | Vector3 pos = obj.AbsolutePosition; |
165 | ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); | 183 | ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y); |
184 | |||
185 | // If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it | ||
186 | if (landObject == null) | ||
187 | { | ||
188 | // m_log.WarnFormat( | ||
189 | // "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}", | ||
190 | // obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName); | ||
191 | |||
192 | return; | ||
193 | } | ||
194 | |||
166 | LandData landData = landObject.LandData; | 195 | LandData landData = landObject.LandData; |
196 | |||
197 | // m_log.DebugFormat( | ||
198 | // "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}", | ||
199 | // obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName); | ||
200 | |||
201 | // m_log.DebugFormat( | ||
202 | // "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}", | ||
203 | // obj.Name, obj.OwnerID, landData.OwnerID); | ||
167 | 204 | ||
168 | ParcelCounts parcelCounts; | 205 | ParcelCounts parcelCounts; |
169 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
@@ -177,23 +214,28 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
177 | else | 214 | else |
178 | parcelCounts.Users[obj.OwnerID] = partCount; | 215 | parcelCounts.Users[obj.OwnerID] = partCount; |
179 | 216 | ||
180 | if (landData.IsGroupOwned) | 217 | if (obj.IsSelected) |
181 | { | 218 | { |
182 | if (obj.OwnerID == landData.GroupID) | 219 | parcelCounts.Selected += partCount; |
183 | parcelCounts.Owner += partCount; | ||
184 | else if (obj.GroupID == landData.GroupID) | ||
185 | parcelCounts.Group += partCount; | ||
186 | else | ||
187 | parcelCounts.Others += partCount; | ||
188 | } | 220 | } |
189 | else | 221 | else |
190 | { | 222 | { |
191 | if (obj.OwnerID == landData.OwnerID) | 223 | if (landData.IsGroupOwned) |
192 | parcelCounts.Owner += partCount; | 224 | { |
193 | else if (obj.GroupID == landData.GroupID) | 225 | if (obj.OwnerID == landData.GroupID) |
194 | parcelCounts.Group += partCount; | 226 | parcelCounts.Owner += partCount; |
227 | else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID) | ||
228 | parcelCounts.Group += partCount; | ||
229 | else | ||
230 | parcelCounts.Others += partCount; | ||
231 | } | ||
195 | else | 232 | else |
196 | parcelCounts.Others += partCount; | 233 | { |
234 | if (obj.OwnerID == landData.OwnerID) | ||
235 | parcelCounts.Owner += partCount; | ||
236 | else | ||
237 | parcelCounts.Others += partCount; | ||
238 | } | ||
197 | } | 239 | } |
198 | } | 240 | } |
199 | } | 241 | } |
@@ -201,10 +243,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
201 | // NOTE: Call under Taint Lock | 243 | // NOTE: Call under Taint Lock |
202 | private void RemoveObject(SceneObjectGroup obj) | 244 | private void RemoveObject(SceneObjectGroup obj) |
203 | { | 245 | { |
246 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID); | ||
247 | |||
248 | // Currently this is being done by tainting the count instead. | ||
204 | } | 249 | } |
205 | 250 | ||
206 | public IPrimCounts GetPrimCounts(UUID parcelID) | 251 | public IPrimCounts GetPrimCounts(UUID parcelID) |
207 | { | 252 | { |
253 | // m_log.DebugFormat( | ||
254 | // "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName); | ||
255 | |||
208 | PrimCounts primCounts; | 256 | PrimCounts primCounts; |
209 | 257 | ||
210 | lock (m_PrimCounts) | 258 | lock (m_PrimCounts) |
@@ -218,8 +266,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
218 | return primCounts; | 266 | return primCounts; |
219 | } | 267 | } |
220 | 268 | ||
269 | |||
270 | /// <summary> | ||
271 | /// Get the number of prims on the parcel that are owned by the parcel owner. | ||
272 | /// </summary> | ||
273 | /// <param name="parcelID"></param> | ||
274 | /// <returns></returns> | ||
221 | public int GetOwnerCount(UUID parcelID) | 275 | public int GetOwnerCount(UUID parcelID) |
222 | { | 276 | { |
277 | int count = 0; | ||
278 | |||
223 | lock (m_TaintLock) | 279 | lock (m_TaintLock) |
224 | { | 280 | { |
225 | if (m_Tainted) | 281 | if (m_Tainted) |
@@ -227,13 +283,25 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
227 | 283 | ||
228 | ParcelCounts counts; | 284 | ParcelCounts counts; |
229 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 285 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
230 | return counts.Owner; | 286 | count = counts.Owner; |
231 | } | 287 | } |
232 | return 0; | 288 | |
289 | // m_log.DebugFormat( | ||
290 | // "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}", | ||
291 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
292 | |||
293 | return count; | ||
233 | } | 294 | } |
234 | 295 | ||
296 | /// <summary> | ||
297 | /// Get the number of prims on the parcel that have been set to the group that owns the parcel. | ||
298 | /// </summary> | ||
299 | /// <param name="parcelID"></param> | ||
300 | /// <returns></returns> | ||
235 | public int GetGroupCount(UUID parcelID) | 301 | public int GetGroupCount(UUID parcelID) |
236 | { | 302 | { |
303 | int count = 0; | ||
304 | |||
237 | lock (m_TaintLock) | 305 | lock (m_TaintLock) |
238 | { | 306 | { |
239 | if (m_Tainted) | 307 | if (m_Tainted) |
@@ -241,13 +309,25 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
241 | 309 | ||
242 | ParcelCounts counts; | 310 | ParcelCounts counts; |
243 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 311 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
244 | return counts.Group; | 312 | count = counts.Group; |
245 | } | 313 | } |
246 | return 0; | 314 | |
315 | // m_log.DebugFormat( | ||
316 | // "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}", | ||
317 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
318 | |||
319 | return count; | ||
247 | } | 320 | } |
248 | 321 | ||
322 | /// <summary> | ||
323 | /// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group. | ||
324 | /// </summary> | ||
325 | /// <param name="parcelID"></param> | ||
326 | /// <returns></returns> | ||
249 | public int GetOthersCount(UUID parcelID) | 327 | public int GetOthersCount(UUID parcelID) |
250 | { | 328 | { |
329 | int count = 0; | ||
330 | |||
251 | lock (m_TaintLock) | 331 | lock (m_TaintLock) |
252 | { | 332 | { |
253 | if (m_Tainted) | 333 | if (m_Tainted) |
@@ -255,13 +335,83 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
255 | 335 | ||
256 | ParcelCounts counts; | 336 | ParcelCounts counts; |
257 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | 337 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) |
258 | return counts.Others; | 338 | count = counts.Others; |
259 | } | 339 | } |
260 | return 0; | 340 | |
341 | // m_log.DebugFormat( | ||
342 | // "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", | ||
343 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
344 | |||
345 | return count; | ||
261 | } | 346 | } |
347 | |||
348 | /// <summary> | ||
349 | /// Get the number of selected prims. | ||
350 | /// </summary> | ||
351 | /// <param name="parcelID"></param> | ||
352 | /// <returns></returns> | ||
353 | public int GetSelectedCount(UUID parcelID) | ||
354 | { | ||
355 | int count = 0; | ||
356 | |||
357 | lock (m_TaintLock) | ||
358 | { | ||
359 | if (m_Tainted) | ||
360 | Recount(); | ||
262 | 361 | ||
362 | ParcelCounts counts; | ||
363 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | ||
364 | count = counts.Selected; | ||
365 | } | ||
366 | |||
367 | // m_log.DebugFormat( | ||
368 | // "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}", | ||
369 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
370 | |||
371 | return count; | ||
372 | } | ||
373 | |||
374 | /// <summary> | ||
375 | /// Get the total count of owner, group and others prims on the parcel. | ||
376 | /// FIXME: Need to do selected prims once this is reimplemented. | ||
377 | /// </summary> | ||
378 | /// <param name="parcelID"></param> | ||
379 | /// <returns></returns> | ||
380 | public int GetTotalCount(UUID parcelID) | ||
381 | { | ||
382 | int count = 0; | ||
383 | |||
384 | lock (m_TaintLock) | ||
385 | { | ||
386 | if (m_Tainted) | ||
387 | Recount(); | ||
388 | |||
389 | ParcelCounts counts; | ||
390 | if (m_ParcelCounts.TryGetValue(parcelID, out counts)) | ||
391 | { | ||
392 | count = counts.Owner; | ||
393 | count += counts.Group; | ||
394 | count += counts.Others; | ||
395 | count += counts.Selected; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | // m_log.DebugFormat( | ||
400 | // "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}", | ||
401 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
402 | |||
403 | return count; | ||
404 | } | ||
405 | |||
406 | /// <summary> | ||
407 | /// Get the number of prims that are in the entire simulator for the owner of this parcel. | ||
408 | /// </summary> | ||
409 | /// <param name="parcelID"></param> | ||
410 | /// <returns></returns> | ||
263 | public int GetSimulatorCount(UUID parcelID) | 411 | public int GetSimulatorCount(UUID parcelID) |
264 | { | 412 | { |
413 | int count = 0; | ||
414 | |||
265 | lock (m_TaintLock) | 415 | lock (m_TaintLock) |
266 | { | 416 | { |
267 | if (m_Tainted) | 417 | if (m_Tainted) |
@@ -272,14 +422,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
272 | { | 422 | { |
273 | int val; | 423 | int val; |
274 | if (m_SimwideCounts.TryGetValue(owner, out val)) | 424 | if (m_SimwideCounts.TryGetValue(owner, out val)) |
275 | return val; | 425 | count = val; |
276 | } | 426 | } |
277 | } | 427 | } |
278 | return 0; | 428 | |
429 | // m_log.DebugFormat( | ||
430 | // "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}", | ||
431 | // parcelID, m_Scene.RegionInfo.RegionName, count); | ||
432 | |||
433 | return count; | ||
279 | } | 434 | } |
280 | 435 | ||
436 | /// <summary> | ||
437 | /// Get the number of prims that a particular user owns on this parcel. | ||
438 | /// </summary> | ||
439 | /// <param name="parcelID"></param> | ||
440 | /// <param name="userID"></param> | ||
441 | /// <returns></returns> | ||
281 | public int GetUserCount(UUID parcelID, UUID userID) | 442 | public int GetUserCount(UUID parcelID, UUID userID) |
282 | { | 443 | { |
444 | int count = 0; | ||
445 | |||
283 | lock (m_TaintLock) | 446 | lock (m_TaintLock) |
284 | { | 447 | { |
285 | if (m_Tainted) | 448 | if (m_Tainted) |
@@ -290,27 +453,37 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
290 | { | 453 | { |
291 | int val; | 454 | int val; |
292 | if (counts.Users.TryGetValue(userID, out val)) | 455 | if (counts.Users.TryGetValue(userID, out val)) |
293 | return val; | 456 | count = val; |
294 | } | 457 | } |
295 | } | 458 | } |
296 | return 0; | 459 | |
460 | // m_log.DebugFormat( | ||
461 | // "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}", | ||
462 | // userID, parcelID, m_Scene.RegionInfo.RegionName, count); | ||
463 | |||
464 | return count; | ||
297 | } | 465 | } |
298 | 466 | ||
299 | // NOTE: This method MUST be called while holding the taint lock! | 467 | // NOTE: This method MUST be called while holding the taint lock! |
300 | private void Recount() | 468 | private void Recount() |
301 | { | 469 | { |
470 | // m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName); | ||
471 | |||
302 | m_OwnerMap.Clear(); | 472 | m_OwnerMap.Clear(); |
303 | m_SimwideCounts.Clear(); | 473 | m_SimwideCounts.Clear(); |
304 | m_ParcelCounts.Clear(); | 474 | m_ParcelCounts.Clear(); |
305 | 475 | ||
306 | List<ILandObject> land = m_Scene.LandChannel.AllParcels(); | 476 | List<ILandObject> land = m_Scene.LandChannel.AllParcels(); |
307 | 477 | ||
308 | foreach (ILandObject l in land) | 478 | foreach (ILandObject l in land) |
309 | { | 479 | { |
310 | LandData landData = l.LandData; | 480 | LandData landData = l.LandData; |
311 | 481 | ||
312 | m_OwnerMap[landData.GlobalID] = landData.OwnerID; | 482 | m_OwnerMap[landData.GlobalID] = landData.OwnerID; |
313 | m_SimwideCounts[landData.OwnerID] = 0; | 483 | m_SimwideCounts[landData.OwnerID] = 0; |
484 | // m_log.DebugFormat( | ||
485 | // "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}", | ||
486 | // landData.Name, m_Scene.RegionInfo.RegionName); | ||
314 | m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); | 487 | m_ParcelCounts[landData.GlobalID] = new ParcelCounts(); |
315 | } | 488 | } |
316 | 489 | ||
@@ -322,6 +495,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
322 | if (!m_OwnerMap.ContainsKey(k)) | 495 | if (!m_OwnerMap.ContainsKey(k)) |
323 | m_PrimCounts.Remove(k); | 496 | m_PrimCounts.Remove(k); |
324 | } | 497 | } |
498 | |||
325 | m_Tainted = false; | 499 | m_Tainted = false; |
326 | } | 500 | } |
327 | } | 501 | } |
@@ -363,6 +537,22 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
363 | return m_Parent.GetOthersCount(m_ParcelID); | 537 | return m_Parent.GetOthersCount(m_ParcelID); |
364 | } | 538 | } |
365 | } | 539 | } |
540 | |||
541 | public int Selected | ||
542 | { | ||
543 | get | ||
544 | { | ||
545 | return m_Parent.GetSelectedCount(m_ParcelID); | ||
546 | } | ||
547 | } | ||
548 | |||
549 | public int Total | ||
550 | { | ||
551 | get | ||
552 | { | ||
553 | return m_Parent.GetTotalCount(m_ParcelID); | ||
554 | } | ||
555 | } | ||
366 | 556 | ||
367 | public int Simulator | 557 | public int Simulator |
368 | { | 558 | { |
@@ -403,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
403 | } | 593 | } |
404 | } | 594 | } |
405 | } | 595 | } |
406 | } | 596 | } \ No newline at end of file |
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs new file mode 100644 index 0000000..67b00ac --- /dev/null +++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | |||
@@ -0,0 +1,382 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
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 | ||
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 | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Reflection; | ||
31 | using log4net.Config; | ||
32 | using NUnit.Framework; | ||
33 | using OpenMetaverse; | ||
34 | using OpenMetaverse.Assets; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Tests.Common; | ||
39 | using OpenSim.Tests.Common.Mock; | ||
40 | using OpenSim.Tests.Common.Setup; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.World.Land.Tests | ||
43 | { | ||
44 | [TestFixture] | ||
45 | public class PrimCountModuleTests | ||
46 | { | ||
47 | protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); | ||
48 | protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000"); | ||
49 | protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999"); | ||
50 | protected TestScene m_scene; | ||
51 | protected PrimCountModule m_pcm; | ||
52 | |||
53 | /// <summary> | ||
54 | /// A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side. | ||
55 | /// </summary> | ||
56 | protected ILandObject m_lo; | ||
57 | |||
58 | /// <summary> | ||
59 | /// A parcel that covers just the eastern strip of the sim. | ||
60 | /// </summary> | ||
61 | protected ILandObject m_lo2; | ||
62 | |||
63 | [SetUp] | ||
64 | public void SetUp() | ||
65 | { | ||
66 | m_pcm = new PrimCountModule(); | ||
67 | LandManagementModule lmm = new LandManagementModule(); | ||
68 | m_scene = SceneSetupHelpers.SetupScene(); | ||
69 | SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm); | ||
70 | |||
71 | int xParcelDivider = (int)Constants.RegionSize - 1; | ||
72 | |||
73 | ILandObject lo = new LandObject(m_userId, false, m_scene); | ||
74 | lo.LandData.Name = "m_lo"; | ||
75 | lo.SetLandBitmap( | ||
76 | lo.GetSquareLandBitmap(0, 0, xParcelDivider, (int)Constants.RegionSize)); | ||
77 | m_lo = lmm.AddLandObject(lo); | ||
78 | |||
79 | ILandObject lo2 = new LandObject(m_userId, false, m_scene); | ||
80 | lo2.SetLandBitmap( | ||
81 | lo2.GetSquareLandBitmap(xParcelDivider, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | ||
82 | lo2.LandData.Name = "m_lo2"; | ||
83 | m_lo2 = lmm.AddLandObject(lo2); | ||
84 | } | ||
85 | |||
86 | /// <summary> | ||
87 | /// Test that counts before we do anything are correct. | ||
88 | /// </summary> | ||
89 | [Test] | ||
90 | public void TestInitialCounts() | ||
91 | { | ||
92 | IPrimCounts pc = m_lo.PrimCounts; | ||
93 | |||
94 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
95 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
96 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
97 | Assert.That(pc.Total, Is.EqualTo(0)); | ||
98 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
99 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
100 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
101 | Assert.That(pc.Simulator, Is.EqualTo(0)); | ||
102 | } | ||
103 | |||
104 | /// <summary> | ||
105 | /// Test count after a parcel owner owned object is added. | ||
106 | /// </summary> | ||
107 | [Test] | ||
108 | public void TestAddOwnerObject() | ||
109 | { | ||
110 | TestHelper.InMethod(); | ||
111 | // log4net.Config.XmlConfigurator.Configure(); | ||
112 | |||
113 | IPrimCounts pc = m_lo.PrimCounts; | ||
114 | |||
115 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
116 | m_scene.AddNewSceneObject(sog, false); | ||
117 | |||
118 | Assert.That(pc.Owner, Is.EqualTo(3)); | ||
119 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
120 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
121 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
122 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
123 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | ||
124 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
125 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
126 | |||
127 | // Add a second object and retest | ||
128 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); | ||
129 | m_scene.AddNewSceneObject(sog2, false); | ||
130 | |||
131 | Assert.That(pc.Owner, Is.EqualTo(5)); | ||
132 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
133 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
134 | Assert.That(pc.Total, Is.EqualTo(5)); | ||
135 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
136 | Assert.That(pc.Users[m_userId], Is.EqualTo(5)); | ||
137 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
138 | Assert.That(pc.Simulator, Is.EqualTo(5)); | ||
139 | } | ||
140 | |||
141 | /// <summary> | ||
142 | /// Test count after a parcel owner owned copied object is added. | ||
143 | /// </summary> | ||
144 | [Test] | ||
145 | public void TestCopyOwnerObject() | ||
146 | { | ||
147 | TestHelper.InMethod(); | ||
148 | // log4net.Config.XmlConfigurator.Configure(); | ||
149 | |||
150 | IPrimCounts pc = m_lo.PrimCounts; | ||
151 | |||
152 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
153 | m_scene.AddNewSceneObject(sog, false); | ||
154 | m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity); | ||
155 | |||
156 | Assert.That(pc.Owner, Is.EqualTo(6)); | ||
157 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
158 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
159 | Assert.That(pc.Total, Is.EqualTo(6)); | ||
160 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
161 | Assert.That(pc.Users[m_userId], Is.EqualTo(6)); | ||
162 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
163 | Assert.That(pc.Simulator, Is.EqualTo(6)); | ||
164 | } | ||
165 | |||
166 | /// <summary> | ||
167 | /// Test that parcel counts update correctly when an object is moved between parcels, where that movement | ||
168 | /// is not done directly by the user/ | ||
169 | /// </summary> | ||
170 | [Test] | ||
171 | public void TestMoveOwnerObject() | ||
172 | { | ||
173 | TestHelper.InMethod(); | ||
174 | // log4net.Config.XmlConfigurator.Configure(); | ||
175 | |||
176 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
177 | m_scene.AddNewSceneObject(sog, false); | ||
178 | SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10); | ||
179 | m_scene.AddNewSceneObject(sog2, false); | ||
180 | |||
181 | // Move the first scene object to the eastern strip parcel | ||
182 | sog.AbsolutePosition = new Vector3(254, 2, 2); | ||
183 | |||
184 | IPrimCounts pclo1 = m_lo.PrimCounts; | ||
185 | |||
186 | Assert.That(pclo1.Owner, Is.EqualTo(2)); | ||
187 | Assert.That(pclo1.Group, Is.EqualTo(0)); | ||
188 | Assert.That(pclo1.Others, Is.EqualTo(0)); | ||
189 | Assert.That(pclo1.Total, Is.EqualTo(2)); | ||
190 | Assert.That(pclo1.Selected, Is.EqualTo(0)); | ||
191 | Assert.That(pclo1.Users[m_userId], Is.EqualTo(2)); | ||
192 | Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); | ||
193 | Assert.That(pclo1.Simulator, Is.EqualTo(5)); | ||
194 | |||
195 | IPrimCounts pclo2 = m_lo2.PrimCounts; | ||
196 | |||
197 | Assert.That(pclo2.Owner, Is.EqualTo(3)); | ||
198 | Assert.That(pclo2.Group, Is.EqualTo(0)); | ||
199 | Assert.That(pclo2.Others, Is.EqualTo(0)); | ||
200 | Assert.That(pclo2.Total, Is.EqualTo(3)); | ||
201 | Assert.That(pclo2.Selected, Is.EqualTo(0)); | ||
202 | Assert.That(pclo2.Users[m_userId], Is.EqualTo(3)); | ||
203 | Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); | ||
204 | Assert.That(pclo2.Simulator, Is.EqualTo(5)); | ||
205 | |||
206 | // Now move it back again | ||
207 | sog.AbsolutePosition = new Vector3(2, 2, 2); | ||
208 | |||
209 | Assert.That(pclo1.Owner, Is.EqualTo(5)); | ||
210 | Assert.That(pclo1.Group, Is.EqualTo(0)); | ||
211 | Assert.That(pclo1.Others, Is.EqualTo(0)); | ||
212 | Assert.That(pclo1.Total, Is.EqualTo(5)); | ||
213 | Assert.That(pclo1.Selected, Is.EqualTo(0)); | ||
214 | Assert.That(pclo1.Users[m_userId], Is.EqualTo(5)); | ||
215 | Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0)); | ||
216 | Assert.That(pclo1.Simulator, Is.EqualTo(5)); | ||
217 | |||
218 | Assert.That(pclo2.Owner, Is.EqualTo(0)); | ||
219 | Assert.That(pclo2.Group, Is.EqualTo(0)); | ||
220 | Assert.That(pclo2.Others, Is.EqualTo(0)); | ||
221 | Assert.That(pclo2.Total, Is.EqualTo(0)); | ||
222 | Assert.That(pclo2.Selected, Is.EqualTo(0)); | ||
223 | Assert.That(pclo2.Users[m_userId], Is.EqualTo(0)); | ||
224 | Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0)); | ||
225 | Assert.That(pclo2.Simulator, Is.EqualTo(5)); | ||
226 | } | ||
227 | |||
228 | /// <summary> | ||
229 | /// Test count after a parcel owner owned object is removed. | ||
230 | /// </summary> | ||
231 | [Test] | ||
232 | public void TestRemoveOwnerObject() | ||
233 | { | ||
234 | TestHelper.InMethod(); | ||
235 | // log4net.Config.XmlConfigurator.Configure(); | ||
236 | |||
237 | IPrimCounts pc = m_lo.PrimCounts; | ||
238 | |||
239 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false); | ||
240 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); | ||
241 | m_scene.AddNewSceneObject(sogToDelete, false); | ||
242 | m_scene.DeleteSceneObject(sogToDelete, false); | ||
243 | |||
244 | Assert.That(pc.Owner, Is.EqualTo(1)); | ||
245 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
246 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
247 | Assert.That(pc.Total, Is.EqualTo(1)); | ||
248 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
249 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); | ||
250 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
251 | Assert.That(pc.Simulator, Is.EqualTo(1)); | ||
252 | } | ||
253 | |||
254 | [Test] | ||
255 | public void TestAddGroupObject() | ||
256 | { | ||
257 | TestHelper.InMethod(); | ||
258 | // log4net.Config.XmlConfigurator.Configure(); | ||
259 | |||
260 | m_lo.DeedToGroup(m_groupId); | ||
261 | |||
262 | IPrimCounts pc = m_lo.PrimCounts; | ||
263 | |||
264 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); | ||
265 | sog.GroupID = m_groupId; | ||
266 | m_scene.AddNewSceneObject(sog, false); | ||
267 | |||
268 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
269 | Assert.That(pc.Group, Is.EqualTo(3)); | ||
270 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
271 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
272 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
273 | |||
274 | // Is this desired behaviour? Not totally sure. | ||
275 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
276 | Assert.That(pc.Users[m_groupId], Is.EqualTo(0)); | ||
277 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3)); | ||
278 | |||
279 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
280 | } | ||
281 | |||
282 | /// <summary> | ||
283 | /// Test count after a parcel owner owned object is removed. | ||
284 | /// </summary> | ||
285 | [Test] | ||
286 | public void TestRemoveGroupObject() | ||
287 | { | ||
288 | TestHelper.InMethod(); | ||
289 | // log4net.Config.XmlConfigurator.Configure(); | ||
290 | |||
291 | m_lo.DeedToGroup(m_groupId); | ||
292 | |||
293 | IPrimCounts pc = m_lo.PrimCounts; | ||
294 | |||
295 | SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1); | ||
296 | sogToKeep.GroupID = m_groupId; | ||
297 | m_scene.AddNewSceneObject(sogToKeep, false); | ||
298 | |||
299 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10); | ||
300 | m_scene.AddNewSceneObject(sogToDelete, false); | ||
301 | m_scene.DeleteSceneObject(sogToDelete, false); | ||
302 | |||
303 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
304 | Assert.That(pc.Group, Is.EqualTo(1)); | ||
305 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
306 | Assert.That(pc.Total, Is.EqualTo(1)); | ||
307 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
308 | Assert.That(pc.Users[m_userId], Is.EqualTo(1)); | ||
309 | Assert.That(pc.Users[m_groupId], Is.EqualTo(0)); | ||
310 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
311 | Assert.That(pc.Simulator, Is.EqualTo(1)); | ||
312 | } | ||
313 | |||
314 | [Test] | ||
315 | public void TestAddOthersObject() | ||
316 | { | ||
317 | TestHelper.InMethod(); | ||
318 | // log4net.Config.XmlConfigurator.Configure(); | ||
319 | |||
320 | IPrimCounts pc = m_lo.PrimCounts; | ||
321 | |||
322 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01); | ||
323 | m_scene.AddNewSceneObject(sog, false); | ||
324 | |||
325 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
326 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
327 | Assert.That(pc.Others, Is.EqualTo(3)); | ||
328 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
329 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
330 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
331 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3)); | ||
332 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
333 | } | ||
334 | |||
335 | [Test] | ||
336 | public void TestRemoveOthersObject() | ||
337 | { | ||
338 | TestHelper.InMethod(); | ||
339 | // log4net.Config.XmlConfigurator.Configure(); | ||
340 | |||
341 | IPrimCounts pc = m_lo.PrimCounts; | ||
342 | |||
343 | m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false); | ||
344 | SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10); | ||
345 | m_scene.AddNewSceneObject(sogToDelete, false); | ||
346 | m_scene.DeleteSceneObject(sogToDelete, false); | ||
347 | |||
348 | Assert.That(pc.Owner, Is.EqualTo(0)); | ||
349 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
350 | Assert.That(pc.Others, Is.EqualTo(1)); | ||
351 | Assert.That(pc.Total, Is.EqualTo(1)); | ||
352 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
353 | Assert.That(pc.Users[m_userId], Is.EqualTo(0)); | ||
354 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(1)); | ||
355 | Assert.That(pc.Simulator, Is.EqualTo(1)); | ||
356 | } | ||
357 | |||
358 | /// <summary> | ||
359 | /// Test the count is correct after is has been tainted. | ||
360 | /// </summary> | ||
361 | [Test] | ||
362 | public void TestTaint() | ||
363 | { | ||
364 | TestHelper.InMethod(); | ||
365 | IPrimCounts pc = m_lo.PrimCounts; | ||
366 | |||
367 | SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01); | ||
368 | m_scene.AddNewSceneObject(sog, false); | ||
369 | |||
370 | m_pcm.TaintPrimCount(); | ||
371 | |||
372 | Assert.That(pc.Owner, Is.EqualTo(3)); | ||
373 | Assert.That(pc.Group, Is.EqualTo(0)); | ||
374 | Assert.That(pc.Others, Is.EqualTo(0)); | ||
375 | Assert.That(pc.Total, Is.EqualTo(3)); | ||
376 | Assert.That(pc.Selected, Is.EqualTo(0)); | ||
377 | Assert.That(pc.Users[m_userId], Is.EqualTo(3)); | ||
378 | Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0)); | ||
379 | Assert.That(pc.Simulator, Is.EqualTo(3)); | ||
380 | } | ||
381 | } | ||
382 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index cea7c78..4e14c73 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs | |||
@@ -469,8 +469,8 @@ namespace OpenSim.Region.CoreModules | |||
469 | m_SunFixedHour = FixedSunHour; | 469 | m_SunFixedHour = FixedSunHour; |
470 | m_SunFixed = FixedSun; | 470 | m_SunFixed = FixedSun; |
471 | 471 | ||
472 | m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); | 472 | // m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString()); |
473 | m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); | 473 | // m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString()); |
474 | 474 | ||
475 | receivedEstateToolsSunUpdate = true; | 475 | receivedEstateToolsSunUpdate = true; |
476 | 476 | ||
@@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules | |||
480 | // When sun settings are updated, we should update all clients with new settings. | 480 | // When sun settings are updated, we should update all clients with new settings. |
481 | SunUpdateToAllClients(); | 481 | SunUpdateToAllClients(); |
482 | 482 | ||
483 | m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); | 483 | // m_log.DebugFormat("[SUN]: PosTime : {0}", PosTime.ToString()); |
484 | } | 484 | } |
485 | } | 485 | } |
486 | 486 | ||
diff --git a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs index 6676ec8..d6fa093 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -62,9 +62,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders | |||
62 | return LoadBitmap(new Bitmap(filename)); | 62 | return LoadBitmap(new Bitmap(filename)); |
63 | } | 63 | } |
64 | 64 | ||
65 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) | 65 | public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h) |
66 | { | 66 | { |
67 | throw new NotImplementedException(); | 67 | Bitmap bitmap = new Bitmap(filename); |
68 | ITerrainChannel retval = new TerrainChannel(true); | ||
69 | |||
70 | for (int x = 0; x < retval.Width; x++) | ||
71 | { | ||
72 | for (int y = 0; y < retval.Height; y++) | ||
73 | { | ||
74 | retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | return retval; | ||
68 | } | 79 | } |
69 | 80 | ||
70 | public virtual ITerrainChannel LoadStream(Stream stream) | 81 | public virtual ITerrainChannel LoadStream(Stream stream) |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 7bb7544..f9ef286 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -100,8 +100,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
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(m_scene.RegionInfo.ScopeID, mapName); | 102 | GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); |
103 | if (info != null) regionInfos.Add(info); | 103 | if (info != null) |
104 | regionInfos.Add(info); | ||
104 | } | 105 | } |
106 | else if (regionInfos.Count == 0 && mapName.StartsWith("http://")) | ||
107 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | ||
108 | |||
105 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); | 109 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
106 | List<MapBlockData> blocks = new List<MapBlockData>(); | 110 | List<MapBlockData> blocks = new List<MapBlockData>(); |
107 | 111 | ||