From 3399596e0e2df2d0e260ba88ce8a0166de8cbff2 Mon Sep 17 00:00:00 2001 From: Michelle Argus Date: Mon, 2 Jul 2012 19:12:10 +0200 Subject: Adds a list of viewers that are allowed or banned from the region. Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/Scene.cs | 65 ++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 293c72a..2493df1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -120,6 +120,9 @@ namespace OpenSim.Region.Framework.Scenes { get { return m_defaultDrawDistance; } } + + private List m_AllowedViewers = new List(); + private List m_BanedViewers = new List(); // TODO: need to figure out how allow client agents but deny // root agents when ACL denies access to root agent @@ -779,6 +782,24 @@ namespace OpenSim.Region.Framework.Scenes } } + string grant = startupConfig.GetString("AllowedViewerList", String.Empty); + if (grant.Length > 0) + { + foreach (string viewer in grant.Split(',')) + { + m_AllowedViewers.Add(viewer.Trim().ToLower()); + } + } + + grant = startupConfig.GetString("BannedViewerList", String.Empty); + if (grant.Length > 0) + { + foreach (string viewer in grant.Split(',')) + { + m_BanedViewers.Add(viewer.Trim().ToLower()); + } + } + MinFrameTime = startupConfig.GetFloat( "MinFrameTime", MinFrameTime); m_update_backup = startupConfig.GetInt( "UpdateStorageEveryNFrames", m_update_backup); m_update_coarse_locations = startupConfig.GetInt( "UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); @@ -3417,6 +3438,50 @@ namespace OpenSim.Region.Framework.Scenes return false; } + //Check if the viewer is banned or in the viewer access list + //We check if the substring is listed for higher flexebility + bool ViewerDenied = true; + + //Check if the specific viewer is listed in the allowed viewer list + if (m_AllowedViewers.Count > 0) + { + foreach (string viewer in m_AllowedViewers) + { + if (viewer == agent.Viewer.Substring(0, viewer.Length).Trim().ToLower()) + { + ViewerDenied = false; + break; + } + } + } + else + { + ViewerDenied = false; + } + + //Check if the viewer is in the banned list + if (m_BanedViewers.Count > 0) + { + foreach (string viewer in m_BanedViewers) + { + if (viewer == agent.Viewer.Substring(0, viewer.Length).Trim().ToLower()) + { + ViewerDenied = true; + break; + } + } + } + + if (ViewerDenied) + { + m_log.DebugFormat( + "[SCENE]: Access denied for {0} {1} using {2}", + agent.firstname, agent.lastname, agent.Viewer); + reason = "Access denied, your viewer is banned by the region owner"; + return false; + } + + ScenePresence sp = GetScenePresence(agent.AgentID); if (sp != null && !sp.IsChildAgent) -- cgit v1.1 From 3c9b9a848f6c9723a3cc46f0de8ad802ece7e2a7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Jul 2012 22:58:58 +0100 Subject: Fix issue in database tests where sogs being stored are not in a scene. This puts an extra m_part.ParentGroup.Scene == null check at the top of SceneObjectPartInventory.QueryScriptStates() --- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 6427014..866311a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -220,7 +220,7 @@ namespace OpenSim.Region.Framework.Scenes private void QueryScriptStates() { - if (m_part == null || m_part.ParentGroup == null) + if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) return; IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces(); -- cgit v1.1 From 8183c2926d563aa15cfc53f624353e1779061721 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Jul 2012 23:19:11 +0100 Subject: minor: Add some method doc to HasGroupChanged and Schedule GroupForFull/PartUpdate() to indicate when region modules need to invoke them --- .../Region/Framework/Scenes/SceneObjectGroup.cs | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 1e900a0..96cc376 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -108,6 +108,15 @@ namespace OpenSim.Region.Framework.Scenes private long timeFirstChanged; private long timeLastChanged; + /// + /// This indicates whether the object has changed such that it needs to be repersisted to permenant storage + /// (the database). + /// + /// + /// Ultimately, this should be managed such that region modules can change it at the end of a set of operations + /// so that either all changes are preserved or none at all. However, currently, a large amount of internal + /// code will set this anyway when some object properties are changed. + /// public bool HasGroupChanged { set @@ -1817,8 +1826,13 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Schedule a full update for this scene object + /// Schedule a full update for this scene object to all interested viewers. /// + /// + /// Ultimately, this should be managed such that region modules can invoke it at the end of a set of operations + /// so that either all changes are sent at once. However, currently, a large amount of internal + /// code will set this anyway when some object properties are changed. + /// public void ScheduleGroupForFullUpdate() { // if (IsAttachment) @@ -1837,8 +1851,13 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Schedule a terse update for this scene object + /// Schedule a terse update for this scene object to all interested viewers. /// + /// + /// Ultimately, this should be managed such that region modules can invoke it at the end of a set of operations + /// so that either all changes are sent at once. However, currently, a large amount of internal + /// code will set this anyway when some object properties are changed. + /// public void ScheduleGroupForTerseUpdate() { // m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID); -- cgit v1.1 From f7b48025777a653589b7860e94aaa3230497ffa3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 3 Jul 2012 23:26:02 +0100 Subject: Correct spelling mistake m_BanedViewers to m_BannedViewers --- OpenSim/Region/Framework/Scenes/Scene.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2493df1..36d39ea 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes } private List m_AllowedViewers = new List(); - private List m_BanedViewers = new List(); + private List m_BannedViewers = new List(); // TODO: need to figure out how allow client agents but deny // root agents when ACL denies access to root agent @@ -796,7 +796,7 @@ namespace OpenSim.Region.Framework.Scenes { foreach (string viewer in grant.Split(',')) { - m_BanedViewers.Add(viewer.Trim().ToLower()); + m_BannedViewers.Add(viewer.Trim().ToLower()); } } @@ -3460,9 +3460,9 @@ namespace OpenSim.Region.Framework.Scenes } //Check if the viewer is in the banned list - if (m_BanedViewers.Count > 0) + if (m_BannedViewers.Count > 0) { - foreach (string viewer in m_BanedViewers) + foreach (string viewer in m_BannedViewers) { if (viewer == agent.Viewer.Substring(0, viewer.Length).Trim().ToLower()) { -- cgit v1.1 From 5691a8b860b22939e2b608d6d8400b5260b25cf3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 00:15:03 +0100 Subject: refactor: rename Watchdog.WATCHDOG_TIMEOUT_MS to DEFAULT_WATCHDOG_TIMEOUT_MS to reflect what it actually is --- OpenSim/Framework/Watchdog.cs | 6 +++--- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 7552cd1..2b3a719 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -41,8 +41,8 @@ namespace OpenSim.Framework /// Timer interval in milliseconds for the watchdog timer const double WATCHDOG_INTERVAL_MS = 2500.0d; - /// Maximum timeout in milliseconds before a thread is considered dead - public const int WATCHDOG_TIMEOUT_MS = 5000; + /// Default timeout in milliseconds before a thread is considered dead + public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000; [System.Diagnostics.DebuggerDisplay("{Thread.Name}")] public class ThreadWatchdogInfo @@ -122,7 +122,7 @@ namespace OpenSim.Framework public static Thread StartThread( ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout) { - return StartThread(start, name, priority, isBackground, alarmIfTimeout, null, WATCHDOG_TIMEOUT_MS); + return StartThread(start, name, priority, isBackground, alarmIfTimeout, null, DEFAULT_WATCHDOG_TIMEOUT_MS); } /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 44c65e0..468d524 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -270,7 +270,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP false, true, GetWatchdogIncomingAlarmData, - Watchdog.WATCHDOG_TIMEOUT_MS); + Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); Watchdog.StartThread( OutgoingPacketHandler, @@ -279,7 +279,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP false, true, GetWatchdogOutgoingAlarmData, - Watchdog.WATCHDOG_TIMEOUT_MS); + Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS); m_elapsedMSSinceLastStatReport = Environment.TickCount; } -- cgit v1.1 From 58b13d51a7eddb442e38e6dc6790a9e7cf68bad7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 20:57:48 +0100 Subject: refactor: make llGiveInventory() use existing GetInventoryItem() method rather than iterate through TaskInventory itself. --- .../Shared/Api/Implementation/LSL_Api.cs | 35 +++++++--------------- 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 12eb098..8a3efa7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3860,11 +3860,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llGiveInventory(string destination, string inventory) { m_host.AddScriptLPS(1); - bool found = false; + UUID destId = UUID.Zero; - UUID objId = UUID.Zero; - int assetType = 0; - string objName = String.Empty; if (!UUID.TryParse(destination, out destId)) { @@ -3872,28 +3869,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - // move the first object found with this inventory name - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == inventory) - { - found = true; - objId = inv.Key; - assetType = inv.Value.Type; - objName = inv.Value.Name; - break; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); - if (!found) + if (item == null) { llSay(0, String.Format("Could not find object '{0}'", inventory)); throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory)); } + UUID objId = item.ItemID; + // check if destination is an object if (World.GetSceneObjectPart(destId) != null) { @@ -3924,21 +3909,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; byte[] bucket = new byte[17]; - bucket[0] = (byte)assetType; + bucket[0] = (byte)item.Type; byte[] objBytes = agentItem.ID.GetBytes(); Array.Copy(objBytes, 0, bucket, 1, 16); GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name+", an object owned by "+ - resolveName(m_host.OwnerID)+",", destId, + m_host.UUID, m_host.Name + ", an object owned by " + + resolveName(m_host.OwnerID) + ",", destId, (byte)InstantMessageDialog.TaskInventoryOffered, - false, objName+"\n"+m_host.Name+" is located at "+ + false, item.Name + "\n" + m_host.Name + " is located at " + World.RegionInfo.RegionName+" "+ m_host.AbsolutePosition.ToString(), agentItem.ID, true, m_host.AbsolutePosition, bucket); + if (m_TransferModule != null) m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); + ScriptSleep(3000); } } -- cgit v1.1 From ae64d089c669a9f953fc0992ca4de3a700395def Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:05:51 +0100 Subject: refactor: In llRemoveInventory() use existing GetInventoryItem() method rather than have it iterate through TaskInventory itself. --- .../Shared/Api/Implementation/LSL_Api.cs | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8a3efa7..b52ebac 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3934,20 +3934,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Name == name) - { - if (item.ItemID == m_item.ItemID) - throw new ScriptDeleteException(); - else - m_host.Inventory.RemoveInventoryItem(item.ItemID); - return; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item == null) + return; + + if (item.ItemID == m_item.ItemID) + throw new ScriptDeleteException(); + else + m_host.Inventory.RemoveInventoryItem(item.ItemID); } public void llSetText(string text, LSL_Vector color, double alpha) -- cgit v1.1 From 3717812ce090cae850449ed82463545c079df68d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:15:00 +0100 Subject: refactor: In llCollisionSound() use existing GetInventoryItem() method rather than have it iterate through TaskInventory itself. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b52ebac..ff4b690 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4290,18 +4290,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID soundId = UUID.Zero; if (!UUID.TryParse(impact_sound, out soundId)) { - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == (int)AssetType.Sound && item.Name == impact_sound) - { - soundId = item.AssetID; - break; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(impact_sound); + + if (item != null && item.Type == (int)AssetType.Sound) + soundId = item.AssetID; } + m_host.CollisionSound = soundId; m_host.CollisionSoundVolume = (float)impact_volume; } -- cgit v1.1 From 3769739ca75bd28a126034a74848012164db31b6 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:19:16 +0100 Subject: In llRequestInventoryData() use GetInventoryItems() rather than cloning TaskInventory directory GetInventoryItems() returns a new list and so is equivalent, and creates this list under lock whereas Clone() is not thread-safe --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ff4b690..66d99a2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4084,9 +4084,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); - - foreach (TaskInventoryItem item in itemDictionary.Values) + foreach (TaskInventoryItem item in m_host.Inventory.GetInventoryItems()) { if (item.Type == 3 && item.Name == name) { @@ -4118,6 +4116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return tid.ToString(); } } + ScriptSleep(1000); return String.Empty; } -- cgit v1.1 From 4b2b14dad12d5a8f64609e7eeb3da62a5ca2f8b1 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:22:43 +0100 Subject: In llMessageLinked() use GetInventoryItems() rather than cloning TaskInventory directory GetInventoryItems() returns a new list and so is equivalent, and creates this list under lock whereas Clone() is not thread-safe --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 66d99a2..f57f752 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4116,7 +4116,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return tid.ToString(); } } - + ScriptSleep(1000); return String.Empty; } @@ -4333,9 +4333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID partItemID; foreach (SceneObjectPart part in parts) { - TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone(); - - foreach (TaskInventoryItem item in itemsDictionary.Values) + foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems()) { if (item.Type == ScriptBaseClass.INVENTORY_SCRIPT) { -- cgit v1.1 From 0e3fce9b5c26ee21dee64f8667e7b47b71dbdb3a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:25:58 +0100 Subject: refactor: In llGetInventoryKey() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index f57f752..b0602fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4703,22 +4703,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item == null) + return UUID.Zero.ToString(); + + if ((item.CurrentPermissions + & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) + == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - if ((inv.Value.CurrentPermissions & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) - { - return inv.Value.AssetID.ToString(); - } - else - { - return UUID.Zero.ToString(); - } - } - } + return item.AssetID.ToString(); } return UUID.Zero.ToString(); -- cgit v1.1 From dff7cae2ee78942d97f8481b16e0f682dfcce038 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:33:35 +0100 Subject: refactor: replace use of LSL_Api.GetTaskInventoryItem() with existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 33 ++++++++-------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b0602fc..813fffd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6296,20 +6296,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - protected UUID GetTaskInventoryItem(string name) - { - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - return inv.Key; - } - } - - return UUID.Zero; - } - public void llGiveInventoryList(string destination, string category, LSL_List inventory) { m_host.AddScriptLPS(1); @@ -6322,16 +6308,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (Object item in inventory.Data) { + string rawItemString = item.ToString(); + UUID itemID; - if (UUID.TryParse(item.ToString(), out itemID)) + if (UUID.TryParse(rawItemString, out itemID)) { itemList.Add(itemID); } else { - itemID = GetTaskInventoryItem(item.ToString()); - if (itemID != UUID.Zero) - itemList.Add(itemID); + TaskInventoryItem taskItem = m_host.Inventory.GetInventoryItem(rawItemString); + + if (taskItem != null) + itemList.Add(taskItem.ItemID); } } @@ -6349,11 +6338,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Array.Copy(objBytes, 0, bucket, 1, 16); GridInstantMessage msg = new GridInstantMessage(World, - m_host.UUID, m_host.Name+", an object owned by "+ - resolveName(m_host.OwnerID)+",", destID, + m_host.UUID, m_host.Name + ", an object owned by " + + resolveName(m_host.OwnerID) + ",", destID, (byte)InstantMessageDialog.InventoryOffered, - false, category+"\n"+m_host.Name+" is located at "+ - World.RegionInfo.RegionName+" "+ + false, category + "\n" + m_host.Name + " is located at " + + World.RegionInfo.RegionName + " " + m_host.AbsolutePosition.ToString(), folderID, true, m_host.AbsolutePosition, bucket); -- cgit v1.1 From 857494f6bdef5aef8cfcbee84ca668c2371bfdf0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:36:44 +0100 Subject: refactor: In llRemoteLoadScriptPin() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 25 +++++----------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 813fffd..a1620e7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6644,9 +6644,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_host.AddScriptLPS(1); - bool found = false; + UUID destId = UUID.Zero; - UUID srcId = UUID.Zero; if (!UUID.TryParse(target, out destId)) { @@ -6661,31 +6660,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // copy the first script found with this inventory name - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - // make sure the object is a script - if (10 == inv.Value.Type) - { - found = true; - srcId = inv.Key; - break; - } - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); - if (!found) + // make sure the object is a script + if (item == null || item.Type != 10) { llSay(0, "Could not find script " + name); return; } // the rest of the permission checks are done in RezScript, so check the pin there as well - World.RezScriptFromPrim(srcId, m_host, destId, pin, running, start_param); + World.RezScriptFromPrim(item.ItemID, m_host, destId, pin, running, start_param); // this will cause the delay even if the script pin or permissions were wrong - seems ok ScriptSleep(3000); -- cgit v1.1 From f9fa34408dd178eb202e0cc1336da67cc0a494f0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:42:04 +0100 Subject: refactor: in llGetInventoryPermMask use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 42 ++++++++++------------ 1 file changed, 19 insertions(+), 23 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a1620e7..a173d64 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6644,7 +6644,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { m_host.AddScriptLPS(1); - + UUID destId = UUID.Zero; if (!UUID.TryParse(target, out destId)) @@ -9032,31 +9032,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_Integer llGetInventoryPermMask(string item, int mask) + public LSL_Integer llGetInventoryPermMask(string itemName, int mask) { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == item) - { - switch (mask) - { - case 0: - return (int)inv.Value.BasePermissions; - case 1: - return (int)inv.Value.CurrentPermissions; - case 2: - return (int)inv.Value.GroupPermissions; - case 3: - return (int)inv.Value.EveryonePermissions; - case 4: - return (int)inv.Value.NextPermissions; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item == null) + return -1; + + switch (mask) + { + case 0: + return (int)item.BasePermissions; + case 1: + return (int)item.CurrentPermissions; + case 2: + return (int)item.GroupPermissions; + case 3: + return (int)item.EveryonePermissions; + case 4: + return (int)item.NextPermissions; } return -1; -- cgit v1.1 From d933bdbd59da50e2c335b65870416ac8e5035d3a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:47:20 +0100 Subject: refactor: In llGetInventoryPermMask() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 45 ++++++++++------------ 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a173d64..fce09bf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9058,38 +9058,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return -1; } - public void llSetInventoryPermMask(string item, int mask, int value) + public void llSetInventoryPermMask(string itemName, int mask, int value) { m_host.AddScriptLPS(1); + if (m_ScriptEngine.Config.GetBoolean("AllowGodFunctions", false)) { if (World.Permissions.CanRunConsoleCommand(m_host.OwnerID)) { - lock (m_host.TaskInventory) + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item != null) { - foreach (KeyValuePair inv in m_host.TaskInventory) + switch (mask) { - if (inv.Value.Name == item) - { - switch (mask) - { - case 0: - inv.Value.BasePermissions = (uint)value; - break; - case 1: - inv.Value.CurrentPermissions = (uint)value; - break; - case 2: - inv.Value.GroupPermissions = (uint)value; - break; - case 3: - inv.Value.EveryonePermissions = (uint)value; - break; - case 4: - inv.Value.NextPermissions = (uint)value; - break; - } - } + case 0: + item.BasePermissions = (uint)value; + break; + case 1: + item.CurrentPermissions = (uint)value; + break; + case 2: + item.GroupPermissions = (uint)value; + break; + case 3: + item.EveryonePermissions = (uint)value; + break; + case 4: + item.NextPermissions = (uint)value; + break; } } } -- cgit v1.1 From f2b0377c28623ee915387fef37c88ab3b7694ba8 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:49:21 +0100 Subject: refactor: In llGetInventoryCreator() use existing GetInventoryItem() --- .../Shared/Api/Implementation/LSL_Api.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fce09bf..338ae88 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9093,24 +9093,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_String llGetInventoryCreator(string item) + public LSL_String llGetInventoryCreator(string itemName) { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item == null) { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == item) - { - return inv.Value.CreatorID.ToString(); - } - } - } + llSay(0, "No item name '" + item + "'"); - llSay(0, "No item name '" + item + "'"); + return String.Empty; + } - return String.Empty; + return item.CreatorID.ToString(); } public void llOwnerSay(string msg) -- cgit v1.1 From 9fac7fd932aa929e350fb4795f5036f7dd0cf78f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:50:52 +0100 Subject: refactor: In llGetInventoryType() use existing GetInventoryItem() --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 338ae88..a8a2a50 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9656,18 +9656,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - lock (m_host.TaskInventory) - { - foreach (KeyValuePair inv in m_host.TaskInventory) - { - if (inv.Value.Name == name) - { - return inv.Value.Type; - } - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); - return -1; + if (item == null) + return -1; + + return item.Type; } public void llSetPayPrice(int price, LSL_List quick_pay_buttons) -- cgit v1.1 From eacba4fc0b1e3a34f8bae140c402eacb68ecbb94 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:54:30 +0100 Subject: refactor: use existing GetInventoryItem() in GetScriptByName(), itself renamed from ScriptByName() --- .../Shared/Api/Implementation/LSL_Api.cs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a8a2a50..38f146f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -192,7 +192,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - if ((item = ScriptByName(name)) != UUID.Zero) + if ((item = GetScriptByName(name)) != UUID.Zero) m_ScriptEngine.ResetScript(item); else ShoutError("llResetOtherScript: script "+name+" not found"); @@ -204,7 +204,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - if ((item = ScriptByName(name)) != UUID.Zero) + if ((item = GetScriptByName(name)) != UUID.Zero) { return m_ScriptEngine.GetScriptState(item) ?1:0; } @@ -226,7 +226,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // These functions are supposed to be robust, // so get the state one step at a time. - if ((item = ScriptByName(name)) != UUID.Zero) + if ((item = GetScriptByName(name)) != UUID.Zero) { m_ScriptEngine.SetScriptState(item, run == 0 ? false : true); } @@ -10455,18 +10455,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_List(); } - internal UUID ScriptByName(string name) + internal UUID GetScriptByName(string name) { - lock (m_host.TaskInventory) - { - foreach (TaskInventoryItem item in m_host.TaskInventory.Values) - { - if (item.Type == 10 && item.Name == name) - return item.ItemID; - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item == null || item.Type != 10) + return UUID.Zero; - return UUID.Zero; + return item.ItemID; } internal void ShoutError(string msg) -- cgit v1.1 From 1816ecb747708fea73eec08d3e51a8a2b8c7bd06 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 21:57:57 +0100 Subject: refactor: In llGetNumberOfNotecardLines() use existing GetInventoryItem() rather than inspecting a clone of the TaskInventory dictionary that was not cloned thread-safe --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 38f146f..2b8c4c1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10502,20 +10502,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); - UUID assetID = UUID.Zero; if (!UUID.TryParse(name, out assetID)) { - foreach (TaskInventoryItem item in itemsDictionary.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - break; - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item != null && item.Type == 7) + assetID = item.AssetID; } if (assetID == UUID.Zero) -- cgit v1.1 From 2f998fce1f51e9991852144c940281fedffbbbca Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 22:00:39 +0100 Subject: refactor: In llGetNotecardLine() use existing GetInventoryItem() rather than inspecting a clone of the TaskInventory dictionary that was not cloned thread-safe --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2b8c4c1..cf65abb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -10558,20 +10558,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - TaskInventoryDictionary itemsDictionary = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); - UUID assetID = UUID.Zero; if (!UUID.TryParse(name, out assetID)) { - foreach (TaskInventoryItem item in itemsDictionary.Values) - { - if (item.Type == 7 && item.Name == name) - { - assetID = item.AssetID; - break; - } - } + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(name); + + if (item != null && item.Type == 7) + assetID = item.AssetID; } if (assetID == UUID.Zero) -- cgit v1.1 From 7b327848d0a74296e0180bb8d27544e6c5570215 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 4 Jul 2012 22:21:47 +0100 Subject: Use GetInventoryItem() in llRezAtRoot rather than iterating through a cloned dictionary --- .../Shared/Api/Implementation/LSL_Api.cs | 76 ++++++++++------------ 1 file changed, 36 insertions(+), 40 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index cf65abb..0a25454 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2738,67 +2738,63 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - Util.FireAndForget(delegate (object x) + Util.FireAndForget(x => { if (Double.IsNaN(rot.x) || Double.IsNaN(rot.y) || Double.IsNaN(rot.z) || Double.IsNaN(rot.s)) return; + float dist = (float)llVecDist(llGetPos(), pos); if (dist > m_ScriptDistanceFactor * 10.0f) return; - //Clone is thread-safe - TaskInventoryDictionary partInventory = (TaskInventoryDictionary)m_host.TaskInventory.Clone(); + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(inventory); - foreach (KeyValuePair inv in partInventory) + if (item == null) { - if (inv.Value.Name == inventory) - { - // make sure we're an object. - if (inv.Value.InvType != (int)InventoryType.Object) - { - llSay(0, "Unable to create requested object. Object is missing from database."); - return; - } + llSay(0, "Could not find object " + inventory); + return; + } - Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); - Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); + if (item.InvType != (int)InventoryType.Object) + { + llSay(0, "Unable to create requested object. Object is missing from database."); + return; + } - // need the magnitude later - // float velmag = (float)Util.GetMagnitude(llvel); + Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z); + Vector3 llvel = new Vector3((float)vel.x, (float)vel.y, (float)vel.z); - SceneObjectGroup new_group = World.RezObject(m_host, inv.Value, llpos, Rot2Quaternion(rot), llvel, param); + // need the magnitude later + // float velmag = (float)Util.GetMagnitude(llvel); - // If either of these are null, then there was an unknown error. - if (new_group == null) - continue; + SceneObjectGroup new_group = World.RezObject(m_host, item, llpos, Rot2Quaternion(rot), llvel, param); - // objects rezzed with this method are die_at_edge by default. - new_group.RootPart.SetDieAtEdge(true); + // If either of these are null, then there was an unknown error. + if (new_group == null) + return; - new_group.ResumeScripts(); + // objects rezzed with this method are die_at_edge by default. + new_group.RootPart.SetDieAtEdge(true); - m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( - "object_rez", new Object[] { - new LSL_String( - new_group.RootPart.UUID.ToString()) }, - new DetectParams[0])); + new_group.ResumeScripts(); - float groupmass = new_group.GetMass(); + m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams( + "object_rez", new Object[] { + new LSL_String( + new_group.RootPart.UUID.ToString()) }, + new DetectParams[0])); - PhysicsActor pa = new_group.RootPart.PhysActor; + float groupmass = new_group.GetMass(); - if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) - { - //Recoil. - llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); - } - // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) - return; - } - } + PhysicsActor pa = new_group.RootPart.PhysActor; - llSay(0, "Could not find object " + inventory); + if (pa != null && pa.IsPhysical && llvel != Vector3.Zero) + { + //Recoil. + llApplyImpulse(new LSL_Vector(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); + } + // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay) }); //ScriptSleep((int)((groupmass * velmag) / 10)); -- cgit v1.1 From 951b45b80fd504b4874b9ec3e0fbff49a25cb46f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jul 2012 00:05:06 +0100 Subject: Add OSSL function osForceAttachToAvatarFromInventory() This works like osForceAttachToAvatar() but allows an object to be directly specified from the script object's inventory rather than forcing it to be rezzed in the scene first. Still only attaches objects to the owner of the script. This allows one to bypass the complicated co-ordination of first rezzing objects in the scene before attaching them. Threat level high. --- .../Attachments/Tests/AttachmentsModuleTests.cs | 2 +- .../World/Media/Moap/Tests/MoapTests.cs | 4 +- .../Scenes/Tests/SceneObjectBasicTests.cs | 22 +-- .../Scenes/Tests/SceneObjectLinkingTests.cs | 24 +-- .../Scenes/Tests/SceneObjectResizeTests.cs | 2 +- .../Scenes/Tests/ScenePresenceSitTests.cs | 8 +- .../Framework/Scenes/Tests/TaskInventoryTests.cs | 9 +- .../World/NPC/Tests/NPCModuleTests.cs | 4 +- .../Shared/Api/Implementation/OSSL_Api.cs | 54 ++++++- .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 7 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 + .../Shared/Tests/LSL_ApiLinkingTests.cs | 7 +- .../ScriptEngine/Shared/Tests/LSL_ApiTest.cs | 2 +- .../Shared/Tests/OSSL_ApiAttachmentTests.cs | 178 +++++++++++++++++++++ .../ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs | 6 +- OpenSim/Tests/Common/Helpers/SceneHelpers.cs | 10 +- .../Tests/Common/Helpers/TaskInventoryHelpers.cs | 47 +++++- 17 files changed, 340 insertions(+), 51 deletions(-) create mode 100644 OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b0c087f..7856953 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs @@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests string attName = "att"; - SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID).ParentGroup; + SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, sp.UUID); scene.AttachmentsModule.AttachObject(sp, so, (uint)AttachmentPoint.Chest, false); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs index 0545250..396095a 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; MediaEntry me = new MediaEntry(); m_module.SetMediaEntry(part, 1, me); @@ -88,7 +88,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests string homeUrl = "opensimulator.org"; - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; MediaEntry me = new MediaEntry() { HomeURL = homeUrl }; m_module.SetMediaEntry(part, 1, me); diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 81add43..3398a53 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs @@ -186,15 +186,15 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); TestScene scene = new SceneHelpers().SetupScene(); - SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); - Assert.That(part.ParentGroup.IsDeleted, Is.False); + Assert.That(so.IsDeleted, Is.False); - scene.DeleteSceneObject(part.ParentGroup, false); + scene.DeleteSceneObject(so, false); - Assert.That(part.ParentGroup.IsDeleted, Is.True); + Assert.That(so.IsDeleted, Is.True); - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); Assert.That(retrievedPart, Is.Null); } @@ -215,22 +215,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; sogd.Enabled = false; - SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; - scene.DeRezObjects(client, new System.Collections.Generic.List() { part.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); + scene.DeRezObjects(client, new System.Collections.Generic.List() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); - SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); + SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); Assert.That(retrievedPart, Is.Not.Null); - Assert.That(part.ParentGroup.IsDeleted, Is.False); + Assert.That(so.IsDeleted, Is.False); sogd.InventoryDeQueueAndDelete(); - Assert.That(part.ParentGroup.IsDeleted, Is.True); + Assert.That(so.IsDeleted, Is.True); - SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); + SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); Assert.That(retrievedPart2, Is.Null); } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index 1add3dd..0e525c9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -72,10 +72,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; Scene scene = new SceneHelpers().SetupScene(); - SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); - SceneObjectGroup grp1 = part1.ParentGroup; - SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); - SceneObjectGroup grp2 = part2.ParentGroup; + SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene); + SceneObjectPart part1 = grp1.RootPart; + SceneObjectGroup grp2 = SceneHelpers.AddSceneObject(scene); + SceneObjectPart part2 = grp2.RootPart; grp1.AbsolutePosition = new Vector3(10, 10, 10); grp2.AbsolutePosition = Vector3.Zero; @@ -154,14 +154,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests bool debugtest = false; Scene scene = new SceneHelpers().SetupScene(); - SceneObjectPart part1 = SceneHelpers.AddSceneObject(scene); - SceneObjectGroup grp1 = part1.ParentGroup; - SceneObjectPart part2 = SceneHelpers.AddSceneObject(scene); - SceneObjectGroup grp2 = part2.ParentGroup; - SceneObjectPart part3 = SceneHelpers.AddSceneObject(scene); - SceneObjectGroup grp3 = part3.ParentGroup; - SceneObjectPart part4 = SceneHelpers.AddSceneObject(scene); - SceneObjectGroup grp4 = part4.ParentGroup; + SceneObjectGroup grp1 = SceneHelpers.AddSceneObject(scene); + SceneObjectPart part1 = grp1.RootPart; + SceneObjectGroup grp2 = SceneHelpers.AddSceneObject(scene); + SceneObjectPart part2 = grp2.RootPart; + SceneObjectGroup grp3 = SceneHelpers.AddSceneObject(scene); + SceneObjectPart part3 = grp3.RootPart; + SceneObjectGroup grp4 = SceneHelpers.AddSceneObject(scene); + SceneObjectPart part4 = grp4.RootPart; grp1.AbsolutePosition = new Vector3(10, 10, 10); grp2.AbsolutePosition = Vector3.Zero; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs index 0a94c19..e931859 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectResizeTests.cs @@ -53,7 +53,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // log4net.Config.XmlConfigurator.Configure(); Scene scene = new SceneHelpers().SetupScene(); - SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene).ParentGroup; + SceneObjectGroup g1 = SceneHelpers.AddSceneObject(scene); g1.GroupResize(new Vector3(2, 3, 4)); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs index 313e350..ed39be1 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceSitTests.cs @@ -64,7 +64,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Vector3 startPos = new Vector3(10.1f, 0, 0); m_sp.AbsolutePosition = startPos; - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); @@ -82,7 +82,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Vector3 startPos = new Vector3(9.9f, 0, 0); m_sp.AbsolutePosition = startPos; - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); @@ -100,7 +100,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Vector3 startPos = new Vector3(1, 1, 1); m_sp.AbsolutePosition = startPos; - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); @@ -133,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests Vector3 startPos = new Vector3(128, 128, 30); m_sp.AbsolutePosition = startPos; - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; part.SitTargetPosition = new Vector3(0, 0, 1); m_sp.HandleAgentRequestSit(m_sp.ControllingClient, m_sp.UUID, part.UUID, Vector3.Zero); diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index d15141b..a51e4e3 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs @@ -128,7 +128,9 @@ namespace OpenSim.Region.Framework.Tests UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); SceneObjectPart sop1 = sog1.RootPart; - TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); + TaskInventoryItem sopItem1 + = TaskInventoryHelpers.AddNotecard( + scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); InventoryFolderBase folder = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; @@ -156,8 +158,11 @@ namespace OpenSim.Region.Framework.Tests Scene scene = new SceneHelpers().SetupScene(); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene); SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, user1.PrincipalID); + SceneObjectPart sop1 = sog1.RootPart; - TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1); + TaskInventoryItem sopItem1 + = TaskInventoryHelpers.AddNotecard( + scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); // Perform test scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 65dad2d..9179966 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -301,7 +301,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); ScenePresence npc = m_scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; part.SitTargetPosition = new Vector3(0, 0, 1); m_npcMod.Sit(npc.UUID, part.UUID, m_scene); @@ -333,7 +333,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests UUID npcId = m_npcMod.CreateNPC("John", "Smith", startPos, UUID.Zero, true, m_scene, sp.Appearance); ScenePresence npc = m_scene.GetScenePresence(npcId); - SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(m_scene).RootPart; m_npcMod.Sit(npc.UUID, part.UUID, m_scene); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7fa25f5..fa9364d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -126,7 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api [Serializable] public class OSSL_Api : MarshalByRefObject, IOSSL_Api, IScriptApi { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public const string GridInfoServiceConfigSectionName = "GridInfoService"; @@ -3151,6 +3151,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ((LSL_Api)m_LSL_Api).AttachToAvatar(attachmentPoint); } + public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint) + { + CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory"); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + + if (attachmentsModule == null) + return; + + m_host.AddScriptLPS(1); + + InitLSL(); + + TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); + + if (item == null) + { + ((LSL_Api)m_LSL_Api).llSay(0, string.Format("Could not find object '{0}'", itemName)); + throw new Exception(String.Format("The inventory item '{0}' could not be found", itemName)); + } + + if (item.InvType != (int)InventoryType.Object) + { + // FIXME: Temporary null check for regression tests since they dont' have the infrastructure to set + // up the api reference. + if (m_LSL_Api != null) + ((LSL_Api)m_LSL_Api).llSay(0, string.Format("Unable to attach, item '{0}' is not an object.", itemName)); + + throw new Exception(String.Format("The inventory item '{0}' is not an object", itemName)); + + return; + } + + ScenePresence sp = World.GetScenePresence(m_host.OwnerID); + + if (sp == null) + return; + + InventoryItemBase newItem = World.MoveTaskInventoryItem(sp.UUID, UUID.Zero, m_host, item.ItemID); + + if (newItem == null) + { + m_log.ErrorFormat( + "[OSSL API]: Could not create user inventory item {0} for {1}, attach point {2} in {3}", + itemName, m_host.Name, attachmentPoint, World.Name); + + return; + } + + attachmentsModule.RezSingleAttachmentFromInventory(sp, newItem.ID, (uint)attachmentPoint); + } + public void osForceDetachFromAvatar() { CheckThreatLevel(ThreatLevel.High, "osForceDetachFromAvatar"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index e92518d..a8335aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -107,6 +107,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osForceAttachToAvatar(int attachment); /// + /// Attach the inventory item in the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH + /// + /// Tha name of the item. If this is not found then a warning is said to the owner + /// The attachment point. For example, ATTACH_CHEST + void osForceAttachToAvatarFromInventory(string itemName, int attachment); + + /// /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH /// /// Nothing happens if the object is not attached. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index d230662..500ed96 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -296,6 +296,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceAttachToAvatar(attachmentPoint); } + public void osForceAttachToAvatarFromInventory(string itemName, int attachmentPoint) + { + m_OSSL_Functions.osForceAttachToAvatarFromInventory(itemName, attachmentPoint); + } + public void osForceDetachFromAvatar() { m_OSSL_Functions.osForceDetachFromAvatar(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs index bc3b790..2565ae7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs @@ -89,7 +89,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // FIXME: This should really be a script item (with accompanying script) TaskInventoryItem grp1Item - = TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart); + = TaskInventoryHelpers.AddNotecard( + m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); @@ -122,7 +123,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests // FIXME: This should really be a script item (with accompanying script) TaskInventoryItem grp1Item - = TaskInventoryHelpers.AddNotecard(m_scene, grp1.RootPart); + = TaskInventoryHelpers.AddNotecard( + m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); + grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; LSL_Api apiGrp1 = new LSL_Api(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index f96a156..c41d1e7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs @@ -59,7 +59,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests config.Set("Enabled", "true"); Scene scene = new SceneHelpers().SetupScene(); - SceneObjectPart part = SceneHelpers.AddSceneObject(scene); + SceneObjectPart part = SceneHelpers.AddSceneObject(scene).RootPart; XEngine.XEngine engine = new XEngine.XEngine(); engine.Initialise(initConfigSource); diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs new file mode 100644 index 0000000..537b8aa --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs @@ -0,0 +1,178 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using log4net; +using Nini.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenMetaverse.StructuredData; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.Avatar.Attachments; +using OpenSim.Region.CoreModules.Framework.InventoryAccess; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.ScriptEngine.Shared; +using OpenSim.Region.ScriptEngine.Shared.Api; +using OpenSim.Services.Interfaces; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.ScriptEngine.Shared.Tests +{ + /// + /// Tests for OSSL attachment functions + /// + /// + /// TODO: Add tests for all functions + /// + [TestFixture] + public class OSSL_ApiAttachmentTests : OpenSimTestCase + { + protected Scene m_scene; + protected XEngine.XEngine m_engine; + + [SetUp] + public override void SetUp() + { + base.SetUp(); + + IConfigSource initConfigSource = new IniConfigSource(); + + IConfig xengineConfig = initConfigSource.AddConfig("XEngine"); + xengineConfig.Set("Enabled", "true"); + xengineConfig.Set("AllowOSFunctions", "true"); + xengineConfig.Set("OSFunctionThreatLevel", "Severe"); + + IConfig modulesConfig = initConfigSource.AddConfig("Modules"); + modulesConfig.Set("InventoryAccessModule", "BasicInventoryAccessModule"); + + m_scene = new SceneHelpers().SetupScene(); + SceneHelpers.SetupSceneModules( + m_scene, initConfigSource, new AttachmentsModule(), new BasicInventoryAccessModule()); + + m_engine = new XEngine.XEngine(); + m_engine.Initialise(initConfigSource); + m_engine.AddRegion(m_scene); + } + + [Test] + public void TestOsForceAttachToAvatarFromInventory() + { + TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + + string taskInvObjItemName = "sphere"; + UUID taskInvObjItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); + AttachmentPoint attachPoint = AttachmentPoint.Chin; + + UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); + SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); + TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); + + new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); + +// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID); + + // Create an object embedded inside the first + TaskInventoryHelpers.AddSceneObject(m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, ua1.PrincipalID); + + osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); + + // Check scene presence status + Assert.That(sp.HasAttachments(), Is.True); + List attachments = sp.GetAttachments(); + Assert.That(attachments.Count, Is.EqualTo(1)); + SceneObjectGroup attSo = attachments[0]; + Assert.That(attSo.Name, Is.EqualTo(taskInvObjItemName)); + Assert.That(attSo.AttachmentPoint, Is.EqualTo((uint)attachPoint)); + Assert.That(attSo.IsAttachment); + Assert.That(attSo.UsesPhysics, Is.False); + Assert.That(attSo.IsTemporary, Is.False); + + // Check appearance status + List attachmentsInAppearance = sp.Appearance.GetAttachments(); + Assert.That(attachmentsInAppearance.Count, Is.EqualTo(1)); + Assert.That(sp.Appearance.GetAttachpoint(attachmentsInAppearance[0].ItemID), Is.EqualTo((uint)attachPoint)); + } + + /// + /// Make sure we can't force attach anything other than objects. + /// + [Test] + public void TestOsForceAttachToAvatarFromInventoryNotObject() + { + TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + + string taskInvObjItemName = "sphere"; + UUID taskInvObjItemId = UUID.Parse("00000000-0000-0000-0000-100000000000"); + AttachmentPoint attachPoint = AttachmentPoint.Chin; + + UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(m_scene, 0x1); + ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, ua1.PrincipalID); + SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID); + TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene, inWorldObj.RootPart); + + new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem); + OSSL_Api osslApi = new OSSL_Api(); + osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem); + + // Create an object embedded inside the first + TaskInventoryHelpers.AddNotecard( + m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900)); + + bool exceptionCaught = false; + + try + { + osslApi.osForceAttachToAvatarFromInventory(taskInvObjItemName, (int)attachPoint); + } + catch (Exception e) + { + exceptionCaught = true; + } + + Assert.That(exceptionCaught, Is.True); + + // Check scene presence status + Assert.That(sp.HasAttachments(), Is.False); + List attachments = sp.GetAttachments(); + Assert.That(attachments.Count, Is.EqualTo(0)); + + // Check appearance status + List attachmentsInAppearance = sp.Appearance.GetAttachments(); + Assert.That(attachmentsInAppearance.Count, Is.EqualTo(0)); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs index 0ccd889..813e53b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs @@ -52,14 +52,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests /// Tests for OSSL NPC API /// [TestFixture] - public class OSSL_NpcApiAppearanceTest + public class OSSL_NpcApiAppearanceTest : OpenSimTestCase { protected Scene m_scene; protected XEngine.XEngine m_engine; [SetUp] - public void SetUp() + public override void SetUp() { + base.SetUp(); + IConfigSource initConfigSource = new IniConfigSource(); IConfig config = initConfigSource.AddConfig("XEngine"); config.Set("Enabled", "true"); diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs index 239afc0..3a2e420 100644 --- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs @@ -564,7 +564,7 @@ namespace OpenSim.Tests.Common /// /// /// - public static SceneObjectPart AddSceneObject(Scene scene) + public static SceneObjectGroup AddSceneObject(Scene scene) { return AddSceneObject(scene, "Test Object", UUID.Zero); } @@ -576,16 +576,16 @@ namespace OpenSim.Tests.Common /// /// /// - public static SceneObjectPart AddSceneObject(Scene scene, string name, UUID ownerId) + public static SceneObjectGroup AddSceneObject(Scene scene, string name, UUID ownerId) { - SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), ownerId); + SceneObjectGroup so = new SceneObjectGroup(CreateSceneObjectPart(name, UUID.Random(), ownerId)); //part.UpdatePrimFlags(false, false, true); //part.ObjectFlags |= (uint)PrimFlags.Phantom; - scene.AddNewSceneObject(new SceneObjectGroup(part), false); + scene.AddNewSceneObject(so, false); - return part; + return so; } /// diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index 7058d1e..9607f1f 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs @@ -45,20 +45,23 @@ namespace OpenSim.Tests.Common /// /// /// + /// + /// + /// /// The item that was added - public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part) + public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID) { AssetNotecard nc = new AssetNotecard(); nc.BodyText = "Hello World!"; nc.Encode(); - UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); - UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); + AssetBase ncAsset - = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); + = AssetHelpers.CreateAsset(assetID, AssetType.Notecard, nc.AssetData, UUID.Zero); scene.AssetService.Store(ncAsset); + TaskInventoryItem ncItem = new TaskInventoryItem - { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid, + { Name = itemName, AssetID = assetID, ItemID = itemID, Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard }; part.Inventory.AddInventoryItem(ncItem, true); @@ -66,8 +69,42 @@ namespace OpenSim.Tests.Common } /// + /// Add a blank script to the given part. + /// + /// + /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these + /// functions more than once in a test. + /// + /// + /// + /// The item that was added + public static TaskInventoryItem AddScript(Scene scene, SceneObjectPart part) + { + AssetScriptText ast = new AssetScriptText(); + ast.Encode(); + + UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); + UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000"); + AssetBase asset + = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); + scene.AssetService.Store(asset); + TaskInventoryItem item + = new TaskInventoryItem + { Name = "scriptItem", AssetID = assetUuid, ItemID = itemUuid, + Type = (int)AssetType.LSLText, InvType = (int)InventoryType.LSL }; + part.Inventory.AddInventoryItem(item, true); + + return item; + } + + /// /// Add a scene object item to the given part. /// + /// + /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these + /// functions more than once in a test. + /// + /// /// /// /// -- cgit v1.1 From 510e809abae3c126d68ffe2b0645b4697f5b56b2 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 4 Jul 2012 00:53:16 +0100 Subject: porting console commands from raw2sculpt 3.2 --- .../CoreModules/World/Terrain/TerrainModule.cs | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 2eac0fa..3f848ed 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -1108,6 +1108,32 @@ namespace OpenSim.Region.CoreModules.World.Terrain CheckForTerrainUpdates(); } + private void InterfaceMinTerrain(Object[] args) + { + int x, y; + for (x = 0; x < m_channel.Width; x++) + { + for (y = 0; y < m_channel.Height; y++) + { + m_channel[x, y] = Math.Max((double)args[0], m_channel[x, y]); + } + } + CheckForTerrainUpdates(); + } + + private void InterfaceMaxTerrain(Object[] args) + { + int x, y; + for (x = 0; x < m_channel.Width; x++) + { + for (y = 0; y < m_channel.Height; y++) + { + m_channel[x, y] = Math.Min((double)args[0], m_channel[x, y]); + } + } + CheckForTerrainUpdates(); + } + private void InterfaceShowDebugStats(Object[] args) { double max = Double.MinValue; @@ -1248,6 +1274,12 @@ namespace OpenSim.Region.CoreModules.World.Terrain rescaleCommand.AddArgument("min", "min terrain height after rescaling", "Double"); rescaleCommand.AddArgument("max", "max terrain height after rescaling", "Double"); + Command minCommand = new Command("min", CommandIntentions.COMMAND_HAZARDOUS, InterfaceMinTerrain, "Sets the minimum terrain height to the specified value."); + minCommand.AddArgument("min", "terrain height to use as minimum", "Double"); + + Command maxCommand = new Command("max", CommandIntentions.COMMAND_HAZARDOUS, InterfaceMaxTerrain, "Sets the maximum terrain height to the specified value."); + maxCommand.AddArgument("min", "terrain height to use as maximum", "Double"); + // Debug Command showDebugStatsCommand = @@ -1279,6 +1311,8 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_commander.RegisterCommand("effect", pluginRunCommand); m_commander.RegisterCommand("flip", flipCommand); m_commander.RegisterCommand("rescale", rescaleCommand); + m_commander.RegisterCommand("min", minCommand); + m_commander.RegisterCommand("max", maxCommand); // Add this to our scene so scripts can call these functions m_scene.RegisterModuleCommander(m_commander); -- cgit v1.1 From 8674604ff5760335f08fa910381608757e89ad21 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jul 2012 21:10:59 +0100 Subject: regrade osFormatString, osMatchString and osReplaceString to VeryLow. I can't see that these present any real hazard to sim functioning. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fa9364d..7385dd9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2125,7 +2125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String osFormatString(string str, LSL_List strings) { - CheckThreatLevel(ThreatLevel.Low, "osFormatString"); + CheckThreatLevel(ThreatLevel.VeryLow, "osFormatString"); m_host.AddScriptLPS(1); return String.Format(str, strings.Data); @@ -2133,7 +2133,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List osMatchString(string src, string pattern, int start) { - CheckThreatLevel(ThreatLevel.High, "osMatchString"); + CheckThreatLevel(ThreatLevel.VeryLow, "osMatchString"); m_host.AddScriptLPS(1); LSL_List result = new LSL_List(); @@ -2175,7 +2175,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_String osReplaceString(string src, string pattern, string replace, int count, int start) { - CheckThreatLevel(ThreatLevel.High, "osReplaceString"); + CheckThreatLevel(ThreatLevel.VeryLow, "osReplaceString"); m_host.AddScriptLPS(1); // Normalize indices (if negative). -- cgit v1.1 From db9616f7baa45fc15a9afded024655d4ad442556 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jul 2012 21:30:20 +0100 Subject: minor: add client name to various login service log messages to disambiguate messages from concurrent logins. Also adds destination resolution debug log message showing region endpoint. Adding endpoint to the log helps to find issues where the region external host information has been wrongly configured --- OpenSim/Services/LLLoginService/LLLoginService.cs | 56 +++++++++++++++++------ 1 file changed, 43 insertions(+), 13 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 9acba11..495dc52 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -257,7 +257,9 @@ namespace OpenSim.Services.LLLoginService if (!am.Success) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is not allowed", clientVersion); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is not allowed", + firstName, lastName, clientVersion); return LLFailedLoginResponse.LoginBlockedProblem; } } @@ -269,7 +271,9 @@ namespace OpenSim.Services.LLLoginService if (dm.Success) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: client {0} is denied", clientVersion); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: client {2} is denied", + firstName, lastName, clientVersion); return LLFailedLoginResponse.LoginBlockedProblem; } } @@ -280,13 +284,16 @@ namespace OpenSim.Services.LLLoginService UserAccount account = m_UserAccountService.GetUserAccount(scopeID, firstName, lastName); if (account == null) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user not found", firstName, lastName); return LLFailedLoginResponse.UserProblem; } if (account.UserLevel < m_MinLoginLevel) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: login is blocked for user level {0}", account.UserLevel); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: user level is {2} but minimum login level is {3}", + firstName, lastName, m_MinLoginLevel, account.UserLevel); return LLFailedLoginResponse.LoginBlockedProblem; } @@ -297,7 +304,8 @@ namespace OpenSim.Services.LLLoginService { if (account.ScopeID != scopeID && account.ScopeID != UUID.Zero) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: user not found"); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed, reason: user {0} {1} not found", firstName, lastName); return LLFailedLoginResponse.UserProblem; } } @@ -316,7 +324,9 @@ namespace OpenSim.Services.LLLoginService UUID secureSession = UUID.Zero; if ((token == string.Empty) || (token != string.Empty && !UUID.TryParse(token, out secureSession))) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: authentication failed"); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: authentication failed", + firstName, lastName); return LLFailedLoginResponse.UserProblem; } @@ -325,13 +335,18 @@ namespace OpenSim.Services.LLLoginService // if (m_RequireInventory && m_InventoryService == null) { - m_log.WarnFormat("[LLOGIN SERVICE]: Login failed, reason: inventory service not set up"); + m_log.WarnFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: inventory service not set up", + firstName, lastName); return LLFailedLoginResponse.InventoryProblem; } + List inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID); if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0))) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: unable to retrieve user inventory"); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed, for {0} {1}, reason: unable to retrieve user inventory", + firstName, lastName); return LLFailedLoginResponse.InventoryProblem; } @@ -345,9 +360,12 @@ namespace OpenSim.Services.LLLoginService if (m_PresenceService != null) { success = m_PresenceService.LoginAgent(account.PrincipalID.ToString(), session, secureSession); + if (!success) { - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: could not login presence"); + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: could not login presence", + firstName, lastName); return LLFailedLoginResponse.GridProblem; } } @@ -380,9 +398,18 @@ namespace OpenSim.Services.LLLoginService if (destination == null) { m_PresenceService.LogoutAgent(session); - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: destination not found"); + + m_log.InfoFormat( + "[LLOGIN SERVICE]: Login failed for {0} {1}, reason: destination not found", + firstName, lastName); return LLFailedLoginResponse.GridProblem; } + else + { + m_log.DebugFormat( + "[LLOGIN SERVICE]: Found destination {0}, endpoint {1} for {2} {3}", + destination.RegionName, destination.ExternalEndPoint, firstName, lastName); + } if (account.UserLevel >= 200) flags |= TeleportFlags.Godlike; @@ -406,7 +433,7 @@ namespace OpenSim.Services.LLLoginService if (aCircuit == null) { m_PresenceService.LogoutAgent(session); - m_log.InfoFormat("[LLOGIN SERVICE]: Login failed, reason: {0}", reason); + m_log.InfoFormat("[LLOGIN SERVICE]: Login failed for {0} {1}, reason: {2}", firstName, lastName, reason); return new LLFailedLoginResponse("key", reason, "false"); } @@ -427,7 +454,8 @@ namespace OpenSim.Services.LLLoginService where, startLocation, position, lookAt, gestures, m_WelcomeMessage, home, clientIP, m_MapTileURL, m_ProfileURL, m_OpenIDURL, m_SearchURL, m_Currency, m_DSTZone); - m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to client."); + m_log.DebugFormat("[LLOGIN SERVICE]: All clear. Sending login response to {0} {1}", firstName, lastName); + return response; } catch (Exception e) @@ -446,7 +474,9 @@ namespace OpenSim.Services.LLLoginService { flags = TeleportFlags.ViaLogin; - m_log.DebugFormat("[LLOGIN SERVICE]: FindDestination for start location {0}", startLocation); + m_log.DebugFormat( + "[LLOGIN SERVICE]: Finding destination matching start location {0} for {1}", + startLocation, account.Name); gatekeeper = null; where = "home"; -- cgit v1.1