Compare commits

...

4 Commits

Author SHA1 Message Date
Fernando Oliveira
46dec8666c New methods to get empty coordinates from the server 2012-01-23 16:11:42 -02:00
Fernando Oliveira
352774d5bf Merge remote-tracking branch 'remotes/upstream/master' 2012-01-22 16:04:22 -02:00
Fernando Oliveira
34c0bd212a Moved the EstateName and EstateOwner to OpenSim.ini at EstateDefaults entry
To be used only on first time Estate Creation

Signed-off-by: Fernando Oliveira <fernando@oliveira.eti.br>
2012-01-22 02:04:10 -02:00
Fernando Oliveira
3032b49ec4 Changed to Auto Create a Sim at first time using the Regions.ini files Master Avatar and Estate keys 2012-01-21 19:08:04 -02:00
5 changed files with 125 additions and 13 deletions

View File

@@ -74,6 +74,8 @@ namespace OpenSim.Data
RegionData Get(int x, int y, UUID ScopeID);
List<RegionData> Get(int xStart, int yStart, int xEnd, int yEnd, UUID ScopeID);
List<RegionData> GetEmpty(UUID ScopeID);
bool Store(RegionData data);
bool SetDataItem(UUID principalID, string item, string value);

View File

@@ -443,10 +443,39 @@ namespace OpenSim
{
RegionInfo regionInfo = scene.RegionInfo;
string estateFirstName = "", estateLastName = "", estateOwnerEMail = "", estateOwnerPassword = "", estateOwnerUUID = "";
if (m_config.Source.Configs["EstateDefaults"] != null)
{
string estateOwner = m_config.Source.Configs["EstateDefaults"].GetString("EstateOwner", "").Trim();
string[] ownerNames = estateOwner.Split(' ');
if (ownerNames.Length == 2)
{
estateFirstName = ownerNames[0];
estateLastName = ownerNames[1];
}
// Info to be used only on Standalone Mode
estateOwnerUUID = m_config.Source.Configs["EstateDefaults"].GetString("estateOwnerUUID", "");
estateOwnerEMail = m_config.Source.Configs["EstateDefaults"].GetString("estateOwnerEMail", "");
estateOwnerPassword = m_config.Source.Configs["EstateDefaults"].GetString("estateOwnerPassword", "");
}
MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", regionInfo.EstateSettings.EstateName);
List<char> excluded = new List<char>(new char[1]{' '});
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
string first, last;
if ((estateFirstName != "") && (estateLastName != ""))
{
first = estateFirstName;
last = estateLastName;
}
else
{
first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
}
UserAccount account = scene.UserAccountService.GetUserAccount(regionInfo.ScopeID, first, last);
@@ -467,10 +496,22 @@ namespace OpenSim
if (scene.UserAccountService is UserAccountService)
{
string password = MainConsole.Instance.PasswdPrompt("Password");
string email = MainConsole.Instance.CmdPrompt("Email", "");
string password = "", email = "", rawPrincipalId = "";
string rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString());
if (estateOwnerPassword != "")
password = estateOwnerPassword;
else
MainConsole.Instance.PasswdPrompt("Password");
if (estateOwnerEMail != "")
email = estateOwnerEMail;
else
email = MainConsole.Instance.CmdPrompt("Email", "");
if (estateOwnerUUID != "")
rawPrincipalId = estateOwnerUUID;
else
rawPrincipalId = MainConsole.Instance.CmdPrompt("User ID", UUID.Random().ToString());
UUID principalId = UUID.Zero;
if (!UUID.TryParse(rawPrincipalId, out principalId))
@@ -885,11 +926,20 @@ namespace OpenSim
/// <param name="regInfo"></param>
/// <param name="existingName">A list of estate names that already exist.</param>
/// <returns>true if the estate was created, false otherwise</returns>
public bool CreateEstate(RegionInfo regInfo, List<string> existingNames)
public bool CreateEstate(RegionInfo regInfo, List<string> existingNames, string estateName)
{
// Create a new estate
regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true);
string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
string newName;
if (estateName != "")
{
newName = estateName;
}
else
{
newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
}
if (existingNames.Contains(newName))
{
@@ -925,18 +975,30 @@ namespace OpenSim
List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll();
List<string> estateNames = new List<string>();
foreach (EstateSettings estate in estates)
estateNames.Add(estate.EstateName);
estateNames.Add(estate.EstateName);
string estateName = "";
string estateOwner = "";
if (m_config.Source.Configs["EstateDefaults"] != null)
{
estateName = m_config.Source.Configs["EstateDefaults"].GetString("EstateName", "");
estateOwner = m_config.Source.Configs["EstateDefaults"].GetString("EstateOwner", "");
}
while (true)
{
if (estates.Count == 0)
{
m_log.Info("[ESTATE] No existing estates found. You must create a new one.");
if (CreateEstate(regInfo, estateNames))
break;
if (CreateEstate(regInfo, estateNames, estateName))
break;
else
{
estateName = "";
continue;
}
}
else
{
@@ -949,10 +1011,13 @@ namespace OpenSim
if (response == "no")
{
if (CreateEstate(regInfo, estateNames))
if (CreateEstate(regInfo, estateNames, estateName))
break;
else
{
estateName = "";
continue;
}
}
else
{

View File

@@ -85,6 +85,9 @@ namespace OpenSim.Server.Handlers.Grid
case "deregister":
return Deregister(request);
case "get_empty_coordinates":
return GetEmptyCoordinates(request);
case "get_neighbours":
return GetNeighbours(request);
@@ -194,6 +197,32 @@ namespace OpenSim.Server.Handlers.Grid
}
byte[] GetEmptyCoordinates(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get empty coordinates");
Dictionary<string, object> result = new Dictionary<string, object>();
// TODO: Create the Method to get Empty Coordinates
List<GridRegion> rinfos = m_GridService.GetEmptyCoordinates(scopeID);
if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0)))
result["coordinates"] = "null";
else
{
result["coordinates"] = rinfos[0].RegionCoordX.ToString() + "," + rinfos[0].RegionCoordY.ToString();
}
string xmlString = ServerUtils.BuildXmlResponse(result);
//m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString);
UTF8Encoding encoding = new UTF8Encoding();
return encoding.GetBytes(xmlString);
}
byte[] GetNeighbours(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;

View File

@@ -275,6 +275,15 @@ namespace OpenSim.Services.GridService
return m_Database.Delete(regionID);
}
public List<GridRegion> GetEmptyCoordinates(UUID scopeID)
{
List<GridRegion> rinfos = new List<GridRegion>();
// TODO : Search empty spots on Grid to register a new SIM
return rinfos;
}
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
List<GridRegion> rinfos = new List<GridRegion>();

View File

@@ -52,6 +52,12 @@ namespace OpenSim.Services.Interfaces
/// <exception cref="System.Exception">Thrown if region deregistration failed</exception>
bool DeregisterRegion(UUID regionID);
/// <summary>
/// Get information about the empty spot to register a new Simulator.
/// </summary>
/// <returns></returns>
List<GridRegion> GetEmptyCoordinates(UUID scopeID);
/// <summary>
/// Get information about the regions neighbouring the given co-ordinates (in meters).
/// </summary>
@@ -60,6 +66,7 @@ namespace OpenSim.Services.Interfaces
/// <returns></returns>
List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID);
GridRegion GetRegionByUUID(UUID scopeID, UUID regionID);
/// <summary>