Makes the estate dialog fully functional. Implements all client facing functionality. Moves estate data from estate_settings.xml, which is used to provide defaults, to the region data store. Creates one estate for each region, and places the region in it. Converts all region bans to estate bans.
0.6.0-stable
Melanie Thielker 2008-07-18 02:40:47 +00:00
parent f87d2d8a92
commit 263633e274
27 changed files with 1613 additions and 854 deletions

View File

@ -548,9 +548,9 @@ namespace OpenSim.Data.MSSQL
/// </summary> /// </summary>
/// <param name="regionUUID">the region UUID</param> /// <param name="regionUUID">the region UUID</param>
/// <returns>the banlist list</returns> /// <returns>the banlist list</returns>
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) public List<EstateBan> LoadRegionBanList(LLUUID regionUUID)
{ {
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); List<EstateBan> regionbanlist = new List<EstateBan>();
return regionbanlist; return regionbanlist;
} }
@ -558,7 +558,7 @@ namespace OpenSim.Data.MSSQL
/// STUB, add an item into region banlist /// STUB, add an item into region banlist
/// </summary> /// </summary>
/// <param name="item">the item</param> /// <param name="item">the item</param>
public void AddToRegionBanlist(RegionBanListItem item) public void AddToRegionBanlist(EstateBan item)
{ {
} }
@ -567,7 +567,7 @@ namespace OpenSim.Data.MSSQL
/// STUB, remove an item from region banlist /// STUB, remove an item from region banlist
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void RemoveFromRegionBanlist(RegionBanListItem item) public void RemoveFromRegionBanlist(EstateBan item)
{ {
} }

View File

@ -53,7 +53,6 @@ namespace OpenSim.Data.MySQL
private const string m_terrainSelect = "select * from terrain limit 1"; private const string m_terrainSelect = "select * from terrain limit 1";
private const string m_landSelect = "select * from land"; private const string m_landSelect = "select * from land";
private const string m_landAccessListSelect = "select * from landaccesslist"; private const string m_landAccessListSelect = "select * from landaccesslist";
private const string m_regionBanListSelect = "select * from regionban";
private const string m_regionSettingsSelect = "select * from regionsettings"; private const string m_regionSettingsSelect = "select * from regionsettings";
private const string m_waitTimeoutSelect = "select @@wait_timeout"; private const string m_waitTimeoutSelect = "select @@wait_timeout";
@ -83,7 +82,6 @@ namespace OpenSim.Data.MySQL
private MySqlDataAdapter m_terrainDataAdapter; private MySqlDataAdapter m_terrainDataAdapter;
private MySqlDataAdapter m_landDataAdapter; private MySqlDataAdapter m_landDataAdapter;
private MySqlDataAdapter m_landAccessListDataAdapter; private MySqlDataAdapter m_landAccessListDataAdapter;
private MySqlDataAdapter m_regionBanListDataAdapter;
private MySqlDataAdapter m_regionSettingsDataAdapter; private MySqlDataAdapter m_regionSettingsDataAdapter;
private DataTable m_primTable; private DataTable m_primTable;
@ -92,7 +90,6 @@ namespace OpenSim.Data.MySQL
private DataTable m_terrainTable; private DataTable m_terrainTable;
private DataTable m_landTable; private DataTable m_landTable;
private DataTable m_landAccessListTable; private DataTable m_landAccessListTable;
private DataTable m_regionBanListTable;
private DataTable m_regionSettingsTable; private DataTable m_regionSettingsTable;
/// <value>Temporary attribute while this is experimental</value> /// <value>Temporary attribute while this is experimental</value>
@ -150,9 +147,6 @@ namespace OpenSim.Data.MySQL
MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection); MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection);
m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd); m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd);
MySqlCommand regionBanListSelectCmd = new MySqlCommand(m_regionBanListSelect, m_connection);
m_regionBanListDataAdapter = new MySqlDataAdapter(regionBanListSelectCmd);
MySqlCommand regionSettingsSelectCmd = new MySqlCommand(m_regionSettingsSelect, m_connection); MySqlCommand regionSettingsSelectCmd = new MySqlCommand(m_regionSettingsSelect, m_connection);
m_regionSettingsDataAdapter = new MySqlDataAdapter(regionSettingsSelectCmd); m_regionSettingsDataAdapter = new MySqlDataAdapter(regionSettingsSelectCmd);
@ -192,11 +186,6 @@ namespace OpenSim.Data.MySQL
setupLandAccessCommands(m_landAccessListDataAdapter, m_connection); setupLandAccessCommands(m_landAccessListDataAdapter, m_connection);
m_landAccessListDataAdapter.Fill(m_landAccessListTable); m_landAccessListDataAdapter.Fill(m_landAccessListTable);
m_regionBanListTable = createRegionBanTable();
m_dataSet.Tables.Add(m_regionBanListTable);
SetupRegionBanCommands(m_regionBanListDataAdapter, m_connection);
m_regionBanListDataAdapter.Fill(m_regionBanListTable);
m_regionSettingsTable = createRegionSettingsTable(); m_regionSettingsTable = createRegionSettingsTable();
m_dataSet.Tables.Add(m_regionSettingsTable); m_dataSet.Tables.Add(m_regionSettingsTable);
SetupRegionSettingsCommands(m_regionSettingsDataAdapter, m_connection); SetupRegionSettingsCommands(m_regionSettingsDataAdapter, m_connection);
@ -773,99 +762,6 @@ namespace OpenSim.Data.MySQL
} }
} }
/// <summary>
/// Load (fetch?) a region banlist
/// </summary>
/// <param name="regionUUID">The region UUID</param>
/// <returns>The Region banlist</returns>
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
{
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
lock (m_dataSet)
{
CheckConnection();
DataTable regionban = m_regionBanListTable;
string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
DataRow[] rawbanlist = regionban.Select(searchExp);
foreach (DataRow rawbanrow in rawbanlist)
{
RegionBanListItem rbli = new RegionBanListItem();
LLUUID tmpvalue = LLUUID.Zero;
rbli.regionUUID = regionUUID;
if (Helpers.TryParse((string)rawbanrow["bannedUUID"], out tmpvalue))
rbli.bannedUUID = tmpvalue;
rbli.bannedIP = (string)rawbanrow["bannedIp"];
rbli.bannedIPHostMask = (string)rawbanrow["bannedIpHostMask"];
regionbanlist.Add(rbli);
}
return regionbanlist;
}
}
/// <summary>
/// Add an item to region banlist
/// </summary>
/// <param name="item">The item</param>
public void AddToRegionBanlist(RegionBanListItem item)
{
lock (m_dataSet)
{
CheckConnection();
DataTable regionban = m_regionBanListTable;
string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'";
DataRow[] rawbanlist = regionban.Select(searchExp);
if (rawbanlist.Length == 0)
{
DataRow regionbanrow = regionban.NewRow();
regionbanrow["regionUUID"] = item.regionUUID.ToString();
regionbanrow["bannedUUID"] = item.bannedUUID.ToString();
regionbanrow["bannedIp"] = item.bannedIP.ToString();
regionbanrow["bannedIpHostMask"] = item.bannedIPHostMask.ToString();
regionban.Rows.Add(regionbanrow);
}
Commit();
}
}
/// <summary>
/// Remove an item from region banlist
/// </summary>
/// <param name="item">The item</param>
public void RemoveFromRegionBanlist(RegionBanListItem item)
{
lock (m_dataSet)
{
CheckConnection();
DataTable regionban = m_regionBanListTable;
string searchExp = "regionUUID = '" + item.regionUUID.ToString() + "' AND bannedUUID = '" + item.bannedUUID.ToString() + "'";
DataRow[] rawbanlist = regionban.Select(searchExp);
if (rawbanlist.Length > 0)
{
foreach (DataRow rbli in rawbanlist)
{
regionban.Rows.Remove(rbli);
}
}
Commit();
}
using
(
MySqlCommand cmd =
new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_connection)
)
{
cmd.Parameters.Add(new MySqlParameter("?regionUUID", item.regionUUID.ToString()));
cmd.Parameters.Add(new MySqlParameter("?bannedUUID", item.bannedUUID.ToString()));
CheckConnection();
cmd.ExecuteNonQuery();
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -918,7 +814,6 @@ namespace OpenSim.Data.MySQL
m_terrainDataAdapter.Update(m_terrainTable); m_terrainDataAdapter.Update(m_terrainTable);
m_landDataAdapter.Update(m_landTable); m_landDataAdapter.Update(m_landTable);
m_landAccessListDataAdapter.Update(m_landAccessListTable); m_landAccessListDataAdapter.Update(m_landAccessListTable);
m_regionBanListDataAdapter.Update(m_regionBanListTable);
m_regionSettingsDataAdapter.Update(m_regionSettingsTable); m_regionSettingsDataAdapter.Update(m_regionSettingsTable);
m_dataSet.AcceptChanges(); m_dataSet.AcceptChanges();
@ -1006,6 +901,7 @@ namespace OpenSim.Data.MySQL
createCol(regionsettings, "terrain_raise_limit", typeof (Double)); createCol(regionsettings, "terrain_raise_limit", typeof (Double));
createCol(regionsettings, "terrain_lower_limit", typeof (Double)); createCol(regionsettings, "terrain_lower_limit", typeof (Double));
createCol(regionsettings, "use_estate_sun", typeof (Int32)); createCol(regionsettings, "use_estate_sun", typeof (Int32));
createCol(regionsettings, "sandbox", typeof (Int32));
createCol(regionsettings, "fixed_sun", typeof (Int32)); createCol(regionsettings, "fixed_sun", typeof (Int32));
createCol(regionsettings, "sun_position", typeof (Double)); createCol(regionsettings, "sun_position", typeof (Double));
createCol(regionsettings, "covenant", typeof(String)); createCol(regionsettings, "covenant", typeof(String));
@ -1015,21 +911,6 @@ namespace OpenSim.Data.MySQL
return regionsettings; return regionsettings;
} }
/// <summary>
/// Create the "regionban" table
/// </summary>
/// <returns></returns>
private static DataTable createRegionBanTable()
{
DataTable regionban = new DataTable("regionban");
createCol(regionban, "regionUUID", typeof(String));
createCol(regionban, "bannedUUID", typeof(String));
createCol(regionban, "bannedIp", typeof(String));
createCol(regionban, "bannedIpHostMask", typeof(String));
return regionban;
}
/// <summary> /// <summary>
/// Create the "prims" table /// Create the "prims" table
/// </summary> /// </summary>
@ -1417,6 +1298,7 @@ namespace OpenSim.Data.MySQL
newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]); newSettings.TerrainRaiseLimit = Convert.ToDouble(row["terrain_raise_limit"]);
newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]); newSettings.TerrainLowerLimit = Convert.ToDouble(row["terrain_lower_limit"]);
newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]); newSettings.UseEstateSun = Convert.ToBoolean(row["use_estate_sun"]);
newSettings.Sandbox = Convert.ToBoolean(row["sandbox"]);
newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]);
newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); newSettings.SunPosition = Convert.ToDouble(row["sun_position"]);
newSettings.Covenant = new LLUUID((String) row["covenant"]); newSettings.Covenant = new LLUUID((String) row["covenant"]);
@ -1676,6 +1558,7 @@ namespace OpenSim.Data.MySQL
row["terrain_raise_limit"] = settings.TerrainRaiseLimit; row["terrain_raise_limit"] = settings.TerrainRaiseLimit;
row["terrain_lower_limit"] = settings.TerrainLowerLimit; row["terrain_lower_limit"] = settings.TerrainLowerLimit;
row["use_estate_sun"] = settings.UseEstateSun; row["use_estate_sun"] = settings.UseEstateSun;
row["sandbox"] = settings.Sandbox;
row["fixed_sun"] = settings.FixedSun; row["fixed_sun"] = settings.FixedSun;
row["sun_position"] = settings.SunPosition; row["sun_position"] = settings.SunPosition;
row["covenant"] = settings.Covenant.ToString(); row["covenant"] = settings.Covenant.ToString();
@ -2138,26 +2021,6 @@ namespace OpenSim.Data.MySQL
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
/// <summary>
///
/// </summary>
/// <param name="da"></param>
/// <param name="conn"></param>
private void SetupRegionBanCommands(MySqlDataAdapter da, MySqlConnection conn)
{
da.InsertCommand = createInsertCommand("regionban", m_regionBanListTable);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("regionban", "regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID", m_regionBanListTable);
da.UpdateCommand.Connection = conn;
MySqlCommand delete = new MySqlCommand("delete from regionban where regionUUID = ?regionUUID AND bannedUUID = ?bannedUUID");
delete.Parameters.Add(createMySqlParameter("regionUUID", typeof(String)));
delete.Parameters.Add(createMySqlParameter("bannedUUID", typeof(String)));
delete.Connection = conn;
da.DeleteCommand = delete;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -0,0 +1,386 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
using System.Threading;
using libsecondlife;
using log4net;
using MySql.Data.MySqlClient;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Data.MySQL
{
public class MySQLEstateStore : IEstateDataStore
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string m_waitTimeoutSelect = "select @@wait_timeout";
private MySqlConnection m_connection;
private string m_connectionString;
private long m_waitTimeout;
private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond;
private long m_lastConnectionUse;
private FieldInfo[] m_Fields;
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
m_log.Info("[ESTATE DB]: MySql - connecting: "+m_connectionString);
m_connection = new MySqlConnection(m_connectionString);
m_connection.Open();
GetWaitTimeout();
Assembly assem = GetType().Assembly;
Migration m = new Migration(m_connection, assem, "EstateStore");
m.Update();
Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
foreach (FieldInfo f in m_Fields)
if(f.Name.Substring(0, 2) == "m_")
m_FieldMap[f.Name.Substring(2)] = f;
}
private string[] FieldList
{
get { return new List<string>(m_FieldMap.Keys).ToArray(); }
}
protected void GetWaitTimeout()
{
MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect,
m_connection);
using (MySqlDataReader dbReader =
cmd.ExecuteReader(CommandBehavior.SingleRow))
{
if (dbReader.Read())
{
m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) *
TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
}
dbReader.Close();
cmd.Dispose();
}
m_lastConnectionUse = System.DateTime.Now.Ticks;
m_log.DebugFormat(
"[REGION DB]: Connection wait timeout {0} seconds",
m_waitTimeout / TimeSpan.TicksPerSecond);
}
protected void CheckConnection()
{
long timeNow = System.DateTime.Now.Ticks;
if (timeNow - m_lastConnectionUse > m_waitTimeout ||
m_connection.State != ConnectionState.Open)
{
m_log.DebugFormat("[REGION DB]: Database connection has gone away - reconnecting");
lock (m_connection)
{
m_connection.Close();
m_connection = new MySqlConnection(m_connectionString);
m_connection.Open();
}
}
m_lastConnectionUse = timeNow;
}
public EstateSettings LoadEstateSettings(LLUUID regionID)
{
EstateSettings es = new EstateSettings();
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = ?RegionID";
CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = sql;
cmd.Parameters.Add("?RegionID", regionID.ToString());
IDataReader r = cmd.ExecuteReader();
if(r.Read())
{
foreach (string name in FieldList)
{
if(m_FieldMap[name].GetValue(es) is bool)
{
int v = Convert.ToInt32(r[name]);
if(v != 0)
m_FieldMap[name].SetValue(es, true);
else
m_FieldMap[name].SetValue(es, false);
}
else
{
m_FieldMap[name].SetValue(es, r[name]);
}
}
r.Close();
}
else
{
// Migration case
//
r.Close();
List<string> names = new List<string>(FieldList);
names.Remove("EstateID");
sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( ?"+String.Join(", ?", names.ToArray())+")";
cmd.CommandText = sql;
cmd.Parameters.Clear();
foreach (string name in FieldList)
{
if(m_FieldMap[name].GetValue(es) is bool)
{
if((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add("?"+name, "1");
else
cmd.Parameters.Add("?"+name, "0");
}
else
{
cmd.Parameters.Add("?"+name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd.ExecuteNonQuery();
cmd.CommandText = "select LAST_INSERT_ID() as id";
cmd.Parameters.Clear();
r = cmd.ExecuteReader();
r.Read();
es.EstateID = Convert.ToUInt32(r["id"]);
r.Close();
cmd.CommandText = "insert into estate_map values (?RegionID, ?EstateID)";
cmd.Parameters.Add("?RegionID", regionID.ToString());
cmd.Parameters.Add("?EstateID", es.EstateID.ToString());
// This will throw on dupe key
try
{
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
// Munge and transfer the ban list
//
cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = ?UUID";
cmd.Parameters.Add("?UUID", regionID.ToString());
try
{
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
}
LoadBanList(es);
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
return es;
}
public void StoreEstateSettings(EstateSettings es)
{
string sql = "replace into estate_settings ("+String.Join(",", FieldList)+") values ( ?"+String.Join(", ?", FieldList)+")";
CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = sql;
foreach (string name in FieldList)
{
if(m_FieldMap[name].GetValue(es) is bool)
{
if((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add("?"+name, "1");
else
cmd.Parameters.Add("?"+name, "0");
}
else
{
cmd.Parameters.Add("?"+name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd.ExecuteNonQuery();
SaveBanList(es);
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
}
private void LoadBanList(EstateSettings es)
{
es.ClearBans();
CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID";
cmd.Parameters.Add("?EstateID", es.EstateID);
IDataReader r = cmd.ExecuteReader();
while(r.Read())
{
EstateBan eb = new EstateBan();
LLUUID uuid = new LLUUID();
LLUUID.TryParse(r["bannedUUID"].ToString(), out uuid);
eb.bannedUUID = uuid;
eb.bannedIP = "0.0.0.0";
eb.bannedIPHostMask = "0.0.0.0";
es.AddBan(eb);
}
r.Close();
}
private void SaveBanList(EstateSettings es)
{
CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "delete from estateban where EstateID = ?EstateID";
cmd.Parameters.Add("?EstateID", es.EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban (EstateID, bannedUUID) values ( ?EstateID, ?bannedUUID )";
foreach(EstateBan b in es.EstateBans)
{
cmd.Parameters.Add("?EstateID", es.EstateID.ToString());
cmd.Parameters.Add("?bannedUUID", b.bannedUUID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
void SaveUUIDList(uint EstateID, string table, LLUUID[] data)
{
CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "delete from "+table+" where EstateID = ?EstateID";
cmd.Parameters.Add("?EstateID", EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( ?EstateID, ?uuid )";
foreach(LLUUID uuid in data)
{
cmd.Parameters.Add("?EstateID", EstateID.ToString());
cmd.Parameters.Add("?uuid", uuid.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
LLUUID[] LoadUUIDList(uint EstateID, string table)
{
List<LLUUID> uuids = new List<LLUUID>();
CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "select uuid from "+table+" where EstateID = ?EstateID";
cmd.Parameters.Add("?EstateID", EstateID);
IDataReader r = cmd.ExecuteReader();
while(r.Read())
{
EstateBan eb = new EstateBan();
LLUUID uuid = new LLUUID();
LLUUID.TryParse(r["uuid"].ToString(), out uuid);
uuids.Add(uuid);
}
r.Close();
return uuids.ToArray();
}
}
}

View File

@ -0,0 +1,103 @@
begin;
drop table regionsettings;
CREATE TABLE `regionsettings` (
`regionUUID` char(36) NOT NULL,
`block_terraform` int(11) NOT NULL,
`block_fly` int(11) NOT NULL,
`allow_damage` int(11) NOT NULL,
`restrict_pushing` int(11) NOT NULL,
`allow_land_resell` int(11) NOT NULL,
`allow_land_join_divide` int(11) NOT NULL,
`block_show_in_search` int(11) NOT NULL,
`agent_limit` int(11) NOT NULL,
`object_bonus` float NOT NULL,
`maturity` int(11) NOT NULL,
`disable_scripts` int(11) NOT NULL,
`disable_collisions` int(11) NOT NULL,
`disable_physics` int(11) NOT NULL,
`terrain_texture_1` char(36) NOT NULL,
`terrain_texture_2` char(36) NOT NULL,
`terrain_texture_3` char(36) NOT NULL,
`terrain_texture_4` char(36) NOT NULL,
`elevation_1_nw` float NOT NULL,
`elevation_2_nw` float NOT NULL,
`elevation_1_ne` float NOT NULL,
`elevation_2_ne` float NOT NULL,
`elevation_1_se` float NOT NULL,
`elevation_2_se` float NOT NULL,
`elevation_1_sw` float NOT NULL,
`elevation_2_sw` float NOT NULL,
`water_height` float NOT NULL,
`terrain_raise_limit` float NOT NULL,
`terrain_lower_limit` float NOT NULL,
`use_estate_sun` int(11) NOT NULL,
`fixed_sun` int(11) NOT NULL,
`sun_position` float NOT NULL,
`covenant` char(36) default NULL,
`Sandbox` tinyint(4) NOT NULL,
PRIMARY KEY (`regionUUID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_managers` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_groups` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_users` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estateban` (
`EstateID` int(10) unsigned NOT NULL,
`bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL,
`bannedNameMask` varchar(64) default NULL,
KEY `estateban_EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_settings` (
`EstateID` int(10) unsigned NOT NULL auto_increment,
`EstateName` varchar(64) default NULL,
`AbuseEmailToEstateOwner` tinyint(4) NOT NULL,
`DenyAnonymous` tinyint(4) NOT NULL,
`ResetHomeOnTeleport` tinyint(4) NOT NULL,
`FixedSun` tinyint(4) NOT NULL,
`DenyTransacted` tinyint(4) NOT NULL,
`BlockDwell` tinyint(4) NOT NULL,
`DenyIdentified` tinyint(4) NOT NULL,
`AllowVoice` tinyint(4) NOT NULL,
`UseGlobalTime` tinyint(4) NOT NULL,
`PricePerMeter` int(11) NOT NULL,
`TaxFree` tinyint(4) NOT NULL,
`AllowDirectTeleport` tinyint(4) NOT NULL,
`RedirectGridX` int(11) NOT NULL,
`RedirectGridY` int(11) NOT NULL,
`ParentEstateID` int(10) unsigned NOT NULL,
`SunPosition` double NOT NULL,
`EstateSkipScripts` tinyint(4) NOT NULL,
`BillableFactor` float NOT NULL,
`PublicAccess` tinyint(4) NOT NULL,
PRIMARY KEY (`EstateID`)
) ENGINE=InnoDB AUTO_INCREMENT=100;
CREATE TABLE `estate_map` (
`RegionID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`EstateID` int(11) NOT NULL,
PRIMARY KEY (`RegionID`),
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
commit;

View File

@ -349,9 +349,9 @@ namespace OpenSim.Data.NHibernate
/// </summary> /// </summary>
/// <param name="regionUUID">the region UUID</param> /// <param name="regionUUID">the region UUID</param>
/// <returns>The banlist</returns> /// <returns>The banlist</returns>
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID) public List<EstateBan> LoadRegionBanList(LLUUID regionUUID)
{ {
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>(); List<EstateBan> regionbanlist = new List<EstateBan>();
return regionbanlist; return regionbanlist;
} }
@ -360,7 +360,7 @@ namespace OpenSim.Data.NHibernate
/// Add en entry into region banlist /// Add en entry into region banlist
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void AddToRegionBanlist(RegionBanListItem item) public void AddToRegionBanlist(EstateBan item)
{ {
} }
@ -369,7 +369,7 @@ namespace OpenSim.Data.NHibernate
/// remove an entry from the region banlist /// remove an entry from the region banlist
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void RemoveFromRegionBanlist(RegionBanListItem item) public void RemoveFromRegionBanlist(EstateBan item)
{ {
} }

View File

@ -92,22 +92,6 @@ namespace OpenSim.Data.Null
return new List<LandData>(); return new List<LandData>();
} }
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
{
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
return regionbanlist;
}
public void AddToRegionBanlist(RegionBanListItem item)
{
}
public void RemoveFromRegionBanlist(RegionBanListItem item)
{
}
public void Shutdown() public void Shutdown()
{ {
} }

View File

@ -0,0 +1,92 @@
CREATE TABLE `estate_groups` (
`EstateID` int(10) NOT NULL,
`uuid` char(36) NOT NULL
);
CREATE TABLE `estate_managers` (
`EstateID` int(10) NOT NULL,
`uuid` char(36) NOT NULL
);
CREATE TABLE `estate_map` (
`RegionID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`EstateID` int(11) NOT NULL
);
CREATE TABLE `estate_settings` (
`EstateID` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
`EstateName` varchar(64) default NULL,
`AbuseEmailToEstateOwner` tinyint(4) NOT NULL,
`DenyAnonymous` tinyint(4) NOT NULL,
`ResetHomeOnTeleport` tinyint(4) NOT NULL,
`FixedSun` tinyint(4) NOT NULL,
`DenyTransacted` tinyint(4) NOT NULL,
`BlockDwell` tinyint(4) NOT NULL,
`DenyIdentified` tinyint(4) NOT NULL,
`AllowVoice` tinyint(4) NOT NULL,
`UseGlobalTime` tinyint(4) NOT NULL,
`PricePerMeter` int(11) NOT NULL,
`TaxFree` tinyint(4) NOT NULL,
`AllowDirectTeleport` tinyint(4) NOT NULL,
`RedirectGridX` int(11) NOT NULL,
`RedirectGridY` int(11) NOT NULL,
`ParentEstateID` int(10) NOT NULL,
`SunPosition` double NOT NULL,
`EstateSkipScripts` tinyint(4) NOT NULL,
`BillableFactor` float NOT NULL,
`PublicAccess` tinyint(4) NOT NULL
);
insert into `estate_settings` (`EstateID`,`EstateName`,`AbuseEmailToEstateOwner`,`DenyAnonymous`,`ResetHomeOnTeleport`,`FixedSun`,`DenyTransacted`,`BlockDwell`,`DenyIdentified`,`AllowVoice`,`UseGlobalTime`,`PricePerMeter`,`TaxFree`,`AllowDirectTeleport`,`RedirectGridX`,`RedirectGridY`,`ParentEstateID`,`SunPosition`,`PublicAccess`,`EstateSkipScripts`,`BillableFactor`) values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
delete from `estate_settings`;
CREATE TABLE `estate_users` (
`EstateID` int(10) NOT NULL,
`uuid` char(36) NOT NULL
);
CREATE TABLE `estateban` (
`EstateID` int(10) NOT NULL,
`bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL,
`bannedNameMask` varchar(64) default NULL
);
drop table if exists `regionsettings`;
CREATE TABLE `regionsettings` (
`regionUUID` char(36) NOT NULL,
`block_terraform` int(11) NOT NULL,
`block_fly` int(11) NOT NULL,
`allow_damage` int(11) NOT NULL,
`restrict_pushing` int(11) NOT NULL,
`allow_land_resell` int(11) NOT NULL,
`allow_land_join_divide` int(11) NOT NULL,
`block_show_in_search` int(11) NOT NULL,
`agent_limit` int(11) NOT NULL,
`object_bonus` float NOT NULL,
`maturity` int(11) NOT NULL,
`disable_scripts` int(11) NOT NULL,
`disable_collisions` int(11) NOT NULL,
`disable_physics` int(11) NOT NULL,
`terrain_texture_1` char(36) NOT NULL,
`terrain_texture_2` char(36) NOT NULL,
`terrain_texture_3` char(36) NOT NULL,
`terrain_texture_4` char(36) NOT NULL,
`elevation_1_nw` float NOT NULL,
`elevation_2_nw` float NOT NULL,
`elevation_1_ne` float NOT NULL,
`elevation_2_ne` float NOT NULL,
`elevation_1_se` float NOT NULL,
`elevation_2_se` float NOT NULL,
`elevation_1_sw` float NOT NULL,
`elevation_2_sw` float NOT NULL,
`water_height` float NOT NULL,
`terrain_raise_limit` float NOT NULL,
`terrain_lower_limit` float NOT NULL,
`use_estate_sun` int(11) NOT NULL,
`fixed_sun` int(11) NOT NULL,
`sun_position` float NOT NULL,
`covenant` char(36) default NULL,
`Sandbox` tinyint(4) NOT NULL,
PRIMARY KEY (`regionUUID`)
);
CREATE INDEX `estate_ban_estate_id` on `estateban`(`EstateID`);
CREATE INDEX `estate_groups_estate_id` on `estate_groups`(`EstateID`);
CREATE INDEX `estate_managers_estate_id` on `estate_managers`(`EstateID`);
CREATE INDEX `estate_map_estate_id` on `estate_map`(`EstateID`);
CREATE UNIQUE INDEX `estate_map_region)id` on `estate_map`(`RegionID`);
CREATE INDEX `estate_users_estate_id` on `estate_users`(`EstateID`);

View File

@ -0,0 +1,333 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
using System.Threading;
using libsecondlife;
using Mono.Data.SqliteClient;
using log4net;
using OpenSim.Framework;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Data.MySQL
{
public class MySQLEstateStore : IEstateDataStore
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private SqliteConnection m_connection;
private string m_connectionString;
private FieldInfo[] m_Fields;
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
m_connection = new SqliteConnection(m_connectionString);
m_connection.Open();
Assembly assem = GetType().Assembly;
Migration m = new Migration(m_connection, assem, "EstateStore");
m.Update();
m_connection.Close();
m_connection.Open();
Type t = typeof(EstateSettings);
m_Fields = t.GetFields(BindingFlags.NonPublic |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);
foreach (FieldInfo f in m_Fields)
if(f.Name.Substring(0, 2) == "m_")
m_FieldMap[f.Name.Substring(2)] = f;
}
private string[] FieldList
{
get { return new List<string>(m_FieldMap.Keys).ToArray(); }
}
public EstateSettings LoadEstateSettings(LLUUID regionID)
{
EstateSettings es = new EstateSettings();
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_map left join estate_settings on estate_map.EstateID = estate_settings.EstateID where estate_settings.EstateID is not null and RegionID = @RegionID";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
cmd.Parameters.Add("@RegionID", regionID.ToString());
IDataReader r = cmd.ExecuteReader();
if(r.Read())
{
foreach (string name in FieldList)
{
if(m_FieldMap[name].GetValue(es) is bool)
{
int v = Convert.ToInt32(r[name]);
if(v != 0)
m_FieldMap[name].SetValue(es, true);
else
m_FieldMap[name].SetValue(es, false);
}
else
{
m_FieldMap[name].SetValue(es, Convert.ChangeType(r[name], m_FieldMap[name].FieldType));
}
}
r.Close();
}
else
{
// Migration case
//
r.Close();
List<string> names = new List<string>(FieldList);
names.Remove("EstateID");
sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( @"+String.Join(", @", names.ToArray())+")";
cmd.CommandText = sql;
cmd.Parameters.Clear();
foreach (string name in FieldList)
{
if(m_FieldMap[name].GetValue(es) is bool)
{
if((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add("@"+name, "1");
else
cmd.Parameters.Add("@"+name, "0");
}
else
{
cmd.Parameters.Add("@"+name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd.ExecuteNonQuery();
cmd.CommandText = "select LAST_INSERT_ROWID() as id";
cmd.Parameters.Clear();
r = cmd.ExecuteReader();
r.Read();
es.EstateID = Convert.ToUInt32(r["id"]);
r.Close();
cmd.CommandText = "insert into estate_map values (@RegionID, @EstateID)";
cmd.Parameters.Add("@RegionID", regionID.ToString());
cmd.Parameters.Add("@EstateID", es.EstateID.ToString());
// This will throw on dupe key
try
{
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
// Munge and transfer the ban list
//
cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban select "+es.EstateID.ToString()+", bannedUUID, bannedIp, bannedIpHostMask, '' from regionban where regionban.regionUUID = @UUID";
cmd.Parameters.Add("@UUID", regionID.ToString());
try
{
cmd.ExecuteNonQuery();
}
catch (Exception)
{
}
}
LoadBanList(es);
es.EstateManagers = LoadUUIDList(es.EstateID, "estate_managers");
es.EstateAccess = LoadUUIDList(es.EstateID, "estate_users");
es.EstateGroups = LoadUUIDList(es.EstateID, "estate_groups");
return es;
}
public void StoreEstateSettings(EstateSettings es)
{
List<string> fields = new List<string>(FieldList);
fields.Remove("EstateID");
List<string> terms = new List<string>();
foreach (string f in fields)
terms.Add(f+" = @"+f);
string sql = "update estate_settings set "+String.Join(", ", terms.ToArray())+" where EstateID = @EstateID";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
foreach (string name in FieldList)
{
if(m_FieldMap[name].GetValue(es) is bool)
{
if((bool)m_FieldMap[name].GetValue(es))
cmd.Parameters.Add("@"+name, "1");
else
cmd.Parameters.Add("@"+name, "0");
}
else
{
cmd.Parameters.Add("@"+name, m_FieldMap[name].GetValue(es).ToString());
}
}
cmd.ExecuteNonQuery();
SaveBanList(es);
SaveUUIDList(es.EstateID, "estate_managers", es.EstateManagers);
SaveUUIDList(es.EstateID, "estate_users", es.EstateAccess);
SaveUUIDList(es.EstateID, "estate_groups", es.EstateGroups);
}
private void LoadBanList(EstateSettings es)
{
es.ClearBans();
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "select bannedUUID from estateban where EstateID = @EstateID";
cmd.Parameters.Add("@EstateID", es.EstateID);
IDataReader r = cmd.ExecuteReader();
while(r.Read())
{
EstateBan eb = new EstateBan();
LLUUID uuid = new LLUUID();
LLUUID.TryParse(r["bannedUUID"].ToString(), out uuid);
eb.bannedUUID = uuid;
eb.bannedIP = "0.0.0.0";
eb.bannedIPHostMask = "0.0.0.0";
es.AddBan(eb);
}
r.Close();
}
private void SaveBanList(EstateSettings es)
{
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from estateban where EstateID = @EstateID";
cmd.Parameters.Add("@EstateID", es.EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( @EstateID, @bannedUUID, '', '', '' )";
foreach(EstateBan b in es.EstateBans)
{
cmd.Parameters.Add("@EstateID", es.EstateID.ToString());
cmd.Parameters.Add("@bannedUUID", b.bannedUUID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
void SaveUUIDList(uint EstateID, string table, LLUUID[] data)
{
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from "+table+" where EstateID = @EstateID";
cmd.Parameters.Add("@EstateID", EstateID.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( @EstateID, @uuid )";
foreach(LLUUID uuid in data)
{
cmd.Parameters.Add("@EstateID", EstateID.ToString());
cmd.Parameters.Add("@uuid", uuid.ToString());
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
LLUUID[] LoadUUIDList(uint EstateID, string table)
{
List<LLUUID> uuids = new List<LLUUID>();
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "select uuid from "+table+" where EstateID = @EstateID";
cmd.Parameters.Add("@EstateID", EstateID);
IDataReader r = cmd.ExecuteReader();
while(r.Read())
{
EstateBan eb = new EstateBan();
LLUUID uuid = new LLUUID();
LLUUID.TryParse(r["uuid"].ToString(), out uuid);
uuids.Add(uuid);
}
r.Close();
return uuids.ToArray();
}
}
}

View File

@ -62,7 +62,6 @@ namespace OpenSim.Data.SQLite
private SqliteDataAdapter terrainDa; private SqliteDataAdapter terrainDa;
private SqliteDataAdapter landDa; private SqliteDataAdapter landDa;
private SqliteDataAdapter landAccessListDa; private SqliteDataAdapter landAccessListDa;
private SqliteDataAdapter regionBanListDa;
private SqliteConnection m_conn; private SqliteConnection m_conn;
@ -119,9 +118,6 @@ namespace OpenSim.Data.SQLite
SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn); SqliteCommand landAccessListSelectCmd = new SqliteCommand(landAccessListSelect, m_conn);
landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd); landAccessListDa = new SqliteDataAdapter(landAccessListSelectCmd);
SqliteCommand regionBanListSelectCmd = new SqliteCommand(regionbanListSelect, m_conn);
regionBanListDa = new SqliteDataAdapter(regionBanListSelectCmd);
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration(m_conn, assem, "RegionStore"); Migration m = new Migration(m_conn, assem, "RegionStore");
@ -157,10 +153,6 @@ namespace OpenSim.Data.SQLite
ds.Tables.Add(createLandAccessListTable()); ds.Tables.Add(createLandAccessListTable());
setupLandAccessCommands(landAccessListDa, m_conn); setupLandAccessCommands(landAccessListDa, m_conn);
ds.Tables.Add(createRegionBanListTable());
setupRegionBanCommands(regionBanListDa, m_conn);
// WORKAROUND: This is a work around for sqlite on // WORKAROUND: This is a work around for sqlite on
// windows, which gets really unhappy with blob columns // windows, which gets really unhappy with blob columns
// that have no sample data in them. At some point we // that have no sample data in them. At some point we
@ -201,15 +193,6 @@ namespace OpenSim.Data.SQLite
m_log.Info("[REGION DB]: Caught fill error on landaccesslist table"); m_log.Info("[REGION DB]: Caught fill error on landaccesslist table");
} }
try
{
regionBanListDa.Fill(ds.Tables["regionban"]);
}
catch (Exception)
{
m_log.Info("[REGION DB]: Caught fill error on regionban table");
}
return; return;
} }
} }
@ -900,21 +883,6 @@ namespace OpenSim.Data.SQLite
return landaccess; return landaccess;
} }
/// <summary>
/// create "regionban" table
/// </summary>
/// <returns>regionban datatable</returns>
private static DataTable createRegionBanListTable()
{
DataTable regionbanlist = new DataTable("regionban");
createCol(regionbanlist, "regionUUID", typeof(String));
createCol(regionbanlist, "bannedUUID", typeof(String));
createCol(regionbanlist, "bannedIp", typeof(String));
createCol(regionbanlist, "bannedIpHostMask", typeof(String));
return regionbanlist;
}
/*********************************************************************** /***********************************************************************
* *
* Convert between ADO.NET <=> OpenSim Objects * Convert between ADO.NET <=> OpenSim Objects
@ -1178,74 +1146,6 @@ namespace OpenSim.Data.SQLite
return entry; return entry;
} }
/// <summary>
/// Load a region banlist
/// </summary>
/// <param name="regionUUID">the region UUID</param>
/// <returns>The banlist</returns>
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
{
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
lock (ds)
{
DataTable regionban = ds.Tables["regionban"];
string searchExp = "regionUUID = '" + regionUUID.ToString() + "'";
DataRow[] rawbanlist = regionban.Select(searchExp);
foreach (DataRow rawbanrow in rawbanlist)
{
RegionBanListItem rbli = new RegionBanListItem();
LLUUID tmpvalue = LLUUID.Zero;
rbli.regionUUID = regionUUID;
if (Helpers.TryParse((string)rawbanrow["bannedUUID"], out tmpvalue))
rbli.bannedUUID = tmpvalue;
rbli.bannedIP = (string)rawbanrow["bannedIp"];
rbli.bannedIPHostMask = (string)rawbanrow["bannedIpHostMask"];
regionbanlist.Add(rbli);
}
}
return regionbanlist;
}
/// <summary>
/// Add en entry into region banlist
/// </summary>
/// <param name="item"></param>
public void AddToRegionBanlist(RegionBanListItem item)
{
lock (ds)
{
using (SqliteCommand cmd = new SqliteCommand("insert into regionban (regionUUID, bannedUUID, bannedIp, bannedIpHostMask) values (:regionUUID,:bannedUUID,:bannedIp,:bannedIpHostMask)", m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":regionUUID", item.regionUUID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":bannedUUID", item.bannedUUID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":bannedIp", item.bannedIP));
cmd.Parameters.Add(new SqliteParameter(":bannedIpHostMask", item.bannedIPHostMask));
cmd.ExecuteNonQuery();
}
}
}
/// <summary>
/// remove an entry from the region banlist
/// </summary>
/// <param name="item"></param>
public void RemoveFromRegionBanlist(RegionBanListItem item)
{
lock (ds)
{
using (SqliteCommand cmd = new SqliteCommand("delete from regionban where regionUUID=:regionUUID AND bannedUUID=:bannedUUID", m_conn))
{
cmd.Parameters.Add(new SqliteParameter(":regionUUID", item.regionUUID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":bannedUUID", item.bannedUUID.ToString()));
cmd.ExecuteNonQuery();
}
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -1822,20 +1722,6 @@ namespace OpenSim.Data.SQLite
da.InsertCommand.Connection = conn; da.InsertCommand.Connection = conn;
} }
/// <summary>
///
/// </summary>
/// <param name="da"></param>
/// <param name="conn"></param>
private void setupRegionBanCommands(SqliteDataAdapter da, SqliteConnection conn)
{
da.InsertCommand = createInsertCommand("regionban", ds.Tables["regionban"]);
da.InsertCommand.Connection = conn;
da.UpdateCommand = createUpdateCommand("regionban", "regionUUID=:regionUUID AND bannedUUID=:bannedUUID", ds.Tables["regionban"]);
da.UpdateCommand.Connection = conn;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@ -32,16 +32,12 @@ using System.Text;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
public class RegionBanListItem public class EstateBan
{ {
public LLUUID regionUUID = LLUUID.Zero; public uint estateID = 1;
public LLUUID bannedUUID = LLUUID.Zero; public LLUUID bannedUUID = LLUUID.Zero;
public string bannedIP = string.Empty; public string bannedIP = string.Empty;
public string bannedIPHostMask = string.Empty; public string bannedIPHostMask = string.Empty;
public string bannedNameMask = string.Empty;
public RegionBanListItem()
{
}
} }
} }

View File

@ -28,6 +28,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using log4net; using log4net;
@ -38,451 +39,440 @@ namespace OpenSim.Framework
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private ConfigurationMember configMember; private ConfigurationMember configMember;
//Settings to this island public delegate void SaveDelegate(EstateSettings rs);
private float m_billableFactor;
private uint m_estateID; public event SaveDelegate OnSave;
private LLUUID m_estateManager0;
private LLUUID m_estateManager1;
private LLUUID m_estateManager2;
private LLUUID m_estateManager3;
private LLUUID m_estateManager4;
private LLUUID m_estateManager5;
private LLUUID m_estateManager6;
private LLUUID m_estateManager7;
private LLUUID m_estateManager8;
private LLUUID m_estateManager9;
private string m_estateName;
private uint m_parentEstateID; // Only the client uses these
private int m_pricePerMeter; //
private int m_redirectGridX; private uint m_EstateID = 100;
private int m_redirectGridY;
public uint EstateID
{
get { return m_EstateID; }
set { m_EstateID = value; }
}
private string m_EstateName;
public string EstateName
{
get { return m_EstateName; }
set { m_EstateName = value; }
}
private uint m_ParentEstateID = 100;
public uint ParentEstateID
{
get { return m_ParentEstateID; }
set { m_ParentEstateID = value; }
}
private float m_BillableFactor;
public float BillableFactor
{
get { return m_BillableFactor; }
set { m_BillableFactor = value; }
}
private int m_PricePerMeter;
public int PricePerMeter
{
get { return m_PricePerMeter; }
set { m_PricePerMeter = value; }
}
private int m_RedirectGridX;
public int RedirectGridX
{
get { return m_RedirectGridX; }
set { m_RedirectGridX = value; }
}
private int m_RedirectGridY;
public int RedirectGridY
{
get { return m_RedirectGridY; }
set { m_RedirectGridY = value; }
}
// Used by the sim
//
private bool m_UseGlobalTime = true;
public bool UseGlobalTime
{
get { return m_UseGlobalTime; }
set { m_UseGlobalTime = value; }
}
private bool m_FixedSun = false;
public bool FixedSun
{
get { return m_FixedSun; }
set { m_FixedSun = value; }
}
private double m_SunPosition = 0.0;
public double SunPosition
{
get { return m_SunPosition; }
set { m_SunPosition = value; }
}
private bool m_AllowVoice = true;
public bool AllowVoice
{
get { return m_AllowVoice; }
set { m_AllowVoice = value; }
}
private bool m_AllowDirectTeleport = true;
public bool AllowDirectTeleport
{
get { return m_AllowDirectTeleport; }
set { m_AllowDirectTeleport = value; }
}
private bool m_DenyAnonymous = false;
public bool DenyAnonymous
{
get { return m_DenyAnonymous; }
set { m_DenyAnonymous = value; }
}
private bool m_DenyIdentified = false;
public bool DenyIdentified
{
get { return m_DenyIdentified; }
set { m_DenyIdentified = value; }
}
private bool m_DenyTransacted = false;
public bool DenyTransacted
{
get { return m_DenyTransacted; }
set { m_DenyTransacted = value; }
}
private bool m_AbuseEmailToEstateOwner = false;
public bool AbuseEmailToEstateOwner
{
get { return m_AbuseEmailToEstateOwner; }
set { m_AbuseEmailToEstateOwner = value; }
}
private bool m_BlockDwell = false;
public bool BlockDwell
{
get { return m_BlockDwell; }
set { m_BlockDwell = value; }
}
private bool m_EstateSkipScripts = false;
public bool EstateSkipScripts
{
get { return m_EstateSkipScripts; }
set { m_EstateSkipScripts = value; }
}
private bool m_ResetHomeOnTeleport = false;
public bool ResetHomeOnTeleport
{
get { return m_ResetHomeOnTeleport; }
set { m_ResetHomeOnTeleport = value; }
}
private bool m_TaxFree = false;
public bool TaxFree
{
get { return m_TaxFree; }
set { m_TaxFree = value; }
}
private bool m_PublicAccess = true;
public bool PublicAccess
{
get { return m_PublicAccess; }
set { m_PublicAccess = value; }
}
// All those lists...
//
private List<LLUUID> l_EstateManagers = new List<LLUUID>();
public LLUUID[] EstateManagers
{
get { return l_EstateManagers.ToArray(); }
set { l_EstateManagers = new List<LLUUID>(value); }
}
private List<EstateBan> l_EstateBans = new List<EstateBan>();
public EstateBan[] EstateBans
{
get { return l_EstateBans.ToArray(); }
set { l_EstateBans = new List<EstateBan>(value); }
}
private List<LLUUID> l_EstateAccess = new List<LLUUID>();
public LLUUID[] EstateAccess
{
get { return l_EstateAccess.ToArray(); }
set { l_EstateAccess = new List<LLUUID>(value); }
}
private List<LLUUID> l_EstateGroups = new List<LLUUID>();
public LLUUID[] EstateGroups
{
get { return l_EstateGroups.ToArray(); }
set { l_EstateGroups = new List<LLUUID>(value); }
}
public EstateSettings() public EstateSettings()
{ {
// Temporary hack to prevent multiple loadings.
if (configMember == null) if (configMember == null)
{ {
// Load legacy defaults
//
configMember = configMember =
new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", new ConfigurationMember(Path.Combine(Util.configDir(),
loadConfigurationOptions, handleIncomingConfiguration, true); "estate_settings.xml"), "ESTATE SETTINGS",
loadConfigurationOptions,
handleIncomingConfiguration, true);
l_EstateManagers.Clear();
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
} }
public float billableFactor public void Save()
{ {
get { return m_billableFactor; } if(OnSave != null)
set OnSave(this);
{
m_billableFactor = value;
configMember.forceSetConfigurationOption("billable_factor", m_billableFactor.ToString());
}
}
public uint estateID
{
get { return m_estateID; }
set
{
m_estateID = value;
configMember.forceSetConfigurationOption("estate_id", m_estateID.ToString());
}
}
public uint parentEstateID
{
get { return m_parentEstateID; }
set
{
m_parentEstateID = value;
configMember.forceSetConfigurationOption("parent_estate_id", m_parentEstateID.ToString());
}
}
public int redirectGridX
{
get { return m_redirectGridX; }
set
{
m_redirectGridX = value;
configMember.forceSetConfigurationOption("redirect_grid_x", m_redirectGridX.ToString());
}
}
public int redirectGridY
{
get { return m_redirectGridY; }
set
{
m_redirectGridY = value;
configMember.forceSetConfigurationOption("redirect_grid_y", m_redirectGridY.ToString());
}
}
public int pricePerMeter
{
get { return m_pricePerMeter; }
set
{
m_pricePerMeter = value;
configMember.forceSetConfigurationOption("price_per_meter", m_pricePerMeter.ToString());
}
}
// Estate name
public string estateName
{
get { return m_estateName; }
set
{
m_estateName = value;
configMember.forceSetConfigurationOption("estate_name", m_estateName.ToString());
}
}
public LLUUID[] estateManagers
{
get
{
// returns a condensed array of LLUUIDs
return GetEstateManagers();
}
set
{
// Sets a Condensed array of LLUUIDS
int i = 0;
for (i = 0; i < value.Length; i++)
{
switch (i)
{
case 0:
m_estateManager0 = value[i];
break;
case 1:
m_estateManager1 = value[i];
break;
case 2:
m_estateManager2 = value[i];
break;
case 3:
m_estateManager3 = value[i];
break;
case 4:
m_estateManager4 = value[i];
break;
case 5:
m_estateManager5 = value[i];
break;
case 6:
m_estateManager6 = value[i];
break;
case 7:
m_estateManager7 = value[i];
break;
case 8:
m_estateManager8 = value[i];
break;
case 9:
m_estateManager9 = value[i];
break;
}
}
// Clear the rest of them.. as they're no longer valid
for (int j = i; j < 10; j++)
{
switch (j)
{
case 0:
m_estateManager0 = LLUUID.Zero;
break;
case 1:
m_estateManager1 = LLUUID.Zero;
break;
case 2:
m_estateManager2 = LLUUID.Zero;
break;
case 3:
m_estateManager3 = LLUUID.Zero;
break;
case 4:
m_estateManager4 = LLUUID.Zero;
break;
case 5:
m_estateManager5 = LLUUID.Zero;
break;
case 6:
m_estateManager6 = LLUUID.Zero;
break;
case 7:
m_estateManager7 = LLUUID.Zero;
break;
case 8:
m_estateManager8 = LLUUID.Zero;
break;
case 9:
m_estateManager9 = LLUUID.Zero;
break;
}
}
for (i = 0; i < 10; i++)
{
// Writes out the Estate managers to the XML file.
configMember.forceSetConfigurationOption("estate_manager_" + i, (GetEstateManagerAtPos(i)).ToString());
}
}
}
#region EstateManager Get Methods to sort out skipped spots in the XML (suser error)
private LLUUID GetEstateManagerAtPos(int pos)
{
// This is a helper for writing them out to the xml file
switch (pos)
{
case 0:
return m_estateManager0;
case 1:
return m_estateManager1;
case 2:
return m_estateManager2;
case 3:
return m_estateManager3;
case 4:
return m_estateManager4;
case 5:
return m_estateManager5;
case 6:
return m_estateManager6;
case 7:
return m_estateManager7;
case 8:
return m_estateManager8;
case 9:
return m_estateManager9;
default:
return LLUUID.Zero;
}
}
private LLUUID[] GetEstateManagers()
{
int numEstateManagers = GetNumberOfEstateManagers();
LLUUID[] rEstateManagers = new LLUUID[numEstateManagers];
int pos = 0;
for (int i = 0; i < numEstateManagers; i++)
{
pos = GetNextEstateManager(pos);
rEstateManagers[i] = GetEstateManagerAtPos(pos);
pos++;
}
return rEstateManagers;
}
private int GetNextEstateManager(int startpos)
{
// This is a utility function that skips over estate managers set to LLUUID.Zero
int i = startpos;
for (i = startpos; i < 10; i++)
{
if (GetEstateManagerAtPos(i) != LLUUID.Zero) return i;
}
return i;
}
private int GetNumberOfEstateManagers()
{
// This function returns the number of estate managers set
// Regardless of whether there is a skipped spot
int numEstateManagers = 0;
if (m_estateManager0 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager1 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager2 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager3 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager4 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager5 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager6 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager7 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager8 != LLUUID.Zero) numEstateManagers++;
if (m_estateManager9 != LLUUID.Zero) numEstateManagers++;
return numEstateManagers;
} }
public void AddEstateManager(LLUUID avatarID) public void AddEstateManager(LLUUID avatarID)
{ {
LLUUID[] testateManagers = GetEstateManagers(); if(avatarID == null || avatarID == LLUUID.Zero)
LLUUID[] nestateManagers = new LLUUID[testateManagers.Length + 1]; return;
if(!l_EstateManagers.Contains(avatarID))
int i = 0; l_EstateManagers.Add(avatarID);
for (i = 0; i < testateManagers.Length; i++)
{
nestateManagers[i] = testateManagers[i];
}
nestateManagers[i] = avatarID;
//Saves it to the estate settings file
estateManagers = nestateManagers;
} }
public void RemoveEstateManager(LLUUID avatarID) public void RemoveEstateManager(LLUUID avatarID)
{ {
int notfoundparam = 11; // starting high so the condense routine (max ten) doesn't run if we don't find it. if(l_EstateManagers.Contains(avatarID))
LLUUID[] testateManagers = GetEstateManagers(); // temporary estate managers list l_EstateManagers.Remove(avatarID);
int i = 0;
int foundpos = notfoundparam;
// search for estate manager.
for (i = 0; i < testateManagers.Length; i++)
{
if (testateManagers[i] == avatarID)
{
foundpos = i;
break;
}
}
if (foundpos < notfoundparam)
{
LLUUID[] restateManagers = new LLUUID[testateManagers.Length - 1];
// fill new estate managers array up to the found spot
for (int j = 0; j < foundpos; j++)
restateManagers[j] = testateManagers[j];
// skip over the estate manager we're removing and compress
for (int j = foundpos + 1; j < testateManagers.Length; j++)
restateManagers[j - 1] = testateManagers[j];
estateManagers = restateManagers;
}
else
{
m_log.Error("[ESTATESETTINGS]: Unable to locate estate manager : " + avatarID.ToString() + " for removal");
}
} }
#endregion public bool IsEstateManager(LLUUID avatarID)
{
return l_EstateManagers.Contains(avatarID);
}
public bool IsBanned(LLUUID avatarID)
{
foreach (EstateBan ban in l_EstateBans)
if(ban.bannedUUID == avatarID)
return true;
return false;
}
public void AddBan(EstateBan ban)
{
if(ban == null)
return;
if(!IsBanned(ban.bannedUUID))
l_EstateBans.Add(ban);
}
public void ClearBans()
{
l_EstateBans.Clear();
}
public void RemoveBan(LLUUID avatarID)
{
foreach (EstateBan ban in new List<EstateBan>(l_EstateBans))
if(ban.bannedUUID == avatarID)
l_EstateBans.Remove(ban);
}
public void loadConfigurationOptions() public void loadConfigurationOptions()
{ {
configMember.addConfigurationOption("billable_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, configMember.addConfigurationOption("billable_factor",
"0.0", true); ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
configMember.addConfigurationOption("estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, String.Empty, "100", String.Empty, "0.0", true);
true);
configMember.addConfigurationOption("parent_estate_id", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
String.Empty, "1", true);
configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, String.Empty, "40",
true);
configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty, // configMember.addConfigurationOption("estate_id",
"0", true); // ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty, // String.Empty, "100", true);
"0", true);
configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
String.Empty, "1", true);
configMember.addConfigurationOption("water_height", ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE, String.Empty, // configMember.addConfigurationOption("parent_estate_id",
"20.0", true); // ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
// String.Empty, "1", true);
configMember.addConfigurationOption("estate_name", ConfigurationOption.ConfigurationTypes.TYPE_STRING, configMember.addConfigurationOption("redirect_grid_x",
String.Empty, "TestEstate", true); ConfigurationOption.ConfigurationTypes.TYPE_INT32,
configMember.addConfigurationOption("estate_manager_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty, "0", true);
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_1", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("redirect_grid_y",
String.Empty, "00000000-0000-0000-0000-000000000000", true); ConfigurationOption.ConfigurationTypes.TYPE_INT32,
configMember.addConfigurationOption("estate_manager_2", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty, "0", true);
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_3", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("price_per_meter",
String.Empty, "00000000-0000-0000-0000-000000000000", true); ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
configMember.addConfigurationOption("estate_manager_4", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty, "1", true);
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_5", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("estate_name",
String.Empty, "00000000-0000-0000-0000-000000000000", true); ConfigurationOption.ConfigurationTypes.TYPE_STRING,
configMember.addConfigurationOption("estate_manager_6", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty, "My Estate", true);
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_7", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("estate_manager_0",
String.Empty, "00000000-0000-0000-0000-000000000000", true); ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
configMember.addConfigurationOption("estate_manager_8", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty, "00000000-0000-0000-0000-000000000000", true);
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_9", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("estate_manager_1",
String.Empty, "00000000-0000-0000-0000-000000000000", true); ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_2",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_3",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_4",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_5",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_6",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_7",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_8",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("estate_manager_9",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
String.Empty, "00000000-0000-0000-0000-000000000000", true);
configMember.addConfigurationOption("region_flags",
ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
String.Empty, "336723974", true);
} }
public bool handleIncomingConfiguration(string configuration_key, object configuration_result) public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
{ {
switch (configuration_key) switch (configuration_key)
{ {
case "region_flags":
Simulator.RegionFlags flags = (Simulator.RegionFlags)(uint)configuration_result;
if((flags & (Simulator.RegionFlags)(1<<29)) != 0)
m_AllowVoice = true;
if((flags & Simulator.RegionFlags.AllowDirectTeleport) != 0)
m_AllowDirectTeleport = true;
if((flags & Simulator.RegionFlags.DenyAnonymous) != 0)
m_DenyAnonymous = true;
if((flags & Simulator.RegionFlags.DenyIdentified) != 0)
m_DenyIdentified = true;
if((flags & Simulator.RegionFlags.DenyTransacted) != 0)
m_DenyTransacted = true;
if((flags & Simulator.RegionFlags.AbuseEmailToEstateOwner) != 0)
m_AbuseEmailToEstateOwner = true;
if((flags & Simulator.RegionFlags.BlockDwell) != 0)
m_BlockDwell = true;
if((flags & Simulator.RegionFlags.EstateSkipScripts) != 0)
m_EstateSkipScripts = true;
if((flags & Simulator.RegionFlags.ResetHomeOnTeleport) != 0)
m_ResetHomeOnTeleport = true;
if((flags & Simulator.RegionFlags.TaxFree) != 0)
m_TaxFree = true;
if((flags & Simulator.RegionFlags.PublicAllowed) != 0)
m_PublicAccess = true;
break;
case "billable_factor": case "billable_factor":
m_billableFactor = (float) configuration_result; m_BillableFactor = (float) configuration_result;
break;
case "estate_id":
m_estateID = (uint) configuration_result;
break;
case "parent_estate_id":
m_parentEstateID = (uint) configuration_result;
break; break;
// case "estate_id":
// m_EstateID = (uint) configuration_result;
// break;
// case "parent_estate_id":
// m_ParentEstateID = (uint) configuration_result;
// break;
case "redirect_grid_x": case "redirect_grid_x":
m_redirectGridX = (int) configuration_result; m_RedirectGridX = (int) configuration_result;
break; break;
case "redirect_grid_y": case "redirect_grid_y":
m_redirectGridY = (int) configuration_result; m_RedirectGridY = (int) configuration_result;
break; break;
case "price_per_meter": case "price_per_meter":
m_pricePerMeter = Convert.ToInt32(configuration_result); m_PricePerMeter = Convert.ToInt32(configuration_result);
break; break;
case "estate_name": case "estate_name":
m_estateName = (string) configuration_result; m_EstateName = (string) configuration_result;
break; break;
case "estate_manager_0": case "estate_manager_0":
m_estateManager0 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_1": case "estate_manager_1":
m_estateManager1 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_2": case "estate_manager_2":
m_estateManager2 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_3": case "estate_manager_3":
m_estateManager3 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_4": case "estate_manager_4":
m_estateManager4 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_5": case "estate_manager_5":
m_estateManager5 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_6": case "estate_manager_6":
m_estateManager6 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_7": case "estate_manager_7":
m_estateManager7 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_8": case "estate_manager_8":
m_estateManager8 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
case "estate_manager_9": case "estate_manager_9":
m_estateManager9 = (LLUUID) configuration_result; AddEstateManager((LLUUID)configuration_result);
break; break;
} }

View File

@ -285,7 +285,8 @@ namespace OpenSim.Framework
public delegate void SetEstateTerrainDetailTexture(IClientAPI remoteClient, int corner, LLUUID side); public delegate void SetEstateTerrainDetailTexture(IClientAPI remoteClient, int corner, LLUUID side);
public delegate void SetEstateTerrainTextureHeights(IClientAPI remoteClient, int corner, float lowVal, float highVal); public delegate void SetEstateTerrainTextureHeights(IClientAPI remoteClient, int corner, float lowVal, float highVal);
public delegate void CommitEstateTerrainTextureRequest(IClientAPI remoteClient); public delegate void CommitEstateTerrainTextureRequest(IClientAPI remoteClient);
public delegate void SetRegionTerrainSettings(float waterHeight, float terrainRaiseLimit, float terrainLowerLimit, bool fixedSun, float sunHour); public delegate void SetRegionTerrainSettings(float waterHeight, float terrainRaiseLimit, float terrainLowerLimit, bool estateSun, bool fixedSun, float sunHour, bool globalSun, bool estateFixed, float estateSunHour);
public delegate void EstateChangeInfo(IClientAPI client, LLUUID invoice, LLUUID senderID, UInt32 param1, UInt32 param2);
public delegate void BakeTerrain(IClientAPI remoteClient ); public delegate void BakeTerrain(IClientAPI remoteClient );
public delegate void EstateRestartSimRequest(IClientAPI remoteClient, int secondsTilReboot); public delegate void EstateRestartSimRequest(IClientAPI remoteClient, int secondsTilReboot);
public delegate void EstateChangeCovenantRequest(IClientAPI remoteClient, LLUUID newCovenantID); public delegate void EstateChangeCovenantRequest(IClientAPI remoteClient, LLUUID newCovenantID);
@ -349,6 +350,7 @@ namespace OpenSim.Framework
// [Obsolete("LLClientView Specific - Replace with more suitable arguments.")] // [Obsolete("LLClientView Specific - Replace with more suitable arguments.")]
event ModifyTerrain OnModifyTerrain; event ModifyTerrain OnModifyTerrain;
event BakeTerrain OnBakeTerrain; event BakeTerrain OnBakeTerrain;
event EstateChangeInfo OnEstateChangeInfo;
// [Obsolete("LLClientView Specific.")] // [Obsolete("LLClientView Specific.")]
event SetAppearance OnSetAppearance; event SetAppearance OnSetAppearance;
// [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")] // [Obsolete("LLClientView Specific - Replace and rename OnAvatarUpdate. Difference from SetAppearance?")]
@ -628,11 +630,11 @@ namespace OpenSim.Framework
void SendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID); void SendEstateManagersList(LLUUID invoice, LLUUID[] EstateManagers, uint estateID);
void SendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID); void SendBannedUserList(LLUUID invoice, EstateBan[] banlist, uint estateID);
void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args); void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args);
void SendEstateCovenantInformation(); void SendEstateCovenantInformation(LLUUID covenant);
void SendDetailedEstateData(LLUUID invoice,string estateName, uint estateID); void SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, LLUUID covenant);
void SendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags); void SendLandProperties(IClientAPI remote_client, int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags);
void SendLandAccessListData(List<LLUUID> avatars, uint accessFlag, int localLandID); void SendLandAccessListData(List<LLUUID> avatars, uint accessFlag, int localLandID);

View File

@ -193,7 +193,6 @@ namespace OpenSim.Framework
public bool commFailTF = false; public bool commFailTF = false;
public ConfigurationMember configMember; public ConfigurationMember configMember;
public LLUUID CovenantID = LLUUID.Zero;
public string DataStore = String.Empty; public string DataStore = String.Empty;
public bool isSandbox = false; public bool isSandbox = false;
private EstateSettings m_estateSettings; private EstateSettings m_estateSettings;
@ -212,7 +211,6 @@ namespace OpenSim.Framework
public LLUUID lastMapUUID = LLUUID.Zero; public LLUUID lastMapUUID = LLUUID.Zero;
public string lastMapRefresh = "0"; public string lastMapRefresh = "0";
public List<RegionBanListItem> regionBanlist = new List<RegionBanListItem>();
// Apparently, we're applying the same estatesettings regardless of whether it's local or remote. // Apparently, we're applying the same estatesettings regardless of whether it's local or remote.
@ -279,6 +277,8 @@ namespace OpenSim.Framework
return m_estateSettings; return m_estateSettings;
} }
set { m_estateSettings = value; }
} }
public RegionSettings RegionSettings public RegionSettings RegionSettings
@ -364,28 +364,6 @@ namespace OpenSim.Framework
configMember.performConfigurationRetrieve(); configMember.performConfigurationRetrieve();
} }
public bool CheckIfUserBanned(LLUUID user)
{
RegionBanListItem[] bl = regionBanlist.ToArray();
bool banned = false;
for (int i = 0; i < bl.Length; i++)
{
if (bl[i] == null)
continue;
if (bl[i].bannedUUID == user)
{
banned = true;
break;
}
}
return banned;
}
public void loadConfigurationOptionsFromMe() public void loadConfigurationOptionsFromMe()
{ {
configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID_NULL_FREE, configMember.addConfigurationOption("sim_UUID", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID_NULL_FREE,
@ -415,9 +393,6 @@ namespace OpenSim.Framework
"External Host Name", m_externalHostName, true); "External Host Name", m_externalHostName, true);
configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"Master Avatar UUID", MasterAvatarAssignedUUID.ToString(), true); "Master Avatar UUID", MasterAvatarAssignedUUID.ToString(), true);
configMember.addConfigurationOption("estate_covanant_uuid",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant",
CovenantID.ToString(), true);
configMember.addConfigurationOption("master_avatar_first", configMember.addConfigurationOption("master_avatar_first",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"First Name of Master Avatar", MasterAvatarFirstName, true); "First Name of Master Avatar", MasterAvatarFirstName, true);
@ -461,9 +436,6 @@ namespace OpenSim.Framework
"External Host Name", "127.0.0.1", false); "External Host Name", "127.0.0.1", false);
configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("master_avatar_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"Master Avatar UUID", LLUUID.Zero.ToString(), true); "Master Avatar UUID", LLUUID.Zero.ToString(), true);
configMember.addConfigurationOption("estate_covanant_uuid",
ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, "Estate Covenant",
LLUUID.Zero.ToString(), true);
configMember.addConfigurationOption("master_avatar_first", configMember.addConfigurationOption("master_avatar_first",
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"First Name of Master Avatar", "Test", false, "First Name of Master Avatar", "Test", false,
@ -538,10 +510,6 @@ namespace OpenSim.Framework
case "master_avatar_uuid": case "master_avatar_uuid":
MasterAvatarAssignedUUID = (LLUUID) configuration_result; MasterAvatarAssignedUUID = (LLUUID) configuration_result;
break; break;
case "estate_covanant_uuid":
CovenantID = (LLUUID) configuration_result;
break;
case "master_avatar_first": case "master_avatar_first":
MasterAvatarFirstName = (string) configuration_result; MasterAvatarFirstName = (string) configuration_result;
break; break;
@ -563,11 +531,6 @@ namespace OpenSim.Framework
return true; return true;
} }
public void SaveEstatecovenantUUID(LLUUID notecard)
{
if (null == configMember) return;
configMember.forceSetConfigurationOption("estate_covanant_uuid", notecard.ToString());
}
public void SaveLastMapUUID(LLUUID mapUUID) public void SaveLastMapUUID(LLUUID mapUUID)
{ {
if (null == configMember) return; if (null == configMember) return;

View File

@ -162,6 +162,8 @@ namespace OpenSim.Framework
(flags & Simulator.RegionFlags.SkipPhysics) != 0; (flags & Simulator.RegionFlags.SkipPhysics) != 0;
m_FixedSun = m_FixedSun =
(flags & Simulator.RegionFlags.SunFixed) != 0; (flags & Simulator.RegionFlags.SunFixed) != 0;
m_Sandbox =
(flags & Simulator.RegionFlags.Sandbox) != 0;
break; break;
case "max_agents": case "max_agents":
m_AgentLimit = (int)value; m_AgentLimit = (int)value;
@ -231,7 +233,8 @@ namespace OpenSim.Framework
public void Save() public void Save()
{ {
OnSave(this); if(OnSave != null)
OnSave(this);
} }
private LLUUID m_RegionUUID = LLUUID.Zero; private LLUUID m_RegionUUID = LLUUID.Zero;
@ -474,6 +477,14 @@ namespace OpenSim.Framework
set { m_UseEstateSun = value; } set { m_UseEstateSun = value; }
} }
private bool m_Sandbox = false;
public bool Sandbox
{
get { return m_Sandbox; }
set { m_Sandbox = value; }
}
private LLVector3 m_SunVector; private LLVector3 m_SunVector;
public LLVector3 SunVector public LLVector3 SunVector

View File

@ -520,7 +520,6 @@ namespace OpenSim
//moved these here as the terrain texture has to be created after the modules are initialized //moved these here as the terrain texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid. // and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(false); scene.CreateTerrainTexture(false);
scene.LoadRegionBanlist();
try try
{ {

View File

@ -166,6 +166,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private GenericCall4 handlerDeRezObject = null; //OnDeRezObject; private GenericCall4 handlerDeRezObject = null; //OnDeRezObject;
private ModifyTerrain handlerModifyTerrain = null; private ModifyTerrain handlerModifyTerrain = null;
private BakeTerrain handlerBakeTerrain = null; private BakeTerrain handlerBakeTerrain = null;
private EstateChangeInfo handlerEstateChangeInfo = null;
private Action<IClientAPI> handlerRegionHandShakeReply = null; //OnRegionHandShakeReply; private Action<IClientAPI> handlerRegionHandShakeReply = null; //OnRegionHandShakeReply;
private GenericCall2 handlerRequestWearables = null; //OnRequestWearables; private GenericCall2 handlerRequestWearables = null; //OnRequestWearables;
private Action<IClientAPI> handlerRequestAvatarsData = null; //OnRequestAvatarsData; private Action<IClientAPI> handlerRequestAvatarsData = null; //OnRequestAvatarsData;
@ -920,6 +921,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest; public event CommitEstateTerrainTextureRequest OnCommitEstateTerrainTextureRequest;
public event SetRegionTerrainSettings OnSetRegionTerrainSettings; public event SetRegionTerrainSettings OnSetRegionTerrainSettings;
public event BakeTerrain OnBakeTerrain; public event BakeTerrain OnBakeTerrain;
public event EstateChangeInfo OnEstateChangeInfo;
public event EstateRestartSimRequest OnEstateRestartSimRequest; public event EstateRestartSimRequest OnEstateRestartSimRequest;
public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest; public event EstateChangeCovenantRequest OnEstateChangeCovenantRequest;
public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest; public event UpdateEstateAccessDeltaRequest OnUpdateEstateAccessDeltaRequest;
@ -2614,18 +2616,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
this.OutPacket(packet, ThrottleOutPacketType.Task); this.OutPacket(packet, ThrottleOutPacketType.Task);
} }
public void SendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID) public void SendBannedUserList(LLUUID invoice, EstateBan[] bl, uint estateID)
{ {
RegionBanListItem[] bl = banlist.ToArray(); List<LLUUID>BannedUsers = new List<LLUUID>();
LLUUID[] BannedUsers = new LLUUID[bl.Length];
for (int i = 0; i < bl.Length; i++) for (int i = 0; i < bl.Length; i++)
{ {
if (bl[i] == null) if (bl[i] == null)
continue; continue;
BannedUsers[i] = bl[i].bannedUUID; if (bl[i].bannedUUID == LLUUID.Zero)
continue;
BannedUsers.Add(bl[i].bannedUUID);
} }
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
@ -2635,9 +2636,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.MethodData.Invoice = invoice; packet.MethodData.Invoice = invoice;
packet.MethodData.Method = Helpers.StringToField("setaccess"); packet.MethodData.Method = Helpers.StringToField("setaccess");
EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Length]; EstateOwnerMessagePacket.ParamListBlock[] returnblock = new EstateOwnerMessagePacket.ParamListBlock[6 + BannedUsers.Count];
for (int i = 0; i < (6 + BannedUsers.Length); i++) for (int i = 0; i < (6 + BannedUsers.Count); i++)
{ {
returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock(); returnblock[i] = new EstateOwnerMessagePacket.ParamListBlock();
} }
@ -2647,12 +2648,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
returnblock[j].Parameter = Helpers.StringToField(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; returnblock[j].Parameter = Helpers.StringToField(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++;
returnblock[j].Parameter = Helpers.StringToField("0"); j++; returnblock[j].Parameter = Helpers.StringToField("0"); j++;
returnblock[j].Parameter = Helpers.StringToField("0"); j++; returnblock[j].Parameter = Helpers.StringToField("0"); j++;
returnblock[j].Parameter = Helpers.StringToField(BannedUsers.Length.ToString()); j++; returnblock[j].Parameter = Helpers.StringToField(BannedUsers.Count.ToString()); j++;
returnblock[j].Parameter = Helpers.StringToField("0"); j++; returnblock[j].Parameter = Helpers.StringToField("0"); j++;
for (int i = 0; i < BannedUsers.Length; i++) foreach (LLUUID banned in BannedUsers)
{ {
returnblock[j].Parameter = BannedUsers[i].GetBytes(); j++; returnblock[j].Parameter = banned.GetBytes(); j++;
} }
packet.ParamList = returnblock; packet.ParamList = returnblock;
packet.Header.Reliable = false; packet.Header.Reliable = false;
@ -2687,11 +2688,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
this.OutPacket(rinfopack, ThrottleOutPacketType.Task); this.OutPacket(rinfopack, ThrottleOutPacketType.Task);
} }
public void SendEstateCovenantInformation() public void SendEstateCovenantInformation(LLUUID covenant)
{ {
EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket();
EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock();
edata.CovenantID = m_scene.RegionInfo.CovenantID; edata.CovenantID = covenant;
edata.CovenantTimestamp = 0; edata.CovenantTimestamp = 0;
edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID; edata.EstateOwnerID = m_scene.RegionInfo.MasterAvatarAssignedUUID;
edata.EstateName = edata.EstateName =
@ -2700,7 +2701,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
this.OutPacket(einfopack, ThrottleOutPacketType.Task); this.OutPacket(einfopack, ThrottleOutPacketType.Task);
} }
public void SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID) public void SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, LLUUID covenant)
{ {
EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket(); EstateOwnerMessagePacket packet = new EstateOwnerMessagePacket();
packet.MethodData.Invoice = invoice; packet.MethodData.Invoice = invoice;
@ -2718,13 +2719,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString()); returnblock[1].Parameter = Helpers.StringToField(m_scene.RegionInfo.MasterAvatarAssignedUUID.ToString());
returnblock[2].Parameter = Helpers.StringToField(estateID.ToString()); returnblock[2].Parameter = Helpers.StringToField(estateID.ToString());
// TODO: Resolve Magic numbers here returnblock[3].Parameter = Helpers.StringToField(estateFlags.ToString());
returnblock[3].Parameter = Helpers.StringToField("269516800"); returnblock[4].Parameter = Helpers.StringToField(sunPosition.ToString());
returnblock[4].Parameter = Helpers.StringToField("0"); returnblock[5].Parameter = Helpers.StringToField(parentEstate.ToString());
returnblock[5].Parameter = Helpers.StringToField("1"); returnblock[6].Parameter = Helpers.StringToField(covenant.ToString());
returnblock[6].Parameter = Helpers.StringToField(m_scene.RegionInfo.RegionID.ToString()); returnblock[7].Parameter = Helpers.StringToField("1160895077"); // what is this?
returnblock[7].Parameter = Helpers.StringToField("1160895077"); returnblock[8].Parameter = Helpers.StringToField("1"); // what is this?
returnblock[8].Parameter = Helpers.StringToField("1");
packet.ParamList = returnblock; packet.ParamList = returnblock;
packet.Header.Reliable = false; packet.Header.Reliable = false;
@ -5959,10 +5959,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
tmp = Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter); tmp = Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter);
if (!tmp.Contains(".")) tmp += ".00"; if (!tmp.Contains(".")) tmp += ".00";
float TerrainLowerLimit = (float)Convert.ToDecimal(tmp); float TerrainLowerLimit = (float)Convert.ToDecimal(tmp);
bool UseEstateSun = convertParamStringToBool(messagePacket.ParamList[3].Parameter);
bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter); bool UseFixedSun = convertParamStringToBool(messagePacket.ParamList[4].Parameter);
float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(messagePacket.ParamList[5].Parameter)); float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(messagePacket.ParamList[5].Parameter));
bool UseGlobal = convertParamStringToBool(messagePacket.ParamList[6].Parameter);
bool EstateFixedSun = convertParamStringToBool(messagePacket.ParamList[7].Parameter);
float EstateSunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(messagePacket.ParamList[8].Parameter));
OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); OnSetRegionTerrainSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseEstateSun, UseFixedSun, SunHour, UseGlobal, EstateFixedSun, EstateSunHour);
} }
catch (Exception ex) catch (Exception ex)
@ -6076,6 +6080,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case "estatechangeinfo":
if (((Scene)m_scene).ExternalChecks.ExternalChecksCanIssueEstateCommand(this.AgentId))
{
LLUUID invoice = messagePacket.MethodData.Invoice;
LLUUID SenderID = messagePacket.AgentData.AgentID;
UInt32 param1 = Convert.ToUInt32(Helpers.FieldToUTF8String(messagePacket.ParamList[1].Parameter));
UInt32 param2 = Convert.ToUInt32(Helpers.FieldToUTF8String(messagePacket.ParamList[2].Parameter));
handlerEstateChangeInfo = OnEstateChangeInfo;
if (handlerEstateChangeInfo != null)
{
handlerEstateChangeInfo(this, invoice, SenderID, param1, param2);
}
}
break;
default: default:
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString()); m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString());
break; break;

View File

@ -623,7 +623,7 @@ namespace OpenSim.Region.Communications.OGS1
{ {
if (regions[i].RegionHandle == regionHandle) if (regions[i].RegionHandle == regionHandle)
{ {
if (regions[i].CheckIfUserBanned(agentData.AgentID)) if (regions[i].EstateSettings.IsBanned(agentData.AgentID))
{ {
banned = true; banned = true;
break; break;
@ -1158,7 +1158,7 @@ namespace OpenSim.Region.Communications.OGS1
{ {
if (regions[i].RegionHandle == regionHandle) if (regions[i].RegionHandle == regionHandle)
{ {
if (regions[i].CheckIfUserBanned(agentID)) if (regions[i].EstateSettings.IsBanned(agentID))
{ {
banned = true; banned = true;
break; break;

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenSim.Framework;
using libsecondlife;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IEstateDataStore
{
void Initialise(string connectstring);
EstateSettings LoadEstateSettings(LLUUID regionID);
void StoreEstateSettings(EstateSettings es);
}
}

View File

@ -72,10 +72,6 @@ namespace OpenSim.Region.Environment.Interfaces
void RemoveLandObject(LLUUID globalID); void RemoveLandObject(LLUUID globalID);
List<LandData> LoadLandObjects(LLUUID regionUUID); List<LandData> LoadLandObjects(LLUUID regionUUID);
List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID);
void AddToRegionBanlist(RegionBanListItem item);
void RemoveFromRegionBanlist(RegionBanListItem item);
void StoreRegionSettings(RegionSettings rs); void StoreRegionSettings(RegionSettings rs);
RegionSettings LoadRegionSettings(LLUUID regionUUID); RegionSettings LoadRegionSettings(LLUUID regionUUID);

View File

@ -49,9 +49,26 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
private void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice) private void sendDetailedEstateData(IClientAPI remote_client, LLUUID invoice)
{ {
remote_client.SendDetailedEstateData(invoice,m_scene.RegionInfo.EstateSettings.estateName,m_scene.RegionInfo.EstateSettings.estateID); //SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, LLUUID covenant)
remote_client.SendEstateManagersList(invoice,m_scene.RegionInfo.EstateSettings.estateManagers,m_scene.RegionInfo.EstateSettings.estateID);
remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); uint sun = 0;
if(!m_scene.RegionInfo.EstateSettings.UseGlobalTime)
sun=(uint)(m_scene.RegionInfo.EstateSettings.SunPosition*1024.0) + 0x1800;
remote_client.SendDetailedEstateData(invoice,
m_scene.RegionInfo.EstateSettings.EstateName,
m_scene.RegionInfo.EstateSettings.EstateID,
m_scene.RegionInfo.EstateSettings.ParentEstateID,
GetEstateFlags(),
sun,
m_scene.RegionInfo.RegionSettings.Covenant);
remote_client.SendEstateManagersList(invoice,
m_scene.RegionInfo.EstateSettings.EstateManagers,
m_scene.RegionInfo.EstateSettings.EstateID);
remote_client.SendBannedUserList(invoice,
m_scene.RegionInfo.EstateSettings.EstateBans,
m_scene.RegionInfo.EstateSettings.EstateID);
} }
private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor,
@ -150,8 +167,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
sendRegionHandshakeToAll(); sendRegionHandshakeToAll();
} }
public void setRegionTerrainSettings(float WaterHeight, float TerrainRaiseLimit, float TerrainLowerLimit, public void setRegionTerrainSettings(float WaterHeight,
bool UseFixedSun, float SunHour) float TerrainRaiseLimit, float TerrainLowerLimit,
bool UseEstateSun, bool UseFixedSun, float SunHour,
bool UseGlobal, bool EstateFixedSun, float EstateSunHour)
{ {
// Water Height // Water Height
m_scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; m_scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight;
@ -161,10 +180,11 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
m_scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; m_scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit;
// Time of day / fixed sun // Time of day / fixed sun
m_scene.RegionInfo.RegionSettings.UseEstateSun = UseEstateSun;
m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun;
m_scene.RegionInfo.RegionSettings.SunPosition = SunHour; m_scene.RegionInfo.RegionSettings.SunPosition = SunHour;
m_scene.EventManager.TriggerEstateToolsTimeUpdate(m_scene.RegionInfo.RegionHandle, UseFixedSun, UseFixedSun, SunHour); m_scene.EventManager.TriggerEstateToolsTimeUpdate(m_scene.RegionInfo.RegionHandle, UseFixedSun, UseEstateSun, SunHour);
//m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString());
//m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString());
@ -180,20 +200,23 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID) private void handleChangeEstateCovenantRequest(IClientAPI remoteClient, LLUUID estateCovenantID)
{ {
m_scene.RegionInfo.CovenantID = estateCovenantID; m_scene.RegionInfo.RegionSettings.Covenant = estateCovenantID;
m_scene.RegionInfo.SaveEstatecovenantUUID(estateCovenantID); m_scene.RegionInfo.RegionSettings.Save();
} }
private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user) private void handleEstateAccessDeltaRequest(IClientAPI remote_client, LLUUID invoice, int estateAccessType, LLUUID user)
{ {
// EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc. // EstateAccessDelta handles Estate Managers, Sim Access, Sim Banlist, allowed Groups.. etc.
if (user == m_scene.RegionInfo.MasterAvatarAssignedUUID)
return; // never process owner
switch (estateAccessType) switch (estateAccessType)
{ {
case 64: case 64:
if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray(); EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false; bool alreadyInList = false;
@ -209,15 +232,15 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
if (!alreadyInList) if (!alreadyInList)
{ {
RegionBanListItem item = new RegionBanListItem(); EstateBan item = new EstateBan();
item.bannedUUID = user; item.bannedUUID = user;
item.regionUUID = m_scene.RegionInfo.RegionID; item.estateID = m_scene.RegionInfo.EstateSettings.EstateID;
item.bannedIP = "0.0.0.0"; item.bannedIP = "0.0.0.0";
item.bannedIPHostMask = "0.0.0.0"; item.bannedIPHostMask = "0.0.0.0";
m_scene.RegionInfo.regionBanlist.Add(item); m_scene.RegionInfo.EstateSettings.AddBan(item);
m_scene.AddToRegionBanlist(item); m_scene.RegionInfo.EstateSettings.Save();
ScenePresence s = m_scene.GetScenePresence(user); ScenePresence s = m_scene.GetScenePresence(user);
if (s != null) if (s != null)
@ -231,7 +254,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
remote_client.SendAlertMessage("User is already on the region ban list"); remote_client.SendAlertMessage("User is already on the region ban list");
} }
//m_scene.RegionInfo.regionBanlist.Add(Manager(user); //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
} }
else else
{ {
@ -241,10 +264,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
case 128: case 128:
if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) if (m_scene.ExternalChecks.ExternalChecksCanIssueEstateCommand(remote_client.AgentId) || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
RegionBanListItem[] banlistcheck = m_scene.RegionInfo.regionBanlist.ToArray(); EstateBan[] banlistcheck = m_scene.RegionInfo.EstateSettings.EstateBans;
bool alreadyInList = false; bool alreadyInList = false;
RegionBanListItem listitem = null; EstateBan listitem = null;
for (int i = 0; i < banlistcheck.Length; i++) for (int i = 0; i < banlistcheck.Length; i++)
{ {
@ -258,15 +281,15 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
} }
if (alreadyInList && listitem != null) if (alreadyInList && listitem != null)
{ {
m_scene.RegionInfo.regionBanlist.Remove(listitem); m_scene.RegionInfo.EstateSettings.RemoveBan(listitem.bannedUUID);
m_scene.RemoveFromRegionBanlist(listitem); m_scene.RegionInfo.EstateSettings.Save();
} }
else else
{ {
remote_client.SendAlertMessage("User is not on the region ban list"); remote_client.SendAlertMessage("User is not on the region ban list");
} }
//m_scene.RegionInfo.regionBanlist.Add(Manager(user); //m_scene.RegionInfo.regionBanlist.Add(Manager(user);
remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.regionBanlist, m_scene.RegionInfo.EstateSettings.estateID); remote_client.SendBannedUserList(invoice, m_scene.RegionInfo.EstateSettings.EstateBans, m_scene.RegionInfo.EstateSettings.EstateID);
} }
else else
{ {
@ -280,7 +303,8 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.AddEstateManager(user); m_scene.RegionInfo.EstateSettings.AddEstateManager(user);
remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
} }
else else
{ {
@ -294,7 +318,9 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions()) if (remote_client.AgentId == m_scene.RegionInfo.MasterAvatarAssignedUUID || m_scene.ExternalChecks.ExternalChecksBypassPermissions())
{ {
m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user); m_scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.estateManagers, m_scene.RegionInfo.EstateSettings.estateID); m_scene.RegionInfo.EstateSettings.Save();
remote_client.SendEstateManagersList(invoice, m_scene.RegionInfo.EstateSettings.EstateManagers, m_scene.RegionInfo.EstateSettings.EstateID);
} }
else else
{ {
@ -358,28 +384,24 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
{ {
RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs();
args.billableFactor = m_scene.RegionInfo.EstateSettings.billableFactor; args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor;
args.estateID = m_scene.RegionInfo.EstateSettings.estateID; args.estateID = m_scene.RegionInfo.EstateSettings.EstateID;
args.maxAgents = (byte)m_scene.RegionInfo.RegionSettings.AgentLimit; args.maxAgents = (byte)m_scene.RegionInfo.RegionSettings.AgentLimit;
args.objectBonusFactor = (float)m_scene.RegionInfo.RegionSettings.ObjectBonus; args.objectBonusFactor = (float)m_scene.RegionInfo.RegionSettings.ObjectBonus;
args.parentEstateID = m_scene.RegionInfo.EstateSettings.parentEstateID; args.parentEstateID = m_scene.RegionInfo.EstateSettings.ParentEstateID;
args.pricePerMeter = m_scene.RegionInfo.EstateSettings.pricePerMeter; args.pricePerMeter = m_scene.RegionInfo.EstateSettings.PricePerMeter;
args.redirectGridX = m_scene.RegionInfo.EstateSettings.redirectGridX; args.redirectGridX = m_scene.RegionInfo.EstateSettings.RedirectGridX;
args.redirectGridY = m_scene.RegionInfo.EstateSettings.redirectGridY; args.redirectGridY = m_scene.RegionInfo.EstateSettings.RedirectGridY;
args.regionFlags = GetRegionFlags(); args.regionFlags = GetRegionFlags();
byte mature = 13; byte mature = 13;
if(m_scene.RegionInfo.RegionSettings.Maturity == 1) if(m_scene.RegionInfo.RegionSettings.Maturity == 1)
mature = 21; mature = 21;
args.simAccess = mature; args.simAccess = mature;
if (m_scene.RegionInfo.RegionSettings.FixedSun) args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition;
args.sunHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition;
else
args.sunHour = m_scene.EventManager.GetSunLindenHour();
args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit;
args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit;
args.useEstateSun = !m_scene.RegionInfo.RegionSettings.FixedSun; args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun;
args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
args.simName = m_scene.RegionInfo.RegionName; args.simName = m_scene.RegionInfo.RegionName;
@ -387,9 +409,9 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
remote_client.SendRegionInfoToEstateMenu(args); remote_client.SendRegionInfoToEstateMenu(args);
} }
private static void HandleEstateCovenantRequest(IClientAPI remote_client) private void HandleEstateCovenantRequest(IClientAPI remote_client)
{ {
remote_client.SendEstateCovenantInformation(); remote_client.SendEstateCovenantInformation(m_scene.RegionInfo.RegionSettings.Covenant);
} }
private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient) private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
{ {
@ -508,7 +530,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
{ {
RegionHandshakeArgs args = new RegionHandshakeArgs(); RegionHandshakeArgs args = new RegionHandshakeArgs();
bool estatemanager = false; bool estatemanager = false;
LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.estateManagers; LLUUID[] EstateManagers = m_scene.RegionInfo.EstateSettings.EstateManagers;
for (int i = 0; i < EstateManagers.Length; i++) for (int i = 0; i < EstateManagers.Length; i++)
{ {
if (EstateManagers[i] == remoteClient.AgentId) if (EstateManagers[i] == remoteClient.AgentId)
@ -517,7 +539,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
args.isEstateManager = estatemanager; args.isEstateManager = estatemanager;
args.billableFactor = m_scene.RegionInfo.EstateSettings.billableFactor; args.billableFactor = m_scene.RegionInfo.EstateSettings.BillableFactor;
args.terrainStartHeight0 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SW; args.terrainStartHeight0 = (float)m_scene.RegionInfo.RegionSettings.Elevation1SW;
args.terrainHeightRange0 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SW; args.terrainHeightRange0 = (float)m_scene.RegionInfo.RegionSettings.Elevation2SW;
args.terrainStartHeight1 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NW; args.terrainStartHeight1 = (float)m_scene.RegionInfo.RegionSettings.Elevation1NW;
@ -554,6 +576,73 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
); );
} }
public void handleEstateChangeInfo(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, UInt32 parms1, UInt32 parms2)
{
if(parms2 == 0)
{
m_scene.RegionInfo.EstateSettings.UseGlobalTime = true;
m_scene.RegionInfo.EstateSettings.SunPosition = 0.0;
}
else
{
m_scene.RegionInfo.EstateSettings.UseGlobalTime = false;
m_scene.RegionInfo.EstateSettings.SunPosition = (double)(parms2 - 0x1800)/1024.0;
}
if((parms1 & 0x00000010) != 0)
m_scene.RegionInfo.EstateSettings.FixedSun = true;
else
m_scene.RegionInfo.EstateSettings.FixedSun = false;
if((parms1 & 0x00008000) != 0)
m_scene.RegionInfo.EstateSettings.PublicAccess = true;
else
m_scene.RegionInfo.EstateSettings.PublicAccess = false;
if((parms1 & 0x10000000) != 0)
m_scene.RegionInfo.EstateSettings.AllowVoice = true;
else
m_scene.RegionInfo.EstateSettings.AllowVoice = false;
if((parms1 & 0x00100000) != 0)
m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = true;
else
m_scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
if((parms1 & 0x00800000) != 0)
m_scene.RegionInfo.EstateSettings.DenyAnonymous = true;
else
m_scene.RegionInfo.EstateSettings.DenyAnonymous = false;
if((parms1 & 0x01000000) != 0)
m_scene.RegionInfo.EstateSettings.DenyIdentified = true;
else
m_scene.RegionInfo.EstateSettings.DenyIdentified = false;
if((parms1 & 0x02000000) != 0)
m_scene.RegionInfo.EstateSettings.DenyTransacted = true;
else
m_scene.RegionInfo.EstateSettings.DenyTransacted = false;
m_scene.RegionInfo.EstateSettings.Save();
float sun = (float)m_scene.RegionInfo.RegionSettings.SunPosition;
if(m_scene.RegionInfo.RegionSettings.UseEstateSun)
{
sun = (float)m_scene.RegionInfo.EstateSettings.SunPosition;
if(m_scene.RegionInfo.EstateSettings.UseGlobalTime)
sun = m_scene.EventManager.GetSunLindenHour();
}
m_scene.EventManager.TriggerEstateToolsTimeUpdate(
m_scene.RegionInfo.RegionHandle,
m_scene.RegionInfo.EstateSettings.FixedSun ||
m_scene.RegionInfo.RegionSettings.FixedSun,
m_scene.RegionInfo.RegionSettings.UseEstateSun, sun);
sendDetailedEstateData(remoteClient, invoice);
}
#endregion #endregion
#region IRegionModule Members #region IRegionModule Members
@ -594,8 +683,12 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
setRegionTerrainSettings(height, setRegionTerrainSettings(height,
(float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit, (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit,
(float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit, (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit,
m_scene.RegionInfo.RegionSettings.UseEstateSun,
m_scene.RegionInfo.RegionSettings.FixedSun, m_scene.RegionInfo.RegionSettings.FixedSun,
(float)m_scene.RegionInfo.RegionSettings.SunPosition); (float)m_scene.RegionInfo.RegionSettings.SunPosition,
m_scene.RegionInfo.EstateSettings.UseGlobalTime,
m_scene.RegionInfo.EstateSettings.FixedSun,
(float)m_scene.RegionInfo.EstateSettings.SunPosition);
sendRegionInfoPacketToAll(); sendRegionInfoPacketToAll();
} }
@ -613,6 +706,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
client.OnSetRegionTerrainSettings += setRegionTerrainSettings; client.OnSetRegionTerrainSettings += setRegionTerrainSettings;
client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
client.OnEstateChangeInfo += handleEstateChangeInfo;
client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
@ -652,41 +746,53 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
if(m_scene.RegionInfo.RegionSettings.BlockShowInSearch) if(m_scene.RegionInfo.RegionSettings.BlockShowInSearch)
flags |= (Simulator.RegionFlags)(1 << 29); flags |= (Simulator.RegionFlags)(1 << 29);
// Partially implemented
//
if(m_scene.RegionInfo.RegionSettings.FixedSun) if(m_scene.RegionInfo.RegionSettings.FixedSun)
flags |= Simulator.RegionFlags.SunFixed; flags |= Simulator.RegionFlags.SunFixed;
if(m_scene.RegionInfo.RegionSettings.Sandbox)
flags |= Simulator.RegionFlags.Sandbox;
// Not implemented // Handled in LandObject.cs: AllowLandmark
// // Handled in LandObject.cs: AllowSetHome
// TODO: ExternallyVisible
flags |= Simulator.RegionFlags.ExternallyVisible;
// TODO: PublicAllowed
flags |= Simulator.RegionFlags.PublicAllowed;
// TODO: AllowDirectTeleport
flags |= Simulator.RegionFlags.AllowDirectTeleport;
// TODO: AllowVoice
flags |= Simulator.RegionFlags.AllowVoice;
// TDOD: AllowLandmark
// TDOD: AllowSetHome
// TODO: ResetHomeOnTeleport
// TODO: TaxFree ? (Linden-ism)
// TODO: Sandbox ?
// TODO: SkipUpdateInterestList // TODO: SkipUpdateInterestList
// TODO: ExternallyVisible
// TODO: DenyAnonymous
// TODO: DenyIdentified
// TODO: DenyTransacted
// TODO: AbuseEmailToEstateOwner
// TODO: BlockDwell
// TODO: EstateSkipScripts
// Omitted // Omitted
// //
// Omitted: NullLayer (what is that?) // Omitted: NullLayer (what is that?)
// Omitted: SkipAgentAction (what does it do?) // Omitted: SkipAgentAction (what does it do?)
// Omitted: MainlandVisible (Do we need it)
return (uint)flags;
}
public uint GetEstateFlags()
{
Simulator.RegionFlags flags = Simulator.RegionFlags.None;
if(m_scene.RegionInfo.EstateSettings.FixedSun)
flags |= Simulator.RegionFlags.SunFixed;
if(m_scene.RegionInfo.EstateSettings.PublicAccess)
flags |= (Simulator.RegionFlags.PublicAllowed |
Simulator.RegionFlags.ExternallyVisible);
if(m_scene.RegionInfo.EstateSettings.AllowVoice)
flags |= Simulator.RegionFlags.AllowVoice;
if(m_scene.RegionInfo.EstateSettings.AllowDirectTeleport)
flags |= Simulator.RegionFlags.AllowDirectTeleport;
if(m_scene.RegionInfo.EstateSettings.DenyAnonymous)
flags |= Simulator.RegionFlags.DenyAnonymous;
if(m_scene.RegionInfo.EstateSettings.DenyIdentified)
flags |= Simulator.RegionFlags.DenyIdentified;
if(m_scene.RegionInfo.EstateSettings.DenyTransacted)
flags |= Simulator.RegionFlags.DenyTransacted;
if(m_scene.RegionInfo.EstateSettings.AbuseEmailToEstateOwner)
flags |= Simulator.RegionFlags.AbuseEmailToEstateOwner;
if(m_scene.RegionInfo.EstateSettings.BlockDwell)
flags |= Simulator.RegionFlags.BlockDwell;
if(m_scene.RegionInfo.EstateSettings.EstateSkipScripts)
flags |= Simulator.RegionFlags.EstateSkipScripts;
if(m_scene.RegionInfo.EstateSettings.ResetHomeOnTeleport)
flags |= Simulator.RegionFlags.ResetHomeOnTeleport;
if(m_scene.RegionInfo.EstateSettings.TaxFree)
flags |= Simulator.RegionFlags.TaxFree;
return (uint)flags; return (uint)flags;
} }

View File

@ -162,9 +162,13 @@ namespace OpenSim.Region.Environment.Modules.World.Land
public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client)
{ {
IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
uint regionFlags = 67108864; uint regionFlags = 336723974 & ~((uint)(Simulator.RegionFlags.AllowLandmark | Simulator.RegionFlags.AllowSetHome));
if(estateModule != null) if(estateModule != null)
regionFlags = estateModule.GetRegionFlags(); regionFlags = estateModule.GetRegionFlags();
if((landData.landFlags & (uint)Parcel.ParcelFlags.AllowLandmark) != 0)
regionFlags |= (uint)Simulator.RegionFlags.AllowLandmark;
if(landData.ownerID == remote_client.AgentId)
regionFlags |= (uint)Simulator.RegionFlags.AllowSetHome;
remote_client.SendLandProperties(remote_client, sequence_id, remote_client.SendLandProperties(remote_client, sequence_id,
snap_selection, request_result, landData, snap_selection, request_result, landData,
(float)m_scene.RegionInfo.RegionSettings.ObjectBonus, (float)m_scene.RegionInfo.RegionSettings.ObjectBonus,

View File

@ -291,6 +291,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest; public event EstateBlueBoxMessageRequest OnEstateBlueBoxMessageRequest;
public event EstateDebugRegionRequest OnEstateDebugRegionRequest; public event EstateDebugRegionRequest OnEstateDebugRegionRequest;
public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; public event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
public event EstateChangeInfo OnEstateChangeInfo;
public event ScriptReset OnScriptReset; public event ScriptReset OnScriptReset;
public event GetScriptRunning OnGetScriptRunning; public event GetScriptRunning OnGetScriptRunning;
public event SetScriptRunning OnSetScriptRunning; public event SetScriptRunning OnSetScriptRunning;
@ -752,17 +753,17 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
{ {
} }
public void SendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID) public void SendBannedUserList(LLUUID invoice, EstateBan[] banlist, uint estateID)
{ {
} }
public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
{ {
} }
public void SendEstateCovenantInformation() public void SendEstateCovenantInformation(LLUUID covenant)
{ {
} }
public void SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID) public void SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, LLUUID covenant)
{ {
} }

View File

@ -246,17 +246,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
protected bool IsEstateManager(LLUUID user) protected bool IsEstateManager(LLUUID user)
{ {
if (user != LLUUID.Zero) return m_scene.RegionInfo.EstateSettings.IsEstateManager(user);
{
LLUUID[] estatemanagers = m_scene.RegionInfo.EstateSettings.estateManagers;
foreach (LLUUID estatemanager in estatemanagers)
{
if (estatemanager == user)
return true;
}
}
return false;
} }
#endregion #endregion

View File

@ -271,9 +271,14 @@ namespace OpenSim.Region.Environment.Scenes
// Load region settings // Load region settings
// First try database // First try database
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
// Hook up save event // Hook up save event
m_regInfo.RegionSettings.OnSave += m_storageManager.DataStore.StoreRegionSettings; m_regInfo.RegionSettings.OnSave += m_storageManager.DataStore.StoreRegionSettings;
if(m_storageManager.EstateDataStore != null)
{
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID);
m_regInfo.EstateSettings.OnSave += m_storageManager.EstateDataStore.StoreEstateSettings;
}
//Bind Storage Manager functions to some land manager functions for this scene //Bind Storage Manager functions to some land manager functions for this scene
@ -1445,20 +1450,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void LoadRegionBanlist()
{
List<RegionBanListItem> regionbanlist = m_storageManager.DataStore.LoadRegionBanList(m_regInfo.RegionID);
m_regInfo.regionBanlist = regionbanlist;
}
public void AddToRegionBanlist(RegionBanListItem item)
{
m_storageManager.DataStore.AddToRegionBanlist(item);
}
public void RemoveFromRegionBanlist(RegionBanListItem item)
{
m_storageManager.DataStore.RemoveFromRegionBanlist(item);
}
#endregion #endregion
#region Primitives Methods #region Primitives Methods
@ -1916,7 +1907,7 @@ namespace OpenSim.Region.Environment.Scenes
SceneObjectPart RootPrim = GetSceneObjectPart(primID); SceneObjectPart RootPrim = GetSceneObjectPart(primID);
if (RootPrim != null) if (RootPrim != null)
{ {
if (m_regInfo.CheckIfUserBanned(RootPrim.OwnerID)) if (m_regInfo.EstateSettings.IsBanned(RootPrim.OwnerID))
{ {
SceneObjectGroup grp = RootPrim.ParentGroup; SceneObjectGroup grp = RootPrim.ParentGroup;
if (grp != null) if (grp != null)
@ -2410,7 +2401,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (regionHandle == m_regInfo.RegionHandle) if (regionHandle == m_regInfo.RegionHandle)
{ {
if (m_regInfo.CheckIfUserBanned(agent.AgentID)) if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[CONNECTION DEBUGGING]: Denied access to: {0} [{1}] at {2} because the user is on the region banlist", "[CONNECTION DEBUGGING]: Denied access to: {0} [{1}] at {2} because the user is on the region banlist",

View File

@ -43,6 +43,13 @@ namespace OpenSim.Region.Environment
get { return m_dataStore; } get { return m_dataStore; }
} }
private IEstateDataStore m_estateDataStore;
public IEstateDataStore EstateDataStore
{
get { return m_estateDataStore; }
}
public StorageManager(IRegionDataStore storage) public StorageManager(IRegionDataStore storage)
{ {
m_dataStore = storage; m_dataStore = storage;
@ -69,6 +76,17 @@ namespace OpenSim.Region.Environment
m_log.Info("[DATASTORE]: Added IRegionDataStore Interface"); m_log.Info("[DATASTORE]: Added IRegionDataStore Interface");
} }
typeInterface = pluginType.GetInterface("IEstateDataStore", true);
if(typeInterface != null)
{
IEstateDataStore estPlug =
(IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
estPlug.Initialise(connectionstring);
m_estateDataStore = estPlug;
}
} }
} }

View File

@ -158,6 +158,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event ObjectDeselect OnObjectDeselect; public event ObjectDeselect OnObjectDeselect;
public event RegionInfoRequest OnRegionInfoRequest; public event RegionInfoRequest OnRegionInfoRequest;
public event EstateCovenantRequest OnEstateCovenantRequest; public event EstateCovenantRequest OnEstateCovenantRequest;
public event EstateChangeInfo OnEstateChangeInfo;
public event ObjectDuplicateOnRay OnObjectDuplicateOnRay; public event ObjectDuplicateOnRay OnObjectDuplicateOnRay;
@ -741,17 +742,17 @@ namespace OpenSim.Region.Examples.SimpleModule
{ {
} }
public void SendBannedUserList(LLUUID invoice, List<RegionBanListItem> banlist, uint estateID) public void SendBannedUserList(LLUUID invoice, EstateBan[] banlist, uint estateID)
{ {
} }
public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args) public void SendRegionInfoToEstateMenu(RegionInfoForEstateMenuArgs args)
{ {
} }
public void SendEstateCovenantInformation() public void SendEstateCovenantInformation(LLUUID covenant)
{ {
} }
public void SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID) public void SendDetailedEstateData(LLUUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, LLUUID covenant)
{ {
} }

View File

@ -322,23 +322,6 @@ namespace OpenSim.DataStore.MSSQL
return new List<LandData>(); return new List<LandData>();
} }
public List<RegionBanListItem> LoadRegionBanList(LLUUID regionUUID)
{
List<RegionBanListItem> regionbanlist = new List<RegionBanListItem>();
return regionbanlist;
}
public void AddToRegionBanlist(RegionBanListItem item)
{
}
public void RemoveFromRegionBanlist(RegionBanListItem item)
{
}
public void Commit() public void Commit()
{ {
lock (ds) lock (ds)