From db8fd1eb9f75eb7948c9c629064b7fcb5a95809d Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Mon, 12 Dec 2011 00:21:19 -0800 Subject: Added an option for extra settings within region ini file. Any non-hardcoded key-value string pair can be added per-region and referenced by any part of OpenSim with access to the RegionInfo --- OpenSim/Framework/RegionInfo.cs | 75 ++++++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 20 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index f7c080f..169b951 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -141,6 +141,8 @@ namespace OpenSim.Framework public string RemotingAddress; public UUID ScopeID = UUID.Zero; + private Dictionary m_otherSettings = new Dictionary(); + // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. @@ -443,6 +445,18 @@ namespace OpenSim.Framework m_internalEndPoint = tmpEPE; } + public string GetOtherSetting(string key) + { + string val; + m_otherSettings.TryGetValue(key, out val); + return val; + } + + public void SetOtherSetting(string key, string value) + { + m_otherSettings[key] = value; + } + private void ReadNiniConfig(IConfigSource source, string name) { // bool creatingNew = false; @@ -471,30 +485,39 @@ namespace OpenSim.Framework if (source.Configs[name] == null) { source.AddConfig(name); - -// creatingNew = true; } + RegionName = name; IConfig config = source.Configs[name]; - // UUID + // Track all of the keys in this config and remove as they are processed + // The remaining keys will be added to generic key-value storage for + // whoever might need it + HashSet allKeys = new HashSet(); + foreach (string s in config.GetKeys()) + { + allKeys.Add(s.ToLower()); + } + + // RegionUUID // + allKeys.Remove(("RegionUUID").ToLower()); string regionUUID = config.GetString("RegionUUID", string.Empty); - if (regionUUID == String.Empty) { UUID newID = UUID.Random(); - regionUUID = MainConsole.Instance.CmdPrompt("Region UUID", newID.ToString()); + regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString()); config.Set("RegionUUID", regionUUID); } RegionID = new UUID(regionUUID); - originRegionID = RegionID; // What IS this?! + originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?) - RegionName = name; + // Location + // + allKeys.Remove(("Location").ToLower()); string location = config.GetString("Location", String.Empty); - if (location == String.Empty) { location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000"); @@ -506,9 +529,10 @@ namespace OpenSim.Framework m_regionLocX = Convert.ToUInt32(locationElements[0]); m_regionLocY = Convert.ToUInt32(locationElements[1]); - // Internal IP + // InternalAddress + // IPAddress address; - + allKeys.Remove(("InternalAddress").ToLower()); if (config.Contains("InternalAddress")) { address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); @@ -519,8 +543,10 @@ namespace OpenSim.Framework config.Set("InternalAddress", address.ToString()); } + // InternalPort + // int port; - + allKeys.Remove(("InternalPort").ToLower()); if (config.Contains("InternalPort")) { port = config.GetInt("InternalPort", 9000); @@ -530,9 +556,11 @@ namespace OpenSim.Framework port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000")); config.Set("InternalPort", port); } - m_internalEndPoint = new IPEndPoint(address, port); + // AllowAlternatePorts + // + allKeys.Remove(("AllowAlternatePorts").ToLower()); if (config.Contains("AllowAlternatePorts")) { m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); @@ -544,10 +572,10 @@ namespace OpenSim.Framework config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); } - // External IP + // ExternalHostName // + allKeys.Remove(("ExternalHostName").ToLower()); string externalName; - if (config.Contains("ExternalHostName")) { externalName = config.GetString("ExternalHostName", "SYSTEMIP"); @@ -557,7 +585,6 @@ namespace OpenSim.Framework externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP"); config.Set("ExternalHostName", externalName); } - if (externalName == "SYSTEMIP") { m_externalHostName = Util.GetLocalHost().ToString(); @@ -570,24 +597,32 @@ namespace OpenSim.Framework m_externalHostName = externalName; } + // RegionType m_regionType = config.GetString("RegionType", String.Empty); + allKeys.Remove(("RegionType").ToLower()); // Prim stuff // m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256); - + allKeys.Remove(("NonphysicalPrimMax").ToLower()); m_physPrimMax = config.GetInt("PhysicalPrimMax", 10); - + allKeys.Remove(("PhysicalPrimMax").ToLower()); m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); - + allKeys.Remove(("ClampPrimSize").ToLower()); m_objectCapacity = config.GetInt("MaxPrims", 15000); - + allKeys.Remove(("MaxPrims").ToLower()); m_agentCapacity = config.GetInt("MaxAgents", 100); - + allKeys.Remove(("MaxAgents").ToLower()); // Multi-tenancy // ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); + allKeys.Remove(("ScopeID").ToLower()); + + foreach (String s in allKeys) + { + m_otherSettings.Add(s, config.GetString(s)); + } } private void WriteNiniConfig(IConfigSource source) -- cgit v1.1