aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs2
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs92
-rw-r--r--OpenSim/Region/Application/OpenSim.cs10
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs54
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs39
6 files changed, 134 insertions, 68 deletions
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index 1e85a22..b16f46c 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -122,7 +122,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
122 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + 122 m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
123 Thread.CurrentThread.ManagedThreadId.ToString() + 123 Thread.CurrentThread.ManagedThreadId.ToString() +
124 ")"); 124 ")");
125 m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
125 m_openSim.CreateRegion(regionsToLoad[i], true, out scene); 126 m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
127 regionsToLoad[i].EstateSettings.Save();
126 if (scene != null) 128 if (scene != null)
127 { 129 {
128 m_newRegionCreatedHandler = OnNewRegionCreated; 130 m_newRegionCreatedHandler = OnNewRegionCreated;
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 7e4a8e8..da3d3c2 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -444,12 +444,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
444 /// <description>desired region X coordinate (integer)</description></item> 444 /// <description>desired region X coordinate (integer)</description></item>
445 /// <item><term>region_y</term> 445 /// <item><term>region_y</term>
446 /// <description>desired region Y coordinate (integer)</description></item> 446 /// <description>desired region Y coordinate (integer)</description></item>
447 /// <item><term>region_master_first</term> 447 /// <item><term>estate_owner_first</term>
448 /// <description>firstname of region master</description></item> 448 /// <description>firstname of estate owner (formerly region master)
449 /// <item><term>region_master_last</term> 449 /// (required if new estate is being created, optional otherwise)</description></item>
450 /// <description>lastname of region master</description></item> 450 /// <item><term>estate_owner_last</term>
451 /// <item><term>region_master_uuid</term> 451 /// <description>lastname of estate owner (formerly region master)
452 /// <description>explicit UUID to use for master avatar (optional)</description></item> 452 /// (required if new estate is being created, optional otherwise)</description></item>
453 /// <item><term>estate_owner_uuid</term>
454 /// <description>explicit UUID to use for estate owner (optional)</description></item>
453 /// <item><term>listen_ip</term> 455 /// <item><term>listen_ip</term>
454 /// <description>internal IP address (dotted quad)</description></item> 456 /// <description>internal IP address (dotted quad)</description></item>
455 /// <item><term>listen_port</term> 457 /// <item><term>listen_port</term>
@@ -465,6 +467,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
465 /// <item><term>enable_voice</term> 467 /// <item><term>enable_voice</term>
466 /// <description>if true, enable voice on all parcels, 468 /// <description>if true, enable voice on all parcels,
467 /// ('true' or 'false') (optional, default: false)</description></item> 469 /// ('true' or 'false') (optional, default: false)</description></item>
470 /// <item><term>estate_name</term>
471 /// <description>the name of the estate to join (or to create if it doesn't
472 /// already exist)</description></item>
468 /// </list> 473 /// </list>
469 /// 474 ///
470 /// XmlRpcCreateRegionMethod returns 475 /// XmlRpcCreateRegionMethod returns
@@ -503,9 +508,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
503 { 508 {
504 "password", 509 "password",
505 "region_name", 510 "region_name",
506 "region_master_first", "region_master_last", 511 "listen_ip", "external_address",
507 "region_master_password", 512 "estate_name"
508 "listen_ip", "external_address"
509 }); 513 });
510 CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); 514 CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"});
511 515
@@ -576,18 +580,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
576 580
577 region.ExternalHostName = (string) requestData["external_address"]; 581 region.ExternalHostName = (string) requestData["external_address"];
578 582
579 string masterFirst = (string) requestData["region_master_first"];
580 string masterLast = (string) requestData["region_master_last"];
581 string masterPassword = (string) requestData["region_master_password"];
582
583 UUID userID = UUID.Zero;
584 if (requestData.ContainsKey("region_master_uuid"))
585 {
586 // ok, client wants us to use an explicit UUID
587 // regardless of what the avatar name provided
588 userID = new UUID((string) requestData["estate_owner_uuid"]);
589 }
590
591 bool persist = Convert.ToBoolean((string) requestData["persist"]); 583 bool persist = Convert.ToBoolean((string) requestData["persist"]);
592 if (persist) 584 if (persist)
593 { 585 {
@@ -622,7 +614,55 @@ namespace OpenSim.ApplicationPlugins.RemoteController
622 { 614 {
623 region.Persistent = false; 615 region.Persistent = false;
624 } 616 }
625 617
618 // Set the estate
619
620 // Check for an existing estate
621 List<int> estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]);
622 if (estateIDs.Count < 1)
623 {
624 UUID userID = UUID.Zero;
625 if (requestData.ContainsKey("estate_owner_uuid"))
626 {
627 // ok, client wants us to use an explicit UUID
628 // regardless of what the avatar name provided
629 userID = new UUID((string) requestData["estate_owner_uuid"]);
630 }
631 else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last"))
632 {
633 // We need to look up the UUID for the avatar with the provided name.
634 string ownerFirst = (string) requestData["estate_owner_first"];
635 string ownerLast = (string) requestData["estate_owner_last"];
636
637 Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
638 IUserAccountService accountService = currentOrFirst.UserAccountService;
639 UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID,
640 ownerFirst, ownerLast);
641 userID = user.PrincipalID;
642 }
643 else
644 {
645 throw new Exception("Estate owner details not provided.");
646 }
647
648 // Create a new estate with the name provided
649 region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true);
650
651 region.EstateSettings.EstateName = (string) requestData["estate_name"];
652 region.EstateSettings.EstateOwner = userID;
653 // Persistence does not seem to effect the need to save a new estate
654 region.EstateSettings.Save();
655 }
656 else
657 {
658 int estateID = estateIDs[0];
659
660 region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID);
661
662 if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID))
663 throw new Exception("Failed to join estate.");
664 }
665
626 // Create the region and perform any initial initialization 666 // Create the region and perform any initial initialization
627 667
628 IScene newScene; 668 IScene newScene;
@@ -631,9 +671,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
631 // If an access specification was provided, use it. 671 // If an access specification was provided, use it.
632 // Otherwise accept the default. 672 // Otherwise accept the default.
633 newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess); 673 newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess);
634 newScene.RegionInfo.EstateSettings.EstateOwner = userID; 674 newScene.RegionInfo.EstateSettings.Save();
635 if (persist)
636 newScene.RegionInfo.EstateSettings.Save();
637 675
638 // enable voice on newly created region if 676 // enable voice on newly created region if
639 // requested by either the XmlRpc request or the 677 // requested by either the XmlRpc request or the
@@ -1497,7 +1535,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
1497 if (destinationFolder.Type != (short)AssetType.Clothing) 1535 if (destinationFolder.Type != (short)AssetType.Clothing)
1498 { 1536 {
1499 destinationFolder = new InventoryFolderBase(); 1537 destinationFolder = new InventoryFolderBase();
1500 1538
1501 destinationFolder.ID = UUID.Random(); 1539 destinationFolder.ID = UUID.Random();
1502 destinationFolder.Name = "Clothing"; 1540 destinationFolder.Name = "Clothing";
1503 destinationFolder.Owner = destination; 1541 destinationFolder.Owner = destination;
@@ -2982,7 +3020,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
2982 /// <param name="password"></param> 3020 /// <param name="password"></param>
2983 private bool ChangeUserPassword(string firstName, string lastName, string password) 3021 private bool ChangeUserPassword(string firstName, string lastName, string password)
2984 { 3022 {
2985 Scene scene = m_application.SceneManager.CurrentOrFirstScene; 3023 Scene scene = m_application.SceneManager.CurrentOrFirstScene;
2986 IUserAccountService userAccountService = scene.UserAccountService; 3024 IUserAccountService userAccountService = scene.UserAccountService;
2987 IAuthenticationService authenticationService = scene.AuthenticationService; 3025 IAuthenticationService authenticationService = scene.AuthenticationService;
2988 3026
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index c541249..d9ec287 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -530,7 +530,10 @@ namespace OpenSim
530 regionFile = cmd[3]; 530 regionFile = cmd[3];
531 531
532 IScene scene; 532 IScene scene;
533 CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene); 533 RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source);
534 PopulateRegionEstateInfo(regInfo);
535 CreateRegion(regInfo, true, out scene);
536 regInfo.EstateSettings.Save();
534 } 537 }
535 else if (cmd[3].EndsWith(".ini")) 538 else if (cmd[3].EndsWith(".ini"))
536 { 539 {
@@ -541,7 +544,10 @@ namespace OpenSim
541 regionFile = cmd[3]; 544 regionFile = cmd[3];
542 545
543 IScene scene; 546 IScene scene;
544 CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]), true, out scene); 547 RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]);
548 PopulateRegionEstateInfo(regInfo);
549 CreateRegion(regInfo, true, out scene);
550 regInfo.EstateSettings.Save();
545 } 551 }
546 else 552 else
547 { 553 {
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index e148cde..eb18e83 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -790,6 +790,60 @@ namespace OpenSim
790 { 790 {
791 regionnum = m_sceneManager.Scenes.Count; 791 regionnum = m_sceneManager.Scenes.Count;
792 } 792 }
793
794 /// <summary>
795 /// Load the estate information for the provided RegionInfo object.
796 /// </summary>
797 /// <param name="regInfo">
798 /// A <see cref="RegionInfo"/>
799 /// </param>
800 public void PopulateRegionEstateInfo(RegionInfo regInfo)
801 {
802 if (m_storageManager.EstateDataStore != null)
803 {
804 regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false);
805 }
806
807 if (regInfo.EstateSettings.EstateID == 0) // No record at all
808 {
809 MainConsole.Instance.Output("Your region is not part of an estate.");
810 while (true)
811 {
812 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
813 if (response == "no")
814 {
815 // Create a new estate
816 regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true);
817
818 regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
819 //regInfo.EstateSettings.Save();
820 break;
821 }
822 else
823 {
824 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
825 if (response == "None")
826 continue;
827
828 List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
829 if (estateIDs.Count < 1)
830 {
831 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
832 continue;
833 }
834
835 int estateID = estateIDs[0];
836
837 regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
838
839 if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID))
840 break;
841
842 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
843 }
844 }
845 }
846 }
793 } 847 }
794 848
795 849
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index e683821..46b68ec 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -58,6 +58,11 @@ namespace OpenSim.Region.ClientStack
58 58
59 protected StorageManager m_storageManager; 59 protected StorageManager m_storageManager;
60 60
61 public StorageManager StorageManager
62 {
63 get { return m_storageManager; }
64 }
65
61 protected ClientStackManager m_clientStackManager; 66 protected ClientStackManager m_clientStackManager;
62 67
63 public SceneManager SceneManager 68 public SceneManager SceneManager
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f62851a..18705a8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -544,45 +544,6 @@ namespace OpenSim.Region.Framework.Scenes
544 if (m_storageManager.EstateDataStore != null) 544 if (m_storageManager.EstateDataStore != null)
545 { 545 {
546 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 546 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
547 if (m_regInfo.EstateSettings.EstateID == 0) // No record at all
548 {
549 MainConsole.Instance.Output("Your region is not part of an estate.");
550 while (true)
551 {
552 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
553 if (response == "no")
554 {
555 // Create a new estate
556 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true);
557
558 m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName);
559 m_regInfo.EstateSettings.Save();
560 break;
561 }
562 else
563 {
564 response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
565 if (response == "None")
566 continue;
567
568 List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
569 if (estateIDs.Count < 1)
570 {
571 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
572 continue;
573 }
574
575 int estateID = estateIDs[0];
576
577 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
578
579 if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID))
580 break;
581
582 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
583 }
584 }
585 }
586 } 547 }
587 548
588 #endregion Region Settings 549 #endregion Region Settings