From 9671e43497c7bc09903d0ef34a45ee9ad1665927 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 21 Mar 2012 01:02:58 +0000 Subject: [PATCH 01/17] Replace "scene debug true false true" console command with "scene debug scripting true" or other parameters as appropriate. This is to allow individual switching of scene debug settings and to provide flexibiltiy for additional settings. --- OpenSim/Region/Application/OpenSim.cs | 17 +++--- .../World/Estate/EstateManagementModule.cs | 8 ++- OpenSim/Region/Framework/Scenes/Scene.cs | 59 ++++++++++--------- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e955a58527..169efbd10c 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -919,7 +919,7 @@ namespace OpenSim break; case "scene": - if (args.Length == 5) + if (args.Length == 4) { if (m_sceneManager.CurrentScene == null) { @@ -927,20 +927,17 @@ namespace OpenSim } else { - bool scriptingOn = !Convert.ToBoolean(args[2]); - bool collisionsOn = !Convert.ToBoolean(args[3]); - bool physicsOn = !Convert.ToBoolean(args[4]); - m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn); + string key = args[2]; + string value = args[3]; + m_sceneManager.CurrentScene.SetSceneCoreDebug( + new Dictionary() { { key, value } }); - MainConsole.Instance.Output( - String.Format( - "Set debug scene scripting = {0}, collisions = {1}, physics = {2}", - !scriptingOn, !collisionsOn, !physicsOn)); + MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value); } } else { - MainConsole.Instance.Output("Usage: debug scene (where inside <> is true/false)"); + MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics true|false"); } break; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1adeb88aa2..fc217b0d4b 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -670,7 +670,13 @@ namespace OpenSim.Region.CoreModules.World.Estate Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); - Scene.SetSceneCoreDebug(disableScripts, disableCollisions, disablePhysics); + Scene.SetSceneCoreDebug( + new Dictionary() { + { "scripting", (!disableScripts).ToString() }, + { "collisions", (!disableCollisions).ToString() }, + { "physics", (!disablePhysics).ToString() } + } + ); } private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 790ec637b8..f2200da257 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1020,44 +1020,49 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) + public void SetSceneCoreDebug(Dictionary options) { - if (m_scripts_enabled != !ScriptEngine) + if (options.ContainsKey("scripting")) { - if (ScriptEngine) + bool enableScripts = true; + if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts) { - m_log.Info("Stopping all Scripts in Scene"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) + if (!enableScripts) { - if (ent is SceneObjectGroup) - ((SceneObjectGroup)ent).RemoveScriptInstances(false); - } - } - else - { - m_log.Info("Starting all Scripts in Scene"); - - EntityBase[] entities = Entities.GetEntities(); - foreach (EntityBase ent in entities) - { - if (ent is SceneObjectGroup) + m_log.Info("Stopping all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) { - SceneObjectGroup sog = (SceneObjectGroup)ent; - sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); - sog.ResumeScripts(); + if (ent is SceneObjectGroup) + ((SceneObjectGroup)ent).RemoveScriptInstances(false); + } + } + else + { + m_log.Info("Starting all Scripts in Scene"); + + EntityBase[] entities = Entities.GetEntities(); + foreach (EntityBase ent in entities) + { + if (ent is SceneObjectGroup) + { + SceneObjectGroup sog = (SceneObjectGroup)ent; + sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); + sog.ResumeScripts(); + } } } - } - m_scripts_enabled = !ScriptEngine; - m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); + m_scripts_enabled = enableScripts; + } } - if (m_physics_enabled != !PhysicsEngine) + if (options.ContainsKey("physics")) { - m_physics_enabled = !PhysicsEngine; + bool enablePhysics = false; + if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) + m_physics_enabled = enablePhysics; } } From ab243f4a5794e6b7b9a414c2e1bb57d3d0abfb75 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 21 Mar 2012 01:13:44 +0000 Subject: [PATCH 02/17] Incorporate scene teleporting debugging into "debug scene teleport true|false" command --- OpenSim/Region/Application/OpenSim.cs | 17 +---------------- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++- .../Region/Framework/Scenes/ScenePresence.cs | 2 +- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 169efbd10c..59b6b2197e 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -937,26 +937,11 @@ namespace OpenSim } else { - MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics true|false"); + MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics|teleport true|false"); } break; - case "teleport": - foreach(Scene s in m_sceneManager.Scenes) - { - if (s.DEBUG) - { - s.DEBUG = false; - MainConsole.Instance.Output("Teleport debugging is disabled!"); - } - else{ - s.DEBUG = true; - MainConsole.Instance.Output("Teleport debugging is enabled!"); - } - } - break; - default: MainConsole.Instance.Output("Unknown debug command"); break; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f2200da257..e1e4ed5cb8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; - public bool DEBUG = false; + public bool DebugTeleporting { get; private set; } public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; @@ -1064,6 +1064,9 @@ namespace OpenSim.Region.Framework.Scenes if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) m_physics_enabled = enablePhysics; } + + if (options.ContainsKey("teleport")) + DebugTeleporting = true; } public int GetInaccurateNeighborCount() diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 704d12d58d..cf60c698be 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3826,7 +3826,7 @@ namespace OpenSim.Region.Framework.Scenes ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); if (land != null) { - if (Scene.DEBUG) + if (Scene.DebugTeleporting) TeleportFlagsDebug(); // If we come in via login, landmark or map, we want to From de53aa32e0af4a14f6a0d0f27817b41e7befa62e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 21 Mar 2012 01:27:09 +0000 Subject: [PATCH 03/17] Add Scene.DebugUpdates switch which, if turned on, will print out a warning when a frame updates takes longer than twice the desired time This is controlled via "debug scene updates true|false" on the region console. Also fix an oversight with "debug scene teleport true|false" --- OpenSim/Region/Framework/Scenes/Scene.cs | 42 ++++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e1e4ed5cb8..92c10609ee 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -65,8 +65,17 @@ namespace OpenSim.Region.Framework.Scenes #region Fields public bool EmergencyMonitoring = false; + + /// + /// Show debug information about teleports. + /// public bool DebugTeleporting { get; private set; } + /// + /// Show debug information about the scene loop. + /// + public bool DebugUpdates { get; private set; } + public SynchronizeSceneHandler SynchronizeScene; public SimStatsReporter StatsReporter; public List NorthBorders = new List(); @@ -1060,13 +1069,24 @@ namespace OpenSim.Region.Framework.Scenes if (options.ContainsKey("physics")) { - bool enablePhysics = false; - if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) + bool enablePhysics; + if (bool.TryParse(options["physics"], out enablePhysics)) m_physics_enabled = enablePhysics; } if (options.ContainsKey("teleport")) - DebugTeleporting = true; + { + bool enableTeleportDebugging; + if (bool.TryParse(options["teleport"], out enableTeleportDebugging)) + DebugTeleporting = enableTeleportDebugging; + } + + if (options.ContainsKey("updates")) + { + bool enableUpdateDebugging; + if (bool.TryParse(options["updates"], out enableUpdateDebugging)) + DebugUpdates = enableUpdateDebugging; + } } public int GetInaccurateNeighborCount() @@ -1390,7 +1410,7 @@ namespace OpenSim.Region.Framework.Scenes // Tell the watchdog that this thread is still alive Watchdog.UpdateThread(); -// previousFrameTick = m_lastFrameTick; + previousFrameTick = m_lastFrameTick; m_lastFrameTick = Util.EnvironmentTickCount(); maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); maintc = (int)(MinFrameTime * 1000) - maintc; @@ -1399,12 +1419,14 @@ namespace OpenSim.Region.Framework.Scenes Thread.Sleep(maintc); // Optionally warn if a frame takes double the amount of time that it should. -// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) -// m_log.WarnFormat( -// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", -// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), -// MinFrameTime * 1000, -// RegionInfo.RegionName); + if (DebugUpdates + && Util.EnvironmentTickCountSubtract( + m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) + m_log.WarnFormat( + "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", + Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), + MinFrameTime * 1000, + RegionInfo.RegionName); } } From 54a8a5baba4d7d3992cfe2c777c65eac812f7229 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 21 Mar 2012 02:02:14 +0000 Subject: [PATCH 04/17] If "debug scene updates true" then print out to log when a garbage collection occurs. --- OpenSim/Framework/GcNotify.cs | 62 ++++++++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 3 ++ 2 files changed, 65 insertions(+) create mode 100644 OpenSim/Framework/GcNotify.cs diff --git a/OpenSim/Framework/GcNotify.cs b/OpenSim/Framework/GcNotify.cs new file mode 100644 index 0000000000..14a22a6104 --- /dev/null +++ b/OpenSim/Framework/GcNotify.cs @@ -0,0 +1,62 @@ +/* + * 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.Reflection; +using log4net; + +public class GcNotify +{ + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public static bool Enabled + { + get { return s_initialized; } + set + { + if (!s_initialized && value) + new GcNotify(); + + s_initialized = value; + } + } + + private static bool s_initialized = false; + + private GcNotify() {} + + ~GcNotify() + { + if (!Environment.HasShutdownStarted && !AppDomain.CurrentDomain.IsFinalizingForUnload()) + { + m_log.DebugFormat("[GC NOTIFY]: Garbage collection triggered."); + + if (Enabled) + new GcNotify(); + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 92c10609ee..76e632e45d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1085,7 +1085,10 @@ namespace OpenSim.Region.Framework.Scenes { bool enableUpdateDebugging; if (bool.TryParse(options["updates"], out enableUpdateDebugging)) + { DebugUpdates = enableUpdateDebugging; + GcNotify.Enabled = DebugUpdates; + } } } From d49dd5573b3ba73e0a6065eada827037bb51ff39 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 20 Mar 2012 21:36:02 -0700 Subject: [PATCH 05/17] Removed extraneous debug messages. Added a check for UUID.Zero. --- .../Avatar/Friends/HGFriendsModule.cs | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 0fe1134d57..46b0b84787 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -261,25 +261,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // fid is not a UUID... string url = string.Empty, tmp = string.Empty, f = string.Empty, l = string.Empty; - m_log.DebugFormat("[YYY]: FID {0}", fid); if (Util.ParseUniversalUserIdentifier(fid, out agentID, out url, out f, out l, out tmp)) { - m_log.DebugFormat("[YYY]: Adding user {0} {1} {2}", f, l, url); - m_uMan.AddUser(agentID, f, l, url); + if (!agentID.Equals(UUID.Zero)) + { + m_uMan.AddUser(agentID, f, l, url); - string name = m_uMan.GetUserName(agentID); - string[] parts = name.Trim().Split(new char[] {' '}); - if (parts.Length == 2) - { - first = parts[0]; - last = parts[1]; + string name = m_uMan.GetUserName(agentID); + string[] parts = name.Trim().Split(new char[] { ' ' }); + if (parts.Length == 2) + { + first = parts[0]; + last = parts[1]; + } + else + { + first = f; + last = l; + } + return true; } - else - { - first = f; - last = l; - } - return true; } return false; } @@ -744,7 +745,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends { string[] parts = im.fromAgentName.Split(new char[] { '@' }); if (parts.Length == 2) - m_uMan.AddUser(new UUID(im.fromAgentID), parts[0], "http://" + parts[1]); + { + string[] fl = parts[0].Trim().Split(new char[] { '.' }); + if (fl.Length == 2) + m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], fl[1], "http://" + parts[1]); + else + m_uMan.AddUser(new UUID(im.fromAgentID), fl[0], "", "http://" + parts[1]); + } } return true; } From 91cc09b7bf5dd876a74413855b75a1197e3813e4 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 20 Mar 2012 21:36:24 -0700 Subject: [PATCH 06/17] HG Friends config for Robust.HG.ini.example --- bin/Robust.HG.ini.example | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index db9f08b729..e0242abbef 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -395,8 +395,12 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 HomeURI = "http://127.0.0.1:8002" [HGFriendsService] - LocalServiceModule = "OpenSim.Services.FriendsService.dll:FriendsService" - UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" + LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGFriendsService" + UserAgentService = "OpenSim.Services.HypergridService.dll:UserAgentService" + FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" + UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService" + GridService = "OpenSim.Services.GridService.dll:GridService" + PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" [HGInstantMessageService] LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService" From 1089e9b842ae359d9dcdae11145d5f329041c75e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 21 Mar 2012 08:08:12 -0700 Subject: [PATCH 07/17] Removed extraneous debug message --- OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index f6a31b5871..753c0a3aa3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -582,10 +582,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends // Try the local sim if (LocalFriendshipOffered(friendID, im)) - { - m_log.DebugFormat("[XXX]: LocalFriendshipOffered successes"); return true; - } // The prospective friend is not here [as root]. Let's forward. PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); From 8ad426f329299ecb702189b1d56ffe7be186bd58 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 21 Mar 2012 08:08:43 -0700 Subject: [PATCH 08/17] Removed extraneous debug message --- OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index ca566f2857..e0876cd5b9 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -197,7 +197,6 @@ namespace OpenSim.Server.Handlers.Hypergrid string message = string.Empty; string name = string.Empty; - m_log.DebugFormat("[HGFRIENDS HANDLER]: Friendship offered"); if (!request.ContainsKey("FromID") || !request.ContainsKey("ToID")) return BoolResult(false); From d8bcb78b10faf1e4b213a7caa7ee8fcb8d10cf52 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 21 Mar 2012 09:14:17 -0700 Subject: [PATCH 09/17] HG Friends: pulled sim-bound notification code to HGStatusNotifier, so that we can better manage this traffic. --- .../Avatar/Friends/FriendsModule.cs | 2 +- .../Avatar/Friends/HGFriendsModule.cs | 29 ++++-------- .../Avatar/Friends/HGStatusNotifier.cs | 47 +++++++++++++++++++ 3 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 753c0a3aa3..be767c4ad1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.EventManager.OnClientLogin += OnClientLogin; } - public void RegionLoaded(Scene scene) + public virtual void RegionLoaded(Scene scene) { } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index 46b0b84787..f50e52b8fa 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -62,6 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends } protected HGFriendsServicesConnector m_HGFriendsConnector = new HGFriendsServicesConnector(); + protected HGStatusNotifier m_StatusNotifier; #region ISharedRegionModule public override string Name @@ -78,6 +79,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.RegisterModuleInterface(this); } + public override void RegionLoaded(Scene scene) + { + if (!m_Enabled) + return; + if (m_StatusNotifier == null) + m_StatusNotifier = new HGStatusNotifier(this); + } + #endregion #region IFriendsSimConnector @@ -230,25 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (friendsPerDomain.ContainsKey("local")) base.StatusNotify(friendsPerDomain["local"], userID, online); - foreach (KeyValuePair> kvp in friendsPerDomain) - { - if (kvp.Key != "local") - { - // For the others, call the user agent service - List ids = new List(); - foreach (FriendInfo f in kvp.Value) - ids.Add(f.Friend); - UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); - List friendsOnline = uConn.StatusNotification(ids, userID, online); - - if (online && friendsOnline.Count > 0) - { - IClientAPI client = LocateClientObject(userID); - if (client != null) - client.SendAgentOnline(friendsOnline.ToArray()); - } - } - } + m_StatusNotifier.Notify(userID, friendsPerDomain, online); // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting StatusNotify for {0}", userID); } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs new file mode 100644 index 0000000000..62d54e4f65 --- /dev/null +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Connectors.Hypergrid; +using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; + +using OpenMetaverse; + +namespace OpenSim.Region.CoreModules.Avatar.Friends +{ + public class HGStatusNotifier + { + private HGFriendsModule m_FriendsModule; + + public HGStatusNotifier(HGFriendsModule friendsModule) + { + m_FriendsModule = friendsModule; + } + + public void Notify(UUID userID, Dictionary> friendsPerDomain, bool online) + { + foreach (KeyValuePair> kvp in friendsPerDomain) + { + if (kvp.Key != "local") + { + // For the others, call the user agent service + List ids = new List(); + foreach (FriendInfo f in kvp.Value) + ids.Add(f.Friend); + UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); + List friendsOnline = uConn.StatusNotification(ids, userID, online); + + if (online && friendsOnline.Count > 0) + { + IClientAPI client = m_FriendsModule.LocateClientObject(userID); + if (client != null) + client.SendAgentOnline(friendsOnline.ToArray()); + } + } + } + } + } +} From 4a9ca3ca8ff18f4fcf05c3983db5e6b1d49c97ee Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 21 Mar 2012 10:35:06 -0700 Subject: [PATCH 10/17] HG Friends: reroute the status notifications to the HGFriends service, so that they can scale better. They were previously being handled by the UAS; that is still there, but it's now obsolete and will be removed in a future release. --- .../Avatar/Friends/HGFriendsModule.cs | 2 +- .../Avatar/Friends/HGStatusNotifier.cs | 31 ++++- .../Hypergrid/HGFriendsServerPostHandler.cs | 56 +++++++++ .../Hypergrid/UserAgentServerConnector.cs | 1 + .../Hypergrid/HGFriendsServiceConnector.cs | 52 +++++++++ .../Hypergrid/UserAgentServiceConnector.cs | 1 + .../HypergridService/HGFriendsService.cs | 107 ++++++++++++++++++ .../HypergridService/UserAgentService.cs | 2 + .../Services/Interfaces/IHypergridServices.cs | 4 +- 9 files changed, 248 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index f50e52b8fa..e50a84a76e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); IUserManagement m_uMan; - IUserManagement UserManagementModule + public IUserManagement UserManagementModule { get { diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs index 62d54e4f65..61c6a30113 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGStatusNotifier.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; using System.Text; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -10,10 +11,14 @@ using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using OpenMetaverse; +using log4net; + namespace OpenSim.Region.CoreModules.Avatar.Friends { public class HGStatusNotifier { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private HGFriendsModule m_FriendsModule; public HGStatusNotifier(HGFriendsModule friendsModule) @@ -31,14 +36,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends List ids = new List(); foreach (FriendInfo f in kvp.Value) ids.Add(f.Friend); - UserAgentServiceConnector uConn = new UserAgentServiceConnector(kvp.Key); - List friendsOnline = uConn.StatusNotification(ids, userID, online); - if (online && friendsOnline.Count > 0) + if (ids.Count == 0) + continue; // no one to notify. caller don't do this + + m_log.DebugFormat("[HG STATUS NOTIFIER]: Notifying {0} friends in {1}", ids.Count, kvp.Key); + // ASSUMPTION: we assume that all users for one home domain + // have exactly the same set of service URLs. + // If this is ever not true, we need to change this. + UUID friendID = UUID.Zero; String tmp = String.Empty; + if (Util.ParseUniversalUserIdentifier(ids[0], out friendID, out tmp, out tmp, out tmp, out tmp)) { - IClientAPI client = m_FriendsModule.LocateClientObject(userID); - if (client != null) - client.SendAgentOnline(friendsOnline.ToArray()); + string friendsServerURI = m_FriendsModule.UserManagementModule.GetUserServerURL(friendID, "FriendsServerURI"); + HGFriendsServicesConnector fConn = new HGFriendsServicesConnector(friendsServerURI); + + List friendsOnline = fConn.StatusNotification(ids, userID, online); + + if (online && friendsOnline.Count > 0) + { + IClientAPI client = m_FriendsModule.LocateClientObject(userID); + if (client != null) + client.SendAgentOnline(friendsOnline.ToArray()); + } } } } diff --git a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs index e0876cd5b9..8ef03e7a71 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HGFriendsServerPostHandler.cs @@ -105,6 +105,9 @@ namespace OpenSim.Server.Handlers.Hypergrid case "validate_friendship_offered": return ValidateFriendshipOffered(request); + + case "statusnotification": + return StatusNotification(request); /* case "friendship_approved": return FriendshipApproved(request); @@ -228,6 +231,59 @@ namespace OpenSim.Server.Handlers.Hypergrid return BoolResult(success); } + byte[] StatusNotification(Dictionary request) + { + UUID principalID = UUID.Zero; + if (request.ContainsKey("userID")) + UUID.TryParse(request["userID"].ToString(), out principalID); + else + { + m_log.WarnFormat("[HGFRIENDS HANDLER]: no userID in request to notify"); + return FailureResult(); + } + + bool online = true; + if (request.ContainsKey("online")) + Boolean.TryParse(request["online"].ToString(), out online); + else + { + m_log.WarnFormat("[HGFRIENDS HANDLER]: no online in request to notify"); + return FailureResult(); + } + + List friends = new List(); + int i = 0; + foreach (KeyValuePair kvp in request) + { + if (kvp.Key.Equals("friend_" + i.ToString())) + { + friends.Add(kvp.Value.ToString()); + i++; + } + } + + List onlineFriends = m_TheService.StatusNotification(friends, principalID, online); + + Dictionary result = new Dictionary(); + if ((onlineFriends == null) || ((onlineFriends != null) && (onlineFriends.Count == 0))) + result["RESULT"] = "NULL"; + else + { + i = 0; + foreach (UUID f in onlineFriends) + { + result["friend_" + i] = f.ToString(); + i++; + } + } + + string xmlString = ServerUtils.BuildXmlResponse(result); + //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); + UTF8Encoding encoding = new UTF8Encoding(); + return encoding.GetBytes(xmlString); + + } + #endregion diff --git a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs index 9a0e27e2f1..db62aaa1d5 100644 --- a/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/UserAgentServerConnector.cs @@ -222,6 +222,7 @@ namespace OpenSim.Server.Handlers.Hypergrid } + [Obsolete] public XmlRpcResponse StatusNotification(XmlRpcRequest request, IPEndPoint remoteClient) { Hashtable hash = new Hashtable(); diff --git a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs index e3f326037c..e984a544fd 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HGFriendsServiceConnector.cs @@ -255,6 +255,58 @@ namespace OpenSim.Services.Connectors.Hypergrid return false; } + + public List StatusNotification(List friends, UUID userID, bool online) + { + Dictionary sendData = new Dictionary(); + List friendsOnline = new List(); + + sendData["METHOD"] = "statusnotification"; + sendData["userID"] = userID.ToString(); + sendData["online"] = online.ToString(); + int i = 0; + foreach (string s in friends) + { + sendData["friend_" + i.ToString()] = s; + i++; + } + + string reply = string.Empty; + string uri = m_ServerURI + "/hgfriends"; + try + { + reply = SynchronousRestFormsRequester.MakeRequest("POST", + uri, + ServerUtils.BuildQueryString(sendData)); + } + catch (Exception e) + { + m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Exception when contacting friends server at {0}: {1}", uri, e.Message); + return friendsOnline; + } + + if (reply != string.Empty) + { + Dictionary replyData = ServerUtils.ParseXmlResponse(reply); + + // Here is the actual response + foreach (string key in replyData.Keys) + { + if (key.StartsWith("friend_") && replyData[key] != null) + { + UUID uuid; + if (UUID.TryParse(replyData[key].ToString(), out uuid)) + friendsOnline.Add(uuid); + } + } + } + else + m_log.DebugFormat("[HGFRIENDS CONNECTOR]: Received empty reply from remote StatusNotify"); + + return friendsOnline; + + } + #endregion } } \ No newline at end of file diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index bf86035f6a..2f263ae127 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -417,6 +417,7 @@ namespace OpenSim.Services.Connectors.Hypergrid GetBoolResponse(request, out reason); } + [Obsolete] public List StatusNotification(List friends, UUID userID, bool online) { Hashtable hash = new Hashtable(); diff --git a/OpenSim/Services/HypergridService/HGFriendsService.cs b/OpenSim/Services/HypergridService/HGFriendsService.cs index 19ee3e27f9..39524ab93e 100644 --- a/OpenSim/Services/HypergridService/HGFriendsService.cs +++ b/OpenSim/Services/HypergridService/HGFriendsService.cs @@ -214,6 +214,91 @@ namespace OpenSim.Services.HypergridService return false; } + public List StatusNotification(List friends, UUID foreignUserID, bool online) + { + if (m_FriendsService == null || m_PresenceService == null) + { + m_log.WarnFormat("[HGFRIENDS SERVICE]: Unable to perform status notifications because friends or presence services are missing"); + return new List(); + } + + // Let's unblock the caller right now, and take it from here async + + List localFriendsOnline = new List(); + + m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: foreign user {0} wants to notify {1} local friends of {2} status", + foreignUserID, friends.Count, (online ? "online" : "offline")); + + // First, let's double check that the reported friends are, indeed, friends of that user + // And let's check that the secret matches + List usersToBeNotified = new List(); + foreach (string uui in friends) + { + UUID localUserID; + string secret = string.Empty, tmp = string.Empty; + if (Util.ParseUniversalUserIdentifier(uui, out localUserID, out tmp, out tmp, out tmp, out secret)) + { + FriendInfo[] friendInfos = m_FriendsService.GetFriends(localUserID); + foreach (FriendInfo finfo in friendInfos) + { + if (finfo.Friend.StartsWith(foreignUserID.ToString()) && finfo.Friend.EndsWith(secret)) + { + // great! + usersToBeNotified.Add(localUserID.ToString()); + } + } + } + } + + // Now, let's send the notifications + //m_log.DebugFormat("[HGFRIENDS SERVICE]: Status notification: user has {0} local friends", usersToBeNotified.Count); + + // First, let's send notifications to local users who are online in the home grid + PresenceInfo[] friendSessions = m_PresenceService.GetAgents(usersToBeNotified.ToArray()); + if (friendSessions != null && friendSessions.Length > 0) + { + PresenceInfo friendSession = null; + foreach (PresenceInfo pinfo in friendSessions) + if (pinfo.RegionID != UUID.Zero) // let's guard against traveling agents + { + friendSession = pinfo; + break; + } + + if (friendSession != null) + { + ForwardStatusNotificationToSim(friendSession.RegionID, foreignUserID, friendSession.UserID, online); + usersToBeNotified.Remove(friendSession.UserID.ToString()); + UUID id; + if (UUID.TryParse(friendSession.UserID, out id)) + localFriendsOnline.Add(id); + + } + } + + // Lastly, let's notify the rest who may be online somewhere else + foreach (string user in usersToBeNotified) + { + UUID id = new UUID(user); + //m_UserAgentService.LocateUser(id); + //etc... + //if (m_TravelingAgents.ContainsKey(id) && m_TravelingAgents[id].GridExternalName != m_GridName) + //{ + // string url = m_TravelingAgents[id].GridExternalName; + // // forward + //} + //m_log.WarnFormat("[HGFRIENDS SERVICE]: User {0} is visiting another grid. HG Status notifications still not implemented.", user); + } + + // and finally, let's send the online friends + if (online) + { + return localFriendsOnline; + } + else + return new List(); + } + #endregion IHGFriendsService #region Aux @@ -296,6 +381,28 @@ namespace OpenSim.Services.HypergridService return false; } + protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) + { + UUID userID; + if (UUID.TryParse(user, out userID)) + { + if (m_FriendsLocalSimConnector != null) + { + m_log.DebugFormat("[HGFRIENDS SERVICE]: Local Notify, user {0} is {1}", foreignUserID, (online ? "online" : "offline")); + m_FriendsLocalSimConnector.StatusNotify(foreignUserID, userID, online); + } + else + { + GridRegion region = m_GridService.GetRegionByUUID(UUID.Zero /* !!! */, regionID); + if (region != null) + { + m_log.DebugFormat("[HGFRIENDS SERVICE]: Remote Notify to region {0}, user {1} is {2}", region.RegionName, foreignUserID, (online ? "online" : "offline")); + m_FriendsSimConnector.StatusNotify(region, foreignUserID, userID, online); + } + } + } + } + #endregion Aux } } diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 5eca801deb..6a5007ff26 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -334,6 +334,7 @@ namespace OpenSim.Services.HypergridService return false; } + [Obsolete] public List StatusNotification(List friends, UUID foreignUserID, bool online) { if (m_FriendsService == null || m_PresenceService == null) @@ -414,6 +415,7 @@ namespace OpenSim.Services.HypergridService return new List(); } + [Obsolete] protected void ForwardStatusNotificationToSim(UUID regionID, UUID foreignUserID, string user, bool online) { UUID userID; diff --git a/OpenSim/Services/Interfaces/IHypergridServices.cs b/OpenSim/Services/Interfaces/IHypergridServices.cs index f48b8a9a76..3dc877a870 100644 --- a/OpenSim/Services/Interfaces/IHypergridServices.cs +++ b/OpenSim/Services/Interfaces/IHypergridServices.cs @@ -65,8 +65,8 @@ namespace OpenSim.Services.Interfaces UUID GetUUID(String first, String last); // Returns the local friends online + [Obsolete] List StatusNotification(List friends, UUID userID, bool online); - //List GetOnlineFriends(UUID userID, List friends); bool IsAgentComingHome(UUID sessionID, string thisGridExternalName); bool VerifyAgent(UUID sessionID, string token); @@ -92,6 +92,8 @@ namespace OpenSim.Services.Interfaces bool DeleteFriendship(FriendInfo finfo, string secret); bool FriendshipOffered(UUID from, string fromName, UUID to, string message); bool ValidateFriendshipOffered(UUID fromID, UUID toID); + // Returns the local friends online + List StatusNotification(List friends, UUID userID, bool online); } public interface IInstantMessageSimConnector From 5170cd75775eb85922783fa8afe4f8025c054189 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 21 Mar 2012 11:22:39 -0700 Subject: [PATCH 11/17] Updated the UserAccountsClient a little bit, plus some more sanity checks on the service connector. --- .../UserAccountServiceConnector.cs | 9 ++- .../UserAccounts/UserAccountsClient.cs | 80 ++++++++++++------- 2 files changed, 60 insertions(+), 29 deletions(-) diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs index 609dafefd9..6d5ce28425 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServiceConnector.cs @@ -197,8 +197,15 @@ namespace OpenSim.Services.Connectors Dictionary structData = data.ToKeyValuePairs(); - foreach (KeyValuePair kvp in structData) + foreach (KeyValuePair kvp in structData) + { + if (kvp.Value == null) + { + m_log.DebugFormat("[ACCOUNTS CONNECTOR]: Null value for {0}", kvp.Key); + continue; + } sendData[kvp.Key] = kvp.Value.ToString(); + } return SendAndGetBoolReply(sendData); } diff --git a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs index 56195b1418..1e0a35b2dc 100644 --- a/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs +++ b/OpenSim/Tests/Clients/UserAccounts/UserAccountsClient.cs @@ -62,22 +62,60 @@ namespace OpenSim.Tests.Clients.PresenceClient string last = "Clueless"; string email = "foo@bar.com"; - UserAccount account = new UserAccount(user1); - account.FirstName = first; - account.LastName = last; - account.Email = email; - account.ServiceURLs = new Dictionary(); - account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com"); - account.ServiceURLs.Add("AssetServerURI", "http://cnn.com"); + //UserAccount account = new UserAccount(user1); + //account.ScopeID = UUID.Zero; + //account.FirstName = first; + //account.LastName = last; + //account.Email = email; + //account.ServiceURLs = new Dictionary(); + //account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com"); + //account.ServiceURLs.Add("AssetServerURI", "http://cnn.com"); - bool success = m_Connector.StoreUserAccount(account); - if (success) - m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName); + //bool success = m_Connector.StoreUserAccount(account); + //if (success) + // m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName); + //else + // m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName); + + //System.Console.WriteLine("\n"); + + //account = m_Connector.GetUserAccount(UUID.Zero, user1); + //if (account == null) + // m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1); + //else + //{ + // m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", + // account.PrincipalID, account.FirstName, account.LastName, account.Email); + // foreach (KeyValuePair kvp in account.ServiceURLs) + // m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); + //} + + //System.Console.WriteLine("\n"); + + UserAccount account = m_Connector.GetUserAccount(UUID.Zero, first, last); + if (account == null) + m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name "); else - m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName); + { + m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", + account.PrincipalID, account.FirstName, account.LastName, account.Email); + foreach (KeyValuePair kvp in account.ServiceURLs) + m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); + } System.Console.WriteLine("\n"); + account = m_Connector.GetUserAccount(UUID.Zero, email); + if (account == null) + m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email"); + else + { + m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", + account.PrincipalID, account.FirstName, account.LastName, account.Email); + foreach (KeyValuePair kvp in account.ServiceURLs) + m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); + } + System.Console.WriteLine("\n"); account = m_Connector.GetUserAccount(UUID.Zero, user1); if (account == null) m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1); @@ -90,30 +128,16 @@ namespace OpenSim.Tests.Clients.PresenceClient } System.Console.WriteLine("\n"); - - account = m_Connector.GetUserAccount(UUID.Zero, first, last); + account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist"); if (account == null) - m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name for {0}", user1); + m_log.InfoFormat("[USER CLIENT]: Unable to retrieve account 'DoesNot Exist'"); else { - m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", + m_log.InfoFormat("[USER CLIENT]: Account 'DoesNot Exist' retrieved correctly. REALLY??? userID={0}; FirstName={1}; LastName={2}; Email={3}", account.PrincipalID, account.FirstName, account.LastName, account.Email); foreach (KeyValuePair kvp in account.ServiceURLs) m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); } - - System.Console.WriteLine("\n"); - account = m_Connector.GetUserAccount(UUID.Zero, email); - if (account == null) - m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email for {0}", user1); - else - { - m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}", - account.PrincipalID, account.FirstName, account.LastName, account.Email); - foreach (KeyValuePair kvp in account.ServiceURLs) - m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value); - } - } } From 1a8769e6eff0eab750a528f27d127637edbd292b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 21 Mar 2012 23:57:39 +0000 Subject: [PATCH 12/17] Instead of loading default avatar animations in both SLUtil and AvatarAnimations, load just in AvatarAnimations instead. This lets us remove the dependency of OpenSim.Framework.dll on data/avataranimations.xml, which is not necessary for ROBUST. This commit also takes care of the odd situation where animations are stored and used internally with uppercase names (e.g. "STAND") but scripts refer to them with lowercase names (e.g. "sit"). --- OpenSim/Framework/IClientAPI.cs | 3 +- OpenSim/Framework/SLUtil.cs | 50 +----------- .../ClientStack/Linden/UDP/LLClientView.cs | 7 +- .../Scenes/Animation/AnimationSet.cs | 14 +++- .../Scenes/Animation/AvatarAnimations.cs | 79 +++++++++++++++---- .../Scenes/Animation/ScenePresenceAnimator.cs | 8 +- .../Server/IRCClientView.cs | 5 -- .../OptionalModules/World/NPC/NPCAvatar.cs | 5 -- .../Shared/Api/Implementation/LSL_Api.cs | 6 +- OpenSim/Tests/Common/Mock/TestClient.cs | 5 -- 10 files changed, 84 insertions(+), 98 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index c85e599e26..3f560d0ec4 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1215,10 +1215,9 @@ namespace OpenSim.Framework /// The orbital position is given in radians, and must be "adjusted" for the linden client, see LLClientView void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition); - + void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks); void SendViewerTime(int phase); - UUID GetDefaultAnimation(string name); void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID); diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs index f9cb851a9e..db4541ef1a 100644 --- a/OpenSim/Framework/SLUtil.cs +++ b/OpenSim/Framework/SLUtil.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Reflection; using System.Xml; using log4net; @@ -40,13 +41,6 @@ namespace OpenSim.Framework #region SL / file extension / content-type conversions - public static Dictionary DefaultAvatarAnimations = new Dictionary(); - - static SLUtil() - { - DefaultAvatarAnimations = LoadDefaultAvatarAnimations("data/avataranimations.xml"); - } - public static string SLAssetTypeToContentType(int assetType) { switch ((AssetType)assetType) @@ -382,47 +376,5 @@ namespace OpenSim.Framework return output; } - - /// - /// Load the default SL avatar animations. - /// - /// - public static Dictionary LoadDefaultAvatarAnimations(string path) - { - Dictionary animations = new Dictionary(); - - using (XmlTextReader reader = new XmlTextReader(path)) - { - XmlDocument doc = new XmlDocument(); - doc.Load(reader); - if (doc.DocumentElement != null) - { - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) - { - string name = nod.Attributes["name"].Value.ToLower(); - string id = nod.InnerText; - animations.Add(name, (UUID)id); - } - } - } - } - - return animations; - } - - /// - /// Get the default SL avatar animation with the given name. - /// - /// - /// - public static UUID GetDefaultAvatarAnimation(string name) - { - if (DefaultAvatarAnimations.ContainsKey(name)) - return DefaultAvatarAnimations[name]; - - return UUID.Zero; - } } } \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index b388b10b8a..68aae14d77 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -11202,15 +11202,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP scriptQuestion.Data.Questions = question; scriptQuestion.Data.ObjectName = Util.StringToBytes256(taskName); scriptQuestion.Data.ObjectOwner = Util.StringToBytes256(ownerName); - + OutPacket(scriptQuestion, ThrottleOutPacketType.Task); } - public UUID GetDefaultAnimation(string name) - { - return SLUtil.GetDefaultAvatarAnimation(name); - } - /// /// Handler called when we receive a logout packet. /// diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 9176d3d70d..240a424415 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -27,8 +27,10 @@ using System; using System.Collections.Generic; -using OpenSim.Framework; +using System.Reflection; +using log4net; using OpenMetaverse; +using OpenSim.Framework; using Animation = OpenSim.Framework.Animation; @@ -37,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation [Serializable] public class AnimationSet { - public static AvatarAnimations Animations = new AvatarAnimations(); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private OpenSim.Framework.Animation m_defaultAnimation = new OpenSim.Framework.Animation(); private List m_animations = new List(); @@ -132,9 +134,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation /// public bool TrySetDefaultAnimation(string anim, int sequenceNum, UUID objectID) { - if (Animations.AnimsUUID.ContainsKey(anim)) +// m_log.DebugFormat( +// "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", +// anim, sequenceNum, objectID); + + if (AvatarAnimations.AnimsUUID.ContainsKey(anim)) { - return SetDefaultAnimation(Animations.AnimsUUID[anim], sequenceNum, objectID); + return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); } return false; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs index 659c3a5c54..ec928f4e97 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs @@ -26,38 +26,83 @@ */ using System.Collections.Generic; +using System.Reflection; using System.Xml; +using log4net; using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes.Animation { public class AvatarAnimations { - public Dictionary AnimsUUID = new Dictionary(); - public Dictionary AnimsNames = new Dictionary(); - public Dictionary AnimStateNames = new Dictionary(); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - public AvatarAnimations() + public static readonly string DefaultAnimationsPath = "data/avataranimations.xml"; + + public static Dictionary AnimsUUID = new Dictionary(); + public static Dictionary AnimsNames = new Dictionary(); + public static Dictionary AnimStateNames = new Dictionary(); + + static AvatarAnimations() { - using (XmlTextReader reader = new XmlTextReader("data/avataranimations.xml")) + LoadAnimations(DefaultAnimationsPath); + } + + /// + /// Load the default SL avatar animations. + /// + /// + private static void LoadAnimations(string path) + { +// Dictionary animations = new Dictionary(); + + using (XmlTextReader reader = new XmlTextReader(path)) { XmlDocument doc = new XmlDocument(); doc.Load(reader); - foreach (XmlNode nod in doc.DocumentElement.ChildNodes) - { - if (nod.Attributes["name"] != null) +// if (doc.DocumentElement != null) +// { + foreach (XmlNode nod in doc.DocumentElement.ChildNodes) { - string name = (string)nod.Attributes["name"].Value; - UUID id = (UUID)nod.InnerText; - string animState = (string)nod.Attributes["state"].Value; + if (nod.Attributes["name"] != null) + { + string name = nod.Attributes["name"].Value; + UUID id = (UUID)nod.InnerText; + string animState = (string)nod.Attributes["state"].Value; - AnimsUUID.Add(name, id); - AnimsNames.Add(id, name); - if (animState != "") - AnimStateNames.Add(id, animState); + AnimsUUID.Add(name, id); + AnimsNames.Add(id, name); + if (animState != "") + AnimStateNames.Add(id, animState); + +// m_log.DebugFormat("[AVATAR ANIMATIONS]: Loaded {0} {1} {2}", id, name, animState); + } } - } +// } } + +// return animations; + } + + /// + /// Get the default avatar animation with the given name. + /// + /// + /// + public static UUID GetDefaultAnimation(string name) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Looking for default avatar animation with name {0}", name); + + if (AnimsUUID.ContainsKey(name)) + { +// m_log.DebugFormat( +// "[AVATAR ANIMATIONS]: Found {0} {1} in GetDefaultAvatarAnimation()", AnimsUUID[name], name); + + return AnimsUUID[name]; + } + + return UUID.Zero; } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 3584cda015..9038ebc590 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -97,7 +97,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; - UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); + // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations + // are referenced with lower case names! + UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; @@ -121,7 +123,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_scenePresence.IsChildAgent) return; - UUID animID = m_scenePresence.ControllingClient.GetDefaultAnimation(name); + // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations + // are referenced with lower case names! + UUID animID = AvatarAnimations.GetDefaultAnimation(name); if (animID == UUID.Zero) return; diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index d3c96e27ae..5cf478ac10 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1203,11 +1203,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public UUID GetDefaultAnimation(string name) - { - return UUID.Zero; - } - public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, byte[] charterMember, string flAbout, uint flags, UUID flImageID, UUID imageID, string profileURL, UUID partnerID) { diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 24b9e6b4b1..16ec34f62c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -133,11 +133,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC } - public UUID GetDefaultAnimation(string name) - { - return SLUtil.GetDefaultAvatarAnimation(name); - } - public Vector3 Position { get { return m_scene.Entities[m_uuid].AbsolutePosition; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bb374ed002..27f7c03dee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4314,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.RegionHandle == presence.RegionHandle) { - Dictionary animationstateNames = AnimationSet.Animations.AnimStateNames; + Dictionary animationstateNames = AvatarAnimations.AnimStateNames; if (presence != null) { @@ -5600,7 +5600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (agent.Animator.Animations.DefaultAnimation.AnimID - == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) + == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { flags |= ScriptBaseClass.AGENT_SITTING; } @@ -7714,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector lower; LSL_Vector upper; if (presence.Animator.Animations.DefaultAnimation.AnimID - == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) + == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { // This is for ground sitting avatars float height = presence.Appearance.AvatarHeight / 2.66666667f; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 14c12874e2..455b51e595 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -700,11 +700,6 @@ namespace OpenSim.Tests.Common.Mock { } - public UUID GetDefaultAnimation(string name) - { - return UUID.Zero; - } - public void SendTakeControls(int controls, bool passToAgent, bool TakeControls) { } From 9949ac2f9f448faaa873b98451c6025d687358a2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Mar 2012 00:10:41 +0000 Subject: [PATCH 13/17] refactor: Rename AvatarAnimations -> DefaultAvatarAnimations for code clarity since non-default animations are handled completely separately from this class --- OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | 4 ++-- .../{AvatarAnimations.cs => DefaultAvatarAnimations.cs} | 4 ++-- .../Framework/Scenes/Animation/ScenePresenceAnimator.cs | 4 ++-- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) rename OpenSim/Region/Framework/Scenes/Animation/{AvatarAnimations.cs => DefaultAvatarAnimations.cs} (98%) diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 240a424415..33041e9ac7 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -138,9 +138,9 @@ namespace OpenSim.Region.Framework.Scenes.Animation // "[ANIMATION SET]: Setting default animation {0}, sequence number {1}, object id {2}", // anim, sequenceNum, objectID); - if (AvatarAnimations.AnimsUUID.ContainsKey(anim)) + if (DefaultAvatarAnimations.AnimsUUID.ContainsKey(anim)) { - return SetDefaultAnimation(AvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); + return SetDefaultAnimation(DefaultAvatarAnimations.AnimsUUID[anim], sequenceNum, objectID); } return false; } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs similarity index 98% rename from OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs rename to OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs index ec928f4e97..c2b0468067 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AvatarAnimations.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/DefaultAvatarAnimations.cs @@ -33,7 +33,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Scenes.Animation { - public class AvatarAnimations + public class DefaultAvatarAnimations { // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -43,7 +43,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation public static Dictionary AnimsNames = new Dictionary(); public static Dictionary AnimStateNames = new Dictionary(); - static AvatarAnimations() + static DefaultAvatarAnimations() { LoadAnimations(DefaultAnimationsPath); } diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 9038ebc590..cded9be47d 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -99,7 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = AvatarAnimations.GetDefaultAnimation(name.ToUpper()); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name.ToUpper()); if (animID == UUID.Zero) return; @@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation // XXX: For some reason, we store all animations and use them with upper case names, but in LSL animations // are referenced with lower case names! - UUID animID = AvatarAnimations.GetDefaultAnimation(name); + UUID animID = DefaultAvatarAnimations.GetDefaultAnimation(name); if (animID == UUID.Zero) return; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 27f7c03dee..d7a629bf8b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4314,7 +4314,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (m_host.RegionHandle == presence.RegionHandle) { - Dictionary animationstateNames = AvatarAnimations.AnimStateNames; + Dictionary animationstateNames = DefaultAvatarAnimations.AnimStateNames; if (presence != null) { @@ -5600,7 +5600,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (agent.Animator.Animations.DefaultAnimation.AnimID - == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) + == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { flags |= ScriptBaseClass.AGENT_SITTING; } @@ -7714,7 +7714,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector lower; LSL_Vector upper; if (presence.Animator.Animations.DefaultAnimation.AnimID - == AvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) + == DefaultAvatarAnimations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) { // This is for ground sitting avatars float height = presence.Appearance.AvatarHeight / 2.66666667f; From 06c81a2afe4d3c4060863cbb7736776ebf77bfba Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 21 Mar 2012 20:31:51 -0400 Subject: [PATCH 14/17] Fix typo Add enclosing " to urls --- bin/Robust.ini.example | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 326caeb86d..69e94a584a 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -225,10 +225,10 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003 MapTileURL = "http://127.0.0.1:8002"; ; For V2/3 Web Profiles - ProfileServerURL = "http://127.0.0.1/profiles/[AGENT_NAME] + ProfileServerURL = "http://127.0.0.1/profiles/[AGENT_NAME]" ; For V2/V3 webapp authentication SSO - OpenIDServerURL = "http://127.0.0.1/openid/openidserver/ + OpenIDServerURL = "http://127.0.0.1/openid/openidserver/" ; If you run this login server behind a proxy, set this to true ; HasProxy = false From 6146e7ef258b10888ad7464b72b75cca701e02c9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 22 Mar 2012 12:57:12 -0700 Subject: [PATCH 15/17] Simple build permissions feature. NOTE: EXPERIMENTAL, DISABLED BY DEFAULT. Turns out that this can't be expressed by cascading Permission modules, so I did it as per this patch. --- OpenSim/Framework/ILandObject.cs | 2 + .../CoreModules/World/Land/LandObject.cs | 41 +++++++++++++++++-- .../World/Permissions/PermissionsModule.cs | 34 ++++++++++++++- .../Framework/Scenes/Scene.Permissions.cs | 17 ++++++++ bin/OpenSim.ini.example | 8 ++++ bin/OpenSimDefaults.ini | 7 ++++ 6 files changed, 103 insertions(+), 6 deletions(-) diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index dd73b3fe01..33aad9beb4 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -63,6 +63,7 @@ namespace OpenSim.Framework bool ContainsPoint(int x, int y); ILandObject Copy(); + ILandObject MemberwiseCopy(); void SendLandUpdateToAvatarsOverMe(); @@ -70,6 +71,7 @@ namespace OpenSim.Framework void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); bool IsEitherBannedOrRestricted(UUID avatar); bool IsBannedFromLand(UUID avatar); + bool IsAllowedInLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar); void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index cc42f7f493..640a024c9c 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -169,6 +169,11 @@ namespace OpenSim.Region.CoreModules.World.Land return newLand; } + public ILandObject MemberwiseCopy() + { + return (ILandObject)this.MemberwiseClone(); + } + static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; @@ -242,11 +247,13 @@ namespace OpenSim.Region.CoreModules.World.Land m_lastSeqId = seq_id; } + ILandObject landToSend = this; + m_scene.Permissions.LandObjectForClient(remote_client.AgentId, (ILandObject)this, out landToSend); remote_client.SendLandProperties(seq_id, - snap_selection, request_result, this, - (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, - GetParcelMaxPrimCount(), - GetSimulatorMaxPrimCount(), regionFlags); + snap_selection, request_result, landToSend, + (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, + GetParcelMaxPrimCount(), + GetSimulatorMaxPrimCount(), regionFlags); } public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) @@ -475,6 +482,32 @@ namespace OpenSim.Region.CoreModules.World.Land return false; } + public bool IsAllowedInLand(UUID avatar) + { + ExpireAccessList(); + + if (m_scene.Permissions.IsAdministrator(avatar)) + return true; + + if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) + return true; + + if (avatar == LandData.OwnerID) + return true; + + if (LandData.ParcelAccessList.FindIndex( + delegate(LandAccessEntry e) + { + if (e.AgentID == avatar && e.Flags == AccessList.Access) + return true; + return false; + }) != -1) + { + return true; + } + return false; + } + public void SendLandUpdateToClient(IClientAPI remote_client) { SendLandProperties(0, false, 0, remote_client); diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 6018c3926d..f536a0f326 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions private bool m_RegionOwnerIsGod = false; private bool m_RegionManagerIsGod = false; private bool m_ParcelOwnerIsGod = false; - + + private bool m_SimpleBuildPermissions = false; + /// /// The set of users that are allowed to create scripts. This is only active if permissions are not being /// bypassed. This overrides normal permissions. @@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); - + + m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); + m_allowedScriptCreators = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); m_allowedScriptEditors @@ -206,6 +210,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; + if (m_SimpleBuildPermissions) + m_scene.Permissions.OnSendLandProperties += GenerateLandProperties; + m_scene.AddCommand("Users", this, "bypass permissions", "bypass permissions ", "Bypass permission checks", @@ -824,6 +831,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions permission = true; } + if (m_SimpleBuildPermissions && + (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsAllowedInLand(user)) + permission = true; + return permission; } @@ -1966,5 +1977,24 @@ namespace OpenSim.Region.CoreModules.World.Permissions return false; } + + private void GenerateLandProperties(UUID userID, ILandObject realLand, out ILandObject landToSend) + { + landToSend = realLand; + if (m_bypassPermissions) return; + + if (m_SimpleBuildPermissions && + !m_scene.Permissions.IsAdministrator(userID) && + !realLand.LandData.OwnerID.Equals(userID) && + ((realLand.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && realLand.IsAllowedInLand(userID))) + { + ILandObject clone = realLand.MemberwiseCopy(); + LandData ldata = realLand.LandData.Copy(); + clone.LandData = ldata; + clone.LandData.Flags |= (uint)(ParcelFlags.AllowAPrimitiveEntry | ParcelFlags.AllowFly | ParcelFlags.AllowOtherScripts | ParcelFlags.CreateObjects); + landToSend = clone; + } + } + } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index e1fedf4bd0..a4605c431c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -90,6 +90,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); + public delegate void SendLandPropertiesHandler(UUID userID, ILandObject realLand, out ILandObject landToSend); #endregion public class ScenePermissions @@ -157,6 +158,7 @@ namespace OpenSim.Region.Framework.Scenes public event TeleportHandler OnTeleport; public event ControlPrimMediaHandler OnControlPrimMedia; public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; + public event SendLandPropertiesHandler OnSendLandProperties; #endregion #region Object Permission Checks @@ -1098,5 +1100,20 @@ namespace OpenSim.Region.Framework.Scenes } return true; } + + public void LandObjectForClient(UUID userID, ILandObject realLand, out ILandObject landToSend) + { + landToSend = realLand; + SendLandPropertiesHandler handler = OnSendLandProperties; + if (handler != null) + { + Delegate[] list = handler.GetInvocationList(); + foreach (SendLandPropertiesHandler h in list) + { + h(userID, realLand, out landToSend); + } + } + } + } } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 2c85f9db18..01dc1d6956 100755 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -194,6 +194,14 @@ ; region_manager_is_god = false ; parcel_owner_is_god = true + ;; More control over permissions + ;; This is definitely not SL! + ; Provides a simple control for land owners to give build rights to specific avatars + ; in publicly accessible parcels that disallow object creation in general. + ; Owners specific avatars by adding them to the Access List of the parcel + ; without having to use the Groups feature + ; simple_build_permissions = false + ;; Default script engine to use. Currently, we only have XEngine ; DefaultScriptEngine = "XEngine" diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index fd31131bb5..1a0d801c78 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -260,6 +260,13 @@ ; Default value is all ; allowed_script_editors = all + ; Provides a simple control for land owners to give build rights to + ; publicly accessible parcels that disallow object creation in general. + ; Owners specific avatars by adding them to the Access List of the parcel + ; without having to use the Groups feature + ; Disabled by default + ; simple_build_permissions = False + ; ## ; ## SCRIPT ENGINE ; ## From 45b588cf008c514f461bf43c168dcdc9902b7bb9 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 22 Mar 2012 20:10:38 +0000 Subject: [PATCH 16/17] Revert "Simple build permissions feature. NOTE: EXPERIMENTAL, DISABLED BY DEFAULT. Turns out that this can't be expressed by cascading Permission modules, so I did it as per this patch." This reverts commit 6146e7ef258b10888ad7464b72b75cca701e02c9. --- OpenSim/Framework/ILandObject.cs | 2 - .../CoreModules/World/Land/LandObject.cs | 41 ++----------------- .../World/Permissions/PermissionsModule.cs | 34 +-------------- .../Framework/Scenes/Scene.Permissions.cs | 17 -------- bin/OpenSim.ini.example | 8 ---- bin/OpenSimDefaults.ini | 7 ---- 6 files changed, 6 insertions(+), 103 deletions(-) diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index 33aad9beb4..dd73b3fe01 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -63,7 +63,6 @@ namespace OpenSim.Framework bool ContainsPoint(int x, int y); ILandObject Copy(); - ILandObject MemberwiseCopy(); void SendLandUpdateToAvatarsOverMe(); @@ -71,7 +70,6 @@ namespace OpenSim.Framework void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client); bool IsEitherBannedOrRestricted(UUID avatar); bool IsBannedFromLand(UUID avatar); - bool IsAllowedInLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar); void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 640a024c9c..cc42f7f493 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -169,11 +169,6 @@ namespace OpenSim.Region.CoreModules.World.Land return newLand; } - public ILandObject MemberwiseCopy() - { - return (ILandObject)this.MemberwiseClone(); - } - static overrideParcelMaxPrimCountDelegate overrideParcelMaxPrimCount; static overrideSimulatorMaxPrimCountDelegate overrideSimulatorMaxPrimCount; @@ -247,13 +242,11 @@ namespace OpenSim.Region.CoreModules.World.Land m_lastSeqId = seq_id; } - ILandObject landToSend = this; - m_scene.Permissions.LandObjectForClient(remote_client.AgentId, (ILandObject)this, out landToSend); remote_client.SendLandProperties(seq_id, - snap_selection, request_result, landToSend, - (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, - GetParcelMaxPrimCount(), - GetSimulatorMaxPrimCount(), regionFlags); + snap_selection, request_result, this, + (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, + GetParcelMaxPrimCount(), + GetSimulatorMaxPrimCount(), regionFlags); } public void UpdateLandProperties(LandUpdateArgs args, IClientAPI remote_client) @@ -482,32 +475,6 @@ namespace OpenSim.Region.CoreModules.World.Land return false; } - public bool IsAllowedInLand(UUID avatar) - { - ExpireAccessList(); - - if (m_scene.Permissions.IsAdministrator(avatar)) - return true; - - if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) - return true; - - if (avatar == LandData.OwnerID) - return true; - - if (LandData.ParcelAccessList.FindIndex( - delegate(LandAccessEntry e) - { - if (e.AgentID == avatar && e.Flags == AccessList.Access) - return true; - return false; - }) != -1) - { - return true; - } - return false; - } - public void SendLandUpdateToClient(IClientAPI remote_client) { SendLandProperties(0, false, 0, remote_client); diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f536a0f326..6018c3926d 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -94,9 +94,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions private bool m_RegionOwnerIsGod = false; private bool m_RegionManagerIsGod = false; private bool m_ParcelOwnerIsGod = false; - - private bool m_SimpleBuildPermissions = false; - + /// /// The set of users that are allowed to create scripts. This is only active if permissions are not being /// bypassed. This overrides normal permissions. @@ -141,9 +139,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); - - m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); - + m_allowedScriptCreators = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); m_allowedScriptEditors @@ -210,9 +206,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; - if (m_SimpleBuildPermissions) - m_scene.Permissions.OnSendLandProperties += GenerateLandProperties; - m_scene.AddCommand("Users", this, "bypass permissions", "bypass permissions ", "Bypass permission checks", @@ -831,10 +824,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions permission = true; } - if (m_SimpleBuildPermissions && - (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsAllowedInLand(user)) - permission = true; - return permission; } @@ -1977,24 +1966,5 @@ namespace OpenSim.Region.CoreModules.World.Permissions return false; } - - private void GenerateLandProperties(UUID userID, ILandObject realLand, out ILandObject landToSend) - { - landToSend = realLand; - if (m_bypassPermissions) return; - - if (m_SimpleBuildPermissions && - !m_scene.Permissions.IsAdministrator(userID) && - !realLand.LandData.OwnerID.Equals(userID) && - ((realLand.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && realLand.IsAllowedInLand(userID))) - { - ILandObject clone = realLand.MemberwiseCopy(); - LandData ldata = realLand.LandData.Copy(); - clone.LandData = ldata; - clone.LandData.Flags |= (uint)(ParcelFlags.AllowAPrimitiveEntry | ParcelFlags.AllowFly | ParcelFlags.AllowOtherScripts | ParcelFlags.CreateObjects); - landToSend = clone; - } - } - } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs index a4605c431c..e1fedf4bd0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs @@ -90,7 +90,6 @@ namespace OpenSim.Region.Framework.Scenes public delegate bool TeleportHandler(UUID userID, Scene scene); public delegate bool ControlPrimMediaHandler(UUID userID, UUID primID, int face); public delegate bool InteractWithPrimMediaHandler(UUID userID, UUID primID, int face); - public delegate void SendLandPropertiesHandler(UUID userID, ILandObject realLand, out ILandObject landToSend); #endregion public class ScenePermissions @@ -158,7 +157,6 @@ namespace OpenSim.Region.Framework.Scenes public event TeleportHandler OnTeleport; public event ControlPrimMediaHandler OnControlPrimMedia; public event InteractWithPrimMediaHandler OnInteractWithPrimMedia; - public event SendLandPropertiesHandler OnSendLandProperties; #endregion #region Object Permission Checks @@ -1100,20 +1098,5 @@ namespace OpenSim.Region.Framework.Scenes } return true; } - - public void LandObjectForClient(UUID userID, ILandObject realLand, out ILandObject landToSend) - { - landToSend = realLand; - SendLandPropertiesHandler handler = OnSendLandProperties; - if (handler != null) - { - Delegate[] list = handler.GetInvocationList(); - foreach (SendLandPropertiesHandler h in list) - { - h(userID, realLand, out landToSend); - } - } - } - } } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 01dc1d6956..2c85f9db18 100755 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -194,14 +194,6 @@ ; region_manager_is_god = false ; parcel_owner_is_god = true - ;; More control over permissions - ;; This is definitely not SL! - ; Provides a simple control for land owners to give build rights to specific avatars - ; in publicly accessible parcels that disallow object creation in general. - ; Owners specific avatars by adding them to the Access List of the parcel - ; without having to use the Groups feature - ; simple_build_permissions = false - ;; Default script engine to use. Currently, we only have XEngine ; DefaultScriptEngine = "XEngine" diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 1a0d801c78..fd31131bb5 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -260,13 +260,6 @@ ; Default value is all ; allowed_script_editors = all - ; Provides a simple control for land owners to give build rights to - ; publicly accessible parcels that disallow object creation in general. - ; Owners specific avatars by adding them to the Access List of the parcel - ; without having to use the Groups feature - ; Disabled by default - ; simple_build_permissions = False - ; ## ; ## SCRIPT ENGINE ; ## From b5d0bc24887e177e7b6e982789bfd86f27b84cf0 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 22 Mar 2012 20:25:20 +0000 Subject: [PATCH 17/17] Rework Diva's patch to simplify it --- OpenSim/Framework/ILandObject.cs | 1 + .../CoreModules/World/Land/LandObject.cs | 33 +++++++++++-------- .../World/Permissions/PermissionsModule.cs | 12 +++++-- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/OpenSim/Framework/ILandObject.cs b/OpenSim/Framework/ILandObject.cs index dd73b3fe01..4f98d7bb30 100644 --- a/OpenSim/Framework/ILandObject.cs +++ b/OpenSim/Framework/ILandObject.cs @@ -71,6 +71,7 @@ namespace OpenSim.Framework bool IsEitherBannedOrRestricted(UUID avatar); bool IsBannedFromLand(UUID avatar); bool IsRestrictedFromLand(UUID avatar); + bool IsInLandAccessList(UUID avatar); void SendLandUpdateToClient(IClientAPI remote_client); void SendLandUpdateToClient(bool snap_selection, IClientAPI remote_client); List CreateAccessListArrayByFlag(AccessList flag); diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index cc42f7f493..27f0052572 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -448,8 +448,6 @@ namespace OpenSim.Region.CoreModules.World.Land public bool IsRestrictedFromLand(UUID avatar) { - ExpireAccessList(); - if (m_scene.Permissions.IsAdministrator(avatar)) return false; @@ -459,20 +457,27 @@ namespace OpenSim.Region.CoreModules.World.Land if (avatar == LandData.OwnerID) return false; - if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) + if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) == 0) + return true; + + return (!IsInLandAccessList(avatar)); + } + + public bool IsInLandAccessList(UUID avatar) + { + ExpireAccessList(); + + if (LandData.ParcelAccessList.FindIndex( + delegate(LandAccessEntry e) + { + if (e.AgentID == avatar && e.Flags == AccessList.Access) + return true; + return false; + }) == -1) { - if (LandData.ParcelAccessList.FindIndex( - delegate(LandAccessEntry e) - { - if (e.AgentID == avatar && e.Flags == AccessList.Access) - return true; - return false; - }) == -1) - { - return true; - } + return false; } - return false; + return true; } public void SendLandUpdateToClient(IClientAPI remote_client) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 6018c3926d..ac03747620 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -94,7 +94,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions private bool m_RegionOwnerIsGod = false; private bool m_RegionManagerIsGod = false; private bool m_ParcelOwnerIsGod = false; - + + private bool m_SimpleBuildPermissions = false; + /// /// The set of users that are allowed to create scripts. This is only active if permissions are not being /// bypassed. This overrides normal permissions. @@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false); m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); - + + m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); + m_allowedScriptCreators = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); m_allowedScriptEditors @@ -824,6 +828,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions permission = true; } + if (m_SimpleBuildPermissions && + (parcel.LandData.Flags & (uint)ParcelFlags.UseAccessList) == 0 && parcel.IsInLandAccessList(user)) + permission = true; + return permission; }