aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionInfo.cs
diff options
context:
space:
mode:
authorDan Lake2011-12-12 00:21:19 -0800
committerDan Lake2011-12-12 00:21:19 -0800
commitdb8fd1eb9f75eb7948c9c629064b7fcb5a95809d (patch)
treef34ef4197c603d7ad15d73f7782203cbc9ee88db /OpenSim/Framework/RegionInfo.cs
parentImplement handler for TeleportCancel inbound packet (diff)
downloadopensim-SC_OLD-db8fd1eb9f75eb7948c9c629064b7fcb5a95809d.zip
opensim-SC_OLD-db8fd1eb9f75eb7948c9c629064b7fcb5a95809d.tar.gz
opensim-SC_OLD-db8fd1eb9f75eb7948c9c629064b7fcb5a95809d.tar.bz2
opensim-SC_OLD-db8fd1eb9f75eb7948c9c629064b7fcb5a95809d.tar.xz
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
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionInfo.cs75
1 files changed, 55 insertions, 20 deletions
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
141 public string RemotingAddress; 141 public string RemotingAddress;
142 public UUID ScopeID = UUID.Zero; 142 public UUID ScopeID = UUID.Zero;
143 143
144 private Dictionary<String, String> m_otherSettings = new Dictionary<string, string>();
145
144 146
145 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. 147 // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
146 148
@@ -443,6 +445,18 @@ namespace OpenSim.Framework
443 m_internalEndPoint = tmpEPE; 445 m_internalEndPoint = tmpEPE;
444 } 446 }
445 447
448 public string GetOtherSetting(string key)
449 {
450 string val;
451 m_otherSettings.TryGetValue(key, out val);
452 return val;
453 }
454
455 public void SetOtherSetting(string key, string value)
456 {
457 m_otherSettings[key] = value;
458 }
459
446 private void ReadNiniConfig(IConfigSource source, string name) 460 private void ReadNiniConfig(IConfigSource source, string name)
447 { 461 {
448// bool creatingNew = false; 462// bool creatingNew = false;
@@ -471,30 +485,39 @@ namespace OpenSim.Framework
471 if (source.Configs[name] == null) 485 if (source.Configs[name] == null)
472 { 486 {
473 source.AddConfig(name); 487 source.AddConfig(name);
474
475// creatingNew = true;
476 } 488 }
477 489
490 RegionName = name;
478 IConfig config = source.Configs[name]; 491 IConfig config = source.Configs[name];
479 492
480 // UUID 493 // Track all of the keys in this config and remove as they are processed
494 // The remaining keys will be added to generic key-value storage for
495 // whoever might need it
496 HashSet<String> allKeys = new HashSet<String>();
497 foreach (string s in config.GetKeys())
498 {
499 allKeys.Add(s.ToLower());
500 }
501
502 // RegionUUID
481 // 503 //
504 allKeys.Remove(("RegionUUID").ToLower());
482 string regionUUID = config.GetString("RegionUUID", string.Empty); 505 string regionUUID = config.GetString("RegionUUID", string.Empty);
483
484 if (regionUUID == String.Empty) 506 if (regionUUID == String.Empty)
485 { 507 {
486 UUID newID = UUID.Random(); 508 UUID newID = UUID.Random();
487 509
488 regionUUID = MainConsole.Instance.CmdPrompt("Region UUID", newID.ToString()); 510 regionUUID = MainConsole.Instance.CmdPrompt("RegionUUID", newID.ToString());
489 config.Set("RegionUUID", regionUUID); 511 config.Set("RegionUUID", regionUUID);
490 } 512 }
491 513
492 RegionID = new UUID(regionUUID); 514 RegionID = new UUID(regionUUID);
493 originRegionID = RegionID; // What IS this?! 515 originRegionID = RegionID; // What IS this?! (Needed for RegionCombinerModule?)
494 516
495 RegionName = name; 517 // Location
518 //
519 allKeys.Remove(("Location").ToLower());
496 string location = config.GetString("Location", String.Empty); 520 string location = config.GetString("Location", String.Empty);
497
498 if (location == String.Empty) 521 if (location == String.Empty)
499 { 522 {
500 location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000"); 523 location = MainConsole.Instance.CmdPrompt("Region Location", "1000,1000");
@@ -506,9 +529,10 @@ namespace OpenSim.Framework
506 m_regionLocX = Convert.ToUInt32(locationElements[0]); 529 m_regionLocX = Convert.ToUInt32(locationElements[0]);
507 m_regionLocY = Convert.ToUInt32(locationElements[1]); 530 m_regionLocY = Convert.ToUInt32(locationElements[1]);
508 531
509 // Internal IP 532 // InternalAddress
533 //
510 IPAddress address; 534 IPAddress address;
511 535 allKeys.Remove(("InternalAddress").ToLower());
512 if (config.Contains("InternalAddress")) 536 if (config.Contains("InternalAddress"))
513 { 537 {
514 address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); 538 address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
@@ -519,8 +543,10 @@ namespace OpenSim.Framework
519 config.Set("InternalAddress", address.ToString()); 543 config.Set("InternalAddress", address.ToString());
520 } 544 }
521 545
546 // InternalPort
547 //
522 int port; 548 int port;
523 549 allKeys.Remove(("InternalPort").ToLower());
524 if (config.Contains("InternalPort")) 550 if (config.Contains("InternalPort"))
525 { 551 {
526 port = config.GetInt("InternalPort", 9000); 552 port = config.GetInt("InternalPort", 9000);
@@ -530,9 +556,11 @@ namespace OpenSim.Framework
530 port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000")); 556 port = Convert.ToInt32(MainConsole.Instance.CmdPrompt("Internal port", "9000"));
531 config.Set("InternalPort", port); 557 config.Set("InternalPort", port);
532 } 558 }
533
534 m_internalEndPoint = new IPEndPoint(address, port); 559 m_internalEndPoint = new IPEndPoint(address, port);
535 560
561 // AllowAlternatePorts
562 //
563 allKeys.Remove(("AllowAlternatePorts").ToLower());
536 if (config.Contains("AllowAlternatePorts")) 564 if (config.Contains("AllowAlternatePorts"))
537 { 565 {
538 m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); 566 m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true);
@@ -544,10 +572,10 @@ namespace OpenSim.Framework
544 config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); 572 config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString());
545 } 573 }
546 574
547 // External IP 575 // ExternalHostName
548 // 576 //
577 allKeys.Remove(("ExternalHostName").ToLower());
549 string externalName; 578 string externalName;
550
551 if (config.Contains("ExternalHostName")) 579 if (config.Contains("ExternalHostName"))
552 { 580 {
553 externalName = config.GetString("ExternalHostName", "SYSTEMIP"); 581 externalName = config.GetString("ExternalHostName", "SYSTEMIP");
@@ -557,7 +585,6 @@ namespace OpenSim.Framework
557 externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP"); 585 externalName = MainConsole.Instance.CmdPrompt("External host name", "SYSTEMIP");
558 config.Set("ExternalHostName", externalName); 586 config.Set("ExternalHostName", externalName);
559 } 587 }
560
561 if (externalName == "SYSTEMIP") 588 if (externalName == "SYSTEMIP")
562 { 589 {
563 m_externalHostName = Util.GetLocalHost().ToString(); 590 m_externalHostName = Util.GetLocalHost().ToString();
@@ -570,24 +597,32 @@ namespace OpenSim.Framework
570 m_externalHostName = externalName; 597 m_externalHostName = externalName;
571 } 598 }
572 599
600 // RegionType
573 m_regionType = config.GetString("RegionType", String.Empty); 601 m_regionType = config.GetString("RegionType", String.Empty);
602 allKeys.Remove(("RegionType").ToLower());
574 603
575 // Prim stuff 604 // Prim stuff
576 // 605 //
577 m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256); 606 m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256);
578 607 allKeys.Remove(("NonphysicalPrimMax").ToLower());
579 m_physPrimMax = config.GetInt("PhysicalPrimMax", 10); 608 m_physPrimMax = config.GetInt("PhysicalPrimMax", 10);
580 609 allKeys.Remove(("PhysicalPrimMax").ToLower());
581 m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); 610 m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
582 611 allKeys.Remove(("ClampPrimSize").ToLower());
583 m_objectCapacity = config.GetInt("MaxPrims", 15000); 612 m_objectCapacity = config.GetInt("MaxPrims", 15000);
584 613 allKeys.Remove(("MaxPrims").ToLower());
585 m_agentCapacity = config.GetInt("MaxAgents", 100); 614 m_agentCapacity = config.GetInt("MaxAgents", 100);
586 615 allKeys.Remove(("MaxAgents").ToLower());
587 616
588 // Multi-tenancy 617 // Multi-tenancy
589 // 618 //
590 ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); 619 ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString()));
620 allKeys.Remove(("ScopeID").ToLower());
621
622 foreach (String s in allKeys)
623 {
624 m_otherSettings.Add(s, config.GetString(s));
625 }
591 } 626 }
592 627
593 private void WriteNiniConfig(IConfigSource source) 628 private void WriteNiniConfig(IConfigSource source)