diff options
author | Melanie Thielker | 2009-06-26 11:32:36 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-06-26 11:32:36 +0000 |
commit | febd54499b5decd9cb58191ead5695b6fab247c8 (patch) | |
tree | 54c48023e13b0a300e905137cb46c597a349bd88 | |
parent | Make delete-region delete the section from an ini file. Will delete the whole (diff) | |
download | opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.zip opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.tar.gz opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.tar.bz2 opensim-SC-febd54499b5decd9cb58191ead5695b6fab247c8.tar.xz |
Enable the RemoteAdmin module to save regions as ini files rather than XML
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 39 | ||||
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 68 |
2 files changed, 89 insertions, 18 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index f768516..bcab2d1 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -556,25 +556,28 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
556 | } | 556 | } |
557 | else | 557 | else |
558 | { | 558 | { |
559 | // no client supplied UUID: look it up... | 559 | if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar |
560 | CachedUserInfo userInfo | ||
561 | = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails( | ||
562 | masterFirst, masterLast); | ||
563 | |||
564 | if (null == userInfo) | ||
565 | { | ||
566 | m_log.InfoFormat("master avatar does not exist, creating it"); | ||
567 | // ...or create new user | ||
568 | userID = m_app.CommunicationsManager.UserAdminService.AddUser( | ||
569 | masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY); | ||
570 | |||
571 | if (userID == UUID.Zero) | ||
572 | throw new Exception(String.Format("failed to create new user {0} {1}", | ||
573 | masterFirst, masterLast)); | ||
574 | } | ||
575 | else | ||
576 | { | 560 | { |
577 | userID = userInfo.UserProfile.ID; | 561 | // no client supplied UUID: look it up... |
562 | CachedUserInfo userInfo | ||
563 | = m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails( | ||
564 | masterFirst, masterLast); | ||
565 | |||
566 | if (null == userInfo) | ||
567 | { | ||
568 | m_log.InfoFormat("master avatar does not exist, creating it"); | ||
569 | // ...or create new user | ||
570 | userID = m_app.CommunicationsManager.UserAdminService.AddUser( | ||
571 | masterFirst, masterLast, masterPassword, "", region.RegionLocX, region.RegionLocY); | ||
572 | |||
573 | if (userID == UUID.Zero) | ||
574 | throw new Exception(String.Format("failed to create new user {0} {1}", | ||
575 | masterFirst, masterLast)); | ||
576 | } | ||
577 | else | ||
578 | { | ||
579 | userID = userInfo.UserProfile.ID; | ||
580 | } | ||
578 | } | 581 | } |
579 | } | 582 | } |
580 | 583 | ||
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 504b303..7ac1e62 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -594,6 +594,57 @@ namespace OpenSim.Framework | |||
594 | ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); | 594 | ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); |
595 | } | 595 | } |
596 | 596 | ||
597 | private void WriteNiniConfig(IConfigSource source) | ||
598 | { | ||
599 | IConfig config = source.Configs[RegionName]; | ||
600 | |||
601 | if (config != null) | ||
602 | source.Configs.Remove(RegionName); | ||
603 | |||
604 | config = source.AddConfig(RegionName); | ||
605 | |||
606 | config.Set("RegionUUID", RegionID.ToString()); | ||
607 | |||
608 | string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY); | ||
609 | config.Set("Location", location); | ||
610 | |||
611 | if (DataStore != String.Empty) | ||
612 | config.Set("Datastore", DataStore); | ||
613 | |||
614 | config.Set("InternalAddress", m_internalEndPoint.Address.ToString()); | ||
615 | config.Set("InternalPort", m_internalEndPoint.Port); | ||
616 | |||
617 | config.Set("AllowAlternatePorts", m_allow_alternate_ports.ToString()); | ||
618 | |||
619 | config.Set("ExternalHostName", m_externalHostName); | ||
620 | |||
621 | if (MasterAvatarAssignedUUID != UUID.Zero) | ||
622 | { | ||
623 | config.Set("MasterAvatarUUID", MasterAvatarAssignedUUID.ToString()); | ||
624 | } | ||
625 | else if (MasterAvatarFirstName != String.Empty && MasterAvatarLastName != String.Empty) | ||
626 | { | ||
627 | config.Set("MasterAvatarFirstName", MasterAvatarFirstName); | ||
628 | config.Set("MasterAvatarLastName", MasterAvatarLastName); | ||
629 | } | ||
630 | if (MasterAvatarSandboxPassword != String.Empty) | ||
631 | { | ||
632 | config.Set("MasterAvatarSandboxPassword", MasterAvatarSandboxPassword); | ||
633 | } | ||
634 | |||
635 | if (m_nonphysPrimMax != 0) | ||
636 | config.Set("NonphysicalPrimMax", m_nonphysPrimMax); | ||
637 | if (m_physPrimMax != 0) | ||
638 | config.Set("PhysicalPrimMax", m_physPrimMax); | ||
639 | config.Set("ClampPrimSize", m_clampPrimSize.ToString()); | ||
640 | |||
641 | if (m_objectCapacity != 0) | ||
642 | config.Set("MaxPrims", m_objectCapacity); | ||
643 | |||
644 | if (ScopeID != UUID.Zero) | ||
645 | config.Set("ScopeID", ScopeID.ToString()); | ||
646 | } | ||
647 | |||
597 | public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) | 648 | public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) |
598 | { | 649 | { |
599 | return true; | 650 | return true; |
@@ -601,6 +652,23 @@ namespace OpenSim.Framework | |||
601 | 652 | ||
602 | public void SaveRegionToFile(string description, string filename) | 653 | public void SaveRegionToFile(string description, string filename) |
603 | { | 654 | { |
655 | if (filename.ToLower().EndsWith(".ini")) | ||
656 | { | ||
657 | IniConfigSource source = new IniConfigSource(); | ||
658 | try | ||
659 | { | ||
660 | source = new IniConfigSource(filename); // Load if it exists | ||
661 | } | ||
662 | catch (Exception) | ||
663 | { | ||
664 | } | ||
665 | |||
666 | WriteNiniConfig(source); | ||
667 | |||
668 | source.Save(filename); | ||
669 | |||
670 | return; | ||
671 | } | ||
604 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, | 672 | configMember = new ConfigurationMember(filename, description, loadConfigurationOptionsFromMe, |
605 | ignoreIncomingConfiguration, false); | 673 | ignoreIncomingConfiguration, false); |
606 | configMember.performConfigurationRetrieve(); | 674 | configMember.performConfigurationRetrieve(); |