Updated the create_region command in the RemoteAdmin plugin to properly support estates without seeking further input on the console.
parent
8acb401a14
commit
8eeb3f2fd2
|
@ -122,7 +122,9 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
|||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||
Thread.CurrentThread.ManagedThreadId.ToString() +
|
||||
")");
|
||||
m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
|
||||
m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
|
||||
regionsToLoad[i].EstateSettings.Save();
|
||||
if (scene != null)
|
||||
{
|
||||
m_newRegionCreatedHandler = OnNewRegionCreated;
|
||||
|
|
|
@ -444,12 +444,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
/// <description>desired region X coordinate (integer)</description></item>
|
||||
/// <item><term>region_y</term>
|
||||
/// <description>desired region Y coordinate (integer)</description></item>
|
||||
/// <item><term>region_master_first</term>
|
||||
/// <description>firstname of region master</description></item>
|
||||
/// <item><term>region_master_last</term>
|
||||
/// <description>lastname of region master</description></item>
|
||||
/// <item><term>region_master_uuid</term>
|
||||
/// <description>explicit UUID to use for master avatar (optional)</description></item>
|
||||
/// <item><term>estate_owner_first</term>
|
||||
/// <description>firstname of estate owner (formerly region master)
|
||||
/// (required if new estate is being created, optional otherwise)</description></item>
|
||||
/// <item><term>estate_owner_last</term>
|
||||
/// <description>lastname of estate owner (formerly region master)
|
||||
/// (required if new estate is being created, optional otherwise)</description></item>
|
||||
/// <item><term>estate_owner_uuid</term>
|
||||
/// <description>explicit UUID to use for estate owner (optional)</description></item>
|
||||
/// <item><term>listen_ip</term>
|
||||
/// <description>internal IP address (dotted quad)</description></item>
|
||||
/// <item><term>listen_port</term>
|
||||
|
@ -465,6 +467,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
/// <item><term>enable_voice</term>
|
||||
/// <description>if true, enable voice on all parcels,
|
||||
/// ('true' or 'false') (optional, default: false)</description></item>
|
||||
/// <item><term>estate_name</term>
|
||||
/// <description>the name of the estate to join (or to create if it doesn't
|
||||
/// already exist)</description></item>
|
||||
/// </list>
|
||||
///
|
||||
/// XmlRpcCreateRegionMethod returns
|
||||
|
@ -503,9 +508,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
"password",
|
||||
"region_name",
|
||||
"region_master_first", "region_master_last",
|
||||
"region_master_password",
|
||||
"listen_ip", "external_address"
|
||||
"listen_ip", "external_address",
|
||||
"estate_name"
|
||||
});
|
||||
CheckIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"});
|
||||
|
||||
|
@ -576,18 +580,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
region.ExternalHostName = (string) requestData["external_address"];
|
||||
|
||||
string masterFirst = (string) requestData["region_master_first"];
|
||||
string masterLast = (string) requestData["region_master_last"];
|
||||
string masterPassword = (string) requestData["region_master_password"];
|
||||
|
||||
UUID userID = UUID.Zero;
|
||||
if (requestData.ContainsKey("region_master_uuid"))
|
||||
{
|
||||
// ok, client wants us to use an explicit UUID
|
||||
// regardless of what the avatar name provided
|
||||
userID = new UUID((string) requestData["estate_owner_uuid"]);
|
||||
}
|
||||
|
||||
bool persist = Convert.ToBoolean((string) requestData["persist"]);
|
||||
if (persist)
|
||||
{
|
||||
|
@ -623,6 +615,54 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
region.Persistent = false;
|
||||
}
|
||||
|
||||
// Set the estate
|
||||
|
||||
// Check for an existing estate
|
||||
List<int> estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]);
|
||||
if (estateIDs.Count < 1)
|
||||
{
|
||||
UUID userID = UUID.Zero;
|
||||
if (requestData.ContainsKey("estate_owner_uuid"))
|
||||
{
|
||||
// ok, client wants us to use an explicit UUID
|
||||
// regardless of what the avatar name provided
|
||||
userID = new UUID((string) requestData["estate_owner_uuid"]);
|
||||
}
|
||||
else if (requestData.ContainsKey("estate_owner_first") & requestData.ContainsKey("estate_owner_last"))
|
||||
{
|
||||
// We need to look up the UUID for the avatar with the provided name.
|
||||
string ownerFirst = (string) requestData["estate_owner_first"];
|
||||
string ownerLast = (string) requestData["estate_owner_last"];
|
||||
|
||||
Scene currentOrFirst = m_application.SceneManager.CurrentOrFirstScene;
|
||||
IUserAccountService accountService = currentOrFirst.UserAccountService;
|
||||
UserAccount user = accountService.GetUserAccount(currentOrFirst.RegionInfo.ScopeID,
|
||||
ownerFirst, ownerLast);
|
||||
userID = user.PrincipalID;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Estate owner details not provided.");
|
||||
}
|
||||
|
||||
// Create a new estate with the name provided
|
||||
region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true);
|
||||
|
||||
region.EstateSettings.EstateName = (string) requestData["estate_name"];
|
||||
region.EstateSettings.EstateOwner = userID;
|
||||
// Persistence does not seem to effect the need to save a new estate
|
||||
region.EstateSettings.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
int estateID = estateIDs[0];
|
||||
|
||||
region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID);
|
||||
|
||||
if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID))
|
||||
throw new Exception("Failed to join estate.");
|
||||
}
|
||||
|
||||
// Create the region and perform any initial initialization
|
||||
|
||||
IScene newScene;
|
||||
|
@ -631,8 +671,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
// If an access specification was provided, use it.
|
||||
// Otherwise accept the default.
|
||||
newScene.RegionInfo.EstateSettings.PublicAccess = GetBoolean(requestData, "public", m_publicAccess);
|
||||
newScene.RegionInfo.EstateSettings.EstateOwner = userID;
|
||||
if (persist)
|
||||
newScene.RegionInfo.EstateSettings.Save();
|
||||
|
||||
// enable voice on newly created region if
|
||||
|
|
|
@ -530,7 +530,10 @@ namespace OpenSim
|
|||
regionFile = cmd[3];
|
||||
|
||||
IScene scene;
|
||||
CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene);
|
||||
RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source);
|
||||
PopulateRegionEstateInfo(regInfo);
|
||||
CreateRegion(regInfo, true, out scene);
|
||||
regInfo.EstateSettings.Save();
|
||||
}
|
||||
else if (cmd[3].EndsWith(".ini"))
|
||||
{
|
||||
|
@ -541,7 +544,10 @@ namespace OpenSim
|
|||
regionFile = cmd[3];
|
||||
|
||||
IScene scene;
|
||||
CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]), true, out scene);
|
||||
RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]);
|
||||
PopulateRegionEstateInfo(regInfo);
|
||||
CreateRegion(regInfo, true, out scene);
|
||||
regInfo.EstateSettings.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -790,6 +790,60 @@ namespace OpenSim
|
|||
{
|
||||
regionnum = m_sceneManager.Scenes.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Load the estate information for the provided RegionInfo object.
|
||||
/// </summary>
|
||||
/// <param name="regInfo">
|
||||
/// A <see cref="RegionInfo"/>
|
||||
/// </param>
|
||||
public void PopulateRegionEstateInfo(RegionInfo regInfo)
|
||||
{
|
||||
if (m_storageManager.EstateDataStore != null)
|
||||
{
|
||||
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false);
|
||||
}
|
||||
|
||||
if (regInfo.EstateSettings.EstateID == 0) // No record at all
|
||||
{
|
||||
MainConsole.Instance.Output("Your region is not part of an estate.");
|
||||
while (true)
|
||||
{
|
||||
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
|
||||
if (response == "no")
|
||||
{
|
||||
// Create a new estate
|
||||
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true);
|
||||
|
||||
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
|
||||
//regInfo.EstateSettings.Save();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
|
||||
if (response == "None")
|
||||
continue;
|
||||
|
||||
List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
|
||||
if (estateIDs.Count < 1)
|
||||
{
|
||||
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
|
||||
continue;
|
||||
}
|
||||
|
||||
int estateID = estateIDs[0];
|
||||
|
||||
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
|
||||
|
||||
if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID))
|
||||
break;
|
||||
|
||||
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,6 +58,11 @@ namespace OpenSim.Region.ClientStack
|
|||
|
||||
protected StorageManager m_storageManager;
|
||||
|
||||
public StorageManager StorageManager
|
||||
{
|
||||
get { return m_storageManager; }
|
||||
}
|
||||
|
||||
protected ClientStackManager m_clientStackManager;
|
||||
|
||||
public SceneManager SceneManager
|
||||
|
|
|
@ -544,45 +544,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (m_storageManager.EstateDataStore != null)
|
||||
{
|
||||
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
|
||||
if (m_regInfo.EstateSettings.EstateID == 0) // No record at all
|
||||
{
|
||||
MainConsole.Instance.Output("Your region is not part of an estate.");
|
||||
while (true)
|
||||
{
|
||||
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
|
||||
if (response == "no")
|
||||
{
|
||||
// Create a new estate
|
||||
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, true);
|
||||
|
||||
m_regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", m_regInfo.EstateSettings.EstateName);
|
||||
m_regInfo.EstateSettings.Save();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
|
||||
if (response == "None")
|
||||
continue;
|
||||
|
||||
List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
|
||||
if (estateIDs.Count < 1)
|
||||
{
|
||||
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
|
||||
continue;
|
||||
}
|
||||
|
||||
int estateID = estateIDs[0];
|
||||
|
||||
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
|
||||
|
||||
if (m_storageManager.EstateDataStore.LinkRegion(m_regInfo.RegionID, estateID))
|
||||
break;
|
||||
|
||||
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Region Settings
|
||||
|
|
Loading…
Reference in New Issue