Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-08-01 18:00:04 +01:00
commit 5f94b98cb2
7 changed files with 559 additions and 557 deletions

View File

@ -62,6 +62,7 @@ namespace OpenSim.Data
List<RegionData> GetDefaultRegions(UUID scopeID);
List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
List<RegionData> GetHyperlinks(UUID scopeID);
}
[Flags]

View File

@ -310,23 +310,23 @@ namespace OpenSim.Data.MSSQL
public List<RegionData> GetDefaultRegions(UUID scopeID)
{
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 1) <> 0";
if (scopeID != UUID.Zero)
sql += " AND ScopeID = @scopeID";
using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
conn.Open();
return RunCommand(cmd);
}
return Get((int)RegionFlags.DefaultRegion, scopeID);
}
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
{
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & 2) <> 0";
// TODO: distance-sort results
return Get((int)RegionFlags.FallbackRegion, scopeID);
}
public List<RegionData> GetHyperlinks(UUID scopeID)
{
return Get((int)RegionFlags.Hyperlink, scopeID);
}
private List<RegionData> Get(int regionFlags, UUID scopeID)
{
string sql = "SELECT * FROM [" + m_Realm + "] WHERE (flags & " + regionFlags.ToString() + ") <> 0";
if (scopeID != UUID.Zero)
sql += " AND ScopeID = @scopeID";
@ -335,7 +335,6 @@ namespace OpenSim.Data.MSSQL
{
cmd.Parameters.Add(m_database.CreateParameter("@scopeID", scopeID));
conn.Open();
// TODO: distance-sort results
return RunCommand(cmd);
}
}

View File

@ -281,22 +281,26 @@ namespace OpenSim.Data.MySQL
return false;
}
public List<RegionData> GetDefaultRegions(UUID scopeID)
{
string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
MySqlCommand cmd = new MySqlCommand(command);
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
return RunCommand(cmd);
return Get((int)RegionFlags.DefaultRegion, scopeID);
}
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
{
string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0";
// TODO: distance-sort results
return Get((int)RegionFlags.FallbackRegion, scopeID);
}
public List<RegionData> GetHyperlinks(UUID scopeID)
{
return Get((int)RegionFlags.Hyperlink, scopeID);
}
private List<RegionData> Get(int regionFlags, UUID scopeID)
{
string command = "select * from `" + m_Realm + "` where (flags & " + regionFlags.ToString() + ") <> 0";
if (scopeID != UUID.Zero)
command += " and ScopeID = ?scopeID";
@ -304,7 +308,6 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
// TODO: distance-sort results
return RunCommand(cmd);
}
}

View File

@ -164,30 +164,29 @@ namespace OpenSim.Data.Null
public List<RegionData> GetDefaultRegions(UUID scopeID)
{
if (Instance != this)
return Instance.GetDefaultRegions(scopeID);
List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values)
{
if ((Convert.ToInt32(r.Data["flags"]) & 1) != 0)
ret.Add(r);
}
return ret;
return Get((int)RegionFlags.DefaultRegion, scopeID);
}
public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
{
return Get((int)RegionFlags.FallbackRegion, scopeID);
}
public List<RegionData> GetHyperlinks(UUID scopeID)
{
return Get((int)RegionFlags.Hyperlink, scopeID);
}
private List<RegionData> Get(int regionFlags, UUID scopeID)
{
if (Instance != this)
return Instance.GetFallbackRegions(scopeID, x, y);
return Instance.Get(regionFlags, scopeID);
List<RegionData> ret = new List<RegionData>();
foreach (RegionData r in m_regionData.Values)
{
if ((Convert.ToInt32(r.Data["flags"]) & 2) != 0)
if ((Convert.ToInt32(r.Data["flags"]) & regionFlags) != 0)
ret.Add(r);
}

View File

@ -50,7 +50,7 @@ namespace OpenSim.Services.GridService
private bool m_DeleteOnUnregister = true;
private static GridService m_RootInstance = null;
protected IConfigSource m_config;
protected HypergridLinker m_HypergridLinker;
protected static HypergridLinker m_HypergridLinker;
protected IAuthenticationService m_AuthenticationService = null;
protected bool m_AllowDuplicateNames = false;

View File

@ -378,32 +378,31 @@ namespace OpenSim.Services.GridService
public void HandleShow(string module, string[] cmd)
{
MainConsole.Instance.Output("Not Implemented Yet");
//if (cmd.Length != 2)
//{
// MainConsole.Instance.Output("Syntax: show hyperlinks");
// return;
//}
//List<GridRegion> regions = new List<GridRegion>(m_HypergridService.m_HyperlinkRegions.Values);
//if (regions == null || regions.Count < 1)
//{
// MainConsole.Instance.Output("No hyperlinks");
// return;
//}
if (cmd.Length != 2)
{
MainConsole.Instance.Output("Syntax: show hyperlinks");
return;
}
List<RegionData> regions = m_Database.GetHyperlinks(UUID.Zero);
if (regions == null || regions.Count < 1)
{
MainConsole.Instance.Output("No hyperlinks");
return;
}
//MainConsole.Instance.Output("Region Name Region UUID");
//MainConsole.Instance.Output("Location URI");
//MainConsole.Instance.Output("Owner ID ");
//MainConsole.Instance.Output("-------------------------------------------------------------------------------");
//foreach (GridRegion r in regions)
//{
// MainConsole.Instance.Output(String.Format("{0,-20} {1}\n{2,-20} {3}\n{4,-39} \n\n",
// r.RegionName, r.RegionID,
// String.Format("{0},{1}", r.RegionLocX, r.RegionLocY), "http://" + r.ExternalHostName + ":" + r.HttpPort.ToString(),
// r.EstateOwner.ToString()));
//}
//return;
MainConsole.Instance.Output("Region Name Region UUID");
MainConsole.Instance.Output("Location URI");
MainConsole.Instance.Output("-------------------------------------------------------------------------------");
foreach (RegionData r in regions)
{
MainConsole.Instance.Output(String.Format("{0,-39} {1}\n{2,-39} {3}\n",
r.RegionName, r.RegionID,
String.Format("{0},{1} ({2},{3})", r.posX, r.posY, r.posX / 256, r.posY / 256),
"http://" + r.Data["serverIP"].ToString() + ":" + r.Data["serverHttpPort"].ToString()));
}
return;
}
public void RunCommand(string module, string[] cmdparams)
{
List<string> args = new List<string>(cmdparams);