diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
38 files changed, 1543 insertions, 418 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs index ec4dfd0..4cedfe6 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | ||
31 | using log4net; | 32 | using log4net; |
32 | using OpenMetaverse; | 33 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -38,6 +39,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
38 | { | 39 | { |
39 | public class AssetXferUploader | 40 | public class AssetXferUploader |
40 | { | 41 | { |
42 | // Viewer's notion of the default texture | ||
43 | private List<UUID> defaultIDs = new List<UUID> { | ||
44 | new UUID("5748decc-f629-461c-9a36-a35a221fe21f"), | ||
45 | new UUID("7ca39b4c-bd19-4699-aff7-f93fd03d3e7b"), | ||
46 | new UUID("6522e74d-1660-4e7f-b601-6f48c1659a77"), | ||
47 | new UUID("c228d1cf-4b5d-4ba8-84f4-899a0796aa97") | ||
48 | }; | ||
41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 50 | ||
43 | /// <summary> | 51 | /// <summary> |
@@ -65,6 +73,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
65 | private UUID TransactionID = UUID.Zero; | 73 | private UUID TransactionID = UUID.Zero; |
66 | private sbyte type = 0; | 74 | private sbyte type = 0; |
67 | private byte wearableType = 0; | 75 | private byte wearableType = 0; |
76 | private byte[] m_oldData = null; | ||
68 | public ulong XferID; | 77 | public ulong XferID; |
69 | private Scene m_Scene; | 78 | private Scene m_Scene; |
70 | 79 | ||
@@ -302,6 +311,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
302 | 311 | ||
303 | private void DoCreateItem(uint callbackID) | 312 | private void DoCreateItem(uint callbackID) |
304 | { | 313 | { |
314 | ValidateAssets(); | ||
305 | m_Scene.AssetService.Store(m_asset); | 315 | m_Scene.AssetService.Store(m_asset); |
306 | 316 | ||
307 | InventoryItemBase item = new InventoryItemBase(); | 317 | InventoryItemBase item = new InventoryItemBase(); |
@@ -322,12 +332,84 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
322 | item.Flags = (uint) wearableType; | 332 | item.Flags = (uint) wearableType; |
323 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 333 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
324 | 334 | ||
335 | m_log.DebugFormat("[XFER]: Created item {0} with asset {1}", | ||
336 | item.ID, item.AssetID); | ||
337 | |||
325 | if (m_Scene.AddInventoryItem(item)) | 338 | if (m_Scene.AddInventoryItem(item)) |
326 | ourClient.SendInventoryItemCreateUpdate(item, callbackID); | 339 | ourClient.SendInventoryItemCreateUpdate(item, callbackID); |
327 | else | 340 | else |
328 | ourClient.SendAlertMessage("Unable to create inventory item"); | 341 | ourClient.SendAlertMessage("Unable to create inventory item"); |
329 | } | 342 | } |
330 | 343 | ||
344 | private void ValidateAssets() | ||
345 | { | ||
346 | if (m_asset.Type == (sbyte)AssetType.Clothing || | ||
347 | m_asset.Type == (sbyte)AssetType.Bodypart) | ||
348 | { | ||
349 | string content = System.Text.Encoding.ASCII.GetString(m_asset.Data); | ||
350 | string[] lines = content.Split(new char[] {'\n'}); | ||
351 | |||
352 | List<string> validated = new List<string>(); | ||
353 | |||
354 | Dictionary<int, UUID> allowed = ExtractTexturesFromOldData(); | ||
355 | |||
356 | int textures = 0; | ||
357 | |||
358 | foreach (string line in lines) | ||
359 | { | ||
360 | try | ||
361 | { | ||
362 | if (line.StartsWith("textures ")) | ||
363 | { | ||
364 | textures = Convert.ToInt32(line.Substring(9)); | ||
365 | validated.Add(line); | ||
366 | } | ||
367 | else if (textures > 0) | ||
368 | { | ||
369 | string[] parts = line.Split(new char[] {' '}); | ||
370 | |||
371 | UUID tx = new UUID(parts[1]); | ||
372 | int id = Convert.ToInt32(parts[0]); | ||
373 | |||
374 | if (defaultIDs.Contains(tx) || tx == UUID.Zero || | ||
375 | (allowed.ContainsKey(id) && allowed[id] == tx)) | ||
376 | { | ||
377 | validated.Add(parts[0] + " " + tx.ToString()); | ||
378 | } | ||
379 | else | ||
380 | { | ||
381 | int perms = m_Scene.InventoryService.GetAssetPermissions(ourClient.AgentId, tx); | ||
382 | int full = (int)(PermissionMask.Modify | PermissionMask.Transfer | PermissionMask.Copy); | ||
383 | |||
384 | if ((perms & full) != full) | ||
385 | { | ||
386 | m_log.ErrorFormat("[ASSET UPLOADER]: REJECTED update with texture {0} from {1} because they do not own the texture", tx, ourClient.AgentId); | ||
387 | validated.Add(parts[0] + " " + UUID.Zero.ToString()); | ||
388 | } | ||
389 | else | ||
390 | { | ||
391 | validated.Add(line); | ||
392 | } | ||
393 | } | ||
394 | textures--; | ||
395 | } | ||
396 | else | ||
397 | { | ||
398 | validated.Add(line); | ||
399 | } | ||
400 | } | ||
401 | catch | ||
402 | { | ||
403 | // If it's malformed, skip it | ||
404 | } | ||
405 | } | ||
406 | |||
407 | string final = String.Join("\n", validated.ToArray()); | ||
408 | |||
409 | m_asset.Data = System.Text.Encoding.ASCII.GetBytes(final); | ||
410 | } | ||
411 | } | ||
412 | |||
331 | /// <summary> | 413 | /// <summary> |
332 | /// Get the asset data uploaded in this transfer. | 414 | /// Get the asset data uploaded in this transfer. |
333 | /// </summary> | 415 | /// </summary> |
@@ -336,10 +418,55 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
336 | { | 418 | { |
337 | if (m_finished) | 419 | if (m_finished) |
338 | { | 420 | { |
421 | ValidateAssets(); | ||
339 | return m_asset; | 422 | return m_asset; |
340 | } | 423 | } |
341 | 424 | ||
342 | return null; | 425 | return null; |
343 | } | 426 | } |
427 | |||
428 | public void SetOldData(byte[] d) | ||
429 | { | ||
430 | m_oldData = d; | ||
431 | } | ||
432 | |||
433 | private Dictionary<int,UUID> ExtractTexturesFromOldData() | ||
434 | { | ||
435 | Dictionary<int,UUID> result = new Dictionary<int,UUID>(); | ||
436 | if (m_oldData == null) | ||
437 | return result; | ||
438 | |||
439 | string content = System.Text.Encoding.ASCII.GetString(m_oldData); | ||
440 | string[] lines = content.Split(new char[] {'\n'}); | ||
441 | |||
442 | int textures = 0; | ||
443 | |||
444 | foreach (string line in lines) | ||
445 | { | ||
446 | try | ||
447 | { | ||
448 | if (line.StartsWith("textures ")) | ||
449 | { | ||
450 | textures = Convert.ToInt32(line.Substring(9)); | ||
451 | } | ||
452 | else if (textures > 0) | ||
453 | { | ||
454 | string[] parts = line.Split(new char[] {' '}); | ||
455 | |||
456 | UUID tx = new UUID(parts[1]); | ||
457 | int id = Convert.ToInt32(parts[0]); | ||
458 | result[id] = tx; | ||
459 | textures--; | ||
460 | } | ||
461 | } | ||
462 | catch | ||
463 | { | ||
464 | // If it's malformed, skip it | ||
465 | } | ||
466 | } | ||
467 | |||
468 | return result; | ||
469 | } | ||
344 | } | 470 | } |
345 | } | 471 | } |
472 | |||
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 22c301b..8e2dba4 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -257,53 +257,66 @@ namespace Flotsam.RegionModules.AssetCache | |||
257 | 257 | ||
258 | private void UpdateFileCache(string key, AssetBase asset) | 258 | private void UpdateFileCache(string key, AssetBase asset) |
259 | { | 259 | { |
260 | string filename = GetFileName(asset.ID); | 260 | // TODO: Spawn this off to some seperate thread to do the actual writing |
261 | 261 | if (asset != null) | |
262 | try | ||
263 | { | 262 | { |
264 | // If the file is already cached, don't cache it, just touch it so access time is updated | 263 | string filename = GetFileName(key); |
265 | if (File.Exists(filename)) | 264 | |
266 | { | 265 | try |
267 | File.SetLastAccessTime(filename, DateTime.Now); | ||
268 | } | ||
269 | else | ||
270 | { | 266 | { |
271 | // Once we start writing, make sure we flag that we're writing | 267 | // If the file is already cached, don't cache it, just touch it so access time is updated |
272 | // that object to the cache so that we don't try to write the | 268 | if (File.Exists(filename)) |
273 | // same file multiple times. | ||
274 | lock (m_CurrentlyWriting) | ||
275 | { | 269 | { |
276 | #if WAIT_ON_INPROGRESS_REQUESTS | 270 | // We don't really want to know about sharing |
277 | if (m_CurrentlyWriting.ContainsKey(filename)) | 271 | // violations here. If the file is locked, then |
272 | // the other thread has updated the time for us. | ||
273 | try | ||
278 | { | 274 | { |
279 | return; | 275 | File.SetLastAccessTime(filename, DateTime.Now); |
280 | } | 276 | } |
281 | else | 277 | catch |
282 | { | ||
283 | m_CurrentlyWriting.Add(filename, new ManualResetEvent(false)); | ||
284 | } | ||
285 | |||
286 | #else | ||
287 | if (m_CurrentlyWriting.Contains(filename)) | ||
288 | { | 278 | { |
289 | return; | ||
290 | } | 279 | } |
291 | else | 280 | } else { |
281 | |||
282 | // Once we start writing, make sure we flag that we're writing | ||
283 | // that object to the cache so that we don't try to write the | ||
284 | // same file multiple times. | ||
285 | lock (m_CurrentlyWriting) | ||
292 | { | 286 | { |
293 | m_CurrentlyWriting.Add(filename); | 287 | #if WAIT_ON_INPROGRESS_REQUESTS |
294 | } | 288 | if (m_CurrentlyWriting.ContainsKey(filename)) |
289 | { | ||
290 | return; | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | m_CurrentlyWriting.Add(filename, new ManualResetEvent(false)); | ||
295 | } | ||
296 | |||
297 | #else | ||
298 | if (m_CurrentlyWriting.Contains(filename)) | ||
299 | { | ||
300 | return; | ||
301 | } | ||
302 | else | ||
303 | { | ||
304 | m_CurrentlyWriting.Add(filename); | ||
305 | } | ||
295 | #endif | 306 | #endif |
296 | } | ||
297 | 307 | ||
298 | Util.FireAndForget( | 308 | } |
299 | delegate { WriteFileCache(filename, asset); }); | 309 | |
310 | Util.FireAndForget( | ||
311 | delegate { WriteFileCache(filename, asset); }); | ||
312 | } | ||
313 | } | ||
314 | catch (Exception e) | ||
315 | { | ||
316 | m_log.ErrorFormat( | ||
317 | "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}", | ||
318 | asset.ID, e.Message, e.StackTrace); | ||
300 | } | 319 | } |
301 | } | ||
302 | catch (Exception e) | ||
303 | { | ||
304 | m_log.ErrorFormat( | ||
305 | "[FLOTSAM ASSET CACHE]: Failed to update cache for asset {0}. Exception {1} {2}", | ||
306 | asset.ID, e.Message, e.StackTrace); | ||
307 | } | 320 | } |
308 | } | 321 | } |
309 | 322 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index de99b94..f8681e7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Xml; | ||
31 | using log4net; | 32 | using log4net; |
32 | using Mono.Addins; | 33 | using Mono.Addins; |
33 | using Nini.Config; | 34 | using Nini.Config; |
@@ -135,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
135 | // If we're an NPC then skip all the item checks and manipulations since we don't have an | 136 | // If we're an NPC then skip all the item checks and manipulations since we don't have an |
136 | // inventory right now. | 137 | // inventory right now. |
137 | if (sp.PresenceType == PresenceType.Npc) | 138 | if (sp.PresenceType == PresenceType.Npc) |
138 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p); | 139 | RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null); |
139 | else | 140 | else |
140 | RezSingleAttachmentFromInventory(sp, attach.ItemID, p); | 141 | RezSingleAttachmentFromInventory(sp, attach.ItemID, p); |
141 | } | 142 | } |
@@ -265,6 +266,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
265 | } | 266 | } |
266 | 267 | ||
267 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) | 268 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt) |
269 | { | ||
270 | return RezSingleAttachmentFromInventory(sp, itemID, AttachmentPt, true, null); | ||
271 | } | ||
272 | |||
273 | public ISceneEntity RezSingleAttachmentFromInventory(IScenePresence sp, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) | ||
268 | { | 274 | { |
269 | if (!Enabled) | 275 | if (!Enabled) |
270 | return null; | 276 | return null; |
@@ -303,7 +309,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
303 | return null; | 309 | return null; |
304 | } | 310 | } |
305 | 311 | ||
306 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt); | 312 | SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc); |
307 | 313 | ||
308 | if (att == null) | 314 | if (att == null) |
309 | DetachSingleAttachmentToInv(sp, itemID); | 315 | DetachSingleAttachmentToInv(sp, itemID); |
@@ -542,15 +548,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
542 | 548 | ||
543 | if (!silent) | 549 | if (!silent) |
544 | { | 550 | { |
545 | // Killing it here will cause the client to deselect it | ||
546 | // It then reappears on the avatar, deselected | ||
547 | // through the full update below | ||
548 | // | ||
549 | if (so.IsSelected) | ||
550 | { | ||
551 | m_scene.SendKillObject(so.RootPart.LocalId); | ||
552 | } | ||
553 | |||
554 | so.IsSelected = false; // fudge.... | 551 | so.IsSelected = false; // fudge.... |
555 | so.ScheduleGroupForFullUpdate(); | 552 | so.ScheduleGroupForFullUpdate(); |
556 | } | 553 | } |
@@ -574,11 +571,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
574 | 571 | ||
575 | Vector3 inventoryStoredPosition = new Vector3 | 572 | Vector3 inventoryStoredPosition = new Vector3 |
576 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) | 573 | (((grp.AbsolutePosition.X > (int)Constants.RegionSize) |
577 | ? Constants.RegionSize - 6 | 574 | ? (float)Constants.RegionSize - 6 |
578 | : grp.AbsolutePosition.X) | 575 | : grp.AbsolutePosition.X) |
579 | , | 576 | , |
580 | (grp.AbsolutePosition.Y > (int)Constants.RegionSize) | 577 | (grp.AbsolutePosition.Y > (int)Constants.RegionSize) |
581 | ? Constants.RegionSize - 6 | 578 | ? (float)Constants.RegionSize - 6 |
582 | : grp.AbsolutePosition.Y, | 579 | : grp.AbsolutePosition.Y, |
583 | grp.AbsolutePosition.Z); | 580 | grp.AbsolutePosition.Z); |
584 | 581 | ||
@@ -696,8 +693,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
696 | } | 693 | } |
697 | } | 694 | } |
698 | 695 | ||
699 | private SceneObjectGroup RezSingleAttachmentFromInventoryInternal( | 696 | protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( |
700 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt) | 697 | IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc) |
701 | { | 698 | { |
702 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); | 699 | IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>(); |
703 | if (invAccess != null) | 700 | if (invAccess != null) |
@@ -705,7 +702,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
705 | lock (sp.AttachmentsSyncLock) | 702 | lock (sp.AttachmentsSyncLock) |
706 | { | 703 | { |
707 | SceneObjectGroup objatt; | 704 | SceneObjectGroup objatt; |
708 | 705 | ||
709 | if (itemID != UUID.Zero) | 706 | if (itemID != UUID.Zero) |
710 | objatt = invAccess.RezObject(sp.ControllingClient, | 707 | objatt = invAccess.RezObject(sp.ControllingClient, |
711 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 708 | itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, |
@@ -714,11 +711,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
714 | objatt = invAccess.RezObject(sp.ControllingClient, | 711 | objatt = invAccess.RezObject(sp.ControllingClient, |
715 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, | 712 | null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, |
716 | false, false, sp.UUID, true); | 713 | false, false, sp.UUID, true); |
717 | 714 | ||
718 | // m_log.DebugFormat( | 715 | // m_log.DebugFormat( |
719 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", | 716 | // "[ATTACHMENTS MODULE]: Retrieved single object {0} for attachment to {1} on point {2}", |
720 | // objatt.Name, remoteClient.Name, AttachmentPt); | 717 | // objatt.Name, remoteClient.Name, AttachmentPt); |
721 | 718 | ||
722 | if (objatt != null) | 719 | if (objatt != null) |
723 | { | 720 | { |
724 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. | 721 | // HasGroupChanged is being set from within RezObject. Ideally it would be set by the caller. |
@@ -726,7 +723,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
726 | bool tainted = false; | 723 | bool tainted = false; |
727 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) | 724 | if (attachmentPt != 0 && attachmentPt != objatt.AttachmentPoint) |
728 | tainted = true; | 725 | tainted = true; |
729 | 726 | ||
730 | // This will throw if the attachment fails | 727 | // This will throw if the attachment fails |
731 | try | 728 | try |
732 | { | 729 | { |
@@ -737,21 +734,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
737 | m_log.ErrorFormat( | 734 | m_log.ErrorFormat( |
738 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", | 735 | "[ATTACHMENTS MODULE]: Failed to attach {0} {1} for {2}, exception {3}{4}", |
739 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); | 736 | objatt.Name, objatt.UUID, sp.Name, e.Message, e.StackTrace); |
740 | 737 | ||
741 | // Make sure the object doesn't stick around and bail | 738 | // Make sure the object doesn't stick around and bail |
742 | sp.RemoveAttachment(objatt); | 739 | sp.RemoveAttachment(objatt); |
743 | m_scene.DeleteSceneObject(objatt, false); | 740 | m_scene.DeleteSceneObject(objatt, false); |
744 | return null; | 741 | return null; |
745 | } | 742 | } |
746 | 743 | ||
747 | if (tainted) | 744 | if (tainted) |
748 | objatt.HasGroupChanged = true; | 745 | objatt.HasGroupChanged = true; |
749 | 746 | ||
750 | // Fire after attach, so we don't get messy perms dialogs | 747 | // Fire after attach, so we don't get messy perms dialogs |
751 | // 4 == AttachedRez | 748 | // 4 == AttachedRez |
752 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | 749 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); |
753 | objatt.ResumeScripts(); | 750 | objatt.ResumeScripts(); |
754 | 751 | ||
755 | // Do this last so that event listeners have access to all the effects of the attachment | 752 | // Do this last so that event listeners have access to all the effects of the attachment |
756 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | 753 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); |
757 | 754 | ||
@@ -763,9 +760,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
763 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", | 760 | "[ATTACHMENTS MODULE]: Could not retrieve item {0} for attaching to avatar {1} at point {2}", |
764 | itemID, sp.Name, attachmentPt); | 761 | itemID, sp.Name, attachmentPt); |
765 | } | 762 | } |
763 | |||
764 | if (doc != null) | ||
765 | { | ||
766 | objatt.LoadScriptState(doc); | ||
767 | objatt.ResetOwnerChangeFlag(); | ||
768 | } | ||
769 | |||
770 | // Fire after attach, so we don't get messy perms dialogs | ||
771 | // 4 == AttachedRez | ||
772 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 4); | ||
773 | objatt.ResumeScripts(); | ||
774 | |||
775 | // Do this last so that event listeners have access to all the effects of the attachment | ||
776 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, sp.UUID); | ||
766 | } | 777 | } |
767 | } | 778 | } |
768 | 779 | ||
769 | return null; | 780 | return null; |
770 | } | 781 | } |
771 | 782 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index 4359c01..35a3f43 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | |||
@@ -49,7 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
49 | private int m_shoutdistance = 100; | 49 | private int m_shoutdistance = 100; |
50 | private int m_whisperdistance = 10; | 50 | private int m_whisperdistance = 10; |
51 | private List<Scene> m_scenes = new List<Scene>(); | 51 | private List<Scene> m_scenes = new List<Scene>(); |
52 | 52 | private List<string> FreezeCache = new List<string>(); | |
53 | private string m_adminPrefix = ""; | ||
53 | internal object m_syncy = new object(); | 54 | internal object m_syncy = new object(); |
54 | 55 | ||
55 | internal IConfig m_config; | 56 | internal IConfig m_config; |
@@ -76,6 +77,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
76 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); | 77 | m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); |
77 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); | 78 | m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); |
78 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); | 79 | m_shoutdistance = config.Configs["Chat"].GetInt("shout_distance", m_shoutdistance); |
80 | m_adminPrefix = config.Configs["Chat"].GetString("admin_prefix", ""); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | public virtual void AddRegion(Scene scene) | 83 | public virtual void AddRegion(Scene scene) |
@@ -171,7 +173,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
171 | return; | 173 | return; |
172 | } | 174 | } |
173 | 175 | ||
174 | DeliverChatToAvatars(ChatSourceType.Agent, c); | 176 | if (FreezeCache.Contains(c.Sender.AgentId.ToString())) |
177 | { | ||
178 | if (c.Type != ChatTypeEnum.StartTyping || c.Type != ChatTypeEnum.StopTyping) | ||
179 | c.Sender.SendAgentAlertMessage("You may not talk as you are frozen.", false); | ||
180 | } | ||
181 | else | ||
182 | { | ||
183 | DeliverChatToAvatars(ChatSourceType.Agent, c); | ||
184 | } | ||
175 | } | 185 | } |
176 | 186 | ||
177 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) | 187 | public virtual void OnChatFromWorld(Object sender, OSChatMessage c) |
@@ -185,6 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
185 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) | 195 | protected virtual void DeliverChatToAvatars(ChatSourceType sourceType, OSChatMessage c) |
186 | { | 196 | { |
187 | string fromName = c.From; | 197 | string fromName = c.From; |
198 | string fromNamePrefix = ""; | ||
188 | UUID fromID = UUID.Zero; | 199 | UUID fromID = UUID.Zero; |
189 | string message = c.Message; | 200 | string message = c.Message; |
190 | IScene scene = c.Scene; | 201 | IScene scene = c.Scene; |
@@ -207,7 +218,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
207 | fromPos = avatar.AbsolutePosition; | 218 | fromPos = avatar.AbsolutePosition; |
208 | fromName = avatar.Name; | 219 | fromName = avatar.Name; |
209 | fromID = c.Sender.AgentId; | 220 | fromID = c.Sender.AgentId; |
210 | 221 | if (avatar.GodLevel >= 200) | |
222 | { | ||
223 | fromNamePrefix = m_adminPrefix; | ||
224 | } | ||
211 | break; | 225 | break; |
212 | 226 | ||
213 | case ChatSourceType.Object: | 227 | case ChatSourceType.Object: |
@@ -231,8 +245,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
231 | s.ForEachScenePresence( | 245 | s.ForEachScenePresence( |
232 | delegate(ScenePresence presence) | 246 | delegate(ScenePresence presence) |
233 | { | 247 | { |
234 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromName, c.Type, message, sourceType)) | 248 | ILandObject Presencecheck = s.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
235 | receiverIDs.Add(presence.UUID); | 249 | if (Presencecheck != null) |
250 | { | ||
251 | // This will pass all chat from objects. Not | ||
252 | // perfect, but it will do. For now. Better | ||
253 | // than the prior behavior of muting all | ||
254 | // objects on a parcel with access restrictions | ||
255 | if (c.Sender == null || Presencecheck.IsEitherBannedOrRestricted(c.Sender.AgentId) != true) | ||
256 | { | ||
257 | if (TrySendChatMessage(presence, fromPos, regionPos, fromID, fromNamePrefix + fromName, c.Type, message, sourceType)) | ||
258 | receiverIDs.Add(presence.UUID); | ||
259 | } | ||
260 | } | ||
261 | |||
236 | } | 262 | } |
237 | ); | 263 | ); |
238 | } | 264 | } |
@@ -276,31 +302,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
276 | } | 302 | } |
277 | 303 | ||
278 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); | 304 | // m_log.DebugFormat("[CHAT] Broadcast: fromID {0} fromName {1}, cType {2}, sType {3}", fromID, fromName, cType, sourceType); |
279 | |||
280 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); | 305 | HashSet<UUID> receiverIDs = new HashSet<UUID>(); |
281 | 306 | ||
282 | ((Scene)c.Scene).ForEachScenePresence( | 307 | if (c.Scene != null) |
283 | delegate(ScenePresence presence) | 308 | { |
284 | { | 309 | ((Scene)c.Scene).ForEachScenePresence |
285 | // ignore chat from child agents | 310 | ( |
286 | if (presence.IsChildAgent) return; | 311 | delegate(ScenePresence presence) |
287 | 312 | { | |
288 | IClientAPI client = presence.ControllingClient; | 313 | // ignore chat from child agents |
289 | 314 | if (presence.IsChildAgent) return; | |
290 | // don't forward SayOwner chat from objects to | 315 | |
291 | // non-owner agents | 316 | IClientAPI client = presence.ControllingClient; |
292 | if ((c.Type == ChatTypeEnum.Owner) && | 317 | |
293 | (null != c.SenderObject) && | 318 | // don't forward SayOwner chat from objects to |
294 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) | 319 | // non-owner agents |
295 | return; | 320 | if ((c.Type == ChatTypeEnum.Owner) && |
296 | 321 | (null != c.SenderObject) && | |
297 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, | 322 | (((SceneObjectPart)c.SenderObject).OwnerID != client.AgentId)) |
298 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | 323 | return; |
299 | receiverIDs.Add(presence.UUID); | 324 | |
300 | }); | 325 | client.SendChatMessage(c.Message, (byte)cType, CenterOfRegion, fromName, fromID, |
301 | 326 | (byte)sourceType, (byte)ChatAudibleLevel.Fully); | |
302 | (c.Scene as Scene).EventManager.TriggerOnChatToClients( | 327 | receiverIDs.Add(presence.UUID); |
303 | fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); | 328 | } |
329 | ); | ||
330 | (c.Scene as Scene).EventManager.TriggerOnChatToClients( | ||
331 | fromID, receiverIDs, c.Message, cType, CenterOfRegion, fromName, sourceType, ChatAudibleLevel.Fully); | ||
332 | } | ||
304 | } | 333 | } |
305 | 334 | ||
306 | /// <summary> | 335 | /// <summary> |
@@ -343,5 +372,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat | |||
343 | 372 | ||
344 | return true; | 373 | return true; |
345 | } | 374 | } |
375 | |||
376 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
377 | public void ParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
378 | { | ||
379 | System.Threading.Timer Timer; | ||
380 | if (flags == 0) | ||
381 | { | ||
382 | FreezeCache.Add(target.ToString()); | ||
383 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
384 | Timer = new System.Threading.Timer(timeCB, target, 30000, 0); | ||
385 | Timers.Add(target, Timer); | ||
386 | } | ||
387 | else | ||
388 | { | ||
389 | FreezeCache.Remove(target.ToString()); | ||
390 | Timers.TryGetValue(target, out Timer); | ||
391 | Timers.Remove(target); | ||
392 | Timer.Dispose(); | ||
393 | } | ||
394 | } | ||
395 | |||
396 | private void OnEndParcelFrozen(object avatar) | ||
397 | { | ||
398 | UUID target = (UUID)avatar; | ||
399 | FreezeCache.Remove(target.ToString()); | ||
400 | System.Threading.Timer Timer; | ||
401 | Timers.TryGetValue(target, out Timer); | ||
402 | Timers.Remove(target); | ||
403 | Timer.Dispose(); | ||
404 | } | ||
346 | } | 405 | } |
347 | } | 406 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 36fe040..f343f80 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -218,4 +218,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
218 | return result; | 218 | return result; |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } \ No newline at end of file | 221 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 3a7178c..4350cde 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -304,7 +304,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
304 | //m_log.DebugFormat("[XXX]: OnClientLogin!"); | 304 | //m_log.DebugFormat("[XXX]: OnClientLogin!"); |
305 | // Inform the friends that this user is online | 305 | // Inform the friends that this user is online |
306 | StatusChange(agentID, true); | 306 | StatusChange(agentID, true); |
307 | 307 | ||
308 | // Register that we need to send the list of online friends to this user | 308 | // Register that we need to send the list of online friends to this user |
309 | lock (m_NeedsListOfFriends) | 309 | lock (m_NeedsListOfFriends) |
310 | m_NeedsListOfFriends.Add(agentID); | 310 | m_NeedsListOfFriends.Add(agentID); |
@@ -579,6 +579,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
579 | 579 | ||
580 | StoreFriendships(agentID, friendID); | 580 | StoreFriendships(agentID, friendID); |
581 | 581 | ||
582 | ICallingCardModule ccm = client.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
583 | if (ccm != null) | ||
584 | { | ||
585 | ccm.CreateCallingCard(agentID, friendID, UUID.Zero); | ||
586 | } | ||
587 | |||
582 | // Update the local cache | 588 | // Update the local cache |
583 | RefetchFriends(client); | 589 | RefetchFriends(client); |
584 | 590 | ||
@@ -755,6 +761,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
755 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); | 761 | (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); |
756 | friendClient.SendInstantMessage(im); | 762 | friendClient.SendInstantMessage(im); |
757 | 763 | ||
764 | ICallingCardModule ccm = friendClient.Scene.RequestModuleInterface<ICallingCardModule>(); | ||
765 | if (ccm != null) | ||
766 | { | ||
767 | ccm.CreateCallingCard(friendID, userID, UUID.Zero); | ||
768 | } | ||
769 | |||
770 | |||
758 | // Update the local cache | 771 | // Update the local cache |
759 | RefetchFriends(friendClient); | 772 | RefetchFriends(friendClient); |
760 | 773 | ||
@@ -777,7 +790,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
777 | // we're done | 790 | // we're done |
778 | return true; | 791 | return true; |
779 | } | 792 | } |
780 | 793 | ||
781 | return false; | 794 | return false; |
782 | } | 795 | } |
783 | 796 | ||
@@ -830,7 +843,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
830 | 843 | ||
831 | public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) | 844 | public bool LocalStatusNotification(UUID userID, UUID friendID, bool online) |
832 | { | 845 | { |
833 | // m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); | 846 | //m_log.DebugFormat("[FRIENDS]: Local Status Notify {0} that user {1} is {2}", friendID, userID, online); |
834 | IClientAPI friendClient = LocateClientObject(friendID); | 847 | IClientAPI friendClient = LocateClientObject(friendID); |
835 | if (friendClient != null) | 848 | if (friendClient != null) |
836 | { | 849 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 5ec64d5..a83b3df 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs | |||
@@ -31,16 +31,40 @@ using OpenMetaverse; | |||
31 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
32 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using System; | ||
35 | using System.Reflection; | ||
36 | using System.Collections; | ||
37 | using System.Collections.Specialized; | ||
38 | using System.Reflection; | ||
39 | using System.IO; | ||
40 | using System.Web; | ||
41 | using System.Xml; | ||
42 | using log4net; | ||
43 | using Mono.Addins; | ||
44 | using OpenMetaverse.Messages.Linden; | ||
45 | using OpenMetaverse.StructuredData; | ||
46 | using OpenSim.Framework.Capabilities; | ||
47 | using OpenSim.Framework.Servers; | ||
48 | using OpenSim.Framework.Servers.HttpServer; | ||
49 | using Caps = OpenSim.Framework.Capabilities.Caps; | ||
50 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | ||
51 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | ||
34 | 52 | ||
35 | namespace OpenSim.Region.CoreModules.Avatar.Gods | 53 | namespace OpenSim.Region.CoreModules.Avatar.Gods |
36 | { | 54 | { |
37 | public class GodsModule : IRegionModule, IGodsModule | 55 | public class GodsModule : IRegionModule, IGodsModule |
38 | { | 56 | { |
57 | private static readonly ILog m_log = | ||
58 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
59 | |||
39 | /// <summary>Special UUID for actions that apply to all agents</summary> | 60 | /// <summary>Special UUID for actions that apply to all agents</summary> |
40 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); | 61 | private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); |
41 | 62 | ||
42 | protected Scene m_scene; | 63 | protected Scene m_scene; |
43 | protected IDialogModule m_dialogModule; | 64 | protected IDialogModule m_dialogModule; |
65 | |||
66 | protected Dictionary<UUID, string> m_capsDict = | ||
67 | new Dictionary<UUID, string>(); | ||
44 | 68 | ||
45 | public void Initialise(Scene scene, IConfigSource source) | 69 | public void Initialise(Scene scene, IConfigSource source) |
46 | { | 70 | { |
@@ -48,6 +72,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
48 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); | 72 | m_dialogModule = m_scene.RequestModuleInterface<IDialogModule>(); |
49 | m_scene.RegisterModuleInterface<IGodsModule>(this); | 73 | m_scene.RegisterModuleInterface<IGodsModule>(this); |
50 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; | 74 | m_scene.EventManager.OnNewClient += SubscribeToClientEvents; |
75 | m_scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
76 | m_scene.EventManager.OnClientClosed += OnClientClosed; | ||
77 | scene.EventManager.OnIncomingInstantMessage += | ||
78 | OnIncomingInstantMessage; | ||
51 | } | 79 | } |
52 | 80 | ||
53 | public void PostInitialise() {} | 81 | public void PostInitialise() {} |
@@ -67,6 +95,54 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
67 | client.OnRequestGodlikePowers -= RequestGodlikePowers; | 95 | client.OnRequestGodlikePowers -= RequestGodlikePowers; |
68 | } | 96 | } |
69 | 97 | ||
98 | private void OnClientClosed(UUID agentID, Scene scene) | ||
99 | { | ||
100 | m_capsDict.Remove(agentID); | ||
101 | } | ||
102 | |||
103 | private void OnRegisterCaps(UUID agentID, Caps caps) | ||
104 | { | ||
105 | string uri = "/CAPS/" + UUID.Random(); | ||
106 | m_capsDict[agentID] = uri; | ||
107 | |||
108 | caps.RegisterHandler("UntrustedSimulatorMessage", | ||
109 | new RestStreamHandler("POST", uri, | ||
110 | HandleUntrustedSimulatorMessage)); | ||
111 | } | ||
112 | |||
113 | private string HandleUntrustedSimulatorMessage(string request, | ||
114 | string path, string param, OSHttpRequest httpRequest, | ||
115 | OSHttpResponse httpResponse) | ||
116 | { | ||
117 | OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); | ||
118 | |||
119 | string message = osd["message"].AsString(); | ||
120 | |||
121 | if (message == "GodKickUser") | ||
122 | { | ||
123 | OSDMap body = (OSDMap)osd["body"]; | ||
124 | OSDArray userInfo = (OSDArray)body["UserInfo"]; | ||
125 | OSDMap userData = (OSDMap)userInfo[0]; | ||
126 | |||
127 | UUID agentID = userData["AgentID"].AsUUID(); | ||
128 | UUID godID = userData["GodID"].AsUUID(); | ||
129 | UUID godSessionID = userData["GodSessionID"].AsUUID(); | ||
130 | uint kickFlags = userData["KickFlags"].AsUInteger(); | ||
131 | string reason = userData["Reason"].AsString(); | ||
132 | |||
133 | ScenePresence god = m_scene.GetScenePresence(godID); | ||
134 | if (god == null || god.ControllingClient.SessionId != godSessionID) | ||
135 | return String.Empty; | ||
136 | |||
137 | KickUser(godID, godSessionID, agentID, kickFlags, Util.StringToBytes1024(reason)); | ||
138 | } | ||
139 | else | ||
140 | { | ||
141 | m_log.ErrorFormat("[GOD]: Unhandled UntrustedSimulatorMessage: {0}", message); | ||
142 | } | ||
143 | return String.Empty; | ||
144 | } | ||
145 | |||
70 | public void RequestGodlikePowers( | 146 | public void RequestGodlikePowers( |
71 | UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) | 147 | UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) |
72 | { | 148 | { |
@@ -115,71 +191,85 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods | |||
115 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> | 191 | /// <param name="reason">The message to send to the user after it's been turned into a field</param> |
116 | public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) | 192 | public void KickUser(UUID godID, UUID sessionID, UUID agentID, uint kickflags, byte[] reason) |
117 | { | 193 | { |
118 | UUID kickUserID = ALL_AGENTS; | 194 | if (!m_scene.Permissions.IsGod(godID)) |
119 | 195 | return; | |
196 | |||
120 | ScenePresence sp = m_scene.GetScenePresence(agentID); | 197 | ScenePresence sp = m_scene.GetScenePresence(agentID); |
121 | 198 | ||
122 | if (sp != null || agentID == kickUserID) | 199 | if (sp == null && agentID != ALL_AGENTS) |
123 | { | 200 | { |
124 | if (m_scene.Permissions.IsGod(godID)) | 201 | IMessageTransferModule transferModule = |
202 | m_scene.RequestModuleInterface<IMessageTransferModule>(); | ||
203 | if (transferModule != null) | ||
125 | { | 204 | { |
126 | if (kickflags == 0) | 205 | m_log.DebugFormat("[GODS]: Sending nonlocal kill for agent {0}", agentID); |
127 | { | 206 | transferModule.SendInstantMessage(new GridInstantMessage( |
128 | if (agentID == kickUserID) | 207 | m_scene, godID, "God", agentID, (byte)250, false, |
129 | { | 208 | Utils.BytesToString(reason), UUID.Zero, true, |
130 | string reasonStr = Utils.BytesToString(reason); | 209 | new Vector3(), new byte[] {(byte)kickflags}), |
131 | 210 | delegate(bool success) {} ); | |
132 | m_scene.ForEachClient( | 211 | } |
133 | delegate(IClientAPI controller) | 212 | return; |
134 | { | 213 | } |
135 | if (controller.AgentId != godID) | ||
136 | controller.Kick(reasonStr); | ||
137 | } | ||
138 | ); | ||
139 | |||
140 | // This is a bit crude. It seems the client will be null before it actually stops the thread | ||
141 | // The thread will kill itself eventually :/ | ||
142 | // Is there another way to make sure *all* clients get this 'inter region' message? | ||
143 | m_scene.ForEachScenePresence( | ||
144 | delegate(ScenePresence p) | ||
145 | { | ||
146 | if (p.UUID != godID && !p.IsChildAgent) | ||
147 | { | ||
148 | // Possibly this should really be p.Close() though that method doesn't send a close | ||
149 | // to the client | ||
150 | p.ControllingClient.Close(); | ||
151 | } | ||
152 | } | ||
153 | ); | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | m_scene.SceneGraph.removeUserCount(!sp.IsChildAgent); | ||
158 | 214 | ||
159 | sp.ControllingClient.Kick(Utils.BytesToString(reason)); | 215 | switch (kickflags) |
160 | sp.ControllingClient.Close(); | 216 | { |
161 | } | 217 | case 0: |
162 | } | 218 | if (sp != null) |
163 | 219 | { | |
164 | if (kickflags == 1) | 220 | KickPresence(sp, Utils.BytesToString(reason)); |
165 | { | ||
166 | sp.AllowMovement = false; | ||
167 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
168 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | ||
169 | } | ||
170 | |||
171 | if (kickflags == 2) | ||
172 | { | ||
173 | sp.AllowMovement = true; | ||
174 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
175 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | ||
176 | } | ||
177 | } | 221 | } |
178 | else | 222 | else if (agentID == ALL_AGENTS) |
179 | { | 223 | { |
180 | m_dialogModule.SendAlertToUser(godID, "Kick request denied"); | 224 | m_scene.ForEachScenePresence( |
225 | delegate(ScenePresence p) | ||
226 | { | ||
227 | if (p.UUID != godID && (!m_scene.Permissions.IsGod(p.UUID))) | ||
228 | KickPresence(p, Utils.BytesToString(reason)); | ||
229 | } | ||
230 | ); | ||
181 | } | 231 | } |
232 | break; | ||
233 | case 1: | ||
234 | if (sp != null) | ||
235 | { | ||
236 | sp.AllowMovement = false; | ||
237 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
238 | m_dialogModule.SendAlertToUser(godID, "User Frozen"); | ||
239 | } | ||
240 | break; | ||
241 | case 2: | ||
242 | if (sp != null) | ||
243 | { | ||
244 | sp.AllowMovement = true; | ||
245 | m_dialogModule.SendAlertToUser(agentID, Utils.BytesToString(reason)); | ||
246 | m_dialogModule.SendAlertToUser(godID, "User Unfrozen"); | ||
247 | } | ||
248 | break; | ||
249 | default: | ||
250 | break; | ||
251 | } | ||
252 | } | ||
253 | |||
254 | private void KickPresence(ScenePresence sp, string reason) | ||
255 | { | ||
256 | if (sp.IsChildAgent) | ||
257 | return; | ||
258 | sp.ControllingClient.Kick(reason); | ||
259 | sp.Scene.IncomingCloseAgent(sp.UUID); | ||
260 | } | ||
261 | |||
262 | private void OnIncomingInstantMessage(GridInstantMessage msg) | ||
263 | { | ||
264 | if (msg.dialog == (uint)250) // Nonlocal kick | ||
265 | { | ||
266 | UUID agentID = new UUID(msg.toAgentID); | ||
267 | string reason = msg.message; | ||
268 | UUID godID = new UUID(msg.fromAgentID); | ||
269 | uint kickMode = (uint)msg.binaryBucket[0]; | ||
270 | |||
271 | KickUser(godID, UUID.Zero, agentID, kickMode, Util.StringToBytes1024(reason)); | ||
182 | } | 272 | } |
183 | } | 273 | } |
184 | } | 274 | } |
185 | } \ No newline at end of file | 275 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index ca5d485..1af4d68 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | |||
@@ -157,6 +157,32 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
157 | return; | 157 | return; |
158 | } | 158 | } |
159 | 159 | ||
160 | //DateTime dt = DateTime.UtcNow; | ||
161 | |||
162 | // Ticks from UtcNow, but make it look like local. Evil, huh? | ||
163 | //dt = DateTime.SpecifyKind(dt, DateTimeKind.Local); | ||
164 | |||
165 | //try | ||
166 | //{ | ||
167 | // // Convert that to the PST timezone | ||
168 | // TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); | ||
169 | // dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo); | ||
170 | //} | ||
171 | //catch | ||
172 | //{ | ||
173 | // //m_log.Info("[OFFLINE MESSAGING]: No PST timezone found on this machine. Saving with local timestamp."); | ||
174 | //} | ||
175 | |||
176 | //// And make it look local again to fool the unix time util | ||
177 | //dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); | ||
178 | |||
179 | // If client is null, this message comes from storage and IS offline | ||
180 | if (client != null) | ||
181 | im.offline = 0; | ||
182 | |||
183 | if (im.offline == 0) | ||
184 | im.timestamp = (uint)Util.UnixTimeSinceEpoch(); | ||
185 | |||
160 | if (m_TransferModule != null) | 186 | if (m_TransferModule != null) |
161 | { | 187 | { |
162 | if (client != null) | 188 | if (client != null) |
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 77c7147..c1caf44 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs | |||
@@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private bool m_Enabled = false; | 49 | private bool m_Enabled = false; |
50 | protected string m_MessageKey = String.Empty; | ||
50 | protected List<Scene> m_Scenes = new List<Scene>(); | 51 | protected List<Scene> m_Scenes = new List<Scene>(); |
51 | protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); | 52 | protected Dictionary<UUID, UUID> m_UserRegionMap = new Dictionary<UUID, UUID>(); |
52 | 53 | ||
@@ -66,14 +67,17 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
66 | public virtual void Initialise(IConfigSource config) | 67 | public virtual void Initialise(IConfigSource config) |
67 | { | 68 | { |
68 | IConfig cnf = config.Configs["Messaging"]; | 69 | IConfig cnf = config.Configs["Messaging"]; |
69 | if (cnf != null && cnf.GetString( | 70 | if (cnf != null) |
70 | "MessageTransferModule", "MessageTransferModule") != | ||
71 | "MessageTransferModule") | ||
72 | { | 71 | { |
73 | m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); | 72 | if (cnf.GetString("MessageTransferModule", |
74 | return; | 73 | "MessageTransferModule") != "MessageTransferModule") |
75 | } | 74 | { |
75 | return; | ||
76 | } | ||
76 | 77 | ||
78 | m_MessageKey = cnf.GetString("MessageKey", String.Empty); | ||
79 | } | ||
80 | m_log.Debug("[MESSAGE TRANSFER]: Module enabled"); | ||
77 | m_Enabled = true; | 81 | m_Enabled = true; |
78 | } | 82 | } |
79 | 83 | ||
@@ -145,8 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
145 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 149 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
146 | if (!user.IsChildAgent) | 150 | if (!user.IsChildAgent) |
147 | { | 151 | { |
148 | // Local message | 152 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
149 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to root agent {0} {1}", user.Name, toAgentID); | ||
150 | user.ControllingClient.SendInstantMessage(im); | 153 | user.ControllingClient.SendInstantMessage(im); |
151 | 154 | ||
152 | // Message sent | 155 | // Message sent |
@@ -168,7 +171,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
168 | // Local message | 171 | // Local message |
169 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; | 172 | ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; |
170 | 173 | ||
171 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to child agent {0} {1}", user.Name, toAgentID); | 174 | // m_log.DebugFormat("[INSTANT MESSAGE]: Delivering to client"); |
172 | user.ControllingClient.SendInstantMessage(im); | 175 | user.ControllingClient.SendInstantMessage(im); |
173 | 176 | ||
174 | // Message sent | 177 | // Message sent |
@@ -251,6 +254,19 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
251 | && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") | 254 | && requestData.ContainsKey("position_z") && requestData.ContainsKey("region_id") |
252 | && requestData.ContainsKey("binary_bucket")) | 255 | && requestData.ContainsKey("binary_bucket")) |
253 | { | 256 | { |
257 | if (m_MessageKey != String.Empty) | ||
258 | { | ||
259 | XmlRpcResponse error_resp = new XmlRpcResponse(); | ||
260 | Hashtable error_respdata = new Hashtable(); | ||
261 | error_respdata["success"] = "FALSE"; | ||
262 | error_resp.Value = error_respdata; | ||
263 | |||
264 | if (!requestData.Contains("message_key")) | ||
265 | return error_resp; | ||
266 | if (m_MessageKey != (string)requestData["message_key"]) | ||
267 | return error_resp; | ||
268 | } | ||
269 | |||
254 | // Do the easy way of validating the UUIDs | 270 | // Do the easy way of validating the UUIDs |
255 | UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); | 271 | UUID.TryParse((string)requestData["from_agent_id"], out fromAgentID); |
256 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); | 272 | UUID.TryParse((string)requestData["to_agent_id"], out toAgentID); |
@@ -433,24 +449,37 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
433 | return resp; | 449 | return resp; |
434 | } | 450 | } |
435 | 451 | ||
436 | /// <summary> | 452 | private delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result); |
437 | /// delegate for sending a grid instant message asynchronously | ||
438 | /// </summary> | ||
439 | public delegate void GridInstantMessageDelegate(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID); | ||
440 | 453 | ||
441 | protected virtual void GridInstantMessageCompleted(IAsyncResult iar) | 454 | private class GIM { |
442 | { | 455 | public GridInstantMessage im; |
443 | GridInstantMessageDelegate icon = | 456 | public MessageResultNotification result; |
444 | (GridInstantMessageDelegate)iar.AsyncState; | 457 | }; |
445 | icon.EndInvoke(iar); | ||
446 | } | ||
447 | 458 | ||
459 | private Queue<GIM> pendingInstantMessages = new Queue<GIM>(); | ||
460 | private int numInstantMessageThreads = 0; | ||
448 | 461 | ||
449 | protected virtual void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) | 462 | private void SendGridInstantMessageViaXMLRPC(GridInstantMessage im, MessageResultNotification result) |
450 | { | 463 | { |
451 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsync; | 464 | lock (pendingInstantMessages) { |
465 | if (numInstantMessageThreads >= 4) { | ||
466 | GIM gim = new GIM(); | ||
467 | gim.im = im; | ||
468 | gim.result = result; | ||
469 | pendingInstantMessages.Enqueue(gim); | ||
470 | } else { | ||
471 | ++ numInstantMessageThreads; | ||
472 | //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: ++numInstantMessageThreads={0}", numInstantMessageThreads); | ||
473 | GridInstantMessageDelegate d = SendGridInstantMessageViaXMLRPCAsyncMain; | ||
474 | d.BeginInvoke(im, result, GridInstantMessageCompleted, d); | ||
475 | } | ||
476 | } | ||
477 | } | ||
452 | 478 | ||
453 | d.BeginInvoke(im, result, UUID.Zero, GridInstantMessageCompleted, d); | 479 | private void GridInstantMessageCompleted(IAsyncResult iar) |
480 | { | ||
481 | GridInstantMessageDelegate d = (GridInstantMessageDelegate)iar.AsyncState; | ||
482 | d.EndInvoke(iar); | ||
454 | } | 483 | } |
455 | 484 | ||
456 | /// <summary> | 485 | /// <summary> |
@@ -465,8 +494,31 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
465 | /// Pass in 0 the first time this method is called. It will be called recursively with the last | 494 | /// Pass in 0 the first time this method is called. It will be called recursively with the last |
466 | /// regionhandle tried | 495 | /// regionhandle tried |
467 | /// </param> | 496 | /// </param> |
468 | protected virtual void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | 497 | private void SendGridInstantMessageViaXMLRPCAsyncMain(GridInstantMessage im, MessageResultNotification result) |
469 | { | 498 | { |
499 | GIM gim; | ||
500 | do { | ||
501 | try { | ||
502 | SendGridInstantMessageViaXMLRPCAsync(im, result, UUID.Zero); | ||
503 | } catch (Exception e) { | ||
504 | m_log.Error("[SendGridInstantMessageViaXMLRPC]: exception " + e.Message); | ||
505 | } | ||
506 | lock (pendingInstantMessages) { | ||
507 | if (pendingInstantMessages.Count > 0) { | ||
508 | gim = pendingInstantMessages.Dequeue(); | ||
509 | im = gim.im; | ||
510 | result = gim.result; | ||
511 | } else { | ||
512 | gim = null; | ||
513 | -- numInstantMessageThreads; | ||
514 | //m_log.DebugFormat("[SendGridInstantMessageViaXMLRPC]: --numInstantMessageThreads={0}", numInstantMessageThreads); | ||
515 | } | ||
516 | } | ||
517 | } while (gim != null); | ||
518 | } | ||
519 | private void SendGridInstantMessageViaXMLRPCAsync(GridInstantMessage im, MessageResultNotification result, UUID prevRegionID) | ||
520 | { | ||
521 | |||
470 | UUID toAgentID = new UUID(im.toAgentID); | 522 | UUID toAgentID = new UUID(im.toAgentID); |
471 | 523 | ||
472 | PresenceInfo upd = null; | 524 | PresenceInfo upd = null; |
@@ -533,7 +585,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
533 | 585 | ||
534 | if (upd != null) | 586 | if (upd != null) |
535 | { | 587 | { |
536 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, | 588 | GridRegion reginfo = m_Scenes[0].GridService.GetRegionByUUID(UUID.Zero, |
537 | upd.RegionID); | 589 | upd.RegionID); |
538 | if (reginfo != null) | 590 | if (reginfo != null) |
539 | { | 591 | { |
@@ -682,6 +734,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
682 | gim["position_z"] = msg.Position.Z.ToString(); | 734 | gim["position_z"] = msg.Position.Z.ToString(); |
683 | gim["region_id"] = msg.RegionID.ToString(); | 735 | gim["region_id"] = msg.RegionID.ToString(); |
684 | gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); | 736 | gim["binary_bucket"] = Convert.ToBase64String(msg.binaryBucket,Base64FormattingOptions.None); |
737 | if (m_MessageKey != String.Empty) | ||
738 | gim["message_key"] = m_MessageKey; | ||
685 | return gim; | 739 | return gim; |
686 | } | 740 | } |
687 | 741 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 8d055d4..3373bd5 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs | |||
@@ -171,7 +171,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
171 | 171 | ||
172 | private void RetrieveInstantMessages(IClientAPI client) | 172 | private void RetrieveInstantMessages(IClientAPI client) |
173 | { | 173 | { |
174 | if (m_RestURL != "") | 174 | if (m_RestURL == String.Empty) |
175 | { | ||
176 | return; | ||
177 | } | ||
178 | else | ||
175 | { | 179 | { |
176 | m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId); | 180 | m_log.DebugFormat("[OFFLINE MESSAGING]: Retrieving stored messages for {0}", client.AgentId); |
177 | 181 | ||
@@ -179,22 +183,25 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
179 | = SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>( | 183 | = SynchronousRestObjectRequester.MakeRequest<UUID, List<GridInstantMessage>>( |
180 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); | 184 | "POST", m_RestURL + "/RetrieveMessages/", client.AgentId); |
181 | 185 | ||
182 | if (msglist == null) | 186 | if (msglist != null) |
183 | m_log.WarnFormat("[OFFLINE MESSAGING]: WARNING null message list."); | ||
184 | |||
185 | foreach (GridInstantMessage im in msglist) | ||
186 | { | 187 | { |
187 | // client.SendInstantMessage(im); | 188 | foreach (GridInstantMessage im in msglist) |
188 | 189 | { | |
189 | // Send through scene event manager so all modules get a chance | 190 | // client.SendInstantMessage(im); |
190 | // to look at this message before it gets delivered. | 191 | |
191 | // | 192 | // Send through scene event manager so all modules get a chance |
192 | // Needed for proper state management for stored group | 193 | // to look at this message before it gets delivered. |
193 | // invitations | 194 | // |
194 | // | 195 | // Needed for proper state management for stored group |
195 | Scene s = FindScene(client.AgentId); | 196 | // invitations |
196 | if (s != null) | 197 | // |
197 | s.EventManager.TriggerIncomingInstantMessage(im); | 198 | |
199 | im.offline = 1; | ||
200 | |||
201 | Scene s = FindScene(client.AgentId); | ||
202 | if (s != null) | ||
203 | s.EventManager.TriggerIncomingInstantMessage(im); | ||
204 | } | ||
198 | } | 205 | } |
199 | } | 206 | } |
200 | } | 207 | } |
@@ -205,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
205 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) | 212 | && (!im.fromGroup || (im.fromGroup && m_ForwardOfflineGroupMessages))) |
206 | { | 213 | { |
207 | bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( | 214 | bool success = SynchronousRestObjectRequester.MakeRequest<GridInstantMessage, bool>( |
208 | "POST", m_RestURL+"/SaveMessage/", im); | 215 | "POST", m_RestURL + "/SaveMessage/", im); |
209 | 216 | ||
210 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) | 217 | if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent) |
211 | { | 218 | { |
@@ -217,7 +224,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage | |||
217 | null, new UUID(im.toAgentID), | 224 | null, new UUID(im.toAgentID), |
218 | "System", new UUID(im.fromAgentID), | 225 | "System", new UUID(im.fromAgentID), |
219 | (byte)InstantMessageDialog.MessageFromAgent, | 226 | (byte)InstantMessageDialog.MessageFromAgent, |
220 | "User is not logged in. "+ | 227 | "User is not logged in. " + |
221 | (success ? "Message saved." : "Message not saved"), | 228 | (success ? "Message saved." : "Message not saved"), |
222 | false, new Vector3())); | 229 | false, new Vector3())); |
223 | } | 230 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 6b24718..a19bbfd 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -632,4 +632,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
632 | m_assetsLoaded = true; | 632 | m_assetsLoaded = true; |
633 | } | 633 | } |
634 | } | 634 | } |
635 | } \ No newline at end of file | 635 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 36ecb3b..63fde07 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -178,9 +178,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
178 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, | 178 | InventoryFolderBase inventoryFolder, string path, bool saveThisFolderItself, |
179 | Dictionary<string, object> options, IUserAccountService userAccountService) | 179 | Dictionary<string, object> options, IUserAccountService userAccountService) |
180 | { | 180 | { |
181 | if (options.ContainsKey("verbose")) | ||
182 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saving folder {0}", inventoryFolder.Name); | ||
183 | |||
184 | if (saveThisFolderItself) | 181 | if (saveThisFolderItself) |
185 | { | 182 | { |
186 | path += CreateArchiveFolderName(inventoryFolder); | 183 | path += CreateArchiveFolderName(inventoryFolder); |
@@ -449,4 +446,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
449 | return s; | 446 | return s; |
450 | } | 447 | } |
451 | } | 448 | } |
452 | } \ No newline at end of file | 449 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index f46d9f7..120fd43 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -175,8 +175,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
175 | if (im.binaryBucket.Length < 17) // Invalid | 175 | if (im.binaryBucket.Length < 17) // Invalid |
176 | return; | 176 | return; |
177 | 177 | ||
178 | UUID receipientID = new UUID(im.toAgentID); | 178 | UUID recipientID = new UUID(im.toAgentID); |
179 | ScenePresence user = scene.GetScenePresence(receipientID); | 179 | ScenePresence user = scene.GetScenePresence(recipientID); |
180 | UUID copyID; | 180 | UUID copyID; |
181 | 181 | ||
182 | // First byte is the asset type | 182 | // First byte is the asset type |
@@ -191,7 +191,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
191 | folderID, new UUID(im.toAgentID)); | 191 | folderID, new UUID(im.toAgentID)); |
192 | 192 | ||
193 | InventoryFolderBase folderCopy | 193 | InventoryFolderBase folderCopy |
194 | = scene.GiveInventoryFolder(receipientID, client.AgentId, folderID, UUID.Zero); | 194 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); |
195 | 195 | ||
196 | if (folderCopy == null) | 196 | if (folderCopy == null) |
197 | { | 197 | { |
@@ -244,6 +244,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
244 | im.imSessionID = itemID.Guid; | 244 | im.imSessionID = itemID.Guid; |
245 | } | 245 | } |
246 | 246 | ||
247 | im.offline = 1; // Remember these | ||
248 | |||
247 | // Send the IM to the recipient. The item is already | 249 | // Send the IM to the recipient. The item is already |
248 | // in their inventory, so it will not be lost if | 250 | // in their inventory, so it will not be lost if |
249 | // they are offline. | 251 | // they are offline. |
@@ -427,22 +429,67 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
427 | /// | 429 | /// |
428 | /// </summary> | 430 | /// </summary> |
429 | /// <param name="msg"></param> | 431 | /// <param name="msg"></param> |
430 | private void OnGridInstantMessage(GridInstantMessage msg) | 432 | private void OnGridInstantMessage(GridInstantMessage im) |
431 | { | 433 | { |
432 | // Check if this is ours to handle | 434 | // Check if this is ours to handle |
433 | // | 435 | // |
434 | Scene scene = FindClientScene(new UUID(msg.toAgentID)); | 436 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |
435 | 437 | ||
436 | if (scene == null) | 438 | if (scene == null) |
437 | return; | 439 | return; |
438 | 440 | ||
439 | // Find agent to deliver to | 441 | // Find agent to deliver to |
440 | // | 442 | // |
441 | ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); | 443 | ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); |
444 | if (user == null) | ||
445 | return; | ||
446 | |||
447 | // This requires a little bit of processing because we have to make the | ||
448 | // new item visible in the recipient's inventory here | ||
449 | // | ||
450 | if (im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
451 | { | ||
452 | if (im.binaryBucket.Length < 17) // Invalid | ||
453 | return; | ||
454 | |||
455 | UUID recipientID = new UUID(im.toAgentID); | ||
456 | |||
457 | // First byte is the asset type | ||
458 | AssetType assetType = (AssetType)im.binaryBucket[0]; | ||
459 | |||
460 | if (AssetType.Folder == assetType) | ||
461 | { | ||
462 | UUID folderID = new UUID(im.binaryBucket, 1); | ||
463 | |||
464 | InventoryFolderBase given = | ||
465 | new InventoryFolderBase(folderID, recipientID); | ||
466 | InventoryFolderBase folder = | ||
467 | scene.InventoryService.GetFolder(given); | ||
468 | |||
469 | if (folder != null) | ||
470 | user.ControllingClient.SendBulkUpdateInventory(folder); | ||
471 | } | ||
472 | else | ||
473 | { | ||
474 | UUID itemID = new UUID(im.binaryBucket, 1); | ||
442 | 475 | ||
443 | // Just forward to local handling | 476 | InventoryItemBase given = |
444 | OnInstantMessage(user.ControllingClient, msg); | 477 | new InventoryItemBase(itemID, recipientID); |
478 | InventoryItemBase item = | ||
479 | scene.InventoryService.GetItem(given); | ||
445 | 480 | ||
481 | if (item != null) | ||
482 | { | ||
483 | user.ControllingClient.SendBulkUpdateInventory(item); | ||
484 | } | ||
485 | } | ||
486 | user.ControllingClient.SendInstantMessage(im); | ||
487 | } | ||
488 | else if (im.dialog == (byte) InstantMessageDialog.InventoryAccepted || | ||
489 | im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
490 | { | ||
491 | user.ControllingClient.SendInstantMessage(im); | ||
492 | } | ||
446 | } | 493 | } |
447 | } | 494 | } |
448 | } | 495 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index d295384..dcfdf8f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs | |||
@@ -155,16 +155,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
155 | scene.RegionInfo.RegionHandle, | 155 | scene.RegionInfo.RegionHandle, |
156 | (uint)presence.AbsolutePosition.X, | 156 | (uint)presence.AbsolutePosition.X, |
157 | (uint)presence.AbsolutePosition.Y, | 157 | (uint)presence.AbsolutePosition.Y, |
158 | (uint)presence.AbsolutePosition.Z); | 158 | (uint)presence.AbsolutePosition.Z + 2); |
159 | 159 | ||
160 | m_log.DebugFormat("TP invite with message {0}", message); | 160 | m_log.DebugFormat("[LURE]: TP invite with message {0}", message); |
161 | |||
162 | GridInstantMessage m; | ||
163 | |||
164 | if (scene.Permissions.IsAdministrator(client.AgentId) && presence.GodLevel >= 200 && (!scene.Permissions.IsAdministrator(targetid))) | ||
165 | { | ||
166 | m = new GridInstantMessage(scene, client.AgentId, | ||
167 | client.FirstName+" "+client.LastName, targetid, | ||
168 | (byte)InstantMessageDialog.GodLikeRequestTeleport, false, | ||
169 | message, dest, false, presence.AbsolutePosition, | ||
170 | new Byte[0]); | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | m = new GridInstantMessage(scene, client.AgentId, | ||
175 | client.FirstName+" "+client.LastName, targetid, | ||
176 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
177 | message, dest, false, presence.AbsolutePosition, | ||
178 | new Byte[0]); | ||
179 | } | ||
161 | 180 | ||
162 | GridInstantMessage m = new GridInstantMessage(scene, client.AgentId, | ||
163 | client.FirstName+" "+client.LastName, targetid, | ||
164 | (byte)InstantMessageDialog.RequestTeleport, false, | ||
165 | message, dest, false, presence.AbsolutePosition, | ||
166 | new Byte[0]); | ||
167 | |||
168 | if (m_TransferModule != null) | 181 | if (m_TransferModule != null) |
169 | { | 182 | { |
170 | m_TransferModule.SendInstantMessage(m, | 183 | m_TransferModule.SendInstantMessage(m, |
@@ -199,7 +212,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
199 | { | 212 | { |
200 | // Forward remote teleport requests | 213 | // Forward remote teleport requests |
201 | // | 214 | // |
202 | if (msg.dialog != 22) | 215 | if (msg.dialog != (byte)InstantMessageDialog.RequestTeleport && |
216 | msg.dialog != (byte)InstantMessageDialog.GodLikeRequestTeleport) | ||
203 | return; | 217 | return; |
204 | 218 | ||
205 | if (m_TransferModule != null) | 219 | if (m_TransferModule != null) |
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index eb776fe..7ae304c 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -97,7 +97,8 @@ namespace OpenSim.Region.CoreModules.Framework | |||
97 | 97 | ||
98 | public void CreateCaps(UUID agentId) | 98 | public void CreateCaps(UUID agentId) |
99 | { | 99 | { |
100 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId)) | 100 | int flags = m_scene.GetUserFlags(agentId); |
101 | if (m_scene.RegionInfo.EstateSettings.IsBanned(agentId, flags)) | ||
101 | return; | 102 | return; |
102 | 103 | ||
103 | String capsObjectPath = GetCapsPath(agentId); | 104 | String capsObjectPath = GetCapsPath(agentId); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f4d2fda..7263b51 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -126,7 +126,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
126 | 126 | ||
127 | protected virtual void OnNewClient(IClientAPI client) | 127 | protected virtual void OnNewClient(IClientAPI client) |
128 | { | 128 | { |
129 | client.OnTeleportHomeRequest += TeleportHome; | 129 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
130 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 130 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
131 | } | 131 | } |
132 | 132 | ||
@@ -204,6 +204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
204 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 204 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
205 | 205 | ||
206 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 206 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
207 | sp.TeleportFlags = (TeleportFlags)teleportFlags; | ||
207 | sp.Teleport(position); | 208 | sp.Teleport(position); |
208 | 209 | ||
209 | foreach (SceneObjectGroup grp in sp.GetAttachments()) | 210 | foreach (SceneObjectGroup grp in sp.GetAttachments()) |
@@ -320,7 +321,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
320 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, | 321 | // This may be a costly operation. The reg.ExternalEndPoint field is not a passive field, |
321 | // it's actually doing a lot of work. | 322 | // it's actually doing a lot of work. |
322 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; | 323 | IPEndPoint endPoint = finalDestination.ExternalEndPoint; |
323 | if (endPoint.Address != null) | 324 | if (endPoint != null && endPoint.Address != null) |
324 | { | 325 | { |
325 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from | 326 | // Fixing a bug where teleporting while sitting results in the avatar ending up removed from |
326 | // both regions | 327 | // both regions |
@@ -570,7 +571,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
570 | 571 | ||
571 | protected void KillEntity(Scene scene, uint localID) | 572 | protected void KillEntity(Scene scene, uint localID) |
572 | { | 573 | { |
573 | scene.SendKillObject(localID); | 574 | scene.SendKillObject(new List<uint>() { localID }); |
574 | } | 575 | } |
575 | 576 | ||
576 | protected virtual GridRegion GetFinalDestination(GridRegion region) | 577 | protected virtual GridRegion GetFinalDestination(GridRegion region) |
@@ -631,7 +632,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
631 | 632 | ||
632 | #region Teleport Home | 633 | #region Teleport Home |
633 | 634 | ||
634 | public virtual void TeleportHome(UUID id, IClientAPI client) | 635 | public virtual void TriggerTeleportHome(UUID id, IClientAPI client) |
636 | { | ||
637 | TeleportHome(id, client); | ||
638 | } | ||
639 | |||
640 | public virtual bool TeleportHome(UUID id, IClientAPI client) | ||
635 | { | 641 | { |
636 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 642 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
637 | 643 | ||
@@ -640,12 +646,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
640 | 646 | ||
641 | if (uinfo != null) | 647 | if (uinfo != null) |
642 | { | 648 | { |
649 | if (uinfo.HomeRegionID == UUID.Zero) | ||
650 | { | ||
651 | // can't find the Home region: Tell viewer and abort | ||
652 | client.SendTeleportFailed("You don't have a home position set."); | ||
653 | return false; | ||
654 | } | ||
643 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); | 655 | GridRegion regionInfo = m_aScene.GridService.GetRegionByUUID(UUID.Zero, uinfo.HomeRegionID); |
644 | if (regionInfo == null) | 656 | if (regionInfo == null) |
645 | { | 657 | { |
646 | // can't find the Home region: Tell viewer and abort | 658 | // can't find the Home region: Tell viewer and abort |
647 | client.SendTeleportFailed("Your home region could not be found."); | 659 | client.SendTeleportFailed("Your home region could not be found."); |
648 | return; | 660 | return false; |
649 | } | 661 | } |
650 | 662 | ||
651 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", | 663 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: User's home region is {0} {1} ({2}-{3})", |
@@ -656,6 +668,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
656 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, | 668 | client, regionInfo.RegionHandle, uinfo.HomePosition, uinfo.HomeLookAt, |
657 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); | 669 | (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome)); |
658 | } | 670 | } |
671 | else | ||
672 | { | ||
673 | // can't find the Home region: Tell viewer and abort | ||
674 | client.SendTeleportFailed("Your home region could not be found."); | ||
675 | return false; | ||
676 | } | ||
677 | return true; | ||
659 | } | 678 | } |
660 | 679 | ||
661 | #endregion | 680 | #endregion |
@@ -999,15 +1018,19 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
999 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); | 1018 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); |
1000 | 1019 | ||
1001 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); | 1020 | IEventQueue eq = agent.Scene.RequestModuleInterface<IEventQueue>(); |
1002 | if (eq != null) | 1021 | IPEndPoint neighbourExternal = neighbourRegion.ExternalEndPoint; |
1003 | { | 1022 | if (neighbourExternal != null) |
1004 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | ||
1005 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1006 | } | ||
1007 | else | ||
1008 | { | 1023 | { |
1009 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourRegion.ExternalEndPoint, | 1024 | if (eq != null) |
1010 | capsPath); | 1025 | { |
1026 | eq.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
1027 | capsPath, agent.UUID, agent.ControllingClient.SessionId); | ||
1028 | } | ||
1029 | else | ||
1030 | { | ||
1031 | agent.ControllingClient.CrossRegion(neighbourHandle, pos, agent.Velocity, neighbourExternal, | ||
1032 | capsPath); | ||
1033 | } | ||
1011 | } | 1034 | } |
1012 | 1035 | ||
1013 | if (!WaitForCallback(agent.UUID)) | 1036 | if (!WaitForCallback(agent.UUID)) |
@@ -1122,10 +1145,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1122 | agent.Id0 = currentAgentCircuit.Id0; | 1145 | agent.Id0 = currentAgentCircuit.Id0; |
1123 | } | 1146 | } |
1124 | 1147 | ||
1125 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1148 | IPEndPoint external = region.ExternalEndPoint; |
1126 | d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, | 1149 | if (external != null) |
1150 | { | ||
1151 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | ||
1152 | d.BeginInvoke(sp, agent, region, external, true, | ||
1127 | InformClientOfNeighbourCompleted, | 1153 | InformClientOfNeighbourCompleted, |
1128 | d); | 1154 | d); |
1155 | } | ||
1129 | } | 1156 | } |
1130 | #endregion | 1157 | #endregion |
1131 | 1158 | ||
@@ -1259,6 +1286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1259 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; | 1286 | InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; |
1260 | try | 1287 | try |
1261 | { | 1288 | { |
1289 | //neighbour.ExternalEndPoint may return null, which will be caught | ||
1262 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, | 1290 | d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, |
1263 | InformClientOfNeighbourCompleted, | 1291 | InformClientOfNeighbourCompleted, |
1264 | d); | 1292 | d); |
@@ -1362,8 +1390,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1362 | 1390 | ||
1363 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); | 1391 | m_log.Debug("[ENTITY TRANSFER MODULE]: Completed inform client about neighbour " + endPoint.ToString()); |
1364 | } | 1392 | } |
1365 | if (!regionAccepted) | ||
1366 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Region {0} did not accept agent: {1}", reg.RegionName, reason); | ||
1367 | } | 1393 | } |
1368 | 1394 | ||
1369 | /// <summary> | 1395 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index a87279a..6daae62 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | |||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
84 | 84 | ||
85 | protected override void OnNewClient(IClientAPI client) | 85 | protected override void OnNewClient(IClientAPI client) |
86 | { | 86 | { |
87 | client.OnTeleportHomeRequest += TeleportHome; | 87 | client.OnTeleportHomeRequest += TriggerTeleportHome; |
88 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 88 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
89 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); | 89 | client.OnConnectionClosed += new Action<IClientAPI>(OnConnectionClosed); |
90 | } | 90 | } |
@@ -179,7 +179,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
179 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); | 179 | return m_aScene.SimulationService.CreateAgent(reg, agentCircuit, teleportFlags, out reason); |
180 | } | 180 | } |
181 | 181 | ||
182 | public override void TeleportHome(UUID id, IClientAPI client) | 182 | public void TriggerTeleportHome(UUID id, IClientAPI client) |
183 | { | ||
184 | TeleportHome(id, client); | ||
185 | } | ||
186 | |||
187 | public override bool TeleportHome(UUID id, IClientAPI client) | ||
183 | { | 188 | { |
184 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); | 189 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Request to teleport {0} {1} home", client.FirstName, client.LastName); |
185 | 190 | ||
@@ -189,8 +194,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
189 | { | 194 | { |
190 | // local grid user | 195 | // local grid user |
191 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); | 196 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: User is local"); |
192 | base.TeleportHome(id, client); | 197 | return base.TeleportHome(id, client); |
193 | return; | ||
194 | } | 198 | } |
195 | 199 | ||
196 | // Foreign user wants to go home | 200 | // Foreign user wants to go home |
@@ -200,7 +204,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
200 | { | 204 | { |
201 | client.SendTeleportFailed("Your information has been lost"); | 205 | client.SendTeleportFailed("Your information has been lost"); |
202 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); | 206 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Unable to locate agent's gateway information"); |
203 | return; | 207 | return false; |
204 | } | 208 | } |
205 | 209 | ||
206 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); | 210 | IUserAgentService userAgentService = new UserAgentServiceConnector(aCircuit.ServiceURLs["HomeURI"].ToString()); |
@@ -210,7 +214,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
210 | { | 214 | { |
211 | client.SendTeleportFailed("Your home region could not be found"); | 215 | client.SendTeleportFailed("Your home region could not be found"); |
212 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); | 216 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found"); |
213 | return; | 217 | return false; |
214 | } | 218 | } |
215 | 219 | ||
216 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); | 220 | ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId); |
@@ -218,7 +222,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
218 | { | 222 | { |
219 | client.SendTeleportFailed("Internal error"); | 223 | client.SendTeleportFailed("Internal error"); |
220 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); | 224 | m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be"); |
221 | return; | 225 | return false; |
222 | } | 226 | } |
223 | 227 | ||
224 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); | 228 | IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); |
@@ -228,6 +232,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
228 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); | 232 | aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName); |
229 | 233 | ||
230 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); | 234 | DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq); |
235 | return true; | ||
231 | } | 236 | } |
232 | 237 | ||
233 | /// <summary> | 238 | /// <summary> |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 54b422b..e0f8240 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -674,19 +674,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
674 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) | 674 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) |
675 | { | 675 | { |
676 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); | 676 | // m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID); |
677 | |||
678 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 677 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
679 | item = m_Scene.InventoryService.GetItem(item); | 678 | item = m_Scene.InventoryService.GetItem(item); |
680 | 679 | ||
681 | if (item == null) | 680 | if (item == null) |
682 | { | 681 | { |
683 | m_log.WarnFormat( | ||
684 | "[InventoryAccessModule]: Could not find item {0} for {1} in RezObject()", | ||
685 | itemID, remoteClient.Name); | ||
686 | 682 | ||
687 | return null; | 683 | return null; |
688 | } | 684 | } |
689 | 685 | ||
686 | |||
687 | |||
688 | |||
689 | |||
690 | |||
691 | |||
690 | item.Owner = remoteClient.AgentId; | 692 | item.Owner = remoteClient.AgentId; |
691 | 693 | ||
692 | return RezObject( | 694 | return RezObject( |
@@ -784,10 +786,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
784 | 786 | ||
785 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) | 787 | if (item != null && !DoPreRezWhenFromItem(remoteClient, item, objlist, pos, attachment)) |
786 | return null; | 788 | return null; |
787 | |||
788 | for (int i = 0; i < objlist.Count; i++) | 789 | for (int i = 0; i < objlist.Count; i++) |
789 | { | 790 | { |
790 | group = objlist[i]; | 791 | group = objlist[i]; |
792 | SceneObjectPart rootPart = group.RootPart; | ||
791 | 793 | ||
792 | // Vector3 storedPosition = group.AbsolutePosition; | 794 | // Vector3 storedPosition = group.AbsolutePosition; |
793 | if (group.UUID == UUID.Zero) | 795 | if (group.UUID == UUID.Zero) |
@@ -842,8 +844,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
842 | 844 | ||
843 | if (!attachment) | 845 | if (!attachment) |
844 | { | 846 | { |
845 | SceneObjectPart rootPart = group.RootPart; | ||
846 | |||
847 | if (rootPart.Shape.PCode == (byte)PCode.Prim) | 847 | if (rootPart.Shape.PCode == (byte)PCode.Prim) |
848 | group.ClearPartAttachmentData(); | 848 | group.ClearPartAttachmentData(); |
849 | 849 | ||
@@ -854,11 +854,47 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
854 | rootPart.ScheduleFullUpdate(); | 854 | rootPart.ScheduleFullUpdate(); |
855 | } | 855 | } |
856 | 856 | ||
857 | if ((rootPart.OwnerID != item.Owner) || | ||
858 | (item.CurrentPermissions & 16) != 0 || // Magic number | ||
859 | (item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0) | ||
860 | { | ||
861 | //Need to kill the for sale here | ||
862 | rootPart.ObjectSaleType = 0; | ||
863 | rootPart.SalePrice = 10; | ||
864 | |||
865 | if (m_Scene.Permissions.PropagatePermissions()) | ||
866 | { | ||
867 | foreach (SceneObjectPart part in group.Parts) | ||
868 | { | ||
869 | if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0) | ||
870 | { | ||
871 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0) | ||
872 | part.EveryoneMask = item.EveryOnePermissions; | ||
873 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0) | ||
874 | part.NextOwnerMask = item.NextPermissions; | ||
875 | if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0) | ||
876 | part.GroupMask = item.GroupPermissions; | ||
877 | } | ||
878 | } | ||
879 | |||
880 | foreach (SceneObjectPart part in group.Parts) | ||
881 | { | ||
882 | part.LastOwnerID = part.OwnerID; | ||
883 | part.OwnerID = item.Owner; | ||
884 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
885 | } | ||
886 | |||
887 | group.ApplyNextOwnerPermissions(); | ||
888 | } | ||
889 | } | ||
890 | |||
857 | // m_log.DebugFormat( | 891 | // m_log.DebugFormat( |
858 | // "[InventoryAccessModule]: Rezzed {0} {1} {2} for {3}", | 892 | // "[InventoryAccessModule]: Rezzed {0} {1} {2} for {3}", |
859 | // group.Name, group.LocalId, group.UUID, remoteClient.Name); | 893 | // group.Name, group.LocalId, group.UUID, remoteClient.Name); |
860 | } | 894 | } |
861 | 895 | ||
896 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | ||
897 | // TODO: Remove the magic number badness | ||
862 | if (item != null) | 898 | if (item != null) |
863 | DoPostRezWhenFromItem(item, attachment); | 899 | DoPostRezWhenFromItem(item, attachment); |
864 | 900 | ||
@@ -1111,4 +1147,4 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1111 | 1147 | ||
1112 | #endregion | 1148 | #endregion |
1113 | } | 1149 | } |
1114 | } \ No newline at end of file | 1150 | } |
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs index 2de8d7a..93e65c3 100644 --- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs +++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs | |||
@@ -181,7 +181,8 @@ namespace OpenSim.Region.CoreModules.World.LightShare | |||
181 | } | 181 | } |
182 | private void EventManager_OnMakeRootAgent(ScenePresence presence) | 182 | private void EventManager_OnMakeRootAgent(ScenePresence presence) |
183 | { | 183 | { |
184 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); | 184 | if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid) |
185 | m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client"); | ||
185 | SendProfileToClient(presence); | 186 | SendProfileToClient(presence); |
186 | } | 187 | } |
187 | private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID) | 188 | private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID) |
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 43672d1..5e28ee1 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -366,6 +366,10 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
366 | try | 366 | try |
367 | { | 367 | { |
368 | Request = (HttpWebRequest) WebRequest.Create(Url); | 368 | Request = (HttpWebRequest) WebRequest.Create(Url); |
369 | |||
370 | //This works around some buggy HTTP Servers like Lighttpd | ||
371 | Request.ServicePoint.Expect100Continue = false; | ||
372 | |||
369 | Request.Method = HttpMethod; | 373 | Request.Method = HttpMethod; |
370 | Request.ContentType = HttpMIMEType; | 374 | Request.ContentType = HttpMIMEType; |
371 | 375 | ||
@@ -440,7 +444,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest | |||
440 | { | 444 | { |
441 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; | 445 | HttpWebResponse webRsp = (HttpWebResponse)((WebException)e).Response; |
442 | Status = (int)webRsp.StatusCode; | 446 | Status = (int)webRsp.StatusCode; |
443 | ResponseBody = webRsp.StatusDescription; | 447 | try |
448 | { | ||
449 | using (Stream responseStream = webRsp.GetResponseStream()) | ||
450 | { | ||
451 | ResponseBody = responseStream.GetStreamString(); | ||
452 | } | ||
453 | } | ||
454 | catch | ||
455 | { | ||
456 | ResponseBody = webRsp.StatusDescription; | ||
457 | } | ||
444 | } | 458 | } |
445 | else | 459 | else |
446 | { | 460 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index a552a28..b6af1f2 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -60,6 +60,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
60 | //public ManualResetEvent ev; | 60 | //public ManualResetEvent ev; |
61 | public bool requestDone; | 61 | public bool requestDone; |
62 | public int startTime; | 62 | public int startTime; |
63 | public bool responseSent; | ||
63 | public string uri; | 64 | public string uri; |
64 | } | 65 | } |
65 | 66 | ||
@@ -76,7 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
76 | new Dictionary<string, UrlData>(); | 77 | new Dictionary<string, UrlData>(); |
77 | 78 | ||
78 | 79 | ||
79 | private int m_TotalUrls = 100; | 80 | private int m_TotalUrls = 5000; |
80 | 81 | ||
81 | private uint https_port = 0; | 82 | private uint https_port = 0; |
82 | private IHttpServer m_HttpServer = null; | 83 | private IHttpServer m_HttpServer = null; |
@@ -155,7 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
155 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); | 156 | engine.PostScriptEvent(itemID, "http_request", new Object[] { urlcode.ToString(), "URL_REQUEST_DENIED", "" }); |
156 | return urlcode; | 157 | return urlcode; |
157 | } | 158 | } |
158 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString() + "/"; | 159 | string url = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + "/lslhttp/" + urlcode.ToString(); |
159 | 160 | ||
160 | UrlData urlData = new UrlData(); | 161 | UrlData urlData = new UrlData(); |
161 | urlData.hostID = host.UUID; | 162 | urlData.hostID = host.UUID; |
@@ -165,10 +166,9 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
165 | urlData.urlcode = urlcode; | 166 | urlData.urlcode = urlcode; |
166 | urlData.requests = new Dictionary<UUID, RequestData>(); | 167 | urlData.requests = new Dictionary<UUID, RequestData>(); |
167 | 168 | ||
168 | |||
169 | m_UrlMap[url] = urlData; | 169 | m_UrlMap[url] = urlData; |
170 | 170 | ||
171 | string uri = "/lslhttp/" + urlcode.ToString() + "/"; | 171 | string uri = "/lslhttp/" + urlcode.ToString(); |
172 | 172 | ||
173 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, | 173 | m_HttpServer.AddPollServiceHTTPHandler(uri,HandleHttpPoll, |
174 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, | 174 | new PollServiceEventArgs(HttpRequestHandler,HasEvents, GetEvents, NoEvents, |
@@ -233,9 +233,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | foreach (UUID req in data.requests.Keys) | 236 | lock (m_RequestMap) |
237 | m_RequestMap.Remove(req); | 237 | { |
238 | 238 | foreach (UUID req in data.requests.Keys) | |
239 | m_RequestMap.Remove(req); | ||
240 | } | ||
241 | |||
239 | RemoveUrl(data); | 242 | RemoveUrl(data); |
240 | m_UrlMap.Remove(url); | 243 | m_UrlMap.Remove(url); |
241 | } | 244 | } |
@@ -243,32 +246,42 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
243 | 246 | ||
244 | public void HttpResponse(UUID request, int status, string body) | 247 | public void HttpResponse(UUID request, int status, string body) |
245 | { | 248 | { |
246 | if (m_RequestMap.ContainsKey(request)) | 249 | lock (m_RequestMap) |
247 | { | ||
248 | UrlData urlData = m_RequestMap[request]; | ||
249 | urlData.requests[request].responseCode = status; | ||
250 | urlData.requests[request].responseBody = body; | ||
251 | //urlData.requests[request].ev.Set(); | ||
252 | urlData.requests[request].requestDone =true; | ||
253 | } | ||
254 | else | ||
255 | { | 250 | { |
256 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | 251 | if (m_RequestMap.ContainsKey(request)) |
252 | { | ||
253 | UrlData urlData = m_RequestMap[request]; | ||
254 | if (!urlData.requests[request].responseSent) | ||
255 | { | ||
256 | urlData.requests[request].responseCode = status; | ||
257 | urlData.requests[request].responseBody = body; | ||
258 | //urlData.requests[request].ev.Set(); | ||
259 | urlData.requests[request].requestDone = true; | ||
260 | urlData.requests[request].responseSent = true; | ||
261 | } | ||
262 | } | ||
263 | else | ||
264 | { | ||
265 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | ||
266 | } | ||
257 | } | 267 | } |
258 | } | 268 | } |
259 | 269 | ||
260 | public string GetHttpHeader(UUID requestId, string header) | 270 | public string GetHttpHeader(UUID requestId, string header) |
261 | { | 271 | { |
262 | if (m_RequestMap.ContainsKey(requestId)) | 272 | lock (m_RequestMap) |
263 | { | ||
264 | UrlData urlData=m_RequestMap[requestId]; | ||
265 | string value; | ||
266 | if (urlData.requests[requestId].headers.TryGetValue(header,out value)) | ||
267 | return value; | ||
268 | } | ||
269 | else | ||
270 | { | 273 | { |
271 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | 274 | if (m_RequestMap.ContainsKey(requestId)) |
275 | { | ||
276 | UrlData urlData = m_RequestMap[requestId]; | ||
277 | string value; | ||
278 | if (urlData.requests[requestId].headers.TryGetValue(header, out value)) | ||
279 | return value; | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | ||
284 | } | ||
272 | } | 285 | } |
273 | return String.Empty; | 286 | return String.Empty; |
274 | } | 287 | } |
@@ -290,8 +303,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
290 | { | 303 | { |
291 | RemoveUrl(url.Value); | 304 | RemoveUrl(url.Value); |
292 | removeURLs.Add(url.Key); | 305 | removeURLs.Add(url.Key); |
293 | foreach (UUID req in url.Value.requests.Keys) | 306 | lock (m_RequestMap) |
294 | m_RequestMap.Remove(req); | 307 | { |
308 | foreach (UUID req in url.Value.requests.Keys) | ||
309 | m_RequestMap.Remove(req); | ||
310 | } | ||
295 | } | 311 | } |
296 | } | 312 | } |
297 | 313 | ||
@@ -312,8 +328,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
312 | { | 328 | { |
313 | RemoveUrl(url.Value); | 329 | RemoveUrl(url.Value); |
314 | removeURLs.Add(url.Key); | 330 | removeURLs.Add(url.Key); |
315 | foreach (UUID req in url.Value.requests.Keys) | 331 | lock (m_RequestMap) |
316 | m_RequestMap.Remove(req); | 332 | { |
333 | foreach (UUID req in url.Value.requests.Keys) | ||
334 | m_RequestMap.Remove(req); | ||
335 | } | ||
317 | } | 336 | } |
318 | } | 337 | } |
319 | 338 | ||
@@ -332,14 +351,16 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
332 | { | 351 | { |
333 | Hashtable response = new Hashtable(); | 352 | Hashtable response = new Hashtable(); |
334 | UrlData url; | 353 | UrlData url; |
354 | int startTime = 0; | ||
335 | lock (m_RequestMap) | 355 | lock (m_RequestMap) |
336 | { | 356 | { |
337 | if (!m_RequestMap.ContainsKey(requestID)) | 357 | if (!m_RequestMap.ContainsKey(requestID)) |
338 | return response; | 358 | return response; |
339 | url = m_RequestMap[requestID]; | 359 | url = m_RequestMap[requestID]; |
360 | startTime = url.requests[requestID].startTime; | ||
340 | } | 361 | } |
341 | 362 | ||
342 | if (System.Environment.TickCount - url.requests[requestID].startTime > 25000) | 363 | if (System.Environment.TickCount - startTime > 25000) |
343 | { | 364 | { |
344 | response["int_response_code"] = 500; | 365 | response["int_response_code"] = 500; |
345 | response["str_response_string"] = "Script timeout"; | 366 | response["str_response_string"] = "Script timeout"; |
@@ -348,9 +369,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
348 | response["reusecontext"] = false; | 369 | response["reusecontext"] = false; |
349 | 370 | ||
350 | //remove from map | 371 | //remove from map |
351 | lock (url) | 372 | lock (url.requests) |
352 | { | 373 | { |
353 | url.requests.Remove(requestID); | 374 | url.requests.Remove(requestID); |
375 | } | ||
376 | lock (m_RequestMap) | ||
377 | { | ||
354 | m_RequestMap.Remove(requestID); | 378 | m_RequestMap.Remove(requestID); |
355 | } | 379 | } |
356 | 380 | ||
@@ -372,22 +396,25 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
372 | return false; | 396 | return false; |
373 | } | 397 | } |
374 | url = m_RequestMap[requestID]; | 398 | url = m_RequestMap[requestID]; |
399 | } | ||
400 | lock (url.requests) | ||
401 | { | ||
375 | if (!url.requests.ContainsKey(requestID)) | 402 | if (!url.requests.ContainsKey(requestID)) |
376 | { | 403 | { |
377 | return false; | 404 | return false; |
378 | } | 405 | } |
406 | else | ||
407 | { | ||
408 | if (System.Environment.TickCount - url.requests[requestID].startTime > 25000) | ||
409 | { | ||
410 | return true; | ||
411 | } | ||
412 | if (url.requests[requestID].requestDone) | ||
413 | return true; | ||
414 | else | ||
415 | return false; | ||
416 | } | ||
379 | } | 417 | } |
380 | |||
381 | if (System.Environment.TickCount-url.requests[requestID].startTime>25000) | ||
382 | { | ||
383 | return true; | ||
384 | } | ||
385 | |||
386 | if (url.requests[requestID].requestDone) | ||
387 | return true; | ||
388 | else | ||
389 | return false; | ||
390 | |||
391 | } | 418 | } |
392 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) | 419 | private Hashtable GetEvents(UUID requestID, UUID sessionID, string request) |
393 | { | 420 | { |
@@ -399,9 +426,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
399 | if (!m_RequestMap.ContainsKey(requestID)) | 426 | if (!m_RequestMap.ContainsKey(requestID)) |
400 | return NoEvents(requestID,sessionID); | 427 | return NoEvents(requestID,sessionID); |
401 | url = m_RequestMap[requestID]; | 428 | url = m_RequestMap[requestID]; |
429 | } | ||
430 | lock (url.requests) | ||
431 | { | ||
402 | requestData = url.requests[requestID]; | 432 | requestData = url.requests[requestID]; |
403 | } | 433 | } |
404 | 434 | ||
405 | if (!requestData.requestDone) | 435 | if (!requestData.requestDone) |
406 | return NoEvents(requestID,sessionID); | 436 | return NoEvents(requestID,sessionID); |
407 | 437 | ||
@@ -424,14 +454,18 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
424 | response["reusecontext"] = false; | 454 | response["reusecontext"] = false; |
425 | 455 | ||
426 | //remove from map | 456 | //remove from map |
427 | lock (url) | 457 | lock (url.requests) |
428 | { | 458 | { |
429 | url.requests.Remove(requestID); | 459 | url.requests.Remove(requestID); |
460 | } | ||
461 | lock (m_RequestMap) | ||
462 | { | ||
430 | m_RequestMap.Remove(requestID); | 463 | m_RequestMap.Remove(requestID); |
431 | } | 464 | } |
432 | 465 | ||
433 | return response; | 466 | return response; |
434 | } | 467 | } |
468 | |||
435 | public void HttpRequestHandler(UUID requestID, Hashtable request) | 469 | public void HttpRequestHandler(UUID requestID, Hashtable request) |
436 | { | 470 | { |
437 | lock (request) | 471 | lock (request) |
@@ -447,8 +481,8 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
447 | 481 | ||
448 | int pos1 = uri.IndexOf("/");// /lslhttp | 482 | int pos1 = uri.IndexOf("/");// /lslhttp |
449 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ | 483 | int pos2 = uri.IndexOf("/", pos1 + 1);// /lslhttp/ |
450 | int pos3 = uri.IndexOf("/", pos2 + 1);// /lslhttp/<UUID>/ | 484 | int pos3 = pos2 + 37; // /lslhttp/urlcode |
451 | string uri_tmp = uri.Substring(0, pos3 + 1); | 485 | string uri_tmp = uri.Substring(0, pos3); |
452 | //HTTP server code doesn't provide us with QueryStrings | 486 | //HTTP server code doesn't provide us with QueryStrings |
453 | string pathInfo; | 487 | string pathInfo; |
454 | string queryString; | 488 | string queryString; |
@@ -457,10 +491,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
457 | pathInfo = uri.Substring(pos3); | 491 | pathInfo = uri.Substring(pos3); |
458 | 492 | ||
459 | UrlData url = null; | 493 | UrlData url = null; |
494 | string urlkey; | ||
460 | if (!is_ssl) | 495 | if (!is_ssl) |
461 | url = m_UrlMap["http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp]; | 496 | urlkey = "http://" + m_ExternalHostNameForLSL + ":" + m_HttpServer.Port.ToString() + uri_tmp; |
497 | //m_UrlMap[]; | ||
462 | else | 498 | else |
463 | url = m_UrlMap["https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp]; | 499 | urlkey = "https://" + m_ExternalHostNameForLSL + ":" + m_HttpsServer.Port.ToString() + uri_tmp; |
500 | |||
501 | if (m_UrlMap.ContainsKey(urlkey)) | ||
502 | { | ||
503 | url = m_UrlMap[urlkey]; | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | m_log.Warn("[HttpRequestHandler]: http-in request failed; no such url: "+urlkey.ToString()); | ||
508 | } | ||
464 | 509 | ||
465 | //for llGetHttpHeader support we need to store original URI here | 510 | //for llGetHttpHeader support we need to store original URI here |
466 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers | 511 | //to make x-path-info / x-query-string / x-script-url / x-remote-ip headers |
@@ -490,7 +535,14 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
490 | if (request.ContainsKey(key)) | 535 | if (request.ContainsKey(key)) |
491 | { | 536 | { |
492 | string val = (String)request[key]; | 537 | string val = (String)request[key]; |
493 | queryString = queryString + key + "=" + val + "&"; | 538 | if (key != "") |
539 | { | ||
540 | queryString = queryString + key + "=" + val + "&"; | ||
541 | } | ||
542 | else | ||
543 | { | ||
544 | queryString = queryString + val + "&"; | ||
545 | } | ||
494 | } | 546 | } |
495 | } | 547 | } |
496 | if (queryString.Length > 1) | 548 | if (queryString.Length > 1) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 2cf02b5..9714c36 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -272,7 +272,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
272 | if (s.RegionInfo.RegionID == destination.RegionID) | 272 | if (s.RegionInfo.RegionID == destination.RegionID) |
273 | return s.QueryAccess(id, position, out reason); | 273 | return s.QueryAccess(id, position, out reason); |
274 | } | 274 | } |
275 | //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); | ||
276 | return false; | 275 | return false; |
277 | } | 276 | } |
278 | 277 | ||
@@ -302,10 +301,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
302 | if (s.RegionInfo.RegionID == destination.RegionID) | 301 | if (s.RegionInfo.RegionID == destination.RegionID) |
303 | { | 302 | { |
304 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | 303 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); |
305 | // Let's spawn a threadlet right here, because this may take | 304 | return s.IncomingCloseAgent(id); |
306 | // a while | 305 | } |
307 | Util.FireAndForget(delegate { s.IncomingCloseAgent(id); }); | 306 | } |
308 | return true; | 307 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
308 | return false; | ||
309 | } | ||
310 | |||
311 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
312 | { | ||
313 | if (destination == null) | ||
314 | return false; | ||
315 | |||
316 | foreach (Scene s in m_sceneList) | ||
317 | { | ||
318 | if (s.RegionInfo.RegionID == destination.RegionID) | ||
319 | { | ||
320 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
321 | return s.IncomingCloseChildAgent(id); | ||
309 | } | 322 | } |
310 | } | 323 | } |
311 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | 324 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index f8cea71..391b1a1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -261,6 +261,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
261 | return false; | 261 | return false; |
262 | } | 262 | } |
263 | 263 | ||
264 | public bool CloseChildAgent(GridRegion destination, UUID id) | ||
265 | { | ||
266 | if (destination == null) | ||
267 | return false; | ||
268 | |||
269 | // Try local first | ||
270 | if (m_localBackend.CloseChildAgent(destination, id)) | ||
271 | return true; | ||
272 | |||
273 | // else do the remote thing | ||
274 | if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) | ||
275 | return m_remoteConnector.CloseChildAgent(destination, id); | ||
276 | |||
277 | return false; | ||
278 | } | ||
264 | 279 | ||
265 | public bool CloseAgent(GridRegion destination, UUID id) | 280 | public bool CloseAgent(GridRegion destination, UUID id) |
266 | { | 281 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 0a0ce3c..1ffd480 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs | |||
@@ -127,6 +127,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
127 | // FIXME: Why do we bother setting this module and caching up if we just end up registering the inner | 127 | // FIXME: Why do we bother setting this module and caching up if we just end up registering the inner |
128 | // user account service?! | 128 | // user account service?! |
129 | scene.RegisterModuleInterface<IUserAccountService>(UserAccountService); | 129 | scene.RegisterModuleInterface<IUserAccountService>(UserAccountService); |
130 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); | ||
130 | } | 131 | } |
131 | 132 | ||
132 | public void RemoveRegion(Scene scene) | 133 | public void RemoveRegion(Scene scene) |
@@ -179,6 +180,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
179 | return UserAccountService.GetUserAccount(scopeID, Email); | 180 | return UserAccountService.GetUserAccount(scopeID, Email); |
180 | } | 181 | } |
181 | 182 | ||
183 | public List<UserAccount> GetUserAccountsWhere(UUID scopeID, string query) | ||
184 | { | ||
185 | return null; | ||
186 | } | ||
187 | |||
182 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) | 188 | public List<UserAccount> GetUserAccounts(UUID scopeID, string query) |
183 | { | 189 | { |
184 | return UserAccountService.GetUserAccounts(scopeID, query); | 190 | return UserAccountService.GetUserAccounts(scopeID, query); |
@@ -193,4 +199,4 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
193 | 199 | ||
194 | #endregion | 200 | #endregion |
195 | } | 201 | } |
196 | } \ No newline at end of file | 202 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 3321b38..f6b6aeb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Region.Framework.Interfaces; | |||
33 | using OpenSim.Region.Framework.Scenes; | 33 | using OpenSim.Region.Framework.Scenes; |
34 | using OpenSim.Services.Interfaces; | 34 | using OpenSim.Services.Interfaces; |
35 | using OpenSim.Services.Connectors; | 35 | using OpenSim.Services.Connectors; |
36 | using OpenSim.Framework; | ||
36 | 37 | ||
37 | using OpenMetaverse; | 38 | using OpenMetaverse; |
38 | 39 | ||
@@ -101,6 +102,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
101 | return; | 102 | return; |
102 | 103 | ||
103 | scene.RegisterModuleInterface<IUserAccountService>(this); | 104 | scene.RegisterModuleInterface<IUserAccountService>(this); |
105 | scene.RegisterModuleInterface<IUserAccountCacheModule>(m_Cache); | ||
106 | |||
107 | scene.EventManager.OnNewClient += OnNewClient; | ||
104 | } | 108 | } |
105 | 109 | ||
106 | public void RemoveRegion(Scene scene) | 110 | public void RemoveRegion(Scene scene) |
@@ -115,6 +119,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
115 | return; | 119 | return; |
116 | } | 120 | } |
117 | 121 | ||
122 | // When a user actually enters the sim, clear them from | ||
123 | // cache so the sim will have the current values for | ||
124 | // flags, title, etc. And country, don't forget country! | ||
125 | private void OnNewClient(IClientAPI client) | ||
126 | { | ||
127 | m_Cache.Remove(client.Name); | ||
128 | } | ||
129 | |||
118 | #region Overwritten methods from IUserAccountService | 130 | #region Overwritten methods from IUserAccountService |
119 | 131 | ||
120 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) | 132 | public override UserAccount GetUserAccount(UUID scopeID, UUID userID) |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index ddef75f..cbe2eaa 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -34,7 +34,7 @@ using log4net; | |||
34 | 34 | ||
35 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | 35 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts |
36 | { | 36 | { |
37 | public class UserAccountCache | 37 | public class UserAccountCache : IUserAccountCacheModule |
38 | { | 38 | { |
39 | private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! | 39 | private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! |
40 | 40 | ||
@@ -92,5 +92,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
92 | 92 | ||
93 | return null; | 93 | return null; |
94 | } | 94 | } |
95 | |||
96 | public void Remove(string name) | ||
97 | { | ||
98 | if (!m_NameCache.Contains(name)) | ||
99 | return; | ||
100 | |||
101 | UUID uuid = UUID.Zero; | ||
102 | if (m_NameCache.TryGetValue(name, out uuid)) | ||
103 | { | ||
104 | m_NameCache.Remove(name); | ||
105 | m_UUIDCache.Remove(uuid); | ||
106 | } | ||
107 | } | ||
95 | } | 108 | } |
96 | } | 109 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 587d260..238863e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -292,6 +292,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
292 | // being no copy/no mod for everyone | 292 | // being no copy/no mod for everyone |
293 | lock (part.TaskInventory) | 293 | lock (part.TaskInventory) |
294 | { | 294 | { |
295 | if (!ResolveUserUuid(part.CreatorID)) | ||
296 | part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
297 | |||
298 | if (!ResolveUserUuid(part.OwnerID)) | ||
299 | part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
300 | |||
301 | if (!ResolveUserUuid(part.LastOwnerID)) | ||
302 | part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
303 | |||
304 | // And zap any troublesome sit target information | ||
305 | part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
306 | part.SitTargetPosition = new Vector3(0, 0, 0); | ||
307 | |||
308 | // Fix ownership/creator of inventory items | ||
309 | // Not doing so results in inventory items | ||
310 | // being no copy/no mod for everyone | ||
311 | part.TaskInventory.LockItemsForRead(true); | ||
295 | TaskInventoryDictionary inv = part.TaskInventory; | 312 | TaskInventoryDictionary inv = part.TaskInventory; |
296 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | 313 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) |
297 | { | 314 | { |
@@ -307,6 +324,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
307 | if (UserManager != null) | 324 | if (UserManager != null) |
308 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); | 325 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); |
309 | } | 326 | } |
327 | part.TaskInventory.LockItemsForRead(false); | ||
310 | } | 328 | } |
311 | } | 329 | } |
312 | 330 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 948aac8..900260d 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -251,18 +251,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
251 | 251 | ||
252 | if (asset != null) | 252 | if (asset != null) |
253 | { | 253 | { |
254 | if (m_options.ContainsKey("verbose")) | 254 | // m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id); |
255 | m_log.InfoFormat("[ARCHIVER]: Writing asset {0}", id); | ||
256 | |||
257 | m_foundAssetUuids.Add(asset.FullID); | 255 | m_foundAssetUuids.Add(asset.FullID); |
258 | 256 | ||
259 | m_assetsArchiver.WriteAsset(PostProcess(asset)); | 257 | m_assetsArchiver.WriteAsset(PostProcess(asset)); |
260 | } | 258 | } |
261 | else | 259 | else |
262 | { | 260 | { |
263 | if (m_options.ContainsKey("verbose")) | 261 | // m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id); |
264 | m_log.InfoFormat("[ARCHIVER]: Recording asset {0} as not found", id); | ||
265 | |||
266 | m_notFoundAssetUuids.Add(new UUID(id)); | 262 | m_notFoundAssetUuids.Add(new UUID(id)); |
267 | } | 263 | } |
268 | 264 | ||
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index c199a77..321f6b6 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -30,6 +30,7 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.Security; | 32 | using System.Security; |
33 | using System.Timers; | ||
33 | using log4net; | 34 | using log4net; |
34 | using Mono.Addins; | 35 | using Mono.Addins; |
35 | using Nini.Config; | 36 | using Nini.Config; |
@@ -47,6 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
47 | 48 | ||
48 | private delegate void LookupUUIDS(List<UUID> uuidLst); | 49 | private delegate void LookupUUIDS(List<UUID> uuidLst); |
49 | 50 | ||
51 | private Timer m_regionChangeTimer = new Timer(); | ||
50 | public Scene Scene { get; private set; } | 52 | public Scene Scene { get; private set; } |
51 | public IUserManagement UserManager { get; private set; } | 53 | public IUserManagement UserManager { get; private set; } |
52 | 54 | ||
@@ -60,8 +62,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
60 | 62 | ||
61 | #region Packet Data Responders | 63 | #region Packet Data Responders |
62 | 64 | ||
65 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) | ||
66 | { | ||
67 | sendDetailedEstateData(remote_client, invoice); | ||
68 | sendEstateLists(remote_client, invoice); | ||
69 | } | ||
70 | |||
63 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 71 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
64 | { | 72 | { |
73 | m_log.DebugFormat("[ESTATE]: Invoice is {0}", invoice.ToString()); | ||
65 | uint sun = 0; | 74 | uint sun = 0; |
66 | 75 | ||
67 | if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) | 76 | if (!Scene.RegionInfo.EstateSettings.UseGlobalTime) |
@@ -81,7 +90,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
81 | Scene.RegionInfo.RegionSettings.Covenant, | 90 | Scene.RegionInfo.RegionSettings.Covenant, |
82 | Scene.RegionInfo.EstateSettings.AbuseEmail, | 91 | Scene.RegionInfo.EstateSettings.AbuseEmail, |
83 | estateOwner); | 92 | estateOwner); |
93 | } | ||
84 | 94 | ||
95 | private void sendEstateLists(IClientAPI remote_client, UUID invoice) | ||
96 | { | ||
85 | remote_client.SendEstateList(invoice, | 97 | remote_client.SendEstateList(invoice, |
86 | (int)Constants.EstateAccessCodex.EstateManagers, | 98 | (int)Constants.EstateAccessCodex.EstateManagers, |
87 | Scene.RegionInfo.EstateSettings.EstateManagers, | 99 | Scene.RegionInfo.EstateSettings.EstateManagers, |
@@ -256,7 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
256 | timeInSeconds -= 15; | 268 | timeInSeconds -= 15; |
257 | } | 269 | } |
258 | 270 | ||
259 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 271 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); |
260 | } | 272 | } |
261 | } | 273 | } |
262 | 274 | ||
@@ -463,7 +475,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
463 | { | 475 | { |
464 | if (!s.IsChildAgent) | 476 | if (!s.IsChildAgent) |
465 | { | 477 | { |
466 | Scene.TeleportClientHome(user, s.ControllingClient); | 478 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) |
479 | { | ||
480 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
481 | s.ControllingClient.Close(); | ||
482 | } | ||
467 | } | 483 | } |
468 | } | 484 | } |
469 | 485 | ||
@@ -472,7 +488,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
472 | { | 488 | { |
473 | remote_client.SendAlertMessage("User is already on the region ban list"); | 489 | remote_client.SendAlertMessage("User is already on the region ban list"); |
474 | } | 490 | } |
475 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 491 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
476 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 492 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
477 | } | 493 | } |
478 | else | 494 | else |
@@ -527,7 +543,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
527 | remote_client.SendAlertMessage("User is not on the region ban list"); | 543 | remote_client.SendAlertMessage("User is not on the region ban list"); |
528 | } | 544 | } |
529 | 545 | ||
530 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 546 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
531 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 547 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
532 | } | 548 | } |
533 | else | 549 | else |
@@ -648,7 +664,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
648 | ScenePresence s = Scene.GetScenePresence(prey); | 664 | ScenePresence s = Scene.GetScenePresence(prey); |
649 | if (s != null) | 665 | if (s != null) |
650 | { | 666 | { |
651 | Scene.TeleportClientHome(prey, s.ControllingClient); | 667 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) |
668 | { | ||
669 | s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
670 | s.ControllingClient.Close(); | ||
671 | } | ||
652 | } | 672 | } |
653 | } | 673 | } |
654 | } | 674 | } |
@@ -667,7 +687,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
667 | // Also make sure they are actually in the region | 687 | // Also make sure they are actually in the region |
668 | if (p != null && !p.IsChildAgent) | 688 | if (p != null && !p.IsChildAgent) |
669 | { | 689 | { |
670 | Scene.TeleportClientHome(p.UUID, p.ControllingClient); | 690 | if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) |
691 | { | ||
692 | p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
693 | p.ControllingClient.Close(); | ||
694 | } | ||
671 | } | 695 | } |
672 | } | 696 | } |
673 | }); | 697 | }); |
@@ -912,7 +936,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
912 | 936 | ||
913 | for (int i = 0; i < uuidarr.Length; i++) | 937 | for (int i = 0; i < uuidarr.Length; i++) |
914 | { | 938 | { |
915 | // string lookupname = m_scene.CommsManager.UUIDNameRequestString(uuidarr[i]); | 939 | // string lookupname = Scene.CommsManager.UUIDNameRequestString(uuidarr[i]); |
916 | 940 | ||
917 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); | 941 | IUserManagement userManager = Scene.RequestModuleInterface<IUserManagement>(); |
918 | if (userManager != null) | 942 | if (userManager != null) |
@@ -1054,6 +1078,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1054 | 1078 | ||
1055 | public void AddRegion(Scene scene) | 1079 | public void AddRegion(Scene scene) |
1056 | { | 1080 | { |
1081 | m_regionChangeTimer.AutoReset = false; | ||
1082 | m_regionChangeTimer.Interval = 2000; | ||
1083 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
1084 | |||
1057 | Scene = scene; | 1085 | Scene = scene; |
1058 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1086 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1059 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1087 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
@@ -1102,7 +1130,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1102 | 1130 | ||
1103 | private void EventManager_OnNewClient(IClientAPI client) | 1131 | private void EventManager_OnNewClient(IClientAPI client) |
1104 | { | 1132 | { |
1105 | client.OnDetailedEstateDataRequest += sendDetailedEstateData; | 1133 | client.OnDetailedEstateDataRequest += clientSendDetailedEstateData; |
1106 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; | 1134 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; |
1107 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; | 1135 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; |
1108 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; | 1136 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; |
@@ -1153,6 +1181,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1153 | flags |= RegionFlags.AllowParcelChanges; | 1181 | flags |= RegionFlags.AllowParcelChanges; |
1154 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | 1182 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) |
1155 | flags |= RegionFlags.BlockParcelSearch; | 1183 | flags |= RegionFlags.BlockParcelSearch; |
1184 | if (Scene.RegionInfo.RegionSettings.GodBlockSearch) | ||
1185 | flags |= (RegionFlags)(1 << 11); | ||
1186 | if (Scene.RegionInfo.RegionSettings.Casino) | ||
1187 | flags |= (RegionFlags)(1 << 10); | ||
1156 | 1188 | ||
1157 | if (Scene.RegionInfo.RegionSettings.FixedSun) | 1189 | if (Scene.RegionInfo.RegionSettings.FixedSun) |
1158 | flags |= RegionFlags.SunFixed; | 1190 | flags |= RegionFlags.SunFixed; |
@@ -1160,11 +1192,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1160 | flags |= RegionFlags.Sandbox; | 1192 | flags |= RegionFlags.Sandbox; |
1161 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | 1193 | if (Scene.RegionInfo.EstateSettings.AllowVoice) |
1162 | flags |= RegionFlags.AllowVoice; | 1194 | flags |= RegionFlags.AllowVoice; |
1195 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1196 | flags |= RegionFlags.AllowLandmark; | ||
1197 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1198 | flags |= RegionFlags.AllowSetHome; | ||
1199 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1200 | flags |= RegionFlags.BlockDwell; | ||
1201 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1202 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1163 | 1203 | ||
1164 | // Fudge these to always on, so the menu options activate | ||
1165 | // | ||
1166 | flags |= RegionFlags.AllowLandmark; | ||
1167 | flags |= RegionFlags.AllowSetHome; | ||
1168 | 1204 | ||
1169 | // TODO: SkipUpdateInterestList | 1205 | // TODO: SkipUpdateInterestList |
1170 | 1206 | ||
@@ -1205,6 +1241,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1205 | flags |= RegionFlags.ResetHomeOnTeleport; | 1241 | flags |= RegionFlags.ResetHomeOnTeleport; |
1206 | if (Scene.RegionInfo.EstateSettings.TaxFree) | 1242 | if (Scene.RegionInfo.EstateSettings.TaxFree) |
1207 | flags |= RegionFlags.TaxFree; | 1243 | flags |= RegionFlags.TaxFree; |
1244 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1245 | flags |= RegionFlags.AllowLandmark; | ||
1246 | if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) | ||
1247 | flags |= RegionFlags.AllowParcelChanges; | ||
1248 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1249 | flags |= RegionFlags.AllowSetHome; | ||
1208 | if (Scene.RegionInfo.EstateSettings.DenyMinors) | 1250 | if (Scene.RegionInfo.EstateSettings.DenyMinors) |
1209 | flags |= (RegionFlags)(1 << 30); | 1251 | flags |= (RegionFlags)(1 << 30); |
1210 | 1252 | ||
@@ -1225,6 +1267,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1225 | 1267 | ||
1226 | public void TriggerRegionInfoChange() | 1268 | public void TriggerRegionInfoChange() |
1227 | { | 1269 | { |
1270 | m_regionChangeTimer.Stop(); | ||
1271 | m_regionChangeTimer.Start(); | ||
1272 | } | ||
1273 | |||
1274 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1275 | { | ||
1228 | ChangeDelegate change = OnRegionInfoChange; | 1276 | ChangeDelegate change = OnRegionInfoChange; |
1229 | 1277 | ||
1230 | if (change != null) | 1278 | if (change != null) |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 2117827..474905a 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 91 | private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
92 | 92 | ||
93 | private bool m_allowedForcefulBans = true; | 93 | private bool m_allowedForcefulBans = true; |
94 | private UUID DefaultGodParcelGroup; | ||
95 | private string DefaultGodParcelName; | ||
94 | 96 | ||
95 | // caches ExtendedLandData | 97 | // caches ExtendedLandData |
96 | private Cache parcelInfoCache; | 98 | private Cache parcelInfoCache; |
@@ -106,6 +108,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
106 | 108 | ||
107 | public void Initialise(IConfigSource source) | 109 | public void Initialise(IConfigSource source) |
108 | { | 110 | { |
111 | IConfig cnf = source.Configs["LandManagement"]; | ||
112 | if (cnf != null) | ||
113 | { | ||
114 | DefaultGodParcelGroup = new UUID(cnf.GetString("DefaultAdministratorGroupUUID", UUID.Zero.ToString())); | ||
115 | DefaultGodParcelName = cnf.GetString("DefaultAdministratorParcelName", "Default Parcel"); | ||
116 | } | ||
109 | } | 117 | } |
110 | 118 | ||
111 | public void AddRegion(Scene scene) | 119 | public void AddRegion(Scene scene) |
@@ -157,13 +165,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
157 | m_scene.UnregisterModuleCommander(m_commander.Name); | 165 | m_scene.UnregisterModuleCommander(m_commander.Name); |
158 | } | 166 | } |
159 | 167 | ||
160 | // private bool OnVerifyUserConnection(ScenePresence scenePresence, out string reason) | ||
161 | // { | ||
162 | // ILandObject nearestParcel = m_scene.GetNearestAllowedParcel(scenePresence.UUID, scenePresence.AbsolutePosition.X, scenePresence.AbsolutePosition.Y); | ||
163 | // reason = "You are not allowed to enter this sim."; | ||
164 | // return nearestParcel != null; | ||
165 | // } | ||
166 | |||
167 | /// <summary> | 168 | /// <summary> |
168 | /// Processes commandline input. Do not call directly. | 169 | /// Processes commandline input. Do not call directly. |
169 | /// </summary> | 170 | /// </summary> |
@@ -215,36 +216,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
215 | 216 | ||
216 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) | 217 | void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) |
217 | { | 218 | { |
218 | //If we are forcing a position for them to go | ||
219 | if (forcedPosition.ContainsKey(remoteClient.AgentId)) | ||
220 | { | ||
221 | ScenePresence clientAvatar = m_scene.GetScenePresence(remoteClient.AgentId); | ||
222 | |||
223 | //Putting the user into flying, both keeps the avatar in fligth when it bumps into something and stopped from going another direction AND | ||
224 | //When the avatar walks into a ban line on the ground, it prevents getting stuck | ||
225 | agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; | ||
226 | |||
227 | |||
228 | //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines | ||
229 | if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) | ||
230 | { | ||
231 | Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | ||
232 | forcedPosition.Remove(remoteClient.AgentId); | ||
233 | } | ||
234 | //if we are far away, teleport | ||
235 | else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) | ||
236 | { | ||
237 | Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); | ||
238 | clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); | ||
239 | forcedPosition.Remove(remoteClient.AgentId); | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | //Forces them toward the forced position we want if they aren't there yet | ||
244 | agentData.UseClientAgentPosition = true; | ||
245 | agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; | ||
246 | } | ||
247 | } | ||
248 | } | 219 | } |
249 | 220 | ||
250 | public void Close() | 221 | public void Close() |
@@ -363,10 +334,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
363 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) | 334 | private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) |
364 | { | 335 | { |
365 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; | 336 | if (m_scene.Permissions.IsGod(avatar.UUID)) return; |
366 | if (position.HasValue) | 337 | |
367 | { | 338 | if (!position.HasValue) |
368 | forcedPosition[avatar.ControllingClient.AgentId] = (Vector3)position; | 339 | return; |
369 | } | 340 | |
341 | bool isFlying = avatar.PhysicsActor.Flying; | ||
342 | avatar.RemoveFromPhysicalScene(); | ||
343 | |||
344 | avatar.AbsolutePosition = (Vector3)position; | ||
345 | |||
346 | avatar.AddToPhysicalScene(isFlying); | ||
370 | } | 347 | } |
371 | 348 | ||
372 | public void SendYouAreRestrictedNotice(ScenePresence avatar) | 349 | public void SendYouAreRestrictedNotice(ScenePresence avatar) |
@@ -386,29 +363,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
386 | } | 363 | } |
387 | 364 | ||
388 | if (parcelAvatarIsEntering != null) | 365 | if (parcelAvatarIsEntering != null) |
389 | { | 366 | EnforceBans(parcelAvatarIsEntering, avatar); |
390 | if (avatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
391 | { | ||
392 | if (parcelAvatarIsEntering.IsBannedFromLand(avatar.UUID)) | ||
393 | { | ||
394 | SendYouAreBannedNotice(avatar); | ||
395 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
396 | } | ||
397 | else if (parcelAvatarIsEntering.IsRestrictedFromLand(avatar.UUID)) | ||
398 | { | ||
399 | SendYouAreRestrictedNotice(avatar); | ||
400 | ForceAvatarToPosition(avatar, m_scene.GetNearestAllowedPosition(avatar)); | ||
401 | } | ||
402 | else | ||
403 | { | ||
404 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
405 | } | ||
406 | } | ||
407 | else | ||
408 | { | ||
409 | avatar.sentMessageAboutRestrictedParcelFlyingDown = true; | ||
410 | } | ||
411 | } | ||
412 | } | 367 | } |
413 | } | 368 | } |
414 | 369 | ||
@@ -512,6 +467,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
512 | //when we are finally in a safe place, lets release the forced position lock | 467 | //when we are finally in a safe place, lets release the forced position lock |
513 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); | 468 | forcedPosition.Remove(clientAvatar.ControllingClient.AgentId); |
514 | } | 469 | } |
470 | EnforceBans(parcel, clientAvatar); | ||
515 | } | 471 | } |
516 | } | 472 | } |
517 | 473 | ||
@@ -720,7 +676,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
720 | int x; | 676 | int x; |
721 | int y; | 677 | int y; |
722 | 678 | ||
723 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) | 679 | if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) |
724 | return null; | 680 | return null; |
725 | 681 | ||
726 | try | 682 | try |
@@ -770,14 +726,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
770 | { | 726 | { |
771 | try | 727 | try |
772 | { | 728 | { |
773 | return m_landList[m_landIDList[x / 4, y / 4]]; | 729 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) |
730 | return m_landList[m_landIDList[x / 4, y / 4]]; | ||
731 | //else | ||
732 | // return null; | ||
774 | } | 733 | } |
775 | catch (IndexOutOfRangeException) | 734 | catch (IndexOutOfRangeException) |
776 | { | 735 | { |
777 | // m_log.WarnFormat( | ||
778 | // "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}", | ||
779 | // x, y, m_scene.RegionInfo.RegionName); | ||
780 | |||
781 | return null; | 736 | return null; |
782 | } | 737 | } |
783 | } | 738 | } |
@@ -1060,6 +1015,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1060 | //Owner Flag | 1015 | //Owner Flag |
1061 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); | 1016 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_REQUESTER); |
1062 | } | 1017 | } |
1018 | else if (currentParcelBlock.LandData.IsGroupOwned && remote_client.IsGroupMember(currentParcelBlock.LandData.GroupID)) | ||
1019 | { | ||
1020 | tempByte = Convert.ToByte(tempByte | LandChannel.LAND_TYPE_OWNED_BY_GROUP); | ||
1021 | } | ||
1063 | else if (currentParcelBlock.LandData.SalePrice > 0 && | 1022 | else if (currentParcelBlock.LandData.SalePrice > 0 && |
1064 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || | 1023 | (currentParcelBlock.LandData.AuthBuyerID == UUID.Zero || |
1065 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) | 1024 | currentParcelBlock.LandData.AuthBuyerID == remote_client.AgentId)) |
@@ -1360,18 +1319,31 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1360 | 1319 | ||
1361 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1320 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
1362 | { | 1321 | { |
1363 | for (int i = 0; i < data.Count; i++) | 1322 | lock (m_landList) |
1364 | { | 1323 | { |
1365 | IncomingLandObjectFromStorage(data[i]); | 1324 | //Remove all the land objects in the sim and then process our new data |
1325 | foreach (int n in m_landList.Keys) | ||
1326 | { | ||
1327 | m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); | ||
1328 | } | ||
1329 | m_landIDList.Initialize(); | ||
1330 | m_landList.Clear(); | ||
1331 | |||
1332 | for (int i = 0; i < data.Count; i++) | ||
1333 | { | ||
1334 | IncomingLandObjectFromStorage(data[i]); | ||
1335 | } | ||
1366 | } | 1336 | } |
1367 | } | 1337 | } |
1368 | 1338 | ||
1369 | public void IncomingLandObjectFromStorage(LandData data) | 1339 | public void IncomingLandObjectFromStorage(LandData data) |
1370 | { | 1340 | { |
1341 | |||
1371 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); | 1342 | ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); |
1372 | new_land.LandData = data.Copy(); | 1343 | new_land.LandData = data.Copy(); |
1373 | new_land.SetLandBitmapFromByteArray(); | 1344 | new_land.SetLandBitmapFromByteArray(); |
1374 | AddLandObject(new_land); | 1345 | AddLandObject(new_land); |
1346 | new_land.SendLandUpdateToAvatarsOverMe(); | ||
1375 | } | 1347 | } |
1376 | 1348 | ||
1377 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) | 1349 | public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) |
@@ -1649,6 +1621,322 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1649 | 1621 | ||
1650 | UpdateLandObject(localID, land.LandData); | 1622 | UpdateLandObject(localID, land.LandData); |
1651 | } | 1623 | } |
1624 | |||
1625 | public void ClientOnParcelGodMark(IClientAPI client, UUID god, int landID) | ||
1626 | { | ||
1627 | ILandObject land = null; | ||
1628 | List<ILandObject> Land = ((Scene)client.Scene).LandChannel.AllParcels(); | ||
1629 | foreach (ILandObject landObject in Land) | ||
1630 | { | ||
1631 | if (landObject.LandData.LocalID == landID) | ||
1632 | { | ||
1633 | land = landObject; | ||
1634 | } | ||
1635 | } | ||
1636 | land.DeedToGroup(DefaultGodParcelGroup); | ||
1637 | land.LandData.Name = DefaultGodParcelName; | ||
1638 | land.SendLandUpdateToAvatarsOverMe(); | ||
1639 | } | ||
1640 | |||
1641 | private void ClientOnSimWideDeletes(IClientAPI client, UUID agentID, int flags, UUID targetID) | ||
1642 | { | ||
1643 | ScenePresence SP; | ||
1644 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out SP); | ||
1645 | List<SceneObjectGroup> returns = new List<SceneObjectGroup>(); | ||
1646 | if (SP.UserLevel != 0) | ||
1647 | { | ||
1648 | if (flags == 0) //All parcels, scripted or not | ||
1649 | { | ||
1650 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1651 | { | ||
1652 | if (e.OwnerID == targetID) | ||
1653 | { | ||
1654 | returns.Add(e); | ||
1655 | } | ||
1656 | } | ||
1657 | ); | ||
1658 | } | ||
1659 | if (flags == 4) //All parcels, scripted object | ||
1660 | { | ||
1661 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1662 | { | ||
1663 | if (e.OwnerID == targetID) | ||
1664 | { | ||
1665 | if (e.scriptScore >= 0.01) | ||
1666 | { | ||
1667 | returns.Add(e); | ||
1668 | } | ||
1669 | } | ||
1670 | } | ||
1671 | ); | ||
1672 | } | ||
1673 | if (flags == 4) //not target parcel, scripted object | ||
1674 | { | ||
1675 | ((Scene)client.Scene).ForEachSOG(delegate(SceneObjectGroup e) | ||
1676 | { | ||
1677 | if (e.OwnerID == targetID) | ||
1678 | { | ||
1679 | ILandObject landobject = ((Scene)client.Scene).LandChannel.GetLandObject(e.AbsolutePosition.X, e.AbsolutePosition.Y); | ||
1680 | if (landobject.LandData.OwnerID != e.OwnerID) | ||
1681 | { | ||
1682 | if (e.scriptScore >= 0.01) | ||
1683 | { | ||
1684 | returns.Add(e); | ||
1685 | } | ||
1686 | } | ||
1687 | } | ||
1688 | } | ||
1689 | ); | ||
1690 | } | ||
1691 | foreach (SceneObjectGroup ol in returns) | ||
1692 | { | ||
1693 | ReturnObject(ol, client); | ||
1694 | } | ||
1695 | } | ||
1696 | } | ||
1697 | public void ReturnObject(SceneObjectGroup obj, IClientAPI client) | ||
1698 | { | ||
1699 | SceneObjectGroup[] objs = new SceneObjectGroup[1]; | ||
1700 | objs[0] = obj; | ||
1701 | ((Scene)client.Scene).returnObjects(objs, client.AgentId); | ||
1702 | } | ||
1703 | |||
1704 | Dictionary<UUID, System.Threading.Timer> Timers = new Dictionary<UUID, System.Threading.Timer>(); | ||
1705 | |||
1706 | public void ClientOnParcelFreezeUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1707 | { | ||
1708 | ScenePresence targetAvatar = null; | ||
1709 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1710 | ScenePresence parcelManager = null; | ||
1711 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1712 | System.Threading.Timer Timer; | ||
1713 | |||
1714 | if (targetAvatar.UserLevel == 0) | ||
1715 | { | ||
1716 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1717 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1718 | return; | ||
1719 | if (flags == 0) | ||
1720 | { | ||
1721 | targetAvatar.AllowMovement = false; | ||
1722 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has frozen you for 30 seconds. You cannot move or interact with the world."); | ||
1723 | parcelManager.ControllingClient.SendAlertMessage("Avatar Frozen."); | ||
1724 | System.Threading.TimerCallback timeCB = new System.Threading.TimerCallback(OnEndParcelFrozen); | ||
1725 | Timer = new System.Threading.Timer(timeCB, targetAvatar, 30000, 0); | ||
1726 | Timers.Add(targetAvatar.UUID, Timer); | ||
1727 | } | ||
1728 | else | ||
1729 | { | ||
1730 | targetAvatar.AllowMovement = true; | ||
1731 | targetAvatar.ControllingClient.SendAlertMessage(parcelManager.Firstname + " " + parcelManager.Lastname + " has unfrozen you."); | ||
1732 | parcelManager.ControllingClient.SendAlertMessage("Avatar Unfrozen."); | ||
1733 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1734 | Timers.Remove(targetAvatar.UUID); | ||
1735 | Timer.Dispose(); | ||
1736 | } | ||
1737 | } | ||
1738 | } | ||
1739 | private void OnEndParcelFrozen(object avatar) | ||
1740 | { | ||
1741 | ScenePresence targetAvatar = (ScenePresence)avatar; | ||
1742 | targetAvatar.AllowMovement = true; | ||
1743 | System.Threading.Timer Timer; | ||
1744 | Timers.TryGetValue(targetAvatar.UUID, out Timer); | ||
1745 | Timers.Remove(targetAvatar.UUID); | ||
1746 | targetAvatar.ControllingClient.SendAgentAlertMessage("The freeze has worn off; you may go about your business.", false); | ||
1747 | } | ||
1748 | |||
1749 | |||
1750 | public void ClientOnParcelEjectUser(IClientAPI client, UUID parcelowner, uint flags, UUID target) | ||
1751 | { | ||
1752 | ScenePresence targetAvatar = null; | ||
1753 | ((Scene)client.Scene).TryGetScenePresence(target, out targetAvatar); | ||
1754 | ScenePresence parcelManager = null; | ||
1755 | ((Scene)client.Scene).TryGetScenePresence(client.AgentId, out parcelManager); | ||
1756 | //Just eject | ||
1757 | if (flags == 0) | ||
1758 | { | ||
1759 | if (targetAvatar.UserLevel == 0) | ||
1760 | { | ||
1761 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1762 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1763 | return; | ||
1764 | |||
1765 | Vector3 position = new Vector3(0, 0, 0); | ||
1766 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1767 | allParcels = AllParcels(); | ||
1768 | if (allParcels.Count != 1) | ||
1769 | { | ||
1770 | foreach (ILandObject parcel in allParcels) | ||
1771 | { | ||
1772 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1773 | { | ||
1774 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1775 | { | ||
1776 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1777 | { | ||
1778 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1779 | { | ||
1780 | if (parcel.ContainsPoint(x, y)) | ||
1781 | { | ||
1782 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1783 | targetAvatar.TeleportWithMomentum(position); | ||
1784 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1785 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1786 | return; | ||
1787 | } | ||
1788 | } | ||
1789 | } | ||
1790 | } | ||
1791 | } | ||
1792 | } | ||
1793 | } | ||
1794 | Vector3 targetVector; | ||
1795 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1796 | { | ||
1797 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1798 | { | ||
1799 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1800 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1801 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1802 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1803 | return; | ||
1804 | } | ||
1805 | else | ||
1806 | { | ||
1807 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1808 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1809 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1810 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1811 | return; | ||
1812 | } | ||
1813 | } | ||
1814 | else | ||
1815 | { | ||
1816 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1817 | { | ||
1818 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1819 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1820 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1821 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1822 | return; | ||
1823 | } | ||
1824 | else | ||
1825 | { | ||
1826 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1827 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1828 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1829 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected."); | ||
1830 | return; | ||
1831 | } | ||
1832 | } | ||
1833 | } | ||
1834 | } | ||
1835 | //Eject and ban | ||
1836 | if (flags == 1) | ||
1837 | { | ||
1838 | if (targetAvatar.UserLevel == 0) | ||
1839 | { | ||
1840 | ILandObject land = ((Scene)client.Scene).LandChannel.GetLandObject(targetAvatar.AbsolutePosition.X, targetAvatar.AbsolutePosition.Y); | ||
1841 | if (!((Scene)client.Scene).Permissions.CanEditParcelProperties(client.AgentId, land, GroupPowers.LandEjectAndFreeze)) | ||
1842 | return; | ||
1843 | |||
1844 | Vector3 position = new Vector3(0, 0, 0); | ||
1845 | List<ILandObject> allParcels = new List<ILandObject>(); | ||
1846 | allParcels = AllParcels(); | ||
1847 | if (allParcels.Count != 1) | ||
1848 | { | ||
1849 | foreach (ILandObject parcel in allParcels) | ||
1850 | { | ||
1851 | if (parcel.LandData.GlobalID != land.LandData.GlobalID) | ||
1852 | { | ||
1853 | if (parcel.IsEitherBannedOrRestricted(targetAvatar.UUID) != true) | ||
1854 | { | ||
1855 | for (int x = 1; x <= Constants.RegionSize; x += 2) | ||
1856 | { | ||
1857 | for (int y = 1; y <= Constants.RegionSize; y += 2) | ||
1858 | { | ||
1859 | if (parcel.ContainsPoint(x, y)) | ||
1860 | { | ||
1861 | position = new Vector3(x, y, targetAvatar.AbsolutePosition.Z); | ||
1862 | targetAvatar.TeleportWithMomentum(position); | ||
1863 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1864 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1865 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1866 | entry.AgentID = targetAvatar.UUID; | ||
1867 | entry.Flags = AccessList.Ban; | ||
1868 | entry.Time = new DateTime(); | ||
1869 | land.LandData.ParcelAccessList.Add(entry); | ||
1870 | return; | ||
1871 | } | ||
1872 | } | ||
1873 | } | ||
1874 | } | ||
1875 | } | ||
1876 | } | ||
1877 | } | ||
1878 | Vector3 targetVector; | ||
1879 | if (targetAvatar.AbsolutePosition.X > targetAvatar.AbsolutePosition.Y) | ||
1880 | { | ||
1881 | if (targetAvatar.AbsolutePosition.X > .5 * Constants.RegionSize) | ||
1882 | { | ||
1883 | targetVector = new Vector3(Constants.RegionSize, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1884 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1885 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1886 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1887 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1888 | entry.AgentID = targetAvatar.UUID; | ||
1889 | entry.Flags = AccessList.Ban; | ||
1890 | entry.Time = new DateTime(); | ||
1891 | land.LandData.ParcelAccessList.Add(entry); | ||
1892 | return; | ||
1893 | } | ||
1894 | else | ||
1895 | { | ||
1896 | targetVector = new Vector3(0, targetAvatar.AbsolutePosition.Y, targetAvatar.AbsolutePosition.Z); ; | ||
1897 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1898 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1899 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1900 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1901 | entry.AgentID = targetAvatar.UUID; | ||
1902 | entry.Flags = AccessList.Ban; | ||
1903 | entry.Time = new DateTime(); | ||
1904 | land.LandData.ParcelAccessList.Add(entry); | ||
1905 | return; | ||
1906 | } | ||
1907 | } | ||
1908 | else | ||
1909 | { | ||
1910 | if (targetAvatar.AbsolutePosition.Y > .5 * Constants.RegionSize) | ||
1911 | { | ||
1912 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, Constants.RegionSize, targetAvatar.AbsolutePosition.Z); ; | ||
1913 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1914 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1915 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1916 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1917 | entry.AgentID = targetAvatar.UUID; | ||
1918 | entry.Flags = AccessList.Ban; | ||
1919 | entry.Time = new DateTime(); | ||
1920 | land.LandData.ParcelAccessList.Add(entry); | ||
1921 | return; | ||
1922 | } | ||
1923 | else | ||
1924 | { | ||
1925 | targetVector = new Vector3(targetAvatar.AbsolutePosition.X, 0, targetAvatar.AbsolutePosition.Z); ; | ||
1926 | targetAvatar.TeleportWithMomentum(targetVector); | ||
1927 | targetAvatar.ControllingClient.SendAlertMessage("You have been ejected and banned by " + parcelManager.Firstname + " " + parcelManager.Lastname); | ||
1928 | parcelManager.ControllingClient.SendAlertMessage("Avatar Ejected and Banned."); | ||
1929 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | ||
1930 | entry.AgentID = targetAvatar.UUID; | ||
1931 | entry.Flags = AccessList.Ban; | ||
1932 | entry.Time = new DateTime(); | ||
1933 | land.LandData.ParcelAccessList.Add(entry); | ||
1934 | return; | ||
1935 | } | ||
1936 | } | ||
1937 | } | ||
1938 | } | ||
1939 | } | ||
1652 | 1940 | ||
1653 | protected void InstallInterfaces() | 1941 | protected void InstallInterfaces() |
1654 | { | 1942 | { |
@@ -1711,5 +1999,27 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1711 | 1999 | ||
1712 | MainConsole.Instance.Output(report.ToString()); | 2000 | MainConsole.Instance.Output(report.ToString()); |
1713 | } | 2001 | } |
2002 | |||
2003 | public void EnforceBans(ILandObject land, ScenePresence avatar) | ||
2004 | { | ||
2005 | if (avatar.AbsolutePosition.Z > LandChannel.BAN_LINE_SAFETY_HIEGHT) | ||
2006 | return; | ||
2007 | |||
2008 | if (land.IsEitherBannedOrRestricted(avatar.UUID)) | ||
2009 | { | ||
2010 | if (land.ContainsPoint(Convert.ToInt32(avatar.lastKnownAllowedPosition.X), Convert.ToInt32(avatar.lastKnownAllowedPosition.Y))) | ||
2011 | { | ||
2012 | Vector3? pos = m_scene.GetNearestAllowedPosition(avatar); | ||
2013 | if (pos == null) | ||
2014 | m_scene.TeleportClientHome(avatar.UUID, avatar.ControllingClient); | ||
2015 | else | ||
2016 | ForceAvatarToPosition(avatar, (Vector3)pos); | ||
2017 | } | ||
2018 | else | ||
2019 | { | ||
2020 | ForceAvatarToPosition(avatar, avatar.lastKnownAllowedPosition); | ||
2021 | } | ||
2022 | } | ||
2023 | } | ||
1714 | } | 2024 | } |
1715 | } \ No newline at end of file | 2025 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 8c40171..950dff7 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -190,10 +190,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
190 | else | 190 | else |
191 | { | 191 | { |
192 | // Normal Calculations | 192 | // Normal Calculations |
193 | int parcelMax = (int)(((float)LandData.Area / 65536.0f) | 193 | int parcelMax = (int)((double)(LandData.Area |
194 | * (float)m_scene.RegionInfo.ObjectCapacity | 194 | * m_scene.RegionInfo.ObjectCapacity) |
195 | * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); | 195 | * m_scene.RegionInfo.RegionSettings.ObjectBonus) |
196 | // TODO: The calculation of ObjectBonus should be refactored. It does still not work in the same manner as SL! | 196 | / 65536; |
197 | return parcelMax; | ||
198 | } | ||
199 | } | ||
200 | |||
201 | private int GetParcelBasePrimCount() | ||
202 | { | ||
203 | if (overrideParcelMaxPrimCount != null) | ||
204 | { | ||
205 | return overrideParcelMaxPrimCount(this); | ||
206 | } | ||
207 | else | ||
208 | { | ||
209 | // Normal Calculations | ||
210 | int parcelMax = LandData.Area | ||
211 | * m_scene.RegionInfo.ObjectCapacity | ||
212 | / 65536; | ||
197 | return parcelMax; | 213 | return parcelMax; |
198 | } | 214 | } |
199 | } | 215 | } |
@@ -245,7 +261,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
245 | remote_client.SendLandProperties(seq_id, | 261 | remote_client.SendLandProperties(seq_id, |
246 | snap_selection, request_result, this, | 262 | snap_selection, request_result, this, |
247 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, | 263 | (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, |
248 | GetParcelMaxPrimCount(), | 264 | GetParcelBasePrimCount(), |
249 | GetSimulatorMaxPrimCount(), regionFlags); | 265 | GetSimulatorMaxPrimCount(), regionFlags); |
250 | } | 266 | } |
251 | 267 | ||
@@ -304,7 +320,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
304 | 320 | ||
305 | allowedDelta |= (uint)(ParcelFlags.ShowDirectory | | 321 | allowedDelta |= (uint)(ParcelFlags.ShowDirectory | |
306 | ParcelFlags.AllowPublish | | 322 | ParcelFlags.AllowPublish | |
307 | ParcelFlags.MaturePublish); | 323 | ParcelFlags.MaturePublish) | (uint)(1 << 23); |
308 | } | 324 | } |
309 | 325 | ||
310 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) | 326 | if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId,this, GroupPowers.LandChangeIdentity)) |
@@ -416,9 +432,43 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
416 | return false; | 432 | return false; |
417 | } | 433 | } |
418 | 434 | ||
435 | public bool HasGroupAccess(UUID avatar) | ||
436 | { | ||
437 | if (LandData.GroupID != UUID.Zero && (LandData.Flags & (uint)ParcelFlags.UseAccessGroup) == (uint)ParcelFlags.UseAccessGroup) | ||
438 | { | ||
439 | ScenePresence sp; | ||
440 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | ||
441 | { | ||
442 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | ||
443 | if (groupsModule == null) | ||
444 | return false; | ||
445 | |||
446 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | ||
447 | if (membership == null || membership.Length == 0) | ||
448 | return false; | ||
449 | |||
450 | foreach (GroupMembershipData d in membership) | ||
451 | { | ||
452 | if (d.GroupID == LandData.GroupID) | ||
453 | return true; | ||
454 | } | ||
455 | return false; | ||
456 | } | ||
457 | |||
458 | if (!sp.ControllingClient.IsGroupMember(LandData.GroupID)) | ||
459 | return false; | ||
460 | |||
461 | return true; | ||
462 | } | ||
463 | return false; | ||
464 | } | ||
465 | |||
419 | public bool IsBannedFromLand(UUID avatar) | 466 | public bool IsBannedFromLand(UUID avatar) |
420 | { | 467 | { |
421 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 468 | if (m_scene.Permissions.IsAdministrator(avatar)) |
469 | return false; | ||
470 | |||
471 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
422 | return false; | 472 | return false; |
423 | 473 | ||
424 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 474 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
@@ -429,7 +479,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
429 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) | 479 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) |
430 | return true; | 480 | return true; |
431 | return false; | 481 | return false; |
432 | }) != -1) | 482 | }) != -1 && LandData.OwnerID != avatar) |
433 | { | 483 | { |
434 | return true; | 484 | return true; |
435 | } | 485 | } |
@@ -439,7 +489,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
439 | 489 | ||
440 | public bool IsRestrictedFromLand(UUID avatar) | 490 | public bool IsRestrictedFromLand(UUID avatar) |
441 | { | 491 | { |
442 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 492 | if (m_scene.Permissions.IsAdministrator(avatar)) |
493 | return false; | ||
494 | |||
495 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
443 | return false; | 496 | return false; |
444 | 497 | ||
445 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 498 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
@@ -450,11 +503,15 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
450 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | 503 | if (e.AgentID == avatar && e.Flags == AccessList.Access) |
451 | return true; | 504 | return true; |
452 | return false; | 505 | return false; |
453 | }) == -1) | 506 | }) == -1 && LandData.OwnerID != avatar) |
454 | { | 507 | { |
455 | return true; | 508 | if (!HasGroupAccess(avatar)) |
509 | { | ||
510 | return true; | ||
511 | } | ||
456 | } | 512 | } |
457 | } | 513 | } |
514 | |||
458 | return false; | 515 | return false; |
459 | } | 516 | } |
460 | 517 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index efede5c..5122734 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | |||
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) | 206 | if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts)) |
207 | { | 207 | { |
208 | UUID landOwner = landData.OwnerID; | 208 | UUID landOwner = landData.OwnerID; |
209 | int partCount = obj.Parts.Length; | 209 | int partCount = obj.GetPartCount(); |
210 | 210 | ||
211 | m_SimwideCounts[landOwner] += partCount; | 211 | m_SimwideCounts[landOwner] += partCount; |
212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) | 212 | if (parcelCounts.Users.ContainsKey(obj.OwnerID)) |
@@ -593,4 +593,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
593 | } | 593 | } |
594 | } | 594 | } |
595 | } | 595 | } |
596 | } \ No newline at end of file | 596 | } |
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 1e4f0a4..eb4731c 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs | |||
@@ -176,6 +176,13 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell | |||
176 | return false; | 176 | return false; |
177 | } | 177 | } |
178 | 178 | ||
179 | if ((perms & (uint)PermissionMask.Copy) == 0) | ||
180 | { | ||
181 | if (m_dialogModule != null) | ||
182 | m_dialogModule.SendAlertToUser(remoteClient, "This sale has been blocked by the permissions system"); | ||
183 | return false; | ||
184 | } | ||
185 | |||
179 | AssetBase asset = m_scene.CreateAsset( | 186 | AssetBase asset = m_scene.CreateAsset( |
180 | group.GetPartName(localID), | 187 | group.GetPartName(localID), |
181 | group.GetPartDescription(localID), | 188 | group.GetPartDescription(localID), |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 3b661ed..2e877f0 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -364,7 +364,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
364 | 364 | ||
365 | public string Name | 365 | public string Name |
366 | { | 366 | { |
367 | get { return "PermissionsModule"; } | 367 | get { return "DefaultPermissionsModule"; } |
368 | } | 368 | } |
369 | 369 | ||
370 | public bool IsSharedModule | 370 | public bool IsSharedModule |
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 0f37ddd..7f6f4df 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -28,6 +28,8 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Timers; | 30 | using System.Timers; |
31 | using System.IO; | ||
32 | using System.Diagnostics; | ||
31 | using System.Threading; | 33 | using System.Threading; |
32 | using System.Collections.Generic; | 34 | using System.Collections.Generic; |
33 | using log4net; | 35 | using log4net; |
@@ -56,13 +58,23 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
56 | protected UUID m_Initiator; | 58 | protected UUID m_Initiator; |
57 | protected bool m_Notice = false; | 59 | protected bool m_Notice = false; |
58 | protected IDialogModule m_DialogModule = null; | 60 | protected IDialogModule m_DialogModule = null; |
61 | protected string m_MarkerPath = String.Empty; | ||
59 | 62 | ||
60 | public void Initialise(IConfigSource config) | 63 | public void Initialise(IConfigSource config) |
61 | { | 64 | { |
65 | IConfig restartConfig = config.Configs["RestartModule"]; | ||
66 | if (restartConfig != null) | ||
67 | { | ||
68 | m_MarkerPath = restartConfig.GetString("MarkerPath", String.Empty); | ||
69 | } | ||
62 | } | 70 | } |
63 | 71 | ||
64 | public void AddRegion(Scene scene) | 72 | public void AddRegion(Scene scene) |
65 | { | 73 | { |
74 | if (m_MarkerPath != String.Empty) | ||
75 | File.Delete(Path.Combine(m_MarkerPath, | ||
76 | scene.RegionInfo.RegionID.ToString())); | ||
77 | |||
66 | m_Scene = scene; | 78 | m_Scene = scene; |
67 | 79 | ||
68 | scene.RegisterModuleInterface<IRestartModule>(this); | 80 | scene.RegisterModuleInterface<IRestartModule>(this); |
@@ -121,6 +133,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
121 | 133 | ||
122 | if (alerts == null) | 134 | if (alerts == null) |
123 | { | 135 | { |
136 | CreateMarkerFile(); | ||
124 | m_Scene.RestartNow(); | 137 | m_Scene.RestartNow(); |
125 | return; | 138 | return; |
126 | } | 139 | } |
@@ -134,6 +147,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
134 | 147 | ||
135 | if (m_Alerts[0] == 0) | 148 | if (m_Alerts[0] == 0) |
136 | { | 149 | { |
150 | CreateMarkerFile(); | ||
137 | m_Scene.RestartNow(); | 151 | m_Scene.RestartNow(); |
138 | return; | 152 | return; |
139 | } | 153 | } |
@@ -147,6 +161,7 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
147 | { | 161 | { |
148 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) | 162 | if (m_Alerts.Count == 0 || m_Alerts[0] == 0) |
149 | { | 163 | { |
164 | CreateMarkerFile(); | ||
150 | m_Scene.RestartNow(); | 165 | m_Scene.RestartNow(); |
151 | return 0; | 166 | return 0; |
152 | } | 167 | } |
@@ -266,5 +281,25 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
266 | 281 | ||
267 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); | 282 | ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); |
268 | } | 283 | } |
284 | |||
285 | protected void CreateMarkerFile() | ||
286 | { | ||
287 | if (m_MarkerPath == String.Empty) | ||
288 | return; | ||
289 | |||
290 | string path = Path.Combine(m_MarkerPath, m_Scene.RegionInfo.RegionID.ToString()); | ||
291 | try | ||
292 | { | ||
293 | string pidstring = System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); | ||
294 | FileStream fs = File.Create(path); | ||
295 | System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); | ||
296 | Byte[] buf = enc.GetBytes(pidstring); | ||
297 | fs.Write(buf, 0, buf.Length); | ||
298 | fs.Close(); | ||
299 | } | ||
300 | catch (Exception) | ||
301 | { | ||
302 | } | ||
303 | } | ||
269 | } | 304 | } |
270 | } | 305 | } |
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index c832520..a93ffaa 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | |||
@@ -584,6 +584,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain | |||
584 | m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); | 584 | m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); |
585 | m_scene.SaveTerrain(); | 585 | m_scene.SaveTerrain(); |
586 | 586 | ||
587 | m_scene.EventManager.TriggerTerrainUpdate(); | ||
588 | |||
587 | // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. | 589 | // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. |
588 | //m_scene.CreateTerrainTexture(true); | 590 | //m_scene.CreateTerrainTexture(true); |
589 | } | 591 | } |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index 3804017..c13e9c6 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -86,9 +86,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
86 | 86 | ||
87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) | 87 | private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) |
88 | { | 88 | { |
89 | if (mapName.Length < 3) | 89 | if (mapName.Length < 2) |
90 | { | 90 | { |
91 | remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); | 91 | remoteClient.SendAlertMessage("Use a search string with at least 2 characters"); |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | 94 | ||
@@ -99,7 +99,7 @@ m_log.DebugFormat("MAP NAME=({0})", mapName); | |||
99 | if (regionInfos.Count == 0) | 99 | if (regionInfos.Count == 0) |
100 | remoteClient.SendAlertMessage("Hyperlink could not be established."); | 100 | remoteClient.SendAlertMessage("Hyperlink could not be established."); |
101 | 101 | ||
102 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); | 102 | //m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
103 | List<MapBlockData> blocks = new List<MapBlockData>(); | 103 | List<MapBlockData> blocks = new List<MapBlockData>(); |
104 | 104 | ||
105 | MapBlockData data; | 105 | MapBlockData data; |
@@ -128,7 +128,7 @@ m_log.DebugFormat("MAP NAME=({0})", mapName); | |||
128 | data.Agents = 0; | 128 | data.Agents = 0; |
129 | data.Access = 255; | 129 | data.Access = 255; |
130 | data.MapImageId = UUID.Zero; | 130 | data.MapImageId = UUID.Zero; |
131 | data.Name = ""; // mapName; | 131 | data.Name = mapName; |
132 | data.RegionFlags = 0; | 132 | data.RegionFlags = 0; |
133 | data.WaterHeight = 0; // not used | 133 | data.WaterHeight = 0; // not used |
134 | data.X = 0; | 134 | data.X = 0; |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 857079c..21e3ecb 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -1179,7 +1179,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
1179 | } | 1179 | } |
1180 | else | 1180 | else |
1181 | { | 1181 | { |
1182 | OSDArray responsearr = new OSDArray(m_scene.GetRootAgentCount()); | 1182 | OSDArray responsearr = new OSDArray(); // Don't preallocate. MT (m_scene.GetRootAgentCount()); |
1183 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 1183 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) |
1184 | { | 1184 | { |
1185 | OSDMap responsemapdata = new OSDMap(); | 1185 | OSDMap responsemapdata = new OSDMap(); |