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

iar_mods
Dan Lake 2011-12-12 00:21:19 -08:00
parent 3a91085ac2
commit db8fd1eb9f
1 changed files with 56 additions and 21 deletions

View File

@ -141,6 +141,8 @@ namespace OpenSim.Framework
public string RemotingAddress; public string RemotingAddress;
public UUID ScopeID = UUID.Zero; public UUID ScopeID = UUID.Zero;
private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote. // 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; 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) private void ReadNiniConfig(IConfigSource source, string name)
{ {
// bool creatingNew = false; // bool creatingNew = false;
@ -471,16 +485,24 @@ namespace OpenSim.Framework
if (source.Configs[name] == null) if (source.Configs[name] == null)
{ {
source.AddConfig(name); source.AddConfig(name);
// creatingNew = true;
} }
RegionName = name;
IConfig config = source.Configs[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
string regionUUID = config.GetString("RegionUUID", string.Empty); // whoever might need it
HashSet<String> allKeys = new HashSet<String>();
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) if (regionUUID == String.Empty)
{ {
UUID newID = UUID.Random(); UUID newID = UUID.Random();
@ -490,11 +512,12 @@ namespace OpenSim.Framework
} }
RegionID = new UUID(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); string location = config.GetString("Location", String.Empty);
if (location == String.Empty) if (location == String.Empty)
{ {
location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000"); location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000");
@ -506,9 +529,10 @@ namespace OpenSim.Framework
m_regionLocX = Convert.ToUInt32(locationElements[0]); m_regionLocX = Convert.ToUInt32(locationElements[0]);
m_regionLocY = Convert.ToUInt32(locationElements[1]); m_regionLocY = Convert.ToUInt32(locationElements[1]);
// Internal IP // InternalAddress
//
IPAddress address; IPAddress address;
allKeys.Remove(("InternalAddress").ToLower());
if (config.Contains("InternalAddress")) if (config.Contains("InternalAddress"))
{ {
address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
@ -519,8 +543,10 @@ namespace OpenSim.Framework
config.Set("InternalAddress", address.ToString()); config.Set("InternalAddress", address.ToString());
} }
// InternalPort
//
int port; int port;
allKeys.Remove(("InternalPort").ToLower());
if (config.Contains("InternalPort")) if (config.Contains("InternalPort"))
{ {
port = config.GetInt("InternalPort", 9000); port = config.GetInt("InternalPort", 9000);
@ -530,9 +556,11 @@ namespace OpenSim.Framework
port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000")); port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000"));
config.Set("InternalPort", port); config.Set("InternalPort", port);
} }
m_internalEndPoint = new IPEndPoint(address, port); m_internalEndPoint = new IPEndPoint(address, port);
// AllowAlternatePorts
//
allKeys.Remove(("AllowAlternatePorts").ToLower());
if (config.Contains("AllowAlternatePorts")) if (config.Contains("AllowAlternatePorts"))
{ {
m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
@ -544,10 +572,10 @@ namespace OpenSim.Framework
config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString());
} }
// External IP // ExternalHostName
// //
allKeys.Remove(("ExternalHostName").ToLower());
string externalName; string externalName;
if (config.Contains("ExternalHostName")) if (config.Contains("ExternalHostName"))
{ {
externalName = config.GetString("ExternalHostName", "SYSTEMIP"); externalName = config.GetString("ExternalHostName", "SYSTEMIP");
@ -557,7 +585,6 @@ namespace OpenSim.Framework
externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP"); externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP");
config.Set("ExternalHostName", externalName); config.Set("ExternalHostName", externalName);
} }
if (externalName == "SYSTEMIP") if (externalName == "SYSTEMIP")
{ {
m_externalHostName = Util.GetLocalHost().ToString(); m_externalHostName = Util.GetLocalHost().ToString();
@ -570,24 +597,32 @@ namespace OpenSim.Framework
m_externalHostName = externalName; m_externalHostName = externalName;
} }
// RegionType
m_regionType = config.GetString("RegionType", String.Empty); m_regionType = config.GetString("RegionType", String.Empty);
allKeys.Remove(("RegionType").ToLower());
// Prim stuff // Prim stuff
// //
m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256); m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256);
allKeys.Remove(("NonphysicalPrimMax").ToLower());
m_physPrimMax = config.GetInt("PhysicalPrimMax", 10); m_physPrimMax = config.GetInt("PhysicalPrimMax", 10);
allKeys.Remove(("PhysicalPrimMax").ToLower());
m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
allKeys.Remove(("ClampPrimSize").ToLower());
m_objectCapacity = config.GetInt("MaxPrims", 15000); m_objectCapacity = config.GetInt("MaxPrims", 15000);
allKeys.Remove(("MaxPrims").ToLower());
m_agentCapacity = config.GetInt("MaxAgents", 100); m_agentCapacity = config.GetInt("MaxAgents", 100);
allKeys.Remove(("MaxAgents").ToLower());
// Multi-tenancy // Multi-tenancy
// //
ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); 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) private void WriteNiniConfig(IConfigSource source)