Merge branch 'master' of /home/git/repo/OpenSim
commit
d3457eae7a
|
@ -117,6 +117,7 @@ what it is today.
|
||||||
* SachaMagne
|
* SachaMagne
|
||||||
* Salahzar Stenvaag
|
* Salahzar Stenvaag
|
||||||
* sempuki
|
* sempuki
|
||||||
|
* SignpostMarv
|
||||||
* Snoopy
|
* Snoopy
|
||||||
* Strawberry Fride
|
* Strawberry Fride
|
||||||
* tglion
|
* tglion
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
|
|
||||||
public void Initialise()
|
public void Initialise()
|
||||||
{
|
{
|
||||||
m_log.Error("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
|
m_log.Error("[LOAD REGIONS PLUGIN]: " + Name + " cannot be default-initialized!");
|
||||||
throw new PluginNotInitialisedException(Name);
|
throw new PluginNotInitialisedException(Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
IRegionLoader regionLoader;
|
IRegionLoader regionLoader;
|
||||||
if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
|
if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
|
||||||
{
|
{
|
||||||
m_log.Info("[LOADREGIONS]: Loading region configurations from filesystem");
|
m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from filesystem");
|
||||||
regionLoader = new RegionLoaderFileSystem();
|
regionLoader = new RegionLoaderFileSystem();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -94,8 +94,6 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
regionLoader = new RegionLoaderWebServer();
|
regionLoader = new RegionLoaderWebServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations...");
|
|
||||||
|
|
||||||
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
|
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
|
||||||
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
|
||||||
|
|
||||||
|
@ -112,14 +110,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
|
|
||||||
if (!CheckRegionsForSanity(regionsToLoad))
|
if (!CheckRegionsForSanity(regionsToLoad))
|
||||||
{
|
{
|
||||||
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
|
m_log.Error("[LOAD REGIONS PLUGIN]: Halting startup due to conflicts in region configurations");
|
||||||
Environment.Exit(1);
|
Environment.Exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < regionsToLoad.Length; i++)
|
for (int i = 0; i < regionsToLoad.Length; i++)
|
||||||
{
|
{
|
||||||
IScene scene;
|
IScene scene;
|
||||||
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
m_log.Debug("[LOAD REGIONS PLUGIN]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
|
||||||
Thread.CurrentThread.ManagedThreadId.ToString() +
|
Thread.CurrentThread.ManagedThreadId.ToString() +
|
||||||
")");
|
")");
|
||||||
|
|
||||||
|
@ -164,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
if (regions[i].RegionID == regions[j].RegionID)
|
if (regions[i].RegionID == regions[j].RegionID)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}",
|
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same UUID {2}",
|
||||||
regions[i].RegionName, regions[j].RegionName, regions[i].RegionID);
|
regions[i].RegionName, regions[j].RegionName, regions[i].RegionID);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -172,14 +170,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
|
||||||
regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY)
|
regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[LOADREGIONS]: Regions {0} and {1} have the same grid location ({2}, {3})",
|
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same grid location ({2}, {3})",
|
||||||
regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY);
|
regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port)
|
else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat(
|
m_log.ErrorFormat(
|
||||||
"[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}",
|
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same internal IP port {2}",
|
||||||
regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port);
|
regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,8 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
private readonly IScene m_scene;
|
private readonly IScene m_scene;
|
||||||
private readonly string m_firstName;
|
private readonly string m_firstName;
|
||||||
private readonly string m_lastName;
|
private readonly string m_lastName;
|
||||||
private int m_objectsToSynchronize = 0;
|
// private int m_objectsToSynchronize = 0;
|
||||||
private int m_objectsSynchronized = -1;
|
// private int m_objectsSynchronized = -1;
|
||||||
|
|
||||||
private Vector3 m_startPosition=new Vector3(128f, 128f, 128f);
|
private Vector3 m_startPosition=new Vector3(128f, 128f, 128f);
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -462,8 +462,8 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
|
|
||||||
public void MXPSendSynchronizationBegin(int objectCount)
|
public void MXPSendSynchronizationBegin(int objectCount)
|
||||||
{
|
{
|
||||||
m_objectsToSynchronize = objectCount;
|
// m_objectsToSynchronize = objectCount;
|
||||||
m_objectsSynchronized = 0;
|
// m_objectsSynchronized = 0;
|
||||||
SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage();
|
SynchronizationBeginEventMessage synchronizationBeginEventMessage = new SynchronizationBeginEventMessage();
|
||||||
synchronizationBeginEventMessage.ObjectCount = (uint)objectCount;
|
synchronizationBeginEventMessage.ObjectCount = (uint)objectCount;
|
||||||
Session.Send(synchronizationBeginEventMessage);
|
Session.Send(synchronizationBeginEventMessage);
|
||||||
|
@ -1252,7 +1252,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
||||||
// Need to translate to MXP somehow
|
// Need to translate to MXP somehow
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
|
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
|
||||||
{
|
{
|
||||||
// Need to translate to MXP somehow
|
// Need to translate to MXP somehow
|
||||||
}
|
}
|
||||||
|
|
|
@ -799,7 +799,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
|
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>,
|
public class MSSQLAvatarData : MSSQLGenericTableHandler<AvatarBaseData>,
|
||||||
IAvatarData
|
IAvatarData
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public MSSQLAvatarData(string connectionString, string realm) :
|
public MSSQLAvatarData(string connectionString, string realm) :
|
||||||
base(connectionString, realm, "Avatar")
|
base(connectionString, realm, "Avatar")
|
||||||
|
|
|
@ -350,26 +350,48 @@ namespace OpenSim.Data.MSSQL
|
||||||
|
|
||||||
public EstateSettings LoadEstateSettings(int estateID)
|
public EstateSettings LoadEstateSettings(int estateID)
|
||||||
{
|
{
|
||||||
|
// TODO: Implementation!
|
||||||
return new EstateSettings();
|
return new EstateSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<EstateSettings> LoadEstateSettingsAll()
|
||||||
|
{
|
||||||
|
// TODO: Implementation!
|
||||||
|
return new List<EstateSettings>();
|
||||||
|
}
|
||||||
|
|
||||||
public List<int> GetEstates(string search)
|
public List<int> GetEstates(string search)
|
||||||
|
{
|
||||||
|
// TODO: Implementation!
|
||||||
|
return new List<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstatesAll()
|
||||||
|
{
|
||||||
|
// TODO: Implementation!
|
||||||
|
return new List<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstatesByOwner(UUID ownerID)
|
||||||
{
|
{
|
||||||
return new List<int>();
|
return new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LinkRegion(UUID regionID, int estateID)
|
public bool LinkRegion(UUID regionID, int estateID)
|
||||||
{
|
{
|
||||||
|
// TODO: Implementation!
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<UUID> GetRegions(int estateID)
|
public List<UUID> GetRegions(int estateID)
|
||||||
{
|
{
|
||||||
|
// TODO: Implementation!
|
||||||
return new List<UUID>();
|
return new List<UUID>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeleteEstate(int estateID)
|
public bool DeleteEstate(int estateID)
|
||||||
{
|
{
|
||||||
|
// TODO: Implementation!
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
public class MSSQLGenericTableHandler<T> where T : class, new()
|
public class MSSQLGenericTableHandler<T> where T : class, new()
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
// private static readonly ILog m_log =
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected string m_ConnectionString;
|
protected string m_ConnectionString;
|
||||||
protected MSSQLManager m_database; //used for parameter type translation
|
protected MSSQLManager m_database; //used for parameter type translation
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>,
|
public class MSSQLGridUserData : MSSQLGenericTableHandler<GridUserData>,
|
||||||
IGridUserData
|
IGridUserData
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public MSSQLGridUserData(string connectionString, string realm) :
|
public MSSQLGridUserData(string connectionString, string realm) :
|
||||||
base(connectionString, realm, "GridUserStore")
|
base(connectionString, realm, "GridUserStore")
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MSSQLManager
|
public class MSSQLManager
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Connection string for ADO.net
|
/// Connection string for ADO.net
|
||||||
|
@ -180,8 +180,6 @@ namespace OpenSim.Data.MSSQL
|
||||||
return parameter;
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> emptyDictionary = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if we need to do some migrations to the database
|
/// Checks if we need to do some migrations to the database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
|
||||||
public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>,
|
public class MSSQLPresenceData : MSSQLGenericTableHandler<PresenceData>,
|
||||||
IPresenceData
|
IPresenceData
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public MSSQLPresenceData(string connectionString, string realm) :
|
public MSSQLPresenceData(string connectionString, string realm) :
|
||||||
base(connectionString, realm, "Presence")
|
base(connectionString, realm, "Presence")
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace OpenSim.Data.MSSQL
|
||||||
{
|
{
|
||||||
public class MSSQLXInventoryData : IXInventoryData
|
public class MSSQLXInventoryData : IXInventoryData
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(
|
// private static readonly ILog m_log = LogManager.GetLogger(
|
||||||
MethodBase.GetCurrentMethod().DeclaringType);
|
// MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private MSSQLGenericTableHandler<XInventoryFolder> m_Folders;
|
private MSSQLGenericTableHandler<XInventoryFolder> m_Folders;
|
||||||
private MSSQLItemHandler m_Items;
|
private MSSQLItemHandler m_Items;
|
||||||
|
|
|
@ -414,6 +414,46 @@ namespace OpenSim.Data.MySQL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<EstateSettings> LoadEstateSettingsAll()
|
||||||
|
{
|
||||||
|
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
|
||||||
|
|
||||||
|
List<int> allEstateIds = GetEstatesAll();
|
||||||
|
|
||||||
|
foreach (int estateId in allEstateIds)
|
||||||
|
allEstateSettings.Add(LoadEstateSettings(estateId));
|
||||||
|
|
||||||
|
return allEstateSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstatesAll()
|
||||||
|
{
|
||||||
|
List<int> result = new List<int>();
|
||||||
|
|
||||||
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
dbcon.Open();
|
||||||
|
|
||||||
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "select estateID from estate_settings";
|
||||||
|
|
||||||
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
result.Add(Convert.ToInt32(reader["EstateID"]));
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dbcon.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public List<int> GetEstates(string search)
|
public List<int> GetEstates(string search)
|
||||||
{
|
{
|
||||||
List<int> result = new List<int>();
|
List<int> result = new List<int>();
|
||||||
|
@ -444,6 +484,36 @@ namespace OpenSim.Data.MySQL
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstatesByOwner(UUID ownerID)
|
||||||
|
{
|
||||||
|
List<int> result = new List<int>();
|
||||||
|
|
||||||
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
dbcon.Open();
|
||||||
|
|
||||||
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "select estateID from estate_settings where EstateOwner = ?EstateOwner";
|
||||||
|
cmd.Parameters.AddWithValue("?EstateOwner", ownerID);
|
||||||
|
|
||||||
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
result.Add(Convert.ToInt32(reader["EstateID"]));
|
||||||
|
}
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
dbcon.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public bool LinkRegion(UUID regionID, int estateID)
|
public bool LinkRegion(UUID regionID, int estateID)
|
||||||
{
|
{
|
||||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
|
|
@ -39,6 +39,8 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
|
public class MySQLGenericTableHandler<T> : MySqlFramework where T: class, new()
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
protected Dictionary<string, FieldInfo> m_Fields =
|
protected Dictionary<string, FieldInfo> m_Fields =
|
||||||
new Dictionary<string, FieldInfo>();
|
new Dictionary<string, FieldInfo>();
|
||||||
|
|
||||||
|
@ -217,7 +219,6 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
using (MySqlCommand cmd = new MySqlCommand())
|
using (MySqlCommand cmd = new MySqlCommand())
|
||||||
{
|
{
|
||||||
|
|
||||||
string query = "";
|
string query = "";
|
||||||
List<String> names = new List<String>();
|
List<String> names = new List<String>();
|
||||||
List<String> values = new List<String>();
|
List<String> values = new List<String>();
|
||||||
|
@ -226,6 +227,16 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
names.Add(fi.Name);
|
names.Add(fi.Name);
|
||||||
values.Add("?" + fi.Name);
|
values.Add("?" + fi.Name);
|
||||||
|
|
||||||
|
// Temporarily return more information about what field is unexpectedly null for
|
||||||
|
// http://opensimulator.org/mantis/view.php?id=5403. This might be due to a bug in the
|
||||||
|
// InventoryTransferModule or we may be required to substitute a DBNull here.
|
||||||
|
if (fi.GetValue(row) == null)
|
||||||
|
throw new NullReferenceException(
|
||||||
|
string.Format(
|
||||||
|
"[MYSQL GENERIC TABLE HANDLER]: Trying to store field {0} for {1} which is unexpectedly null",
|
||||||
|
fi.Name, row));
|
||||||
|
|
||||||
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
|
cmd.Parameters.AddWithValue(fi.Name, fi.GetValue(row).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,133 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSimulator 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.Reflection;
|
||||||
|
using log4net;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
|
||||||
|
namespace OpenSim.Data.Null
|
||||||
|
{
|
||||||
|
public class NullEstateStore : IEstateDataStore
|
||||||
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
// private string m_connectionString;
|
||||||
|
|
||||||
|
protected virtual Assembly Assembly
|
||||||
|
{
|
||||||
|
get { return GetType().Assembly; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public NullEstateStore()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public NullEstateStore(string connectionString)
|
||||||
|
{
|
||||||
|
Initialise(connectionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialise(string connectionString)
|
||||||
|
{
|
||||||
|
// m_connectionString = connectionString;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string[] FieldList
|
||||||
|
{
|
||||||
|
get { return new string[0]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public EstateSettings LoadEstateSettings(UUID regionID, bool create)
|
||||||
|
{
|
||||||
|
// This fools the initialization caller into thinking an estate was fetched (a check in OpenSimBase).
|
||||||
|
// The estate info is pretty empty so don't try banning anyone.
|
||||||
|
EstateSettings oneEstate = new EstateSettings();
|
||||||
|
oneEstate.EstateID = 1;
|
||||||
|
return oneEstate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StoreEstateSettings(EstateSettings es)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EstateSettings LoadEstateSettings(int estateID)
|
||||||
|
{
|
||||||
|
return new EstateSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<EstateSettings> LoadEstateSettingsAll()
|
||||||
|
{
|
||||||
|
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
|
||||||
|
allEstateSettings.Add(new EstateSettings());
|
||||||
|
return allEstateSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstatesAll()
|
||||||
|
{
|
||||||
|
List<int> result = new List<int>();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstates(string search)
|
||||||
|
{
|
||||||
|
List<int> result = new List<int>();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool LinkRegion(UUID regionID, int estateID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<UUID> GetRegions(int estateID)
|
||||||
|
{
|
||||||
|
List<UUID> result = new List<UUID>();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool DeleteEstate(int estateID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IEstateDataStore Members
|
||||||
|
|
||||||
|
|
||||||
|
public List<int> GetEstatesByOwner(UUID ownerID)
|
||||||
|
{
|
||||||
|
return new List<int>();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,6 +38,15 @@ namespace OpenSim.Data.Null
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class NullSimulationData : ISimulationDataStore
|
public class NullSimulationData : ISimulationDataStore
|
||||||
{
|
{
|
||||||
|
public NullSimulationData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public NullSimulationData(string connectionString)
|
||||||
|
{
|
||||||
|
Initialise(connectionString);
|
||||||
|
}
|
||||||
|
|
||||||
public void Initialise(string dbfile)
|
public void Initialise(string dbfile)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -85,12 +94,20 @@ namespace OpenSim.Data.Null
|
||||||
return new List<SceneObjectGroup>();
|
return new List<SceneObjectGroup>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Dictionary<UUID, double[,]> m_terrains = new Dictionary<UUID, double[,]>();
|
||||||
public void StoreTerrain(double[,] ter, UUID regionID)
|
public void StoreTerrain(double[,] ter, UUID regionID)
|
||||||
{
|
{
|
||||||
|
if (m_terrains.ContainsKey(regionID))
|
||||||
|
m_terrains.Remove(regionID);
|
||||||
|
m_terrains.Add(regionID, ter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double[,] LoadTerrain(UUID regionID)
|
public double[,] LoadTerrain(UUID regionID)
|
||||||
{
|
{
|
||||||
|
if (m_terrains.ContainsKey(regionID))
|
||||||
|
{
|
||||||
|
return m_terrains[regionID];
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -358,6 +358,17 @@ namespace OpenSim.Data.SQLite
|
||||||
return DoLoad(cmd, UUID.Zero, false);
|
return DoLoad(cmd, UUID.Zero, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<EstateSettings> LoadEstateSettingsAll()
|
||||||
|
{
|
||||||
|
List<EstateSettings> estateSettings = new List<EstateSettings>();
|
||||||
|
|
||||||
|
List<int> estateIds = GetEstatesAll();
|
||||||
|
foreach (int estateId in estateIds)
|
||||||
|
estateSettings.Add(LoadEstateSettings(estateId));
|
||||||
|
|
||||||
|
return estateSettings;
|
||||||
|
}
|
||||||
|
|
||||||
public List<int> GetEstates(string search)
|
public List<int> GetEstates(string search)
|
||||||
{
|
{
|
||||||
List<int> result = new List<int>();
|
List<int> result = new List<int>();
|
||||||
|
@ -380,6 +391,49 @@ namespace OpenSim.Data.SQLite
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstatesAll()
|
||||||
|
{
|
||||||
|
List<int> result = new List<int>();
|
||||||
|
|
||||||
|
string sql = "select EstateID from estate_settings";
|
||||||
|
|
||||||
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
|
||||||
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
while (r.Read())
|
||||||
|
{
|
||||||
|
result.Add(Convert.ToInt32(r["EstateID"]));
|
||||||
|
}
|
||||||
|
r.Close();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<int> GetEstatesByOwner(UUID ownerID)
|
||||||
|
{
|
||||||
|
List<int> result = new List<int>();
|
||||||
|
|
||||||
|
string sql = "select EstateID from estate_settings where estate_settings.EstateOwner = :EstateOwner";
|
||||||
|
|
||||||
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
||||||
|
cmd.CommandText = sql;
|
||||||
|
cmd.Parameters.AddWithValue(":EstateOwner", ownerID);
|
||||||
|
|
||||||
|
IDataReader r = cmd.ExecuteReader();
|
||||||
|
|
||||||
|
while (r.Read())
|
||||||
|
{
|
||||||
|
result.Add(Convert.ToInt32(r["EstateID"]));
|
||||||
|
}
|
||||||
|
r.Close();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public bool LinkRegion(UUID regionID, int estateID)
|
public bool LinkRegion(UUID regionID, int estateID)
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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.Reflection;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
|
|
||||||
[assembly : AssemblyTitle("OpenSim.Data.SQLiteLegacy")]
|
|
||||||
[assembly : AssemblyDescription("")]
|
|
||||||
[assembly : AssemblyConfiguration("")]
|
|
||||||
[assembly : AssemblyCompany("http://opensimulator.org")]
|
|
||||||
[assembly : AssemblyProduct("OpenSim.Data.SQLiteLegacy")]
|
|
||||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")]
|
|
||||||
[assembly : AssemblyTrademark("")]
|
|
||||||
[assembly : AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
|
|
||||||
[assembly : ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
|
|
||||||
[assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
|
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
|
||||||
//
|
|
||||||
// Major Version
|
|
||||||
// Minor Version
|
|
||||||
// Build Number
|
|
||||||
// Revision
|
|
||||||
//
|
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
|
||||||
[assembly : AssemblyVersion("0.6.5.*")]
|
|
||||||
[assembly : AssemblyFileVersion("0.6.5.0")]
|
|
|
@ -1,12 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
CREATE TABLE assets(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
Name varchar(255),
|
|
||||||
Description varchar(255),
|
|
||||||
Type integer,
|
|
||||||
InvType integer,
|
|
||||||
Local integer,
|
|
||||||
Temporary integer,
|
|
||||||
Data blob);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,18 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TABLE auth (
|
|
||||||
UUID char(36) NOT NULL,
|
|
||||||
passwordHash char(32) NOT NULL default '',
|
|
||||||
passwordSalt char(32) NOT NULL default '',
|
|
||||||
webLoginKey varchar(255) NOT NULL default '',
|
|
||||||
accountType VARCHAR(32) NOT NULL DEFAULT 'UserAccount',
|
|
||||||
PRIMARY KEY (`UUID`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE tokens (
|
|
||||||
UUID char(36) NOT NULL,
|
|
||||||
token varchar(255) NOT NULL,
|
|
||||||
validity datetime NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,9 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TABLE Avatars (
|
|
||||||
PrincipalID CHAR(36) NOT NULL,
|
|
||||||
Name VARCHAR(32) NOT NULL,
|
|
||||||
Value VARCHAR(255) NOT NULL DEFAULT '',
|
|
||||||
PRIMARY KEY(PrincipalID, Name));
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,10 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TABLE `Friends` (
|
|
||||||
`PrincipalID` CHAR(36) NOT NULL,
|
|
||||||
`Friend` VARCHAR(255) NOT NULL,
|
|
||||||
`Flags` VARCHAR(16) NOT NULL DEFAULT 0,
|
|
||||||
`Offered` VARCHAR(32) NOT NULL DEFAULT 0,
|
|
||||||
PRIMARY KEY(`PrincipalID`, `Friend`));
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,32 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TABLE inventoryfolders(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
name varchar(255),
|
|
||||||
agentID varchar(255),
|
|
||||||
parentID varchar(255),
|
|
||||||
type integer,
|
|
||||||
version integer);
|
|
||||||
|
|
||||||
CREATE TABLE inventoryitems(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
assetID varchar(255),
|
|
||||||
assetType integer,
|
|
||||||
invType integer,
|
|
||||||
parentFolderID varchar(255),
|
|
||||||
avatarID varchar(255),
|
|
||||||
creatorsID varchar(255),
|
|
||||||
inventoryName varchar(255),
|
|
||||||
inventoryDescription varchar(255),
|
|
||||||
inventoryNextPermissions integer,
|
|
||||||
inventoryCurrentPermissions integer,
|
|
||||||
inventoryBasePermissions integer,
|
|
||||||
inventoryEveryOnePermissions integer,
|
|
||||||
salePrice integer default 99,
|
|
||||||
saleType integer default 0,
|
|
||||||
creationDate integer default 2000,
|
|
||||||
groupID varchar(255) default '00000000-0000-0000-0000-000000000000',
|
|
||||||
groupOwned integer default 0,
|
|
||||||
flags integer default 0);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,144 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TABLE prims(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
RegionUUID varchar(255),
|
|
||||||
ParentID integer,
|
|
||||||
CreationDate integer,
|
|
||||||
Name varchar(255),
|
|
||||||
SceneGroupID varchar(255),
|
|
||||||
Text varchar(255),
|
|
||||||
Description varchar(255),
|
|
||||||
SitName varchar(255),
|
|
||||||
TouchName varchar(255),
|
|
||||||
CreatorID varchar(255),
|
|
||||||
OwnerID varchar(255),
|
|
||||||
GroupID varchar(255),
|
|
||||||
LastOwnerID varchar(255),
|
|
||||||
OwnerMask integer,
|
|
||||||
NextOwnerMask integer,
|
|
||||||
GroupMask integer,
|
|
||||||
EveryoneMask integer,
|
|
||||||
BaseMask integer,
|
|
||||||
PositionX float,
|
|
||||||
PositionY float,
|
|
||||||
PositionZ float,
|
|
||||||
GroupPositionX float,
|
|
||||||
GroupPositionY float,
|
|
||||||
GroupPositionZ float,
|
|
||||||
VelocityX float,
|
|
||||||
VelocityY float,
|
|
||||||
VelocityZ float,
|
|
||||||
AngularVelocityX float,
|
|
||||||
AngularVelocityY float,
|
|
||||||
AngularVelocityZ float,
|
|
||||||
AccelerationX float,
|
|
||||||
AccelerationY float,
|
|
||||||
AccelerationZ float,
|
|
||||||
RotationX float,
|
|
||||||
RotationY float,
|
|
||||||
RotationZ float,
|
|
||||||
RotationW float,
|
|
||||||
ObjectFlags integer,
|
|
||||||
SitTargetOffsetX float NOT NULL default 0,
|
|
||||||
SitTargetOffsetY float NOT NULL default 0,
|
|
||||||
SitTargetOffsetZ float NOT NULL default 0,
|
|
||||||
SitTargetOrientW float NOT NULL default 0,
|
|
||||||
SitTargetOrientX float NOT NULL default 0,
|
|
||||||
SitTargetOrientY float NOT NULL default 0,
|
|
||||||
SitTargetOrientZ float NOT NULL default 0);
|
|
||||||
|
|
||||||
CREATE TABLE primshapes(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
Shape integer,
|
|
||||||
ScaleX float,
|
|
||||||
ScaleY float,
|
|
||||||
ScaleZ float,
|
|
||||||
PCode integer,
|
|
||||||
PathBegin integer,
|
|
||||||
PathEnd integer,
|
|
||||||
PathScaleX integer,
|
|
||||||
PathScaleY integer,
|
|
||||||
PathShearX integer,
|
|
||||||
PathShearY integer,
|
|
||||||
PathSkew integer,
|
|
||||||
PathCurve integer,
|
|
||||||
PathRadiusOffset integer,
|
|
||||||
PathRevolutions integer,
|
|
||||||
PathTaperX integer,
|
|
||||||
PathTaperY integer,
|
|
||||||
PathTwist integer,
|
|
||||||
PathTwistBegin integer,
|
|
||||||
ProfileBegin integer,
|
|
||||||
ProfileEnd integer,
|
|
||||||
ProfileCurve integer,
|
|
||||||
ProfileHollow integer,
|
|
||||||
Texture blob,
|
|
||||||
ExtraParams blob,
|
|
||||||
State Integer NOT NULL default 0);
|
|
||||||
|
|
||||||
CREATE TABLE primitems(
|
|
||||||
itemID varchar(255) primary key,
|
|
||||||
primID varchar(255),
|
|
||||||
assetID varchar(255),
|
|
||||||
parentFolderID varchar(255),
|
|
||||||
invType integer,
|
|
||||||
assetType integer,
|
|
||||||
name varchar(255),
|
|
||||||
description varchar(255),
|
|
||||||
creationDate integer,
|
|
||||||
creatorID varchar(255),
|
|
||||||
ownerID varchar(255),
|
|
||||||
lastOwnerID varchar(255),
|
|
||||||
groupID varchar(255),
|
|
||||||
nextPermissions string,
|
|
||||||
currentPermissions string,
|
|
||||||
basePermissions string,
|
|
||||||
everyonePermissions string,
|
|
||||||
groupPermissions string);
|
|
||||||
|
|
||||||
CREATE TABLE terrain(
|
|
||||||
RegionUUID varchar(255),
|
|
||||||
Revision integer,
|
|
||||||
Heightfield blob);
|
|
||||||
|
|
||||||
CREATE TABLE land(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
RegionUUID varchar(255),
|
|
||||||
LocalLandID string,
|
|
||||||
Bitmap blob,
|
|
||||||
Name varchar(255),
|
|
||||||
Desc varchar(255),
|
|
||||||
OwnerUUID varchar(255),
|
|
||||||
IsGroupOwned string,
|
|
||||||
Area integer,
|
|
||||||
AuctionID integer,
|
|
||||||
Category integer,
|
|
||||||
ClaimDate integer,
|
|
||||||
ClaimPrice integer,
|
|
||||||
GroupUUID varchar(255),
|
|
||||||
SalePrice integer,
|
|
||||||
LandStatus integer,
|
|
||||||
LandFlags string,
|
|
||||||
LandingType string,
|
|
||||||
MediaAutoScale string,
|
|
||||||
MediaTextureUUID varchar(255),
|
|
||||||
MediaURL varchar(255),
|
|
||||||
MusicURL varchar(255),
|
|
||||||
PassHours float,
|
|
||||||
PassPrice string,
|
|
||||||
SnapshotUUID varchar(255),
|
|
||||||
UserLocationX float,
|
|
||||||
UserLocationY float,
|
|
||||||
UserLocationZ float,
|
|
||||||
UserLookAtX float,
|
|
||||||
UserLookAtY float,
|
|
||||||
UserLookAtZ float,
|
|
||||||
AuthbuyerID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000');
|
|
||||||
|
|
||||||
CREATE TABLE landaccesslist(
|
|
||||||
LandUUID varchar(255),
|
|
||||||
AccessUUID varchar(255),
|
|
||||||
Flags string);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,17 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
-- useraccounts table
|
|
||||||
CREATE TABLE UserAccounts (
|
|
||||||
PrincipalID CHAR(36) primary key,
|
|
||||||
ScopeID CHAR(36) NOT NULL,
|
|
||||||
FirstName VARCHAR(64) NOT NULL,
|
|
||||||
LastName VARCHAR(64) NOT NULL,
|
|
||||||
Email VARCHAR(64),
|
|
||||||
ServiceURLs TEXT,
|
|
||||||
Created INT(11),
|
|
||||||
UserLevel integer NOT NULL DEFAULT 0,
|
|
||||||
UserFlags integer NOT NULL DEFAULT 0,
|
|
||||||
UserTitle varchar(64) NOT NULL DEFAULT ''
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,39 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
-- users table
|
|
||||||
CREATE TABLE users(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
username varchar(255),
|
|
||||||
surname varchar(255),
|
|
||||||
passwordHash varchar(255),
|
|
||||||
passwordSalt varchar(255),
|
|
||||||
homeRegionX integer,
|
|
||||||
homeRegionY integer,
|
|
||||||
homeLocationX float,
|
|
||||||
homeLocationY float,
|
|
||||||
homeLocationZ float,
|
|
||||||
homeLookAtX float,
|
|
||||||
homeLookAtY float,
|
|
||||||
homeLookAtZ float,
|
|
||||||
created integer,
|
|
||||||
lastLogin integer,
|
|
||||||
rootInventoryFolderID varchar(255),
|
|
||||||
userInventoryURI varchar(255),
|
|
||||||
userAssetURI varchar(255),
|
|
||||||
profileCanDoMask integer,
|
|
||||||
profileWantDoMask integer,
|
|
||||||
profileAboutText varchar(255),
|
|
||||||
profileFirstText varchar(255),
|
|
||||||
profileImage varchar(255),
|
|
||||||
profileFirstImage varchar(255),
|
|
||||||
webLoginKey text default '00000000-0000-0000-0000-000000000000');
|
|
||||||
-- friends table
|
|
||||||
CREATE TABLE userfriends(
|
|
||||||
ownerID varchar(255),
|
|
||||||
friendID varchar(255),
|
|
||||||
friendPerms integer,
|
|
||||||
ownerPerms integer,
|
|
||||||
datetimestamp integer);
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE assets_backup(UUID,Name,Description,Type,Local,Temporary,Data);
|
|
||||||
INSERT INTO assets_backup SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets;
|
|
||||||
DROP TABLE assets;
|
|
||||||
CREATE TABLE assets(UUID,Name,Description,Type,Local,Temporary,Data);
|
|
||||||
INSERT INTO assets SELECT UUID,Name,Description,Type,Local,Temporary,Data FROM assets_backup;
|
|
||||||
DROP TABLE assets_backup;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
INSERT INTO auth (UUID, passwordHash, passwordSalt, webLoginKey) SELECT `UUID` AS UUID, `passwordHash` AS passwordHash, `passwordSalt` AS passwordSalt, `webLoginKey` AS webLoginKey FROM users;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
INSERT INTO `Friends` SELECT `ownerID`, `friendID`, `friendPerms`, 0 FROM `userfriends`;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,8 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
create index inventoryfolders_agentid on inventoryfolders(agentid);
|
|
||||||
create index inventoryfolders_parentid on inventoryfolders(parentid);
|
|
||||||
create index inventoryitems_parentfolderid on inventoryitems(parentfolderid);
|
|
||||||
create index inventoryitems_avatarid on inventoryitems(avatarid);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,10 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TABLE regionban(
|
|
||||||
regionUUID varchar (255),
|
|
||||||
bannedUUID varchar (255),
|
|
||||||
bannedIp varchar (255),
|
|
||||||
bannedIpHostMask varchar (255)
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
INSERT INTO UserAccounts (PrincipalID, ScopeID, FirstName, LastName, Email, ServiceURLs, Created) SELECT `UUID` AS PrincipalID, '00000000-0000-0000-0000-000000000000' AS ScopeID, username AS FirstName, surname AS LastName, '' as Email, '' AS ServiceURLs, created as Created FROM users;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE users add homeRegionID varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1 +0,0 @@
|
||||||
DELETE FROM assets WHERE UUID = 'dc4b9f0bd00845c696a401dd947ac621'
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
alter table inventoryitems add column inventoryGroupPermissions integer unsigned not null default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE primitems add flags integer not null default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,6 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE users add userFlags integer NOT NULL default 0;
|
|
||||||
ALTER TABLE users add godLevel integer NOT NULL default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,7 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
update assets
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,36 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
update inventoryitems
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
update inventoryitems
|
|
||||||
set assetID = substr(assetID, 1, 8) || "-" || substr(assetID, 9, 4) || "-" || substr(assetID, 13, 4) || "-" || substr(assetID, 17, 4) || "-" || substr(assetID, 21, 12)
|
|
||||||
where assetID not like '%-%';
|
|
||||||
|
|
||||||
update inventoryitems
|
|
||||||
set parentFolderID = substr(parentFolderID, 1, 8) || "-" || substr(parentFolderID, 9, 4) || "-" || substr(parentFolderID, 13, 4) || "-" || substr(parentFolderID, 17, 4) || "-" || substr(parentFolderID, 21, 12)
|
|
||||||
where parentFolderID not like '%-%';
|
|
||||||
|
|
||||||
update inventoryitems
|
|
||||||
set avatarID = substr(avatarID, 1, 8) || "-" || substr(avatarID, 9, 4) || "-" || substr(avatarID, 13, 4) || "-" || substr(avatarID, 17, 4) || "-" || substr(avatarID, 21, 12)
|
|
||||||
where avatarID not like '%-%';
|
|
||||||
|
|
||||||
update inventoryitems
|
|
||||||
set creatorsID = substr(creatorsID, 1, 8) || "-" || substr(creatorsID, 9, 4) || "-" || substr(creatorsID, 13, 4) || "-" || substr(creatorsID, 17, 4) || "-" || substr(creatorsID, 21, 12)
|
|
||||||
where creatorsID not like '%-%';
|
|
||||||
|
|
||||||
|
|
||||||
update inventoryfolders
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
update inventoryfolders
|
|
||||||
set agentID = substr(agentID, 1, 8) || "-" || substr(agentID, 9, 4) || "-" || substr(agentID, 13, 4) || "-" || substr(agentID, 17, 4) || "-" || substr(agentID, 21, 12)
|
|
||||||
where agentID not like '%-%';
|
|
||||||
|
|
||||||
update inventoryfolders
|
|
||||||
set parentID = substr(parentID, 1, 8) || "-" || substr(parentID, 9, 4) || "-" || substr(parentID, 13, 4) || "-" || substr(parentID, 17, 4) || "-" || substr(parentID, 21, 12)
|
|
||||||
where parentID not like '%-%';
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,38 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
create table regionsettings (
|
|
||||||
regionUUID char(36) not null,
|
|
||||||
block_terraform integer not null,
|
|
||||||
block_fly integer not null,
|
|
||||||
allow_damage integer not null,
|
|
||||||
restrict_pushing integer not null,
|
|
||||||
allow_land_resell integer not null,
|
|
||||||
allow_land_join_divide integer not null,
|
|
||||||
block_show_in_search integer not null,
|
|
||||||
agent_limit integer not null,
|
|
||||||
object_bonus float not null,
|
|
||||||
maturity integer not null,
|
|
||||||
disable_scripts integer not null,
|
|
||||||
disable_collisions integer not null,
|
|
||||||
disable_physics integer 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 integer not null,
|
|
||||||
fixed_sun integer not null,
|
|
||||||
sun_position float not null,
|
|
||||||
covenant char(36));
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,6 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE users add customType varchar(32) not null default '';
|
|
||||||
ALTER TABLE users add partner char(36) not null default '00000000-0000-0000-0000-000000000000';
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
delete from regionsettings;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
CREATE TABLE `avatarattachments` (`UUID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `attachpoint` int(11) NOT NULL DEFAULT 0, `item` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000', `asset` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000');
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,102 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
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 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);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,20 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
-- usersagents table
|
|
||||||
CREATE TABLE IF NOT EXISTS useragents(
|
|
||||||
UUID varchar(255) primary key,
|
|
||||||
agentIP varchar(255),
|
|
||||||
agentPort integer,
|
|
||||||
agentOnline boolean,
|
|
||||||
sessionID varchar(255),
|
|
||||||
secureSessionID varchar(255),
|
|
||||||
regionID varchar(255),
|
|
||||||
loginTime integer,
|
|
||||||
logoutTime integer,
|
|
||||||
currentRegion varchar(255),
|
|
||||||
currentHandle varchar(255),
|
|
||||||
currentPosX float,
|
|
||||||
currentPosY float,
|
|
||||||
currentPosZ float);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,8 +0,0 @@
|
||||||
begin;
|
|
||||||
|
|
||||||
alter table estate_settings add column AbuseEmail varchar(255) not null default '';
|
|
||||||
|
|
||||||
alter table estate_settings add column EstateOwner varchar(36) not null default '';
|
|
||||||
|
|
||||||
commit;
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
ALTER TABLE useragents add currentLookAtX float not null default 128;
|
|
||||||
ALTER TABLE useragents add currentLookAtY float not null default 128;
|
|
||||||
ALTER TABLE useragents add currentLookAtZ float not null default 70;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,6 +0,0 @@
|
||||||
begin;
|
|
||||||
|
|
||||||
alter table estate_settings add column DenyMinors tinyint not null default 0;
|
|
||||||
|
|
||||||
commit;
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
ALTER TABLE users add email varchar(250);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,8 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE prims ADD COLUMN ColorR integer not null default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN ColorG integer not null default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN ColorB integer not null default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN ColorA integer not null default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,11 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
update users
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
update useragents
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE prims ADD COLUMN ClickAction INTEGER NOT NULL default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,37 +0,0 @@
|
||||||
BEGIN TRANSACTION;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS avatarappearance(
|
|
||||||
Owner varchar(36) NOT NULL primary key,
|
|
||||||
BodyItem varchar(36) DEFAULT NULL,
|
|
||||||
BodyAsset varchar(36) DEFAULT NULL,
|
|
||||||
SkinItem varchar(36) DEFAULT NULL,
|
|
||||||
SkinAsset varchar(36) DEFAULT NULL,
|
|
||||||
HairItem varchar(36) DEFAULT NULL,
|
|
||||||
HairAsset varchar(36) DEFAULT NULL,
|
|
||||||
EyesItem varchar(36) DEFAULT NULL,
|
|
||||||
EyesAsset varchar(36) DEFAULT NULL,
|
|
||||||
ShirtItem varchar(36) DEFAULT NULL,
|
|
||||||
ShirtAsset varchar(36) DEFAULT NULL,
|
|
||||||
PantsItem varchar(36) DEFAULT NULL,
|
|
||||||
PantsAsset varchar(36) DEFAULT NULL,
|
|
||||||
ShoesItem varchar(36) DEFAULT NULL,
|
|
||||||
ShoesAsset varchar(36) DEFAULT NULL,
|
|
||||||
SocksItem varchar(36) DEFAULT NULL,
|
|
||||||
SocksAsset varchar(36) DEFAULT NULL,
|
|
||||||
JacketItem varchar(36) DEFAULT NULL,
|
|
||||||
JacketAsset varchar(36) DEFAULT NULL,
|
|
||||||
GlovesItem varchar(36) DEFAULT NULL,
|
|
||||||
GlovesAsset varchar(36) DEFAULT NULL,
|
|
||||||
UnderShirtItem varchar(36) DEFAULT NULL,
|
|
||||||
UnderShirtAsset varchar(36) DEFAULT NULL,
|
|
||||||
UnderPantsItem varchar(36) DEFAULT NULL,
|
|
||||||
UnderPantsAsset varchar(36) DEFAULT NULL,
|
|
||||||
SkirtItem varchar(36) DEFAULT NULL,
|
|
||||||
SkirtAsset varchar(36) DEFAULT NULL,
|
|
||||||
Texture blob,
|
|
||||||
VisualParams blob,
|
|
||||||
Serial int DEFAULT NULL,
|
|
||||||
AvatarHeight float DEFAULT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,28 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE prims ADD COLUMN PayPrice INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN PayButton1 INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN PayButton2 INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN PayButton3 INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN PayButton4 INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN LoopedSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
|
||||||
ALTER TABLE prims ADD COLUMN LoopedSoundGain float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN TextureAnimation string;
|
|
||||||
ALTER TABLE prims ADD COLUMN ParticleSystem string;
|
|
||||||
ALTER TABLE prims ADD COLUMN OmegaX float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN OmegaY float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN OmegaZ float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN CameraEyeOffsetX float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN CameraEyeOffsetY float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN CameraEyeOffsetZ float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN CameraAtOffsetX float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN CameraAtOffsetY float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN CameraAtOffsetZ float NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN ForceMouselook string NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN ScriptAccessPin INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN AllowedDrop INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN DieAtEdge string NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN SalePrice INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE prims ADD COLUMN SaleType string NOT NULL default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE prims ADD COLUMN Material INTEGER NOT NULL default 3;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,6 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE land ADD COLUMN OtherCleanTime INTEGER NOT NULL default 0;
|
|
||||||
ALTER TABLE land ADD COLUMN Dwell INTEGER NOT NULL default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,8 +0,0 @@
|
||||||
begin;
|
|
||||||
|
|
||||||
ALTER TABLE regionsettings ADD COLUMN sunvectorx double NOT NULL default 0;
|
|
||||||
ALTER TABLE regionsettings ADD COLUMN sunvectory double NOT NULL default 0;
|
|
||||||
ALTER TABLE regionsettings ADD COLUMN sunvectorz double NOT NULL default 0;
|
|
||||||
|
|
||||||
commit;
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE prims ADD COLUMN CollisionSound varchar(36) NOT NULL default '00000000-0000-0000-0000-000000000000';
|
|
||||||
ALTER TABLE prims ADD COLUMN CollisionSoundVolume float NOT NULL default 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,5 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
ALTER TABLE prims ADD COLUMN VolumeDetect INTEGER NOT NULL DEFAULT 0;
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,8 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
CREATE TEMPORARY TABLE prims_backup(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
|
|
||||||
INSERT INTO prims_backup SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims;
|
|
||||||
DROP TABLE prims;
|
|
||||||
CREATE TABLE prims(UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect);
|
|
||||||
INSERT INTO prims SELECT UUID,RegionUUID,CreationDate,Name,SceneGroupID,Text,Description,SitName,TouchName,CreatorID,OwnerID,GroupID,LastOwnerID,OwnerMask,NextOwnerMask,GroupMask,EveryoneMask,BaseMask,PositionX,PositionY,PositionZ,GroupPositionX,GroupPositionY,GroupPositionZ,VelocityX,VelocityY,VelocityZ,AngularVelocityX,AngularVelocityY,AngularVelocityZ,AccelerationX,AccelerationY,AccelerationZ,RotationX,RotationY,RotationZ,RotationW,ObjectFlags,SitTargetOffsetX,SitTargetOffsetY,SitTargetOffsetZ,SitTargetOrientW,SitTargetOrientX,SitTargetOrientY,SitTargetOrientZ,ColorR,ColorG,ColorB,ColorA,ClickAction,PayPrice,PayButton1,PayButton2,PayButton3,PayButton4,LoopedSound,LoopedSoundGain,TextureAnimation,ParticleSystem,OmegaX,OmegaY,OmegaZ,CameraEyeOffsetX,CameraEyeOffsetY,CameraEyeOffsetZ,CameraAtOffsetX,CameraAtOffsetY,CameraAtOffsetZ,ForceMouselook,ScriptAccessPin,AllowedDrop,DieAtEdge,SalePrice,SaleType,Material,CollisionSound,CollisionSoundVolume,VolumeDetect FROM prims_backup;
|
|
||||||
DROP TABLE prims_backup;
|
|
||||||
COMMIT;
|
|
|
@ -1,79 +0,0 @@
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
update terrain
|
|
||||||
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
|
|
||||||
where RegionUUID not like '%-%';
|
|
||||||
|
|
||||||
|
|
||||||
update landaccesslist
|
|
||||||
set LandUUID = substr(LandUUID, 1, 8) || "-" || substr(LandUUID, 9, 4) || "-" || substr(LandUUID, 13, 4) || "-" || substr(LandUUID, 17, 4) || "-" || substr(LandUUID, 21, 12)
|
|
||||||
where LandUUID not like '%-%';
|
|
||||||
|
|
||||||
update landaccesslist
|
|
||||||
set AccessUUID = substr(AccessUUID, 1, 8) || "-" || substr(AccessUUID, 9, 4) || "-" || substr(AccessUUID, 13, 4) || "-" || substr(AccessUUID, 17, 4) || "-" || substr(AccessUUID, 21, 12)
|
|
||||||
where AccessUUID not like '%-%';
|
|
||||||
|
|
||||||
|
|
||||||
update prims
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
update prims
|
|
||||||
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
|
|
||||||
where RegionUUID not like '%-%';
|
|
||||||
|
|
||||||
update prims
|
|
||||||
set SceneGroupID = substr(SceneGroupID, 1, 8) || "-" || substr(SceneGroupID, 9, 4) || "-" || substr(SceneGroupID, 13, 4) || "-" || substr(SceneGroupID, 17, 4) || "-" || substr(SceneGroupID, 21, 12)
|
|
||||||
where SceneGroupID not like '%-%';
|
|
||||||
|
|
||||||
update prims
|
|
||||||
set CreatorID = substr(CreatorID, 1, 8) || "-" || substr(CreatorID, 9, 4) || "-" || substr(CreatorID, 13, 4) || "-" || substr(CreatorID, 17, 4) || "-" || substr(CreatorID, 21, 12)
|
|
||||||
where CreatorID not like '%-%';
|
|
||||||
|
|
||||||
update prims
|
|
||||||
set OwnerID = substr(OwnerID, 1, 8) || "-" || substr(OwnerID, 9, 4) || "-" || substr(OwnerID, 13, 4) || "-" || substr(OwnerID, 17, 4) || "-" || substr(OwnerID, 21, 12)
|
|
||||||
where OwnerID not like '%-%';
|
|
||||||
|
|
||||||
update prims
|
|
||||||
set GroupID = substr(GroupID, 1, 8) || "-" || substr(GroupID, 9, 4) || "-" || substr(GroupID, 13, 4) || "-" || substr(GroupID, 17, 4) || "-" || substr(GroupID, 21, 12)
|
|
||||||
where GroupID not like '%-%';
|
|
||||||
|
|
||||||
update prims
|
|
||||||
set LastOwnerID = substr(LastOwnerID, 1, 8) || "-" || substr(LastOwnerID, 9, 4) || "-" || substr(LastOwnerID, 13, 4) || "-" || substr(LastOwnerID, 17, 4) || "-" || substr(LastOwnerID, 21, 12)
|
|
||||||
where LastOwnerID not like '%-%';
|
|
||||||
|
|
||||||
|
|
||||||
update primshapes
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
|
|
||||||
update land
|
|
||||||
set UUID = substr(UUID, 1, 8) || "-" || substr(UUID, 9, 4) || "-" || substr(UUID, 13, 4) || "-" || substr(UUID, 17, 4) || "-" || substr(UUID, 21, 12)
|
|
||||||
where UUID not like '%-%';
|
|
||||||
|
|
||||||
update land
|
|
||||||
set RegionUUID = substr(RegionUUID, 1, 8) || "-" || substr(RegionUUID, 9, 4) || "-" || substr(RegionUUID, 13, 4) || "-" || substr(RegionUUID, 17, 4) || "-" || substr(RegionUUID, 21, 12)
|
|
||||||
where RegionUUID not like '%-%';
|
|
||||||
|
|
||||||
update land
|
|
||||||
set OwnerUUID = substr(OwnerUUID, 1, 8) || "-" || substr(OwnerUUID, 9, 4) || "-" || substr(OwnerUUID, 13, 4) || "-" || substr(OwnerUUID, 17, 4) || "-" || substr(OwnerUUID, 21, 12)
|
|
||||||
where OwnerUUID not like '%-%';
|
|
||||||
|
|
||||||
update land
|
|
||||||
set GroupUUID = substr(GroupUUID, 1, 8) || "-" || substr(GroupUUID, 9, 4) || "-" || substr(GroupUUID, 13, 4) || "-" || substr(GroupUUID, 17, 4) || "-" || substr(GroupUUID, 21, 12)
|
|
||||||
where GroupUUID not like '%-%';
|
|
||||||
|
|
||||||
update land
|
|
||||||
set MediaTextureUUID = substr(MediaTextureUUID, 1, 8) || "-" || substr(MediaTextureUUID, 9, 4) || "-" || substr(MediaTextureUUID, 13, 4) || "-" || substr(MediaTextureUUID, 17, 4) || "-" || substr(MediaTextureUUID, 21, 12)
|
|
||||||
where MediaTextureUUID not like '%-%';
|
|
||||||
|
|
||||||
update land
|
|
||||||
set SnapshotUUID = substr(SnapshotUUID, 1, 8) || "-" || substr(SnapshotUUID, 9, 4) || "-" || substr(SnapshotUUID, 13, 4) || "-" || substr(SnapshotUUID, 17, 4) || "-" || substr(SnapshotUUID, 21, 12)
|
|
||||||
where SnapshotUUID not like '%-%';
|
|
||||||
|
|
||||||
update land
|
|
||||||
set AuthbuyerID = substr(AuthbuyerID, 1, 8) || "-" || substr(AuthbuyerID, 9, 4) || "-" || substr(AuthbuyerID, 13, 4) || "-" || substr(AuthbuyerID, 17, 4) || "-" || substr(AuthbuyerID, 21, 12)
|
|
||||||
where AuthbuyerID not like '%-%';
|
|
||||||
|
|
||||||
COMMIT;
|
|
|
@ -1,20 +0,0 @@
|
||||||
<Addin id="OpenSim.Data.SQLite" version="0.1">
|
|
||||||
<Runtime>
|
|
||||||
<Import assembly="OpenSim.Data.SQLite.dll"/>
|
|
||||||
</Runtime>
|
|
||||||
<Dependencies>
|
|
||||||
<Addin id="OpenSim.Data" version="0.5" />
|
|
||||||
</Dependencies>
|
|
||||||
<Extension path = "/OpenSim/GridData">
|
|
||||||
<Plugin id="SQLiteGridData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteGridData" />
|
|
||||||
</Extension>
|
|
||||||
<Extension path = "/OpenSim/AssetData">
|
|
||||||
<Plugin id="SQLiteAssetData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteAssetData" />
|
|
||||||
</Extension>
|
|
||||||
<Extension path = "/OpenSim/InventoryData">
|
|
||||||
<Plugin id="SQLiteInventoryData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteInventoryStore" />
|
|
||||||
</Extension>
|
|
||||||
<Extension path = "/OpenSim/UserData">
|
|
||||||
<Plugin id="SQLiteUserData" provider="OpenSim.Data.SQLite.dll" type="OpenSim.Data.SQLite.SQLiteUserData" />
|
|
||||||
</Extension>
|
|
||||||
</Addin>
|
|
|
@ -1,347 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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.Data;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using log4net;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An asset storage interface for the SQLite database system
|
|
||||||
/// </summary>
|
|
||||||
public class SQLiteAssetData : AssetDataBase
|
|
||||||
{
|
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
|
|
||||||
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count";
|
|
||||||
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
|
|
||||||
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)";
|
|
||||||
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
|
|
||||||
private const string assetSelect = "select * from assets";
|
|
||||||
|
|
||||||
private SqliteConnection m_conn;
|
|
||||||
|
|
||||||
override public void Dispose()
|
|
||||||
{
|
|
||||||
if (m_conn != null)
|
|
||||||
{
|
|
||||||
m_conn.Close();
|
|
||||||
m_conn = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// <list type="bullet">
|
|
||||||
/// <item>Initialises AssetData interface</item>
|
|
||||||
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
|
|
||||||
/// <item>use default URI if connect string is empty.</item>
|
|
||||||
/// </list>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dbconnect">connect string</param>
|
|
||||||
override public void Initialise(string dbconnect)
|
|
||||||
{
|
|
||||||
if (dbconnect == string.Empty)
|
|
||||||
{
|
|
||||||
dbconnect = "URI=file:Asset.db,version=3";
|
|
||||||
}
|
|
||||||
m_conn = new SqliteConnection(dbconnect);
|
|
||||||
m_conn.Open();
|
|
||||||
|
|
||||||
Assembly assem = GetType().Assembly;
|
|
||||||
Migration m = new Migration(m_conn, assem, "AssetStore");
|
|
||||||
m.Update();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fetch Asset
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uuid">UUID of ... ?</param>
|
|
||||||
/// <returns>Asset base</returns>
|
|
||||||
override public AssetBase GetAsset(UUID uuid)
|
|
||||||
{
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
AssetBase asset = buildAsset(reader);
|
|
||||||
reader.Close();
|
|
||||||
return asset;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reader.Close();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create an asset
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="asset">Asset Base</param>
|
|
||||||
override public void StoreAsset(AssetBase asset)
|
|
||||||
{
|
|
||||||
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
|
|
||||||
if (ExistsAsset(asset.FullID))
|
|
||||||
{
|
|
||||||
//LogAssetLoad(asset);
|
|
||||||
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// /// <summary>
|
|
||||||
// /// Some... logging functionnality
|
|
||||||
// /// </summary>
|
|
||||||
// /// <param name="asset"></param>
|
|
||||||
// private static void LogAssetLoad(AssetBase asset)
|
|
||||||
// {
|
|
||||||
// string temporary = asset.Temporary ? "Temporary" : "Stored";
|
|
||||||
// string local = asset.Local ? "Local" : "Remote";
|
|
||||||
//
|
|
||||||
// int assetLength = (asset.Data != null) ? asset.Data.Length : 0;
|
|
||||||
//
|
|
||||||
// m_log.Debug("[ASSET DB]: " +
|
|
||||||
// string.Format("Loaded {5} {4} Asset: [{0}][{3}] \"{1}\":{2} ({6} bytes)",
|
|
||||||
// asset.FullID, asset.Name, asset.Description, asset.Type,
|
|
||||||
// temporary, local, assetLength));
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Check if an asset exist in database
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uuid">The asset UUID</param>
|
|
||||||
/// <returns>True if exist, or false.</returns>
|
|
||||||
override public bool ExistsAsset(UUID uuid)
|
|
||||||
{
|
|
||||||
lock (this) {
|
|
||||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
if (reader.Read())
|
|
||||||
{
|
|
||||||
reader.Close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reader.Close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delete an asset from database
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uuid"></param>
|
|
||||||
public void DeleteAsset(UUID uuid)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", uuid.ToString()));
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="row"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static AssetBase buildAsset(IDataReader row)
|
|
||||||
{
|
|
||||||
// TODO: this doesn't work yet because something more
|
|
||||||
// interesting has to be done to actually get these values
|
|
||||||
// back out. Not enough time to figure it out yet.
|
|
||||||
AssetBase asset = new AssetBase(
|
|
||||||
new UUID((String)row["UUID"]),
|
|
||||||
(String)row["Name"],
|
|
||||||
Convert.ToSByte(row["Type"]),
|
|
||||||
UUID.Zero.ToString()
|
|
||||||
);
|
|
||||||
|
|
||||||
asset.Description = (String) row["Description"];
|
|
||||||
asset.Local = Convert.ToBoolean(row["Local"]);
|
|
||||||
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
|
||||||
asset.Data = (byte[]) row["Data"];
|
|
||||||
return asset;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static AssetMetadata buildAssetMetadata(IDataReader row)
|
|
||||||
{
|
|
||||||
AssetMetadata metadata = new AssetMetadata();
|
|
||||||
|
|
||||||
metadata.FullID = new UUID((string) row["UUID"]);
|
|
||||||
metadata.Name = (string) row["Name"];
|
|
||||||
metadata.Description = (string) row["Description"];
|
|
||||||
metadata.Type = Convert.ToSByte(row["Type"]);
|
|
||||||
metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct.
|
|
||||||
|
|
||||||
// Current SHA1s are not stored/computed.
|
|
||||||
metadata.SHA1 = new byte[] {};
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of AssetMetadata objects. The list is a subset of
|
|
||||||
/// the entire data set offset by <paramref name="start" /> containing
|
|
||||||
/// <paramref name="count" /> elements.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="start">The number of results to discard from the total data set.</param>
|
|
||||||
/// <param name="count">The number of rows the returned list should contain.</param>
|
|
||||||
/// <returns>A list of AssetMetadata objects.</returns>
|
|
||||||
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
|
|
||||||
{
|
|
||||||
List<AssetMetadata> retList = new List<AssetMetadata>(count);
|
|
||||||
|
|
||||||
lock (this)
|
|
||||||
{
|
|
||||||
using (SqliteCommand cmd = new SqliteCommand(SelectAssetMetadataSQL, m_conn))
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":start", start));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":count", count));
|
|
||||||
|
|
||||||
using (IDataReader reader = cmd.ExecuteReader())
|
|
||||||
{
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
AssetMetadata metadata = buildAssetMetadata(reader);
|
|
||||||
retList.Add(metadata);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* Database Binding functions
|
|
||||||
*
|
|
||||||
* These will be db specific due to typing, and minor differences
|
|
||||||
* in databases.
|
|
||||||
*
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
#region IPlugin interface
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
override public string Version
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Module module = GetType().Module;
|
|
||||||
// string dllName = module.Assembly.ManifestModule.Name;
|
|
||||||
Version dllVersion = module.Assembly.GetName().Version;
|
|
||||||
|
|
||||||
return
|
|
||||||
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
|
||||||
dllVersion.Revision);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initialise the AssetData interface using default URI
|
|
||||||
/// </summary>
|
|
||||||
override public void Initialise()
|
|
||||||
{
|
|
||||||
Initialise("URI=file:Asset.db,version=3");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Name of this DB provider
|
|
||||||
/// </summary>
|
|
||||||
override public string Name
|
|
||||||
{
|
|
||||||
get { return "SQLite Asset storage engine"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Delete(string id)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,266 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Reflection;
|
|
||||||
using log4net;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
public class SQLiteAuthenticationData : SQLiteFramework, IAuthenticationData
|
|
||||||
{
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private string m_Realm;
|
|
||||||
private List<string> m_ColumnNames;
|
|
||||||
private int m_LastExpire;
|
|
||||||
private string m_connectionString;
|
|
||||||
|
|
||||||
protected static SqliteConnection m_Connection;
|
|
||||||
private static bool m_initialized = false;
|
|
||||||
|
|
||||||
public SQLiteAuthenticationData(string connectionString, string realm)
|
|
||||||
: base(connectionString)
|
|
||||||
{
|
|
||||||
m_Realm = realm;
|
|
||||||
m_connectionString = connectionString;
|
|
||||||
|
|
||||||
if (!m_initialized)
|
|
||||||
{
|
|
||||||
m_Connection = new SqliteConnection(connectionString);
|
|
||||||
m_Connection.Open();
|
|
||||||
|
|
||||||
using (SqliteConnection dbcon = (SqliteConnection)((ICloneable)m_Connection).Clone())
|
|
||||||
{
|
|
||||||
dbcon.Open();
|
|
||||||
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
|
|
||||||
m.Update();
|
|
||||||
dbcon.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_initialized = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationData Get(UUID principalID)
|
|
||||||
{
|
|
||||||
AuthenticationData ret = new AuthenticationData();
|
|
||||||
ret.Data = new Dictionary<string, object>();
|
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand("select * from `" + m_Realm + "` where UUID = :PrincipalID");
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
|
||||||
|
|
||||||
IDataReader result = ExecuteReader(cmd, m_Connection);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (result.Read())
|
|
||||||
{
|
|
||||||
ret.PrincipalID = principalID;
|
|
||||||
|
|
||||||
if (m_ColumnNames == null)
|
|
||||||
{
|
|
||||||
m_ColumnNames = new List<string>();
|
|
||||||
|
|
||||||
DataTable schemaTable = result.GetSchemaTable();
|
|
||||||
foreach (DataRow row in schemaTable.Rows)
|
|
||||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (string s in m_ColumnNames)
|
|
||||||
{
|
|
||||||
if (s == "UUID")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ret.Data[s] = result[s].ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
CloseCommand(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Store(AuthenticationData data)
|
|
||||||
{
|
|
||||||
if (data.Data.ContainsKey("UUID"))
|
|
||||||
data.Data.Remove("UUID");
|
|
||||||
|
|
||||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
|
||||||
string[] values = new string[data.Data.Count];
|
|
||||||
int i = 0;
|
|
||||||
foreach (object o in data.Data.Values)
|
|
||||||
values[i++] = o.ToString();
|
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
if (Get(data.PrincipalID) != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
string update = "update `" + m_Realm + "` set ";
|
|
||||||
bool first = true;
|
|
||||||
foreach (string field in fields)
|
|
||||||
{
|
|
||||||
if (!first)
|
|
||||||
update += ", ";
|
|
||||||
update += "`" + field + "` = :" + field;
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
|
||||||
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
update += " where UUID = :UUID";
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
|
||||||
|
|
||||||
cmd.CommandText = update;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
|
||||||
{
|
|
||||||
CloseCommand(cmd);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
m_log.Error("[SQLITE]: Exception storing authentication data", e);
|
|
||||||
CloseCommand(cmd);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
|
||||||
String.Join("`, `", fields) +
|
|
||||||
"`) values (:UUID, :" + String.Join(", :", fields) + ")";
|
|
||||||
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":UUID", data.PrincipalID.ToString()));
|
|
||||||
foreach (string field in fields)
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + field, data.Data[field]));
|
|
||||||
|
|
||||||
cmd.CommandText = insert;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) < 1)
|
|
||||||
{
|
|
||||||
CloseCommand(cmd);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e.ToString());
|
|
||||||
CloseCommand(cmd);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseCommand(cmd);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SetDataItem(UUID principalID, string item, string value)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand("update `" + m_Realm +
|
|
||||||
"` set `" + item + "` = " + value + " where UUID = '" + principalID.ToString() + "'");
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool SetToken(UUID principalID, string token, int lifetime)
|
|
||||||
{
|
|
||||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
|
||||||
DoExpire();
|
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() +
|
|
||||||
"', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))");
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
{
|
|
||||||
cmd.Dispose();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CheckToken(UUID principalID, string token, int lifetime)
|
|
||||||
{
|
|
||||||
if (System.Environment.TickCount - m_LastExpire > 30000)
|
|
||||||
DoExpire();
|
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() +
|
|
||||||
" minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
{
|
|
||||||
cmd.Dispose();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DoExpire()
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')");
|
|
||||||
ExecuteNonQuery(cmd, m_Connection);
|
|
||||||
|
|
||||||
cmd.Dispose();
|
|
||||||
|
|
||||||
m_LastExpire = System.Environment.TickCount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,396 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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.Reflection;
|
|
||||||
using log4net;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
public class SQLiteEstateStore : 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 SQLiteEstateStore()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public SQLiteEstateStore(string connectionString)
|
|
||||||
{
|
|
||||||
Initialise(connectionString);
|
|
||||||
}
|
|
||||||
|
|
||||||
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(UUID regionID, bool create)
|
|
||||||
{
|
|
||||||
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());
|
|
||||||
|
|
||||||
return DoLoad(cmd, regionID, create);
|
|
||||||
}
|
|
||||||
|
|
||||||
private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
|
|
||||||
{
|
|
||||||
EstateSettings es = new EstateSettings();
|
|
||||||
es.OnSave += StoreEstateSettings;
|
|
||||||
|
|
||||||
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 if (m_FieldMap[name].GetValue(es) is UUID)
|
|
||||||
{
|
|
||||||
UUID uuid = UUID.Zero;
|
|
||||||
|
|
||||||
UUID.TryParse(r[name].ToString(), out uuid);
|
|
||||||
m_FieldMap[name].SetValue(es, uuid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_FieldMap[name].SetValue(es, Convert.ChangeType(r[name], m_FieldMap[name].FieldType));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
r.Close();
|
|
||||||
}
|
|
||||||
else if (create)
|
|
||||||
{
|
|
||||||
r.Close();
|
|
||||||
|
|
||||||
List<string> names = new List<string>(FieldList);
|
|
||||||
|
|
||||||
names.Remove("EstateID");
|
|
||||||
|
|
||||||
string 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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
es.Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
UUID uuid = new UUID();
|
|
||||||
UUID.TryParse(r["bannedUUID"].ToString(), out uuid);
|
|
||||||
|
|
||||||
eb.BannedUserID = uuid;
|
|
||||||
eb.BannedHostAddress = "0.0.0.0";
|
|
||||||
eb.BannedHostIPMask = "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.BannedUserID.ToString());
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
cmd.Parameters.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveUUIDList(uint EstateID, string table, UUID[] 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 (UUID uuid in data)
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(":EstateID", EstateID.ToString());
|
|
||||||
cmd.Parameters.Add(":uuid", uuid.ToString());
|
|
||||||
|
|
||||||
cmd.ExecuteNonQuery();
|
|
||||||
cmd.Parameters.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UUID[] LoadUUIDList(uint EstateID, string table)
|
|
||||||
{
|
|
||||||
List<UUID> uuids = new List<UUID>();
|
|
||||||
|
|
||||||
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();
|
|
||||||
|
|
||||||
UUID uuid = new UUID();
|
|
||||||
UUID.TryParse(r["uuid"].ToString(), out uuid);
|
|
||||||
|
|
||||||
uuids.Add(uuid);
|
|
||||||
}
|
|
||||||
r.Close();
|
|
||||||
|
|
||||||
return uuids.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EstateSettings LoadEstateSettings(int estateID)
|
|
||||||
{
|
|
||||||
string sql = "select estate_settings."+String.Join(",estate_settings.", FieldList)+" from estate_settings where estate_settings.EstateID = :EstateID";
|
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
|
||||||
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
|
||||||
|
|
||||||
return DoLoad(cmd, UUID.Zero, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<int> GetEstates(string search)
|
|
||||||
{
|
|
||||||
List<int> result = new List<int>();
|
|
||||||
|
|
||||||
string sql = "select EstateID from estate_settings where estate_settings.EstateName = :EstateName";
|
|
||||||
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = sql;
|
|
||||||
cmd.Parameters.Add(":EstateName", search);
|
|
||||||
|
|
||||||
IDataReader r = cmd.ExecuteReader();
|
|
||||||
|
|
||||||
while (r.Read())
|
|
||||||
{
|
|
||||||
result.Add(Convert.ToInt32(r["EstateID"]));
|
|
||||||
}
|
|
||||||
r.Close();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool LinkRegion(UUID regionID, int estateID)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = "insert into estate_map values (:RegionID, :EstateID)";
|
|
||||||
cmd.Parameters.Add(":RegionID", regionID.ToString());
|
|
||||||
cmd.Parameters.Add(":EstateID", estateID.ToString());
|
|
||||||
|
|
||||||
if (cmd.ExecuteNonQuery() == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<UUID> GetRegions(int estateID)
|
|
||||||
{
|
|
||||||
return new List<UUID>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeleteEstate(int estateID)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,91 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A database interface class to a user profile storage system
|
|
||||||
/// </summary>
|
|
||||||
public class SQLiteFramework
|
|
||||||
{
|
|
||||||
protected Object m_lockObject = new Object();
|
|
||||||
|
|
||||||
protected SQLiteFramework(string connectionString)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// All non queries are funneled through one connection
|
|
||||||
// to increase performance a little
|
|
||||||
//
|
|
||||||
protected int ExecuteNonQuery(SqliteCommand cmd, SqliteConnection connection)
|
|
||||||
{
|
|
||||||
lock (connection)
|
|
||||||
{
|
|
||||||
SqliteConnection newConnection =
|
|
||||||
(SqliteConnection)((ICloneable)connection).Clone();
|
|
||||||
newConnection.Open();
|
|
||||||
|
|
||||||
cmd.Connection = newConnection;
|
|
||||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
|
||||||
|
|
||||||
return cmd.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected IDataReader ExecuteReader(SqliteCommand cmd, SqliteConnection connection)
|
|
||||||
{
|
|
||||||
lock (connection)
|
|
||||||
{
|
|
||||||
SqliteConnection newConnection =
|
|
||||||
(SqliteConnection)((ICloneable)connection).Clone();
|
|
||||||
newConnection.Open();
|
|
||||||
|
|
||||||
cmd.Connection = newConnection;
|
|
||||||
//Console.WriteLine("XXX " + cmd.CommandText);
|
|
||||||
|
|
||||||
return cmd.ExecuteReader();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void CloseCommand(SqliteCommand cmd)
|
|
||||||
{
|
|
||||||
cmd.Connection.Close();
|
|
||||||
cmd.Connection.Dispose();
|
|
||||||
cmd.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
public class SQLiteFriendsData : SQLiteGenericTableHandler<FriendsData>, IFriendsData
|
|
||||||
{
|
|
||||||
public SQLiteFriendsData(string connectionString, string realm)
|
|
||||||
: base(connectionString, realm, "FriendsStore")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public FriendsData[] GetFriends(UUID userID)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select a.*,case when b.Flags is null then -1 else b.Flags end as TheirFlags from {0} as a left join {0} as b on a.PrincipalID = b.Friend and a.Friend = b.PrincipalID where a.PrincipalID = :PrincipalID", m_Realm);
|
|
||||||
cmd.Parameters.Add(":PrincipalID", userID.ToString());
|
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(UUID principalID, string friend)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where PrincipalID = :PrincipalID and Friend = :Friend", m_Realm);
|
|
||||||
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
|
||||||
cmd.Parameters.Add(":Friend", friend);
|
|
||||||
|
|
||||||
ExecuteNonQuery(cmd, cmd.Connection);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,268 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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.Reflection;
|
|
||||||
using log4net;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
public class SQLiteGenericTableHandler<T> : SQLiteFramework where T: class, new()
|
|
||||||
{
|
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
protected Dictionary<string, FieldInfo> m_Fields =
|
|
||||||
new Dictionary<string, FieldInfo>();
|
|
||||||
|
|
||||||
protected List<string> m_ColumnNames = null;
|
|
||||||
protected string m_Realm;
|
|
||||||
protected FieldInfo m_DataField = null;
|
|
||||||
|
|
||||||
protected static SqliteConnection m_Connection;
|
|
||||||
private static bool m_initialized;
|
|
||||||
|
|
||||||
public SQLiteGenericTableHandler(string connectionString,
|
|
||||||
string realm, string storeName) : base(connectionString)
|
|
||||||
{
|
|
||||||
m_Realm = realm;
|
|
||||||
|
|
||||||
if (!m_initialized)
|
|
||||||
{
|
|
||||||
m_Connection = new SqliteConnection(connectionString);
|
|
||||||
m_Connection.Open();
|
|
||||||
|
|
||||||
if (storeName != String.Empty)
|
|
||||||
{
|
|
||||||
Assembly assem = GetType().Assembly;
|
|
||||||
SqliteConnection newConnection =
|
|
||||||
(SqliteConnection)((ICloneable)m_Connection).Clone();
|
|
||||||
newConnection.Open();
|
|
||||||
|
|
||||||
Migration m = new Migration(newConnection, assem, storeName);
|
|
||||||
m.Update();
|
|
||||||
newConnection.Close();
|
|
||||||
newConnection.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Type t = typeof(T);
|
|
||||||
FieldInfo[] fields = t.GetFields(BindingFlags.Public |
|
|
||||||
BindingFlags.Instance |
|
|
||||||
BindingFlags.DeclaredOnly);
|
|
||||||
|
|
||||||
if (fields.Length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach (FieldInfo f in fields)
|
|
||||||
{
|
|
||||||
if (f.Name != "Data")
|
|
||||||
m_Fields[f.Name] = f;
|
|
||||||
else
|
|
||||||
m_DataField = f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CheckColumnNames(IDataReader reader)
|
|
||||||
{
|
|
||||||
if (m_ColumnNames != null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_ColumnNames = new List<string>();
|
|
||||||
|
|
||||||
DataTable schemaTable = reader.GetSchemaTable();
|
|
||||||
foreach (DataRow row in schemaTable.Rows)
|
|
||||||
{
|
|
||||||
if (row["ColumnName"] != null &&
|
|
||||||
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
|
|
||||||
m_ColumnNames.Add(row["ColumnName"].ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public T[] Get(string field, string key)
|
|
||||||
{
|
|
||||||
return Get(new string[] { field }, new string[] { key });
|
|
||||||
}
|
|
||||||
|
|
||||||
public T[] Get(string[] fields, string[] keys)
|
|
||||||
{
|
|
||||||
if (fields.Length != keys.Length)
|
|
||||||
return new T[0];
|
|
||||||
|
|
||||||
List<string> terms = new List<string>();
|
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
for (int i = 0 ; i < fields.Length ; i++)
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
|
|
||||||
terms.Add("`" + fields[i] + "` = :" + fields[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
string where = String.Join(" and ", terms.ToArray());
|
|
||||||
|
|
||||||
string query = String.Format("select * from {0} where {1}",
|
|
||||||
m_Realm, where);
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected T[] DoQuery(SqliteCommand cmd)
|
|
||||||
{
|
|
||||||
IDataReader reader = ExecuteReader(cmd, m_Connection);
|
|
||||||
if (reader == null)
|
|
||||||
return new T[0];
|
|
||||||
|
|
||||||
CheckColumnNames(reader);
|
|
||||||
|
|
||||||
List<T> result = new List<T>();
|
|
||||||
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
T row = new T();
|
|
||||||
|
|
||||||
foreach (string name in m_Fields.Keys)
|
|
||||||
{
|
|
||||||
if (m_Fields[name].GetValue(row) is bool)
|
|
||||||
{
|
|
||||||
int v = Convert.ToInt32(reader[name]);
|
|
||||||
m_Fields[name].SetValue(row, v != 0 ? true : false);
|
|
||||||
}
|
|
||||||
else if (m_Fields[name].GetValue(row) is UUID)
|
|
||||||
{
|
|
||||||
UUID uuid = UUID.Zero;
|
|
||||||
|
|
||||||
UUID.TryParse(reader[name].ToString(), out uuid);
|
|
||||||
m_Fields[name].SetValue(row, uuid);
|
|
||||||
}
|
|
||||||
else if (m_Fields[name].GetValue(row) is int)
|
|
||||||
{
|
|
||||||
int v = Convert.ToInt32(reader[name]);
|
|
||||||
m_Fields[name].SetValue(row, v);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Fields[name].SetValue(row, reader[name]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_DataField != null)
|
|
||||||
{
|
|
||||||
Dictionary<string, string> data =
|
|
||||||
new Dictionary<string, string>();
|
|
||||||
|
|
||||||
foreach (string col in m_ColumnNames)
|
|
||||||
{
|
|
||||||
data[col] = reader[col].ToString();
|
|
||||||
if (data[col] == null)
|
|
||||||
data[col] = String.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_DataField.SetValue(row, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.Add(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseCommand(cmd);
|
|
||||||
|
|
||||||
return result.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public T[] Get(string where)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
string query = String.Format("select * from {0} where {1}",
|
|
||||||
m_Realm, where);
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Store(T row)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
string query = "";
|
|
||||||
List<String> names = new List<String>();
|
|
||||||
List<String> values = new List<String>();
|
|
||||||
|
|
||||||
foreach (FieldInfo fi in m_Fields.Values)
|
|
||||||
{
|
|
||||||
names.Add(fi.Name);
|
|
||||||
values.Add(":" + fi.Name);
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + fi.Name, fi.GetValue(row).ToString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_DataField != null)
|
|
||||||
{
|
|
||||||
Dictionary<string, string> data =
|
|
||||||
(Dictionary<string, string>)m_DataField.GetValue(row);
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, string> kvp in data)
|
|
||||||
{
|
|
||||||
names.Add(kvp.Key);
|
|
||||||
values.Add(":" + kvp.Key);
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":" + kvp.Key, kvp.Value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
query = String.Format("replace into {0} (`", m_Realm) + String.Join("`,`", names.ToArray()) + "`) values (" + String.Join(",", values.ToArray()) + ")";
|
|
||||||
|
|
||||||
cmd.CommandText = query;
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Delete(string field, string val)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field);
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(field, val));
|
|
||||||
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,898 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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.Reflection;
|
|
||||||
using log4net;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// An Inventory Interface to the SQLite database
|
|
||||||
/// </summary>
|
|
||||||
public class SQLiteInventoryStore : SQLiteUtil, IInventoryDataPlugin
|
|
||||||
{
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private const string invItemsSelect = "select * from inventoryitems";
|
|
||||||
private const string invFoldersSelect = "select * from inventoryfolders";
|
|
||||||
|
|
||||||
private static SqliteConnection conn;
|
|
||||||
private static DataSet ds;
|
|
||||||
private static SqliteDataAdapter invItemsDa;
|
|
||||||
private static SqliteDataAdapter invFoldersDa;
|
|
||||||
|
|
||||||
private static bool m_Initialized = false;
|
|
||||||
|
|
||||||
public void Initialise()
|
|
||||||
{
|
|
||||||
m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
|
|
||||||
throw new PluginNotInitialisedException(Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// <list type="bullet">
|
|
||||||
/// <item>Initialises Inventory interface</item>
|
|
||||||
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
|
|
||||||
/// <item>use default URI if connect string string is empty.</item>
|
|
||||||
/// </list>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dbconnect">connect string</param>
|
|
||||||
public void Initialise(string dbconnect)
|
|
||||||
{
|
|
||||||
if (!m_Initialized)
|
|
||||||
{
|
|
||||||
m_Initialized = true;
|
|
||||||
|
|
||||||
if (dbconnect == string.Empty)
|
|
||||||
{
|
|
||||||
dbconnect = "URI=file:inventoryStore.db,version=3";
|
|
||||||
}
|
|
||||||
m_log.Info("[INVENTORY DB]: Sqlite - connecting: " + dbconnect);
|
|
||||||
conn = new SqliteConnection(dbconnect);
|
|
||||||
|
|
||||||
conn.Open();
|
|
||||||
|
|
||||||
Assembly assem = GetType().Assembly;
|
|
||||||
Migration m = new Migration(conn, assem, "InventoryStore");
|
|
||||||
m.Update();
|
|
||||||
|
|
||||||
SqliteCommand itemsSelectCmd = new SqliteCommand(invItemsSelect, conn);
|
|
||||||
invItemsDa = new SqliteDataAdapter(itemsSelectCmd);
|
|
||||||
// SqliteCommandBuilder primCb = new SqliteCommandBuilder(primDa);
|
|
||||||
|
|
||||||
SqliteCommand foldersSelectCmd = new SqliteCommand(invFoldersSelect, conn);
|
|
||||||
invFoldersDa = new SqliteDataAdapter(foldersSelectCmd);
|
|
||||||
|
|
||||||
ds = new DataSet();
|
|
||||||
|
|
||||||
ds.Tables.Add(createInventoryFoldersTable());
|
|
||||||
invFoldersDa.Fill(ds.Tables["inventoryfolders"]);
|
|
||||||
setupFoldersCommands(invFoldersDa, conn);
|
|
||||||
m_log.Info("[INVENTORY DB]: Populated Inventory Folders Definitions");
|
|
||||||
|
|
||||||
ds.Tables.Add(createInventoryItemsTable());
|
|
||||||
invItemsDa.Fill(ds.Tables["inventoryitems"]);
|
|
||||||
setupItemsCommands(invItemsDa, conn);
|
|
||||||
m_log.Info("[INVENTORY DB]: Populated Inventory Items Definitions");
|
|
||||||
|
|
||||||
ds.AcceptChanges();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Closes the inventory interface
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
if (conn != null)
|
|
||||||
{
|
|
||||||
conn.Close();
|
|
||||||
conn = null;
|
|
||||||
}
|
|
||||||
if (invItemsDa != null)
|
|
||||||
{
|
|
||||||
invItemsDa.Dispose();
|
|
||||||
invItemsDa = null;
|
|
||||||
}
|
|
||||||
if (invFoldersDa != null)
|
|
||||||
{
|
|
||||||
invFoldersDa.Dispose();
|
|
||||||
invFoldersDa = null;
|
|
||||||
}
|
|
||||||
if (ds != null)
|
|
||||||
{
|
|
||||||
ds.Dispose();
|
|
||||||
ds = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="row"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public InventoryItemBase buildItem(DataRow row)
|
|
||||||
{
|
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
|
||||||
item.ID = new UUID((string) row["UUID"]);
|
|
||||||
item.AssetID = new UUID((string) row["assetID"]);
|
|
||||||
item.AssetType = Convert.ToInt32(row["assetType"]);
|
|
||||||
item.InvType = Convert.ToInt32(row["invType"]);
|
|
||||||
item.Folder = new UUID((string) row["parentFolderID"]);
|
|
||||||
item.Owner = new UUID((string) row["avatarID"]);
|
|
||||||
item.CreatorIdentification = (string)row["creatorsID"];
|
|
||||||
item.Name = (string) row["inventoryName"];
|
|
||||||
item.Description = (string) row["inventoryDescription"];
|
|
||||||
|
|
||||||
item.NextPermissions = Convert.ToUInt32(row["inventoryNextPermissions"]);
|
|
||||||
item.CurrentPermissions = Convert.ToUInt32(row["inventoryCurrentPermissions"]);
|
|
||||||
item.BasePermissions = Convert.ToUInt32(row["inventoryBasePermissions"]);
|
|
||||||
item.EveryOnePermissions = Convert.ToUInt32(row["inventoryEveryOnePermissions"]);
|
|
||||||
item.GroupPermissions = Convert.ToUInt32(row["inventoryGroupPermissions"]);
|
|
||||||
|
|
||||||
// new fields
|
|
||||||
if (!Convert.IsDBNull(row["salePrice"]))
|
|
||||||
item.SalePrice = Convert.ToInt32(row["salePrice"]);
|
|
||||||
|
|
||||||
if (!Convert.IsDBNull(row["saleType"]))
|
|
||||||
item.SaleType = Convert.ToByte(row["saleType"]);
|
|
||||||
|
|
||||||
if (!Convert.IsDBNull(row["creationDate"]))
|
|
||||||
item.CreationDate = Convert.ToInt32(row["creationDate"]);
|
|
||||||
|
|
||||||
if (!Convert.IsDBNull(row["groupID"]))
|
|
||||||
item.GroupID = new UUID((string)row["groupID"]);
|
|
||||||
|
|
||||||
if (!Convert.IsDBNull(row["groupOwned"]))
|
|
||||||
item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
|
|
||||||
|
|
||||||
if (!Convert.IsDBNull(row["Flags"]))
|
|
||||||
item.Flags = Convert.ToUInt32(row["Flags"]);
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Fill a database row with item data
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="row"></param>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
private static void fillItemRow(DataRow row, InventoryItemBase item)
|
|
||||||
{
|
|
||||||
row["UUID"] = item.ID.ToString();
|
|
||||||
row["assetID"] = item.AssetID.ToString();
|
|
||||||
row["assetType"] = item.AssetType;
|
|
||||||
row["invType"] = item.InvType;
|
|
||||||
row["parentFolderID"] = item.Folder.ToString();
|
|
||||||
row["avatarID"] = item.Owner.ToString();
|
|
||||||
row["creatorsID"] = item.CreatorIdentification.ToString();
|
|
||||||
row["inventoryName"] = item.Name;
|
|
||||||
row["inventoryDescription"] = item.Description;
|
|
||||||
|
|
||||||
row["inventoryNextPermissions"] = item.NextPermissions;
|
|
||||||
row["inventoryCurrentPermissions"] = item.CurrentPermissions;
|
|
||||||
row["inventoryBasePermissions"] = item.BasePermissions;
|
|
||||||
row["inventoryEveryOnePermissions"] = item.EveryOnePermissions;
|
|
||||||
row["inventoryGroupPermissions"] = item.GroupPermissions;
|
|
||||||
|
|
||||||
// new fields
|
|
||||||
row["salePrice"] = item.SalePrice;
|
|
||||||
row["saleType"] = item.SaleType;
|
|
||||||
row["creationDate"] = item.CreationDate;
|
|
||||||
row["groupID"] = item.GroupID.ToString();
|
|
||||||
row["groupOwned"] = item.GroupOwned;
|
|
||||||
row["flags"] = item.Flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add inventory folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folder">Folder base</param>
|
|
||||||
/// <param name="add">true=create folder. false=update existing folder</param>
|
|
||||||
/// <remarks>nasty</remarks>
|
|
||||||
private void addFolder(InventoryFolderBase folder, bool add)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
|
|
||||||
if (inventoryRow == null)
|
|
||||||
{
|
|
||||||
if (! add)
|
|
||||||
m_log.ErrorFormat("Interface Misuse: Attempting to Update non-existant inventory folder: {0}", folder.ID);
|
|
||||||
|
|
||||||
inventoryRow = inventoryFolderTable.NewRow();
|
|
||||||
fillFolderRow(inventoryRow, folder);
|
|
||||||
inventoryFolderTable.Rows.Add(inventoryRow);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (add)
|
|
||||||
m_log.ErrorFormat("Interface Misuse: Attempting to Add inventory folder that already exists: {0}", folder.ID);
|
|
||||||
|
|
||||||
fillFolderRow(inventoryRow, folder);
|
|
||||||
}
|
|
||||||
|
|
||||||
invFoldersDa.Update(ds, "inventoryfolders");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Move an inventory folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folder">folder base</param>
|
|
||||||
private void moveFolder(InventoryFolderBase folder)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryFolderTable.Rows.Find(folder.ID.ToString());
|
|
||||||
if (inventoryRow == null)
|
|
||||||
{
|
|
||||||
inventoryRow = inventoryFolderTable.NewRow();
|
|
||||||
fillFolderRow(inventoryRow, folder);
|
|
||||||
inventoryFolderTable.Rows.Add(inventoryRow);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moveFolderRow(inventoryRow, folder);
|
|
||||||
}
|
|
||||||
|
|
||||||
invFoldersDa.Update(ds, "inventoryfolders");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// add an item in inventory
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">the item</param>
|
|
||||||
/// <param name="add">true=add item ; false=update existing item</param>
|
|
||||||
private void addItem(InventoryItemBase item, bool add)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryItemTable.Rows.Find(item.ID.ToString());
|
|
||||||
if (inventoryRow == null)
|
|
||||||
{
|
|
||||||
if (!add)
|
|
||||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Update non-existant inventory item: {0}", item.ID);
|
|
||||||
|
|
||||||
inventoryRow = inventoryItemTable.NewRow();
|
|
||||||
fillItemRow(inventoryRow, item);
|
|
||||||
inventoryItemTable.Rows.Add(inventoryRow);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (add)
|
|
||||||
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID);
|
|
||||||
|
|
||||||
fillItemRow(inventoryRow, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
invItemsDa.Update(ds, "inventoryitems");
|
|
||||||
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
|
||||||
|
|
||||||
inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString());
|
|
||||||
if (inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either.
|
|
||||||
inventoryRow["version"] = (int)inventoryRow["version"] + 1;
|
|
||||||
|
|
||||||
invFoldersDa.Update(ds, "inventoryfolders");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TODO : DataSet commit
|
|
||||||
/// </summary>
|
|
||||||
public void Shutdown()
|
|
||||||
{
|
|
||||||
// TODO: DataSet commit
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The name of this DB provider
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Name of DB provider</returns>
|
|
||||||
public string Name
|
|
||||||
{
|
|
||||||
get { return "SQLite Inventory Data Interface"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the version of this DB provider
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A string containing the DB provider version</returns>
|
|
||||||
public string Version
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
Module module = GetType().Module;
|
|
||||||
// string dllName = module.Assembly.ManifestModule.Name;
|
|
||||||
Version dllVersion = module.Assembly.GetName().Version;
|
|
||||||
|
|
||||||
|
|
||||||
return
|
|
||||||
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
|
||||||
dllVersion.Revision);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of inventory items contained within the specified folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folderID">The UUID of the target folder</param>
|
|
||||||
/// <returns>A List of InventoryItemBase items</returns>
|
|
||||||
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
List<InventoryItemBase> retval = new List<InventoryItemBase>();
|
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
|
||||||
string selectExp = "parentFolderID = '" + folderID + "'";
|
|
||||||
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
|
||||||
foreach (DataRow row in rows)
|
|
||||||
{
|
|
||||||
retval.Add(buildItem(row));
|
|
||||||
}
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of the root folders within a users inventory
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="user">The user whos inventory is to be searched</param>
|
|
||||||
/// <returns>A list of folder objects</returns>
|
|
||||||
public List<InventoryFolderBase> getUserRootFolders(UUID user)
|
|
||||||
{
|
|
||||||
return new List<InventoryFolderBase>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// see InventoryItemBase.getUserRootFolder
|
|
||||||
public InventoryFolderBase getUserRootFolder(UUID user)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
|
||||||
string selectExp = "agentID = '" + user + "' AND parentID = '" + UUID.Zero + "'";
|
|
||||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
|
||||||
foreach (DataRow row in rows)
|
|
||||||
{
|
|
||||||
folders.Add(buildFolder(row));
|
|
||||||
}
|
|
||||||
|
|
||||||
// There should only ever be one root folder for a user. However, if there's more
|
|
||||||
// than one we'll simply use the first one rather than failing. It would be even
|
|
||||||
// nicer to print some message to this effect, but this feels like it's too low a
|
|
||||||
// to put such a message out, and it's too minor right now to spare the time to
|
|
||||||
// suitably refactor.
|
|
||||||
if (folders.Count > 0)
|
|
||||||
{
|
|
||||||
return folders[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Append a list of all the child folders of a parent folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folders">list where folders will be appended</param>
|
|
||||||
/// <param name="parentID">ID of parent</param>
|
|
||||||
protected void getInventoryFolders(ref List<InventoryFolderBase> folders, UUID parentID)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
|
||||||
string selectExp = "parentID = '" + parentID + "'";
|
|
||||||
DataRow[] rows = inventoryFolderTable.Select(selectExp);
|
|
||||||
foreach (DataRow row in rows)
|
|
||||||
{
|
|
||||||
folders.Add(buildFolder(row));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of inventory folders contained in the folder 'parentID'
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parentID">The folder to get subfolders for</param>
|
|
||||||
/// <returns>A list of inventory folders</returns>
|
|
||||||
public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
|
|
||||||
{
|
|
||||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
|
||||||
getInventoryFolders(ref folders, parentID);
|
|
||||||
return folders;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// See IInventoryDataPlugin
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parentID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID)
|
|
||||||
{
|
|
||||||
/* Note: There are subtle changes between this implementation of getFolderHierarchy and the previous one
|
|
||||||
* - We will only need to hit the database twice instead of n times.
|
|
||||||
* - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned
|
|
||||||
* by the same person, each user only has 1 inventory heirarchy
|
|
||||||
* - The returned list is not ordered, instead of breadth-first ordered
|
|
||||||
There are basically 2 usage cases for getFolderHeirarchy:
|
|
||||||
1) Getting the user's entire inventory heirarchy when they log in
|
|
||||||
2) Finding a subfolder heirarchy to delete when emptying the trash.
|
|
||||||
This implementation will pull all inventory folders from the database, and then prune away any folder that
|
|
||||||
is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the
|
|
||||||
database than to make n requests. This pays off only if requested heirarchy is large.
|
|
||||||
By making this choice, we are making the worst case better at the cost of making the best case worse
|
|
||||||
- Francis
|
|
||||||
*/
|
|
||||||
|
|
||||||
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
|
|
||||||
DataRow[] folderRows = null, parentRow;
|
|
||||||
InventoryFolderBase parentFolder = null;
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
/* Fetch the parent folder from the database to determine the agent ID.
|
|
||||||
* Then fetch all inventory folders for that agent from the agent ID.
|
|
||||||
*/
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
|
||||||
string selectExp = "UUID = '" + parentID + "'";
|
|
||||||
parentRow = inventoryFolderTable.Select(selectExp); // Assume at most 1 result
|
|
||||||
if (parentRow.GetLength(0) >= 1) // No result means parent folder does not exist
|
|
||||||
{
|
|
||||||
parentFolder = buildFolder(parentRow[0]);
|
|
||||||
UUID agentID = parentFolder.Owner;
|
|
||||||
selectExp = "agentID = '" + agentID + "'";
|
|
||||||
folderRows = inventoryFolderTable.Select(selectExp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (folderRows != null && folderRows.GetLength(0) >= 1) // No result means parent folder does not exist
|
|
||||||
{ // or has no children
|
|
||||||
/* if we're querying the root folder, just return an unordered list of all folders in the user's
|
|
||||||
* inventory
|
|
||||||
*/
|
|
||||||
if (parentFolder.ParentID == UUID.Zero)
|
|
||||||
{
|
|
||||||
foreach (DataRow row in folderRows)
|
|
||||||
{
|
|
||||||
InventoryFolderBase curFolder = buildFolder(row);
|
|
||||||
if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy
|
|
||||||
folders.Add(buildFolder(row));
|
|
||||||
}
|
|
||||||
} // If requesting root folder
|
|
||||||
/* else we are querying a non-root folder. We currently have a list of all of the user's folders,
|
|
||||||
* we must construct a list of all folders in the heirarchy below parentID.
|
|
||||||
* Our first step will be to construct a hash table of all folders, indexed by parent ID.
|
|
||||||
* Once we have constructed the hash table, we will do a breadth-first traversal on the tree using the
|
|
||||||
* hash table to find child folders.
|
|
||||||
*/
|
|
||||||
else
|
|
||||||
{ // Querying a non-root folder
|
|
||||||
|
|
||||||
// Build a hash table of all user's inventory folders, indexed by each folder's parent ID
|
|
||||||
Dictionary<UUID, List<InventoryFolderBase>> hashtable =
|
|
||||||
new Dictionary<UUID, List<InventoryFolderBase>>(folderRows.GetLength(0));
|
|
||||||
|
|
||||||
foreach (DataRow row in folderRows)
|
|
||||||
{
|
|
||||||
InventoryFolderBase curFolder = buildFolder(row);
|
|
||||||
if (curFolder.ParentID != UUID.Zero) // Discard root of tree - not needed
|
|
||||||
{
|
|
||||||
if (hashtable.ContainsKey(curFolder.ParentID))
|
|
||||||
{
|
|
||||||
// Current folder already has a sibling - append to sibling list
|
|
||||||
hashtable[curFolder.ParentID].Add(curFolder);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>();
|
|
||||||
siblingList.Add(curFolder);
|
|
||||||
// Current folder has no known (yet) siblings
|
|
||||||
hashtable.Add(curFolder.ParentID, siblingList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // For all inventory folders
|
|
||||||
|
|
||||||
// Note: Could release the ds lock here - we don't access folderRows or the database anymore.
|
|
||||||
// This is somewhat of a moot point as the callers of this function usually lock db anyways.
|
|
||||||
|
|
||||||
if (hashtable.ContainsKey(parentID)) // if requested folder does have children
|
|
||||||
folders.AddRange(hashtable[parentID]);
|
|
||||||
|
|
||||||
// BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static
|
|
||||||
for (int i = 0; i < folders.Count; i++)
|
|
||||||
if (hashtable.ContainsKey(folders[i].ID))
|
|
||||||
folders.AddRange(hashtable[folders[i].ID]);
|
|
||||||
|
|
||||||
} // if requesting a subfolder heirarchy
|
|
||||||
} // if folder parentID exists and has children
|
|
||||||
} // lock ds
|
|
||||||
return folders;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an inventory item by its UUID
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The UUID of the item to be returned</param>
|
|
||||||
/// <returns>A class containing item information</returns>
|
|
||||||
public InventoryItemBase getInventoryItem(UUID item)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
DataRow row = ds.Tables["inventoryitems"].Rows.Find(item.ToString());
|
|
||||||
if (row != null)
|
|
||||||
{
|
|
||||||
return buildItem(row);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a specified inventory folder by its UUID
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folder">The UUID of the folder to be returned</param>
|
|
||||||
/// <returns>A class containing folder information</returns>
|
|
||||||
public InventoryFolderBase getInventoryFolder(UUID folder)
|
|
||||||
{
|
|
||||||
// TODO: Deep voodoo here. If you enable this code then
|
|
||||||
// multi region breaks. No idea why, but I figured it was
|
|
||||||
// better to leave multi region at this point. It does mean
|
|
||||||
// that you don't get to see system textures why creating
|
|
||||||
// clothes and the like. :(
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
DataRow row = ds.Tables["inventoryfolders"].Rows.Find(folder.ToString());
|
|
||||||
if (row != null)
|
|
||||||
{
|
|
||||||
return buildFolder(row);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a new inventory item based on item
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item to be created</param>
|
|
||||||
public void addInventoryItem(InventoryItemBase item)
|
|
||||||
{
|
|
||||||
addItem(item, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates an inventory item with item (updates based on ID)
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The updated item</param>
|
|
||||||
public void updateInventoryItem(InventoryItemBase item)
|
|
||||||
{
|
|
||||||
addItem(item, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delete an inventory item
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item UUID</param>
|
|
||||||
public void deleteInventoryItem(UUID itemID)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
|
||||||
|
|
||||||
DataRow inventoryRow = inventoryItemTable.Rows.Find(itemID.ToString());
|
|
||||||
if (inventoryRow != null)
|
|
||||||
{
|
|
||||||
inventoryRow.Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
invItemsDa.Update(ds, "inventoryitems");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public InventoryItemBase queryInventoryItem(UUID itemID)
|
|
||||||
{
|
|
||||||
return getInventoryItem(itemID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
|
||||||
{
|
|
||||||
return getInventoryFolder(folderID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delete all items in the specified folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folderId">id of the folder, whose item content should be deleted</param>
|
|
||||||
/// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo>
|
|
||||||
private void deleteItemsInFolder(UUID folderId)
|
|
||||||
{
|
|
||||||
List<InventoryItemBase> items = getInventoryInFolder(folderId);
|
|
||||||
|
|
||||||
foreach (InventoryItemBase i in items)
|
|
||||||
deleteInventoryItem(i.ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a new folder specified by folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folder">The inventory folder</param>
|
|
||||||
public void addInventoryFolder(InventoryFolderBase folder)
|
|
||||||
{
|
|
||||||
addFolder(folder, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates a folder based on its ID with folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folder">The inventory folder</param>
|
|
||||||
public void updateInventoryFolder(InventoryFolderBase folder)
|
|
||||||
{
|
|
||||||
addFolder(folder, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Moves a folder based on its ID with folder
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="folder">The inventory folder</param>
|
|
||||||
public void moveInventoryFolder(InventoryFolderBase folder)
|
|
||||||
{
|
|
||||||
moveFolder(folder);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delete a folder
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This will clean-up any child folders and child items as well
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="folderID">the folder UUID</param>
|
|
||||||
public void deleteInventoryFolder(UUID folderID)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
List<InventoryFolderBase> subFolders = getFolderHierarchy(folderID);
|
|
||||||
|
|
||||||
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
|
|
||||||
DataRow inventoryRow;
|
|
||||||
|
|
||||||
//Delete all sub-folders
|
|
||||||
foreach (InventoryFolderBase f in subFolders)
|
|
||||||
{
|
|
||||||
inventoryRow = inventoryFolderTable.Rows.Find(f.ID.ToString());
|
|
||||||
if (inventoryRow != null)
|
|
||||||
{
|
|
||||||
deleteItemsInFolder(f.ID);
|
|
||||||
inventoryRow.Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Delete the actual row
|
|
||||||
inventoryRow = inventoryFolderTable.Rows.Find(folderID.ToString());
|
|
||||||
if (inventoryRow != null)
|
|
||||||
{
|
|
||||||
deleteItemsInFolder(folderID);
|
|
||||||
inventoryRow.Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
invFoldersDa.Update(ds, "inventoryfolders");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* Data Table definitions
|
|
||||||
*
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create the "inventoryitems" table
|
|
||||||
/// </summary>
|
|
||||||
private static DataTable createInventoryItemsTable()
|
|
||||||
{
|
|
||||||
DataTable inv = new DataTable("inventoryitems");
|
|
||||||
|
|
||||||
createCol(inv, "UUID", typeof (String)); //inventoryID
|
|
||||||
createCol(inv, "assetID", typeof (String));
|
|
||||||
createCol(inv, "assetType", typeof (Int32));
|
|
||||||
createCol(inv, "invType", typeof (Int32));
|
|
||||||
createCol(inv, "parentFolderID", typeof (String));
|
|
||||||
createCol(inv, "avatarID", typeof (String));
|
|
||||||
createCol(inv, "creatorsID", typeof (String));
|
|
||||||
|
|
||||||
createCol(inv, "inventoryName", typeof (String));
|
|
||||||
createCol(inv, "inventoryDescription", typeof (String));
|
|
||||||
// permissions
|
|
||||||
createCol(inv, "inventoryNextPermissions", typeof (Int32));
|
|
||||||
createCol(inv, "inventoryCurrentPermissions", typeof (Int32));
|
|
||||||
createCol(inv, "inventoryBasePermissions", typeof (Int32));
|
|
||||||
createCol(inv, "inventoryEveryOnePermissions", typeof (Int32));
|
|
||||||
createCol(inv, "inventoryGroupPermissions", typeof (Int32));
|
|
||||||
|
|
||||||
// sale info
|
|
||||||
createCol(inv, "salePrice", typeof(Int32));
|
|
||||||
createCol(inv, "saleType", typeof(Byte));
|
|
||||||
|
|
||||||
// creation date
|
|
||||||
createCol(inv, "creationDate", typeof(Int32));
|
|
||||||
|
|
||||||
// group info
|
|
||||||
createCol(inv, "groupID", typeof(String));
|
|
||||||
createCol(inv, "groupOwned", typeof(Boolean));
|
|
||||||
|
|
||||||
// Flags
|
|
||||||
createCol(inv, "flags", typeof(UInt32));
|
|
||||||
|
|
||||||
inv.PrimaryKey = new DataColumn[] { inv.Columns["UUID"] };
|
|
||||||
return inv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates the "inventoryfolders" table
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static DataTable createInventoryFoldersTable()
|
|
||||||
{
|
|
||||||
DataTable fol = new DataTable("inventoryfolders");
|
|
||||||
|
|
||||||
createCol(fol, "UUID", typeof (String)); //folderID
|
|
||||||
createCol(fol, "name", typeof (String));
|
|
||||||
createCol(fol, "agentID", typeof (String));
|
|
||||||
createCol(fol, "parentID", typeof (String));
|
|
||||||
createCol(fol, "type", typeof (Int32));
|
|
||||||
createCol(fol, "version", typeof (Int32));
|
|
||||||
|
|
||||||
fol.PrimaryKey = new DataColumn[] {fol.Columns["UUID"]};
|
|
||||||
return fol;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="da"></param>
|
|
||||||
/// <param name="conn"></param>
|
|
||||||
private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
da.InsertCommand = createInsertCommand("inventoryitems", ds.Tables["inventoryitems"]);
|
|
||||||
da.InsertCommand.Connection = conn;
|
|
||||||
|
|
||||||
da.UpdateCommand = createUpdateCommand("inventoryitems", "UUID=:UUID", ds.Tables["inventoryitems"]);
|
|
||||||
da.UpdateCommand.Connection = conn;
|
|
||||||
|
|
||||||
SqliteCommand delete = new SqliteCommand("delete from inventoryitems where UUID = :UUID");
|
|
||||||
delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
|
|
||||||
delete.Connection = conn;
|
|
||||||
da.DeleteCommand = delete;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="da"></param>
|
|
||||||
/// <param name="conn"></param>
|
|
||||||
private void setupFoldersCommands(SqliteDataAdapter da, SqliteConnection conn)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
da.InsertCommand = createInsertCommand("inventoryfolders", ds.Tables["inventoryfolders"]);
|
|
||||||
da.InsertCommand.Connection = conn;
|
|
||||||
|
|
||||||
da.UpdateCommand = createUpdateCommand("inventoryfolders", "UUID=:UUID", ds.Tables["inventoryfolders"]);
|
|
||||||
da.UpdateCommand.Connection = conn;
|
|
||||||
|
|
||||||
SqliteCommand delete = new SqliteCommand("delete from inventoryfolders where UUID = :UUID");
|
|
||||||
delete.Parameters.Add(createSqliteParameter("UUID", typeof(String)));
|
|
||||||
delete.Connection = conn;
|
|
||||||
da.DeleteCommand = delete;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="row"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static InventoryFolderBase buildFolder(DataRow row)
|
|
||||||
{
|
|
||||||
InventoryFolderBase folder = new InventoryFolderBase();
|
|
||||||
folder.ID = new UUID((string) row["UUID"]);
|
|
||||||
folder.Name = (string) row["name"];
|
|
||||||
folder.Owner = new UUID((string) row["agentID"]);
|
|
||||||
folder.ParentID = new UUID((string) row["parentID"]);
|
|
||||||
folder.Type = Convert.ToInt16(row["type"]);
|
|
||||||
folder.Version = Convert.ToUInt16(row["version"]);
|
|
||||||
return folder;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="row"></param>
|
|
||||||
/// <param name="folder"></param>
|
|
||||||
private static void fillFolderRow(DataRow row, InventoryFolderBase folder)
|
|
||||||
{
|
|
||||||
row["UUID"] = folder.ID.ToString();
|
|
||||||
row["name"] = folder.Name;
|
|
||||||
row["agentID"] = folder.Owner.ToString();
|
|
||||||
row["parentID"] = folder.ParentID.ToString();
|
|
||||||
row["type"] = folder.Type;
|
|
||||||
row["version"] = folder.Version;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="row"></param>
|
|
||||||
/// <param name="folder"></param>
|
|
||||||
private static void moveFolderRow(DataRow row, InventoryFolderBase folder)
|
|
||||||
{
|
|
||||||
row["UUID"] = folder.ID.ToString();
|
|
||||||
row["parentID"] = folder.ParentID.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InventoryItemBase> fetchActiveGestures (UUID avatarID)
|
|
||||||
{
|
|
||||||
lock (ds)
|
|
||||||
{
|
|
||||||
List<InventoryItemBase> items = new List<InventoryItemBase>();
|
|
||||||
|
|
||||||
DataTable inventoryItemTable = ds.Tables["inventoryitems"];
|
|
||||||
string selectExp
|
|
||||||
= "avatarID = '" + avatarID + "' AND assetType = " + (int)AssetType.Gesture + " AND flags = 1";
|
|
||||||
//m_log.DebugFormat("[SQL]: sql = " + selectExp);
|
|
||||||
DataRow[] rows = inventoryItemTable.Select(selectExp);
|
|
||||||
foreach (DataRow row in rows)
|
|
||||||
{
|
|
||||||
items.Add(buildItem(row));
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,81 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
public class SQLiteUserAccountData : SQLiteGenericTableHandler<UserAccountData>, IUserAccountData
|
|
||||||
{
|
|
||||||
public SQLiteUserAccountData(string connectionString, string realm)
|
|
||||||
: base(connectionString, realm, "UserAccount")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserAccountData[] GetUsers(UUID scopeID, string query)
|
|
||||||
{
|
|
||||||
string[] words = query.Split(new char[] {' '});
|
|
||||||
|
|
||||||
for (int i = 0 ; i < words.Length ; i++)
|
|
||||||
{
|
|
||||||
if (words[i].Length < 3)
|
|
||||||
{
|
|
||||||
if (i != words.Length - 1)
|
|
||||||
Array.Copy(words, i + 1, words, i, words.Length - i - 1);
|
|
||||||
Array.Resize(ref words, words.Length - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (words.Length == 0)
|
|
||||||
return new UserAccountData[0];
|
|
||||||
|
|
||||||
if (words.Length > 2)
|
|
||||||
return new UserAccountData[0];
|
|
||||||
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
if (words.Length == 1)
|
|
||||||
{
|
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{2}%')",
|
|
||||||
m_Realm, scopeID.ToString(), words[0]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cmd.CommandText = String.Format("select * from {0} where (ScopeID='{1}' or ScopeID='00000000-0000-0000-0000-000000000000') and (FirstName like '{2}%' or LastName like '{3}%')",
|
|
||||||
m_Realm, scopeID.ToString(), words[0], words[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,307 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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.Data;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A base class for methods needed by all SQLite database classes
|
|
||||||
/// </summary>
|
|
||||||
public class SQLiteUtil
|
|
||||||
{
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* Database Definition Helper Functions
|
|
||||||
*
|
|
||||||
* This should be db agnostic as we define them in ADO.NET terms
|
|
||||||
*
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dt"></param>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
public static void createCol(DataTable dt, string name, Type type)
|
|
||||||
{
|
|
||||||
DataColumn col = new DataColumn(name, type);
|
|
||||||
dt.Columns.Add(col);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* SQL Statement Creation Functions
|
|
||||||
*
|
|
||||||
* These functions create SQL statements for update, insert, and create.
|
|
||||||
* They can probably be factored later to have a db independant
|
|
||||||
* portion and a db specific portion
|
|
||||||
*
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create an insert command
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="table">table name</param>
|
|
||||||
/// <param name="dt">data table</param>
|
|
||||||
/// <returns>the created command</returns>
|
|
||||||
/// <remarks>
|
|
||||||
/// This is subtle enough to deserve some commentary.
|
|
||||||
/// Instead of doing *lots* and *lots of hardcoded strings
|
|
||||||
/// for database definitions we'll use the fact that
|
|
||||||
/// realistically all insert statements look like "insert
|
|
||||||
/// into A(b, c) values(:b, :c) on the parameterized query
|
|
||||||
/// front. If we just have a list of b, c, etc... we can
|
|
||||||
/// generate these strings instead of typing them out.
|
|
||||||
/// </remarks>
|
|
||||||
public static SqliteCommand createInsertCommand(string table, DataTable dt)
|
|
||||||
{
|
|
||||||
|
|
||||||
string[] cols = new string[dt.Columns.Count];
|
|
||||||
for (int i = 0; i < dt.Columns.Count; i++)
|
|
||||||
{
|
|
||||||
DataColumn col = dt.Columns[i];
|
|
||||||
cols[i] = col.ColumnName;
|
|
||||||
}
|
|
||||||
|
|
||||||
string sql = "insert into " + table + "(";
|
|
||||||
sql += String.Join(", ", cols);
|
|
||||||
// important, the first ':' needs to be here, the rest get added in the join
|
|
||||||
sql += ") values (:";
|
|
||||||
sql += String.Join(", :", cols);
|
|
||||||
sql += ")";
|
|
||||||
SqliteCommand cmd = new SqliteCommand(sql);
|
|
||||||
|
|
||||||
// this provides the binding for all our parameters, so
|
|
||||||
// much less code than it used to be
|
|
||||||
foreach (DataColumn col in dt.Columns)
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
|
||||||
}
|
|
||||||
return cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// create an update command
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="table">table name</param>
|
|
||||||
/// <param name="pk"></param>
|
|
||||||
/// <param name="dt"></param>
|
|
||||||
/// <returns>the created command</returns>
|
|
||||||
public static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
|
|
||||||
{
|
|
||||||
string sql = "update " + table + " set ";
|
|
||||||
string subsql = String.Empty;
|
|
||||||
foreach (DataColumn col in dt.Columns)
|
|
||||||
{
|
|
||||||
if (subsql.Length > 0)
|
|
||||||
{
|
|
||||||
// a map function would rock so much here
|
|
||||||
subsql += ", ";
|
|
||||||
}
|
|
||||||
subsql += col.ColumnName + "= :" + col.ColumnName;
|
|
||||||
}
|
|
||||||
sql += subsql;
|
|
||||||
sql += " where " + pk;
|
|
||||||
SqliteCommand cmd = new SqliteCommand(sql);
|
|
||||||
|
|
||||||
// this provides the binding for all our parameters, so
|
|
||||||
// much less code than it used to be
|
|
||||||
|
|
||||||
foreach (DataColumn col in dt.Columns)
|
|
||||||
{
|
|
||||||
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
|
||||||
}
|
|
||||||
return cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dt">Data Table</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string defineTable(DataTable dt)
|
|
||||||
{
|
|
||||||
string sql = "create table " + dt.TableName + "(";
|
|
||||||
string subsql = String.Empty;
|
|
||||||
foreach (DataColumn col in dt.Columns)
|
|
||||||
{
|
|
||||||
if (subsql.Length > 0)
|
|
||||||
{
|
|
||||||
// a map function would rock so much here
|
|
||||||
subsql += ",\n";
|
|
||||||
}
|
|
||||||
subsql += col.ColumnName + " " + sqliteType(col.DataType);
|
|
||||||
if (dt.PrimaryKey.Length > 0)
|
|
||||||
{
|
|
||||||
if (col == dt.PrimaryKey[0])
|
|
||||||
{
|
|
||||||
subsql += " primary key";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sql += subsql;
|
|
||||||
sql += ")";
|
|
||||||
return sql;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* Database Binding functions
|
|
||||||
*
|
|
||||||
* These will be db specific due to typing, and minor differences
|
|
||||||
* in databases.
|
|
||||||
*
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
///<summary>
|
|
||||||
/// <para>
|
|
||||||
/// This is a convenience function that collapses 5 repetitive
|
|
||||||
/// lines for defining SqliteParameters to 2 parameters:
|
|
||||||
/// column name and database type.
|
|
||||||
/// </para>
|
|
||||||
///
|
|
||||||
/// <para>
|
|
||||||
/// It assumes certain conventions like :param as the param
|
|
||||||
/// name to replace in parametrized queries, and that source
|
|
||||||
/// version is always current version, both of which are fine
|
|
||||||
/// for us.
|
|
||||||
/// </para>
|
|
||||||
///</summary>
|
|
||||||
/// <param name="name"></param>
|
|
||||||
/// <param name="type"></param>
|
|
||||||
///<returns>a built sqlite parameter</returns>
|
|
||||||
public static SqliteParameter createSqliteParameter(string name, Type type)
|
|
||||||
{
|
|
||||||
SqliteParameter param = new SqliteParameter();
|
|
||||||
param.ParameterName = ":" + name;
|
|
||||||
param.DbType = dbtypeFromType(type);
|
|
||||||
param.SourceColumn = name;
|
|
||||||
param.SourceVersion = DataRowVersion.Current;
|
|
||||||
return param;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* Type conversion functions
|
|
||||||
*
|
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Type conversion function
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">a type</param>
|
|
||||||
/// <returns>a DbType</returns>
|
|
||||||
public static DbType dbtypeFromType(Type type)
|
|
||||||
{
|
|
||||||
if (type == typeof (String))
|
|
||||||
{
|
|
||||||
return DbType.String;
|
|
||||||
}
|
|
||||||
else if (type == typeof (Int32))
|
|
||||||
{
|
|
||||||
return DbType.Int32;
|
|
||||||
}
|
|
||||||
else if (type == typeof (UInt32))
|
|
||||||
{
|
|
||||||
return DbType.UInt32;
|
|
||||||
}
|
|
||||||
else if (type == typeof (Int64))
|
|
||||||
{
|
|
||||||
return DbType.Int64;
|
|
||||||
}
|
|
||||||
else if (type == typeof (UInt64))
|
|
||||||
{
|
|
||||||
return DbType.UInt64;
|
|
||||||
}
|
|
||||||
else if (type == typeof (Double))
|
|
||||||
{
|
|
||||||
return DbType.Double;
|
|
||||||
}
|
|
||||||
else if (type == typeof (Boolean))
|
|
||||||
{
|
|
||||||
return DbType.Boolean;
|
|
||||||
}
|
|
||||||
else if (type == typeof (Byte[]))
|
|
||||||
{
|
|
||||||
return DbType.Binary;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return DbType.String;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">a Type</param>
|
|
||||||
/// <returns>a string</returns>
|
|
||||||
/// <remarks>this is something we'll need to implement for each db slightly differently.</remarks>
|
|
||||||
public static string sqliteType(Type type)
|
|
||||||
{
|
|
||||||
if (type == typeof (String))
|
|
||||||
{
|
|
||||||
return "varchar(255)";
|
|
||||||
}
|
|
||||||
else if (type == typeof (Int32))
|
|
||||||
{
|
|
||||||
return "integer";
|
|
||||||
}
|
|
||||||
else if (type == typeof (UInt32))
|
|
||||||
{
|
|
||||||
return "integer";
|
|
||||||
}
|
|
||||||
else if (type == typeof (Int64))
|
|
||||||
{
|
|
||||||
return "varchar(255)";
|
|
||||||
}
|
|
||||||
else if (type == typeof (UInt64))
|
|
||||||
{
|
|
||||||
return "varchar(255)";
|
|
||||||
}
|
|
||||||
else if (type == typeof (Double))
|
|
||||||
{
|
|
||||||
return "float";
|
|
||||||
}
|
|
||||||
else if (type == typeof (Boolean))
|
|
||||||
{
|
|
||||||
return "integer";
|
|
||||||
}
|
|
||||||
else if (type == typeof (Byte[]))
|
|
||||||
{
|
|
||||||
return "blob";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "string";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,155 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 OpenSimulator 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.Data;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
using log4net;
|
|
||||||
using OpenMetaverse;
|
|
||||||
using OpenSim.Framework;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// A MySQL Interface for the Asset Server
|
|
||||||
/// </summary>
|
|
||||||
public class SQLiteXInventoryData : IXInventoryData
|
|
||||||
{
|
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private SQLiteGenericTableHandler<XInventoryFolder> m_Folders;
|
|
||||||
private SqliteItemHandler m_Items;
|
|
||||||
|
|
||||||
public SQLiteXInventoryData(string conn, string realm)
|
|
||||||
{
|
|
||||||
m_Folders = new SQLiteGenericTableHandler<XInventoryFolder>(
|
|
||||||
conn, "inventoryfolders", "InventoryStore");
|
|
||||||
m_Items = new SqliteItemHandler(
|
|
||||||
conn, "inventoryitems", String.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public XInventoryFolder[] GetFolders(string[] fields, string[] vals)
|
|
||||||
{
|
|
||||||
return m_Folders.Get(fields, vals);
|
|
||||||
}
|
|
||||||
|
|
||||||
public XInventoryItem[] GetItems(string[] fields, string[] vals)
|
|
||||||
{
|
|
||||||
return m_Items.Get(fields, vals);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool StoreFolder(XInventoryFolder folder)
|
|
||||||
{
|
|
||||||
return m_Folders.Store(folder);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool StoreItem(XInventoryItem item)
|
|
||||||
{
|
|
||||||
return m_Items.Store(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeleteFolders(string field, string val)
|
|
||||||
{
|
|
||||||
return m_Folders.Delete(field, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DeleteItems(string field, string val)
|
|
||||||
{
|
|
||||||
return m_Items.Delete(field, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
|
||||||
{
|
|
||||||
return m_Items.MoveItem(id, newParent);
|
|
||||||
}
|
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
|
||||||
{
|
|
||||||
return m_Items.GetActiveGestures(principalID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
|
||||||
{
|
|
||||||
return m_Items.GetAssetPermissions(principalID, assetID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SqliteItemHandler : SQLiteGenericTableHandler<XInventoryItem>
|
|
||||||
{
|
|
||||||
public SqliteItemHandler(string c, string t, string m) :
|
|
||||||
base(c, t, m)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool MoveItem(string id, string newParent)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = String.Format("update {0} set parentFolderID = :ParentFolderID where inventoryID = :InventoryID", m_Realm);
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":ParentFolderID", newParent));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":InventoryID", id));
|
|
||||||
|
|
||||||
return ExecuteNonQuery(cmd, m_Connection) == 0 ? false : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public XInventoryItem[] GetActiveGestures(UUID principalID)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
cmd.CommandText = String.Format("select * from inventoryitems where avatarId = :uuid and assetType = :type and flags = 1", m_Realm);
|
|
||||||
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":uuid", principalID.ToString()));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":type", (int)AssetType.Gesture));
|
|
||||||
|
|
||||||
return DoQuery(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int GetAssetPermissions(UUID principalID, UUID assetID)
|
|
||||||
{
|
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
|
||||||
|
|
||||||
cmd.CommandText = String.Format("select inventoryCurrentPermissions from inventoryitems where avatarID = :PrincipalID and assetID = :AssetID", m_Realm);
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":PrincipalID", principalID.ToString()));
|
|
||||||
cmd.Parameters.Add(new SqliteParameter(":AssetID", assetID.ToString()));
|
|
||||||
|
|
||||||
IDataReader reader = ExecuteReader(cmd, m_Connection);
|
|
||||||
|
|
||||||
int perms = 0;
|
|
||||||
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
perms |= Convert.ToInt32(reader["inventoryCurrentPermissions"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
reader.Close();
|
|
||||||
CloseCommand(cmd);
|
|
||||||
|
|
||||||
return perms;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1143,7 +1143,17 @@ namespace OpenSim.Framework
|
||||||
void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags,
|
void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags,
|
||||||
uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner);
|
uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner);
|
||||||
|
|
||||||
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData,
|
/// <summary>
|
||||||
|
/// Send land properties to the client.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sequence_id"></param>
|
||||||
|
/// <param name="snap_selection"></param>
|
||||||
|
/// <param name="request_result"></param>
|
||||||
|
/// <param name="lo"></param></param>
|
||||||
|
/// <param name="parcelObjectCapacity">/param>
|
||||||
|
/// <param name="simObjectCapacity"></param>
|
||||||
|
/// <param name="regionFlags"></param>
|
||||||
|
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo,
|
||||||
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity,
|
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity,
|
||||||
uint regionFlags);
|
uint regionFlags);
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// </param>
|
/// </param>
|
||||||
void Clear(bool setupDefaultParcel);
|
void Clear(bool setupDefaultParcel);
|
||||||
|
|
||||||
bool IsLandPrimCountTainted();
|
|
||||||
bool IsForcefulBansAllowed();
|
bool IsForcefulBansAllowed();
|
||||||
void UpdateLandObject(int localID, LandData data);
|
void UpdateLandObject(int localID, LandData data);
|
||||||
void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient);
|
void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient);
|
|
@ -27,10 +27,8 @@
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
|
||||||
using OpenSim.Region.Framework.Scenes;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Interfaces
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj);
|
public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj);
|
||||||
public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj);
|
public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj);
|
||||||
|
@ -45,6 +43,11 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
bool[,] LandBitmap { get; set; }
|
bool[,] LandBitmap { get; set; }
|
||||||
UUID RegionUUID { get; }
|
UUID RegionUUID { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prim counts for this land object.
|
||||||
|
/// </summary>
|
||||||
|
IPrimCounts PrimCounts { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The start point for the land object. This is the western-most point as one scans land working from
|
/// The start point for the land object. This is the western-most point as one scans land working from
|
||||||
/// north to south.
|
/// north to south.
|
||||||
|
@ -79,17 +82,36 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
void ForceUpdateLandInfo();
|
void ForceUpdateLandInfo();
|
||||||
void SetLandBitmap(bool[,] bitmap);
|
void SetLandBitmap(bool[,] bitmap);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a land bitmap that would cover an entire region.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The bitmap created.</returns>
|
||||||
bool[,] BasicFullRegionLandBitmap();
|
bool[,] BasicFullRegionLandBitmap();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a square land bitmap.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Land co-ordinates are zero indexed. The inputs are treated as points. So if you want to create a bitmap
|
||||||
|
/// that covers an entire 256 x 256m region apart from a strip of land on the east, then you would need to
|
||||||
|
/// specify start_x = 0, start_y = 0, end_x = 252 (or anything up to 255), end_y = 256.
|
||||||
|
///
|
||||||
|
/// At the moment, the smallest parcel of land is 4m x 4m, so if the
|
||||||
|
/// region is 256 x 256m (the SL size), the bitmap returned will start at (0,0) and end at (63,63).
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="start_x"></param>
|
||||||
|
/// <param name="start_y"></param>
|
||||||
|
/// <param name="end_x"></param>
|
||||||
|
/// <param name="end_y"></param>
|
||||||
|
/// <returns>The bitmap created.</returns>
|
||||||
bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y);
|
bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y);
|
||||||
|
|
||||||
bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value);
|
bool[,] ModifyLandBitmapSquare(bool[,] land_bitmap, int start_x, int start_y, int end_x, int end_y, bool set_value);
|
||||||
bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add);
|
bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add);
|
||||||
void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client);
|
void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client);
|
||||||
void SendLandObjectOwners(IClientAPI remote_client);
|
void SendLandObjectOwners(IClientAPI remote_client);
|
||||||
void ReturnObject(SceneObjectGroup obj);
|
|
||||||
void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client);
|
void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client);
|
||||||
void ResetLandPrimCounts();
|
void ResetOverMeRecord();
|
||||||
void AddPrimToCount(SceneObjectGroup obj);
|
|
||||||
void RemovePrimFromCount(SceneObjectGroup obj);
|
|
||||||
void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area);
|
void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area);
|
||||||
|
|
||||||
void DeedToGroup(UUID groupID);
|
void DeedToGroup(UUID groupID);
|
|
@ -25,50 +25,50 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading;
|
|
||||||
using log4net;
|
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
|
||||||
using Mono.Data.SqliteClient;
|
|
||||||
|
|
||||||
namespace OpenSim.Data.SQLiteLegacy
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public interface IPrimCounts
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A SQLite Interface for Avatar Data
|
/// Parcel owner owned prims
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SQLiteAvatarData : SQLiteGenericTableHandler<AvatarBaseData>,
|
int Owner { get; }
|
||||||
IAvatarData
|
|
||||||
{
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
public SQLiteAvatarData(string connectionString, string realm) :
|
/// <summary>
|
||||||
base(connectionString, realm, "Avatar")
|
/// Parcel group owned prims
|
||||||
{
|
/// </summary>
|
||||||
|
int Group { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prims owned by others (not parcel owner or parcel group).
|
||||||
|
/// </summary>
|
||||||
|
int Others { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Selected prims
|
||||||
|
/// </summary>
|
||||||
|
int Selected { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total prims on the parcel.
|
||||||
|
/// </summary>
|
||||||
|
int Total { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prims on the simulator that are owned by the parcel owner, even if they are in other parcels.
|
||||||
|
/// </summary>
|
||||||
|
int Simulator { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prims per individual users.
|
||||||
|
/// </summary>
|
||||||
|
IUserPrimCounts Users { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Delete(UUID principalID, string name)
|
public interface IUserPrimCounts
|
||||||
{
|
{
|
||||||
SqliteCommand cmd = new SqliteCommand();
|
int this[UUID agentID] { get; }
|
||||||
|
|
||||||
cmd.CommandText = String.Format("delete from {0} where `PrincipalID` = :PrincipalID and `Name` = :Name", m_Realm);
|
|
||||||
cmd.Parameters.Add(":PrincipalID", principalID.ToString());
|
|
||||||
cmd.Parameters.Add(":Name", name);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (ExecuteNonQuery(cmd, m_Connection) > 0)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
CloseCommand(cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,12 +54,10 @@ namespace OpenSim.Framework
|
||||||
private int _claimPrice = 0; //Unemplemented
|
private int _claimPrice = 0; //Unemplemented
|
||||||
private UUID _globalID = UUID.Zero;
|
private UUID _globalID = UUID.Zero;
|
||||||
private UUID _groupID = UUID.Zero;
|
private UUID _groupID = UUID.Zero;
|
||||||
private int _groupPrims = 0;
|
|
||||||
private bool _isGroupOwned = false;
|
private bool _isGroupOwned = false;
|
||||||
private byte[] _bitmap = new byte[512];
|
private byte[] _bitmap = new byte[512];
|
||||||
private string _description = String.Empty;
|
private string _description = String.Empty;
|
||||||
|
|
||||||
|
|
||||||
private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
|
private uint _flags = (uint) ParcelFlags.AllowFly | (uint) ParcelFlags.AllowLandmark |
|
||||||
(uint) ParcelFlags.AllowAPrimitiveEntry |
|
(uint) ParcelFlags.AllowAPrimitiveEntry |
|
||||||
(uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform |
|
(uint) ParcelFlags.AllowDeedToGroup | (uint) ParcelFlags.AllowTerraform |
|
||||||
|
@ -72,17 +70,13 @@ namespace OpenSim.Framework
|
||||||
private int _localID = 0;
|
private int _localID = 0;
|
||||||
private byte _mediaAutoScale = 0;
|
private byte _mediaAutoScale = 0;
|
||||||
private UUID _mediaID = UUID.Zero;
|
private UUID _mediaID = UUID.Zero;
|
||||||
|
|
||||||
private string _mediaURL = String.Empty;
|
private string _mediaURL = String.Empty;
|
||||||
private string _musicURL = String.Empty;
|
private string _musicURL = String.Empty;
|
||||||
private int _otherPrims = 0;
|
|
||||||
private UUID _ownerID = UUID.Zero;
|
private UUID _ownerID = UUID.Zero;
|
||||||
private int _ownerPrims = 0;
|
|
||||||
private List<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
private List<ParcelManager.ParcelAccessEntry> _parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||||
private float _passHours = 0;
|
private float _passHours = 0;
|
||||||
private int _passPrice = 0;
|
private int _passPrice = 0;
|
||||||
private int _salePrice = 0; //Unemeplemented. Parcels price.
|
private int _salePrice = 0; //Unemeplemented. Parcels price.
|
||||||
private int _selectedPrims = 0;
|
|
||||||
private int _simwideArea = 0;
|
private int _simwideArea = 0;
|
||||||
private int _simwidePrims = 0;
|
private int _simwidePrims = 0;
|
||||||
private UUID _snapshotID = UUID.Zero;
|
private UUID _snapshotID = UUID.Zero;
|
||||||
|
@ -283,19 +277,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of SceneObjectPart that are owned by a Group
|
|
||||||
/// </summary>
|
|
||||||
[XmlIgnore]
|
|
||||||
public int GroupPrims {
|
|
||||||
get {
|
|
||||||
return _groupPrims;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_groupPrims = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns true if the Land Parcel is owned by a group
|
/// Returns true if the Land Parcel is owned by a group
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -453,20 +434,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of SceneObjectPart that are owned by users who do not own the parcel
|
|
||||||
/// and don't have the 'group. These are elegable for AutoReturn collection
|
|
||||||
/// </summary>
|
|
||||||
[XmlIgnore]
|
|
||||||
public int OtherPrims {
|
|
||||||
get {
|
|
||||||
return _otherPrims;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_otherPrims = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Owner Avatar or Group of the parcel. Naturally, all land masses must be
|
/// Owner Avatar or Group of the parcel. Naturally, all land masses must be
|
||||||
/// owned by someone
|
/// owned by someone
|
||||||
|
@ -480,19 +447,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of SceneObjectPart that are owned by the owner of the parcel
|
|
||||||
/// </summary>
|
|
||||||
[XmlIgnore]
|
|
||||||
public int OwnerPrims {
|
|
||||||
get {
|
|
||||||
return _ownerPrims;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_ownerPrims = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of access data for the parcel. User data, some bitflags, and a time
|
/// List of access data for the parcel. User data, some bitflags, and a time
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -541,19 +495,6 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of SceneObjectPart that are currently selected by avatar
|
|
||||||
/// </summary>
|
|
||||||
[XmlIgnore]
|
|
||||||
public int SelectedPrims {
|
|
||||||
get {
|
|
||||||
return _selectedPrims;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_selectedPrims = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of meters^2 in the Simulator
|
/// Number of meters^2 in the Simulator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -619,7 +560,7 @@ namespace OpenSim.Framework
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
|
/// Autoreturn number of minutes to return SceneObjectGroup that are owned by someone who doesn't own
|
||||||
/// the parcel and isn't set to the same 'group' as the parcel.
|
/// the parcel and isn't set to the same 'group' as the parcel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int OtherCleanTime {
|
public int OtherCleanTime {
|
||||||
|
@ -666,10 +607,6 @@ namespace OpenSim.Framework
|
||||||
landData._claimPrice = _claimPrice;
|
landData._claimPrice = _claimPrice;
|
||||||
landData._globalID = _globalID;
|
landData._globalID = _globalID;
|
||||||
landData._groupID = _groupID;
|
landData._groupID = _groupID;
|
||||||
landData._groupPrims = _groupPrims;
|
|
||||||
landData._otherPrims = _otherPrims;
|
|
||||||
landData._ownerPrims = _ownerPrims;
|
|
||||||
landData._selectedPrims = _selectedPrims;
|
|
||||||
landData._isGroupOwned = _isGroupOwned;
|
landData._isGroupOwned = _isGroupOwned;
|
||||||
landData._localID = _localID;
|
landData._localID = _localID;
|
||||||
landData._landingType = _landingType;
|
landData._landingType = _landingType;
|
||||||
|
|
|
@ -347,7 +347,6 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
public bool commFailTF = false;
|
public bool commFailTF = false;
|
||||||
public ConfigurationMember configMember;
|
public ConfigurationMember configMember;
|
||||||
public string DataStore = String.Empty;
|
|
||||||
public string RegionFile = String.Empty;
|
public string RegionFile = String.Empty;
|
||||||
public bool isSandbox = false;
|
public bool isSandbox = false;
|
||||||
public bool Persistent = true;
|
public bool Persistent = true;
|
||||||
|
@ -746,10 +745,6 @@ namespace OpenSim.Framework
|
||||||
m_regionLocX = Convert.ToUInt32(locationElements[0]);
|
m_regionLocX = Convert.ToUInt32(locationElements[0]);
|
||||||
m_regionLocY = Convert.ToUInt32(locationElements[1]);
|
m_regionLocY = Convert.ToUInt32(locationElements[1]);
|
||||||
|
|
||||||
|
|
||||||
// Datastore (is this implemented? Omitted from example!)
|
|
||||||
DataStore = config.GetString("Datastore", String.Empty);
|
|
||||||
|
|
||||||
// Internal IP
|
// Internal IP
|
||||||
IPAddress address;
|
IPAddress address;
|
||||||
|
|
||||||
|
@ -846,9 +841,6 @@ namespace OpenSim.Framework
|
||||||
string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY);
|
string location = String.Format("{0},{1}", m_regionLocX, m_regionLocY);
|
||||||
config.Set("Location", location);
|
config.Set("Location", location);
|
||||||
|
|
||||||
if (DataStore != String.Empty)
|
|
||||||
config.Set("Datastore", DataStore);
|
|
||||||
|
|
||||||
config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
|
config.Set("InternalAddress", m_internalEndPoint.Address.ToString());
|
||||||
config.Set("InternalPort", m_internalEndPoint.Port);
|
config.Set("InternalPort", m_internalEndPoint.Port);
|
||||||
|
|
||||||
|
@ -1025,9 +1017,6 @@ namespace OpenSim.Framework
|
||||||
case "sim_location_y":
|
case "sim_location_y":
|
||||||
m_regionLocY = (uint) configuration_result;
|
m_regionLocY = (uint) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "datastore":
|
|
||||||
DataStore = (string) configuration_result;
|
|
||||||
break;
|
|
||||||
case "internal_ip_address":
|
case "internal_ip_address":
|
||||||
IPAddress address = (IPAddress) configuration_result;
|
IPAddress address = (IPAddress) configuration_result;
|
||||||
m_internalEndPoint = new IPEndPoint(address, 0);
|
m_internalEndPoint = new IPEndPoint(address, 0);
|
||||||
|
@ -1175,11 +1164,6 @@ namespace OpenSim.Framework
|
||||||
return regionInfo;
|
return regionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInternalEndPointPort()
|
|
||||||
{
|
|
||||||
return m_internalEndPoint.Port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dictionary<string, object> ToKeyValuePairs()
|
public Dictionary<string, object> ToKeyValuePairs()
|
||||||
{
|
{
|
||||||
Dictionary<string, object> kvp = new Dictionary<string, object>();
|
Dictionary<string, object> kvp = new Dictionary<string, object>();
|
||||||
|
|
|
@ -25,15 +25,19 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using log4net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Framework.RegionLoader.Filesystem
|
namespace OpenSim.Framework.RegionLoader.Filesystem
|
||||||
{
|
{
|
||||||
public class RegionLoaderFileSystem : IRegionLoader
|
public class RegionLoaderFileSystem : IRegionLoader
|
||||||
{
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private IConfigSource m_configSource;
|
private IConfigSource m_configSource;
|
||||||
|
|
||||||
public void SetIniConfigSource(IConfigSource configSource)
|
public void SetIniConfigSource(IConfigSource configSource)
|
||||||
|
@ -63,32 +67,44 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
|
||||||
string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
|
||||||
string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
||||||
|
|
||||||
|
// Create an empty Regions.ini if there are no existing config files.
|
||||||
if (configFiles.Length == 0 && iniFiles.Length == 0)
|
if (configFiles.Length == 0 && iniFiles.Length == 0)
|
||||||
{
|
{
|
||||||
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
|
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
|
||||||
iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath);
|
||||||
|
|
||||||
List<RegionInfo> regionInfos = new List<RegionInfo>();
|
List<RegionInfo> regionInfos = new List<RegionInfo>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (string file in iniFiles)
|
foreach (string file in iniFiles)
|
||||||
{
|
{
|
||||||
|
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
|
||||||
|
|
||||||
IConfigSource source = new IniConfigSource(file);
|
IConfigSource source = new IniConfigSource(file);
|
||||||
|
|
||||||
foreach (IConfig config in source.Configs)
|
foreach (IConfig config in source.Configs)
|
||||||
{
|
{
|
||||||
//m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name);
|
|
||||||
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
|
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
|
||||||
regionInfos.Add(regionInfo);
|
regionInfos.Add(regionInfo);
|
||||||
|
|
||||||
|
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string file in configFiles)
|
foreach (string file in configFiles)
|
||||||
{
|
{
|
||||||
|
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
|
||||||
|
|
||||||
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
|
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
|
||||||
regionInfos.Add(regionInfo);
|
regionInfos.Add(regionInfo);
|
||||||
|
|
||||||
|
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,9 @@ namespace OpenSim.Framework.RegionLoader.Web
|
||||||
{
|
{
|
||||||
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
|
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
|
||||||
webRequest.Timeout = 30000; //30 Second Timeout
|
webRequest.Timeout = 30000; //30 Second Timeout
|
||||||
m_log.Debug("[WEBLOADER]: Sending Download Request...");
|
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
|
||||||
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
|
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
|
||||||
m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
|
m_log.Debug("[WEBLOADER]: Downloading region information...");
|
||||||
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
|
||||||
string xmlSource = String.Empty;
|
string xmlSource = String.Empty;
|
||||||
string tempStr = reader.ReadLine();
|
string tempStr = reader.ReadLine();
|
||||||
|
|
|
@ -44,9 +44,6 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||||
private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
private static string preSerialized = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList />\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||||
private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>2009-10-01T00:00:00</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>2010-10-20T00:00:00</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
private static string preSerializedWithParcelAccessList = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n<LandData>\n <Area>128</Area>\n <AuctionID>0</AuctionID>\n <AuthBuyerID>00000000-0000-0000-0000-000000000000</AuthBuyerID>\n <Category>10</Category>\n <ClaimDate>0</ClaimDate>\n <ClaimPrice>0</ClaimPrice>\n <GlobalID>54ff9641-dd40-4a2c-b1f1-47dd3af24e50</GlobalID>\n <GroupID>d740204e-bbbf-44aa-949d-02c7d739f6a5</GroupID>\n <IsGroupOwned>False</IsGroupOwned>\n <Bitmap>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</Bitmap>\n <Description>land data to test LandDataSerializer</Description>\n <Flags>536870944</Flags>\n <LandingType>2</LandingType>\n <Name>LandDataSerializerTest Land</Name>\n <Status>0</Status>\n <LocalID>0</LocalID>\n <MediaAutoScale>1</MediaAutoScale>\n <MediaID>d4452578-2f25-4b97-a81b-819af559cfd7</MediaID>\n <MediaURL>http://videos.opensimulator.org/bumblebee.mp4</MediaURL>\n <MusicURL />\n <OwnerID>1b8eedf9-6d15-448b-8015-24286f1756bf</OwnerID>\n <ParcelAccessList>\n <ParcelAccessEntry>\n <AgentID>62d65d45-c91a-4f77-862c-46557d978b6c</AgentID>\n <Time>2009-10-01T00:00:00</Time>\n <AccessList>2</AccessList>\n </ParcelAccessEntry>\n <ParcelAccessEntry>\n <AgentID>ec2a8d18-2378-4fe0-8b68-2a31b57c481e</AgentID>\n <Time>2010-10-20T00:00:00</Time>\n <AccessList>1</AccessList>\n </ParcelAccessEntry>\n </ParcelAccessList>\n <PassHours>0</PassHours>\n <PassPrice>0</PassPrice>\n <SalePrice>0</SalePrice>\n <SnapshotID>00000000-0000-0000-0000-000000000000</SnapshotID>\n <UserLocation><0, 0, 0></UserLocation>\n <UserLookAt><0, 0, 0></UserLookAt>\n <Dwell>0</Dwell>\n <OtherCleanTime>0</OtherCleanTime>\n</LandData>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void setup()
|
public void setup()
|
||||||
{
|
{
|
||||||
|
@ -62,7 +59,6 @@ namespace OpenSim.Framework.Serialization.Tests
|
||||||
this.land.ClaimPrice = 0;
|
this.land.ClaimPrice = 0;
|
||||||
this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
|
this.land.GlobalID = new UUID("54ff9641-dd40-4a2c-b1f1-47dd3af24e50");
|
||||||
this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
|
this.land.GroupID = new UUID("d740204e-bbbf-44aa-949d-02c7d739f6a5");
|
||||||
this.land.GroupPrims = 0;
|
|
||||||
this.land.Description = "land data to test LandDataSerializer";
|
this.land.Description = "land data to test LandDataSerializer";
|
||||||
this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat);
|
this.land.Flags = (uint)(ParcelFlags.AllowDamage | ParcelFlags.AllowVoiceChat);
|
||||||
this.land.LandingType = (byte)LandingType.Direct;
|
this.land.LandingType = (byte)LandingType.Direct;
|
||||||
|
|
|
@ -252,8 +252,6 @@ namespace OpenSim
|
||||||
// load Crash directory config
|
// load Crash directory config
|
||||||
m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
|
m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (background)
|
if (background)
|
||||||
{
|
{
|
||||||
m_sim = new OpenSimBackground(configSource);
|
m_sim = new OpenSimBackground(configSource);
|
||||||
|
@ -261,14 +259,8 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_sim = new OpenSim(configSource);
|
m_sim = new OpenSim(configSource);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_sim.Startup();
|
m_sim.Startup();
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace OpenSim
|
||||||
m_log.Info("====================================================================");
|
m_log.Info("====================================================================");
|
||||||
m_log.Info("========================= STARTING OPENSIM =========================");
|
m_log.Info("========================= STARTING OPENSIM =========================");
|
||||||
m_log.Info("====================================================================");
|
m_log.Info("====================================================================");
|
||||||
m_log.InfoFormat("[OPENSIM MAIN]: Running ");
|
|
||||||
//m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
|
//m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
|
||||||
// http://msdn.microsoft.com/en-us/library/bb384202.aspx
|
// http://msdn.microsoft.com/en-us/library/bb384202.aspx
|
||||||
//GCSettings.LatencyMode = GCLatencyMode.Batch;
|
//GCSettings.LatencyMode = GCLatencyMode.Batch;
|
||||||
|
@ -341,7 +341,12 @@ namespace OpenSim
|
||||||
|
|
||||||
m_console.Commands.AddCommand("region", false, "config get",
|
m_console.Commands.AddCommand("region", false, "config get",
|
||||||
"config get [<section>] [<key>]",
|
"config get [<section>] [<key>]",
|
||||||
"Show a config option",
|
"Synonym for config show",
|
||||||
|
HandleConfig);
|
||||||
|
|
||||||
|
m_console.Commands.AddCommand("region", false, "config show",
|
||||||
|
"config show [<section>] [<key>]",
|
||||||
|
"Show config information",
|
||||||
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
|
"If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine
|
||||||
+ "If a section is given but not a field, then all fields in that section are printed.",
|
+ "If a section is given but not a field, then all fields in that section are printed.",
|
||||||
HandleConfig);
|
HandleConfig);
|
||||||
|
@ -593,7 +598,9 @@ namespace OpenSim
|
||||||
|
|
||||||
if (cmdparams.Length > 0)
|
if (cmdparams.Length > 0)
|
||||||
{
|
{
|
||||||
switch (cmdparams[0].ToLower())
|
string firstParam = cmdparams[0].ToLower();
|
||||||
|
|
||||||
|
switch (firstParam)
|
||||||
{
|
{
|
||||||
case "set":
|
case "set":
|
||||||
if (cmdparams.Length < 4)
|
if (cmdparams.Length < 4)
|
||||||
|
@ -618,6 +625,7 @@ namespace OpenSim
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "get":
|
case "get":
|
||||||
|
case "show":
|
||||||
if (cmdparams.Length == 1)
|
if (cmdparams.Length == 1)
|
||||||
{
|
{
|
||||||
foreach (IConfig config in m_config.Source.Configs)
|
foreach (IConfig config in m_config.Source.Configs)
|
||||||
|
@ -654,8 +662,8 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Notice("Syntax: config get [<section>] [<key>]");
|
Notice("Syntax: config {0} [<section>] [<key>]", firstParam);
|
||||||
Notice("Example: config get ScriptEngine.DotNetEngine NumberOfScriptThreads");
|
Notice("Example: config {0} ScriptEngine.DotNetEngine NumberOfScriptThreads", firstParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -793,30 +793,27 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load the estate information for the provided RegionInfo object.
|
/// Create an estate with an initial region.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method doesn't allow an estate to be created with the same name as existing estates.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="regInfo"></param>
|
/// <param name="regInfo"></param>
|
||||||
public void PopulateRegionEstateInfo(RegionInfo regInfo)
|
/// <param name="existingName">A list of estate names that already exist.</param>
|
||||||
{
|
/// <returns>true if the estate was created, false otherwise</returns>
|
||||||
IEstateDataService estateDataService = EstateDataService;
|
public bool CreateEstate(RegionInfo regInfo, List<string> existingNames)
|
||||||
|
|
||||||
if (estateDataService != null)
|
|
||||||
{
|
|
||||||
regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (regInfo.EstateSettings.EstateID == 0) // No record at all
|
|
||||||
{
|
|
||||||
MainConsole.Instance.Output("Your region is not part of an estate.");
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" });
|
|
||||||
if (response == "no")
|
|
||||||
{
|
{
|
||||||
// Create a new estate
|
// Create a new estate
|
||||||
regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
|
regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true);
|
||||||
|
string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
|
||||||
|
|
||||||
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
|
if (existingNames.Contains(newName))
|
||||||
|
{
|
||||||
|
MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
regInfo.EstateSettings.EstateName = newName;
|
||||||
|
|
||||||
// FIXME: Later on, the scene constructor will reload the estate settings no matter what.
|
// FIXME: Later on, the scene constructor will reload the estate settings no matter what.
|
||||||
// Therefore, we need to do an initial save here otherwise the new estate name will be reset
|
// Therefore, we need to do an initial save here otherwise the new estate name will be reset
|
||||||
|
@ -824,26 +821,75 @@ namespace OpenSim
|
||||||
// knows that the passed in settings in RegionInfo are already valid. Also, it might be
|
// knows that the passed in settings in RegionInfo are already valid. Also, it might be
|
||||||
// possible to eliminate some additional later saves made by callers of this method.
|
// possible to eliminate some additional later saves made by callers of this method.
|
||||||
regInfo.EstateSettings.Save();
|
regInfo.EstateSettings.Save();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load the estate information for the provided RegionInfo object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="regInfo"></param>
|
||||||
|
public void PopulateRegionEstateInfo(RegionInfo regInfo)
|
||||||
|
{
|
||||||
|
if (EstateDataService != null)
|
||||||
|
regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false);
|
||||||
|
|
||||||
|
if (regInfo.EstateSettings.EstateID == 0) // No record at all
|
||||||
|
{
|
||||||
|
MainConsole.Instance.OutputFormat("Region {0} is not part of an estate.", regInfo.RegionName);
|
||||||
|
|
||||||
|
List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll();
|
||||||
|
List<string> estateNames = new List<string>();
|
||||||
|
foreach (EstateSettings estate in estates)
|
||||||
|
estateNames.Add(estate.EstateName);
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if (estates.Count == 0)
|
||||||
|
{
|
||||||
|
MainConsole.Instance.Output("No existing estates found. You must create a new one.");
|
||||||
|
|
||||||
|
if (CreateEstate(regInfo, estateNames))
|
||||||
break;
|
break;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
|
string response
|
||||||
if (response == "None")
|
= MainConsole.Instance.CmdPrompt(
|
||||||
continue;
|
string.Format(
|
||||||
|
"Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName),
|
||||||
|
"yes",
|
||||||
|
new List<string>() { "yes", "no" });
|
||||||
|
|
||||||
List<int> estateIDs = estateDataService.GetEstates(response);
|
if (response == "no")
|
||||||
|
{
|
||||||
|
if (CreateEstate(regInfo, estateNames))
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response
|
||||||
|
= MainConsole.Instance.CmdPrompt(
|
||||||
|
string.Format(
|
||||||
|
"Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())),
|
||||||
|
estateNames[0]);
|
||||||
|
|
||||||
|
List<int> estateIDs = EstateDataService.GetEstates(response);
|
||||||
if (estateIDs.Count < 1)
|
if (estateIDs.Count < 1)
|
||||||
{
|
{
|
||||||
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
|
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int estateID = estateIDs[0];
|
int estateID = estateIDs[0];
|
||||||
|
|
||||||
regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
|
regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
|
||||||
if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
|
if (EstateDataService.LinkRegion(regInfo.RegionID, estateID))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
|
||||||
|
@ -852,7 +898,7 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class OpenSimConfigSource
|
public class OpenSimConfigSource
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,8 @@ using Timer = System.Timers.Timer;
|
||||||
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
using AssetLandmark = OpenSim.Framework.AssetLandmark;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace OpenSim.Region.ClientStack.LindenUDP
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
|
public delegate bool PacketMethod(IClientAPI simClient, Packet packet);
|
||||||
|
@ -298,6 +300,77 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <summary>Used to adjust Sun Orbit values so Linden based viewers properly position sun</summary>
|
/// <summary>Used to adjust Sun Orbit values so Linden based viewers properly position sun</summary>
|
||||||
private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f;
|
private const float m_sunPainDaHalfOrbitalCutoff = 4.712388980384689858f;
|
||||||
|
|
||||||
|
// First log file or time has expired, start writing to a new log file
|
||||||
|
//<MIC>
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
// THIS IS DEBUGGING CODE & SHOULD BE REMOVED
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
public class QueueLogger
|
||||||
|
{
|
||||||
|
public Int32 start = 0;
|
||||||
|
public StreamWriter Log = null;
|
||||||
|
private Dictionary<UUID,int> m_idMap = new Dictionary<UUID,int>();
|
||||||
|
|
||||||
|
public QueueLogger()
|
||||||
|
{
|
||||||
|
DateTime now = DateTime.Now;
|
||||||
|
String fname = String.Format("queue-{0}.log", now.ToString("yyyyMMddHHmmss"));
|
||||||
|
Log = new StreamWriter(fname);
|
||||||
|
|
||||||
|
start = Util.EnvironmentTickCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int LookupID(UUID uuid)
|
||||||
|
{
|
||||||
|
int localid;
|
||||||
|
if (! m_idMap.TryGetValue(uuid,out localid))
|
||||||
|
{
|
||||||
|
localid = m_idMap.Count + 1;
|
||||||
|
m_idMap[uuid] = localid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return localid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static QueueLogger QueueLog = null;
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
public void LogAvatarUpdateEvent(UUID client, UUID avatar, Int32 timeinqueue)
|
||||||
|
{
|
||||||
|
if (QueueLog == null)
|
||||||
|
QueueLog = new QueueLogger();
|
||||||
|
|
||||||
|
Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start);
|
||||||
|
lock(QueueLog)
|
||||||
|
{
|
||||||
|
int cid = QueueLog.LookupID(client);
|
||||||
|
int aid = QueueLog.LookupID(avatar);
|
||||||
|
QueueLog.Log.WriteLine("{0},AU,AV{1:D4},AV{2:D4},{3}",ticks,cid,aid,timeinqueue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
public void LogQueueProcessEvent(UUID client, PriorityQueue queue, uint maxup)
|
||||||
|
{
|
||||||
|
if (QueueLog == null)
|
||||||
|
QueueLog = new QueueLogger();
|
||||||
|
|
||||||
|
Int32 ticks = Util.EnvironmentTickCountSubtract(QueueLog.start);
|
||||||
|
lock(QueueLog)
|
||||||
|
{
|
||||||
|
int cid = QueueLog.LookupID(client);
|
||||||
|
QueueLog.Log.WriteLine("{0},PQ,AV{1:D4},{2},{3}",ticks,cid,maxup,queue.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
// -----------------------------------------------------------------
|
||||||
|
//</MIC>
|
||||||
|
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
|
protected static Dictionary<PacketType, PacketMethod> PacketHandlers = new Dictionary<PacketType, PacketMethod>(); //Global/static handlers for all clients
|
||||||
|
|
||||||
|
@ -3547,18 +3620,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
#region Primitive Packet/Data Sending Methods
|
#region Primitive Packet/Data Sending Methods
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate one of the object update packets based on PrimUpdateFlags
|
/// Generate one of the object update packets based on PrimUpdateFlags
|
||||||
/// and broadcast the packet to clients
|
/// and broadcast the packet to clients
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
|
public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
|
||||||
{
|
{
|
||||||
double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
//double priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||||
|
uint priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||||
|
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation), entity.LocalId);
|
m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags, m_scene.TimeDilation));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Int32 m_LastQueueFill = 0;
|
||||||
|
private uint m_maxUpdates = 0;
|
||||||
|
|
||||||
private void ProcessEntityUpdates(int maxUpdates)
|
private void ProcessEntityUpdates(int maxUpdates)
|
||||||
{
|
{
|
||||||
OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
|
OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
|
||||||
|
@ -3566,19 +3644,45 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
||||||
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseAgentUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
|
||||||
|
|
||||||
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
|
if (maxUpdates <= 0)
|
||||||
|
{
|
||||||
|
m_maxUpdates = Int32.MaxValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (m_maxUpdates == 0 || m_LastQueueFill == 0)
|
||||||
|
{
|
||||||
|
m_maxUpdates = (uint)maxUpdates;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Util.EnvironmentTickCountSubtract(m_LastQueueFill) < 200)
|
||||||
|
m_maxUpdates += 5;
|
||||||
|
else
|
||||||
|
m_maxUpdates = m_maxUpdates >> 1;
|
||||||
|
}
|
||||||
|
m_maxUpdates = Util.Clamp<uint>(m_maxUpdates,10,500);
|
||||||
|
}
|
||||||
|
m_LastQueueFill = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
int updatesThisCall = 0;
|
int updatesThisCall = 0;
|
||||||
|
|
||||||
|
//<MIC>
|
||||||
|
// DEBUGGING CODE... REMOVE
|
||||||
|
// LogQueueProcessEvent(this.m_agentId,m_entityUpdates,m_maxUpdates);
|
||||||
|
//</MIC>
|
||||||
// We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
|
// We must lock for both manipulating the kill record and sending the packet, in order to avoid a race
|
||||||
// condition where a kill can be processed before an out-of-date update for the same object.
|
// condition where a kill can be processed before an out-of-date update for the same object.
|
||||||
lock (m_killRecord)
|
lock (m_killRecord)
|
||||||
{
|
{
|
||||||
float avgTimeDilation = 1.0f;
|
float avgTimeDilation = 1.0f;
|
||||||
EntityUpdate update;
|
EntityUpdate update;
|
||||||
while (updatesThisCall < maxUpdates)
|
Int32 timeinqueue; // this is just debugging code & can be dropped later
|
||||||
|
|
||||||
|
while (updatesThisCall < m_maxUpdates)
|
||||||
{
|
{
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
if (!m_entityUpdates.TryDequeue(out update))
|
if (!m_entityUpdates.TryDequeue(out update, out timeinqueue))
|
||||||
break;
|
break;
|
||||||
avgTimeDilation += update.TimeDilation;
|
avgTimeDilation += update.TimeDilation;
|
||||||
avgTimeDilation *= 0.5f;
|
avgTimeDilation *= 0.5f;
|
||||||
|
@ -3679,36 +3783,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if (update.Entity is SceneObjectPart && ((SceneObjectPart)update.Entity).IsAttachment)
|
|
||||||
// {
|
|
||||||
// SceneObjectPart sop = (SceneObjectPart)update.Entity;
|
|
||||||
// string text = sop.Text;
|
|
||||||
// if (text.IndexOf("\n") >= 0)
|
|
||||||
// text = text.Remove(text.IndexOf("\n"));
|
|
||||||
//
|
|
||||||
// if (m_attachmentsSent.Contains(sop.ParentID))
|
|
||||||
// {
|
|
||||||
//// m_log.DebugFormat(
|
|
||||||
//// "[CLIENT]: Sending full info about attached prim {0} text {1}",
|
|
||||||
//// sop.LocalId, text);
|
|
||||||
//
|
|
||||||
// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
|
|
||||||
//
|
|
||||||
// m_attachmentsSent.Add(sop.LocalId);
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.DebugFormat(
|
|
||||||
// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
|
|
||||||
// sop.LocalId, text, sop.ParentID);
|
|
||||||
//
|
|
||||||
// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
|
objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!canUseImproved)
|
else if (!canUseImproved)
|
||||||
|
@ -3802,26 +3877,24 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
public void ReprioritizeUpdates()
|
public void ReprioritizeUpdates()
|
||||||
{
|
{
|
||||||
//m_log.Debug("[CLIENT]: Reprioritizing prim updates for " + m_firstName + " " + m_lastName);
|
|
||||||
|
|
||||||
lock (m_entityUpdates.SyncRoot)
|
lock (m_entityUpdates.SyncRoot)
|
||||||
m_entityUpdates.Reprioritize(UpdatePriorityHandler);
|
m_entityUpdates.Reprioritize(UpdatePriorityHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool UpdatePriorityHandler(ref double priority, uint localID)
|
private bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity)
|
||||||
{
|
{
|
||||||
EntityBase entity;
|
if (entity != null)
|
||||||
if (m_scene.Entities.TryGetValue(localID, out entity))
|
|
||||||
{
|
{
|
||||||
priority = m_prioritizer.GetUpdatePriority(this, entity);
|
priority = m_prioritizer.GetUpdatePriority(this, entity);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return priority != double.NaN;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FlushPrimUpdates()
|
public void FlushPrimUpdates()
|
||||||
{
|
{
|
||||||
m_log.Debug("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName);
|
m_log.WarnFormat("[CLIENT]: Flushing prim updates to " + m_firstName + " " + m_lastName);
|
||||||
|
|
||||||
while (m_entityUpdates.Count > 0)
|
while (m_entityUpdates.Count > 0)
|
||||||
ProcessEntityUpdates(-1);
|
ProcessEntityUpdates(-1);
|
||||||
|
@ -4272,8 +4345,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OutPacket(packet, ThrottleOutPacketType.Task);
|
OutPacket(packet, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
|
public void SendLandProperties(
|
||||||
|
int sequence_id, bool snap_selection, int request_result, ILandObject lo,
|
||||||
|
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name);
|
||||||
|
|
||||||
|
LandData landData = lo.LandData;
|
||||||
|
|
||||||
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
|
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
|
||||||
|
|
||||||
updateMessage.AABBMax = landData.AABBMax;
|
updateMessage.AABBMax = landData.AABBMax;
|
||||||
|
@ -4281,15 +4360,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
updateMessage.Area = landData.Area;
|
updateMessage.Area = landData.Area;
|
||||||
updateMessage.AuctionID = landData.AuctionID;
|
updateMessage.AuctionID = landData.AuctionID;
|
||||||
updateMessage.AuthBuyerID = landData.AuthBuyerID;
|
updateMessage.AuthBuyerID = landData.AuthBuyerID;
|
||||||
|
|
||||||
updateMessage.Bitmap = landData.Bitmap;
|
updateMessage.Bitmap = landData.Bitmap;
|
||||||
|
|
||||||
updateMessage.Desc = landData.Description;
|
updateMessage.Desc = landData.Description;
|
||||||
updateMessage.Category = landData.Category;
|
updateMessage.Category = landData.Category;
|
||||||
updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate);
|
updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate);
|
||||||
updateMessage.ClaimPrice = landData.ClaimPrice;
|
updateMessage.ClaimPrice = landData.ClaimPrice;
|
||||||
updateMessage.GroupID = landData.GroupID;
|
updateMessage.GroupID = landData.GroupID;
|
||||||
updateMessage.GroupPrims = landData.GroupPrims;
|
|
||||||
updateMessage.IsGroupOwned = landData.IsGroupOwned;
|
updateMessage.IsGroupOwned = landData.IsGroupOwned;
|
||||||
updateMessage.LandingType = (LandingType) landData.LandingType;
|
updateMessage.LandingType = (LandingType) landData.LandingType;
|
||||||
updateMessage.LocalID = landData.LocalID;
|
updateMessage.LocalID = landData.LocalID;
|
||||||
|
@ -4310,9 +4386,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
updateMessage.Name = landData.Name;
|
updateMessage.Name = landData.Name;
|
||||||
updateMessage.OtherCleanTime = landData.OtherCleanTime;
|
updateMessage.OtherCleanTime = landData.OtherCleanTime;
|
||||||
updateMessage.OtherCount = 0; //TODO: Unimplemented
|
updateMessage.OtherCount = 0; //TODO: Unimplemented
|
||||||
updateMessage.OtherPrims = landData.OtherPrims;
|
|
||||||
updateMessage.OwnerID = landData.OwnerID;
|
updateMessage.OwnerID = landData.OwnerID;
|
||||||
updateMessage.OwnerPrims = landData.OwnerPrims;
|
|
||||||
updateMessage.ParcelFlags = (ParcelFlags) landData.Flags;
|
updateMessage.ParcelFlags = (ParcelFlags) landData.Flags;
|
||||||
updateMessage.ParcelPrimBonus = simObjectBonusFactor;
|
updateMessage.ParcelPrimBonus = simObjectBonusFactor;
|
||||||
updateMessage.PassHours = landData.PassHours;
|
updateMessage.PassHours = landData.PassHours;
|
||||||
|
@ -4328,9 +4402,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
updateMessage.RentPrice = 0;
|
updateMessage.RentPrice = 0;
|
||||||
updateMessage.RequestResult = (ParcelResult) request_result;
|
updateMessage.RequestResult = (ParcelResult) request_result;
|
||||||
updateMessage.SalePrice = landData.SalePrice;
|
updateMessage.SalePrice = landData.SalePrice;
|
||||||
updateMessage.SelectedPrims = landData.SelectedPrims;
|
|
||||||
updateMessage.SelfCount = 0; //TODO: Unimplemented
|
updateMessage.SelfCount = 0; //TODO: Unimplemented
|
||||||
updateMessage.SequenceID = sequence_id;
|
updateMessage.SequenceID = sequence_id;
|
||||||
|
|
||||||
if (landData.SimwideArea > 0)
|
if (landData.SimwideArea > 0)
|
||||||
{
|
{
|
||||||
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
|
||||||
|
@ -4340,12 +4414,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
{
|
{
|
||||||
updateMessage.SimWideMaxPrims = 0;
|
updateMessage.SimWideMaxPrims = 0;
|
||||||
}
|
}
|
||||||
updateMessage.SimWideTotalPrims = landData.SimwidePrims;
|
|
||||||
updateMessage.SnapSelection = snap_selection;
|
updateMessage.SnapSelection = snap_selection;
|
||||||
updateMessage.SnapshotID = landData.SnapshotID;
|
updateMessage.SnapshotID = landData.SnapshotID;
|
||||||
updateMessage.Status = (ParcelStatus) landData.Status;
|
updateMessage.Status = (ParcelStatus) landData.Status;
|
||||||
updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims +
|
|
||||||
landData.SelectedPrims;
|
|
||||||
updateMessage.UserLocation = landData.UserLocation;
|
updateMessage.UserLocation = landData.UserLocation;
|
||||||
updateMessage.UserLookAt = landData.UserLookAt;
|
updateMessage.UserLookAt = landData.UserLookAt;
|
||||||
|
|
||||||
|
@ -4357,19 +4429,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
updateMessage.ObscureMusic = landData.ObscureMusic;
|
updateMessage.ObscureMusic = landData.ObscureMusic;
|
||||||
updateMessage.ObscureMedia = landData.ObscureMedia;
|
updateMessage.ObscureMedia = landData.ObscureMedia;
|
||||||
|
|
||||||
|
IPrimCounts pc = lo.PrimCounts;
|
||||||
|
updateMessage.OwnerPrims = pc.Owner;
|
||||||
|
updateMessage.GroupPrims = pc.Group;
|
||||||
|
updateMessage.OtherPrims = pc.Others;
|
||||||
|
updateMessage.SelectedPrims = pc.Selected;
|
||||||
|
updateMessage.TotalPrims = pc.Total;
|
||||||
|
updateMessage.SimWideTotalPrims = pc.Simulator;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
|
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
|
||||||
if (eq != null)
|
if (eq != null)
|
||||||
{
|
{
|
||||||
eq.ParcelProperties(updateMessage, this.AgentId);
|
eq.ParcelProperties(updateMessage, this.AgentId);
|
||||||
} else {
|
}
|
||||||
m_log.Warn("No EQ Interface when sending parcel data.");
|
else
|
||||||
|
{
|
||||||
|
m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString());
|
m_log.Error("[LLCLIENTVIEW]: Unable to send parcel data via eventqueue - exception: " + ex.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4929,7 +5011,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest);
|
AddLocalPacketHandler(PacketType.TeleportLocationRequest, HandleTeleportLocationRequest);
|
||||||
AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false);
|
AddLocalPacketHandler(PacketType.UUIDNameRequest, HandleUUIDNameRequest, false);
|
||||||
AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest);
|
AddLocalPacketHandler(PacketType.RegionHandleRequest, HandleRegionHandleRequest);
|
||||||
AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest, false);
|
AddLocalPacketHandler(PacketType.ParcelInfoRequest, HandleParcelInfoRequest);
|
||||||
AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false);
|
AddLocalPacketHandler(PacketType.ParcelAccessListRequest, HandleParcelAccessListRequest, false);
|
||||||
AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false);
|
AddLocalPacketHandler(PacketType.ParcelAccessListUpdate, HandleParcelAccessListUpdate, false);
|
||||||
AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false);
|
AddLocalPacketHandler(PacketType.ParcelPropertiesRequest, HandleParcelPropertiesRequest, false);
|
||||||
|
@ -8800,13 +8882,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
case "instantmessage":
|
case "instantmessage":
|
||||||
if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
|
if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))
|
||||||
{
|
{
|
||||||
if (messagePacket.ParamList.Length < 5)
|
if (messagePacket.ParamList.Length < 2)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
UUID invoice = messagePacket.MethodData.Invoice;
|
UUID invoice = messagePacket.MethodData.Invoice;
|
||||||
UUID SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
|
|
||||||
string SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
|
|
||||||
string Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
|
|
||||||
UUID sessionID = messagePacket.AgentData.SessionID;
|
UUID sessionID = messagePacket.AgentData.SessionID;
|
||||||
|
|
||||||
|
UUID SenderID;
|
||||||
|
string SenderName;
|
||||||
|
string Message;
|
||||||
|
|
||||||
|
if (messagePacket.ParamList.Length < 5)
|
||||||
|
{
|
||||||
|
SenderID = AgentId;
|
||||||
|
SenderName = Utils.BytesToString(messagePacket.ParamList[0].Parameter);
|
||||||
|
Message = Utils.BytesToString(messagePacket.ParamList[1].Parameter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SenderID = new UUID(Utils.BytesToString(messagePacket.ParamList[2].Parameter));
|
||||||
|
SenderName = Utils.BytesToString(messagePacket.ParamList[3].Parameter);
|
||||||
|
Message = Utils.BytesToString(messagePacket.ParamList[4].Parameter);
|
||||||
|
}
|
||||||
|
|
||||||
OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
|
OnEstateBlueBoxMessageRequest(this, invoice, SenderID, sessionID, SenderName, Message);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -11701,171 +11799,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
OutPacket(pack, ThrottleOutPacketType.Task);
|
OutPacket(pack, ThrottleOutPacketType.Task);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region PriorityQueue
|
|
||||||
public class PriorityQueue
|
|
||||||
{
|
|
||||||
internal delegate bool UpdatePriorityHandler(ref double priority, uint local_id);
|
|
||||||
|
|
||||||
private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[1];
|
|
||||||
private Dictionary<uint, LookupItem> m_lookupTable;
|
|
||||||
private Comparison<double> m_comparison;
|
|
||||||
private object m_syncRoot = new object();
|
|
||||||
|
|
||||||
internal PriorityQueue() :
|
|
||||||
this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, Comparer<double>.Default) { }
|
|
||||||
internal PriorityQueue(int capacity) :
|
|
||||||
this(capacity, Comparer<double>.Default) { }
|
|
||||||
internal PriorityQueue(IComparer<double> comparer) :
|
|
||||||
this(new Comparison<double>(comparer.Compare)) { }
|
|
||||||
internal PriorityQueue(Comparison<double> comparison) :
|
|
||||||
this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY, comparison) { }
|
|
||||||
internal PriorityQueue(int capacity, IComparer<double> comparer) :
|
|
||||||
this(capacity, new Comparison<double>(comparer.Compare)) { }
|
|
||||||
internal PriorityQueue(int capacity, Comparison<double> comparison)
|
|
||||||
{
|
|
||||||
m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
|
|
||||||
|
|
||||||
for (int i = 0; i < m_heaps.Length; ++i)
|
|
||||||
m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
|
|
||||||
this.m_comparison = comparison;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object SyncRoot { get { return this.m_syncRoot; } }
|
|
||||||
internal int Count
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
for (int i = 0; i < m_heaps.Length; ++i)
|
|
||||||
count = m_heaps[i].Count;
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Enqueue(double priority, EntityUpdate value, uint local_id)
|
|
||||||
{
|
|
||||||
LookupItem item;
|
|
||||||
|
|
||||||
if (m_lookupTable.TryGetValue(local_id, out item))
|
|
||||||
{
|
|
||||||
// Combine flags
|
|
||||||
value.Flags |= item.Heap[item.Handle].Value.Flags;
|
|
||||||
|
|
||||||
item.Heap[item.Handle] = new MinHeapItem(priority, value, local_id, this.m_comparison);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item.Heap = m_heaps[0];
|
|
||||||
item.Heap.Add(new MinHeapItem(priority, value, local_id, this.m_comparison), ref item.Handle);
|
|
||||||
m_lookupTable.Add(local_id, item);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal EntityUpdate Peek()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < m_heaps.Length; ++i)
|
|
||||||
if (m_heaps[i].Count > 0)
|
|
||||||
return m_heaps[i].Min().Value;
|
|
||||||
throw new InvalidOperationException(string.Format("The {0} is empty", this.GetType().ToString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
internal bool TryDequeue(out EntityUpdate value)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < m_heaps.Length; ++i)
|
|
||||||
{
|
|
||||||
if (m_heaps[i].Count > 0)
|
|
||||||
{
|
|
||||||
MinHeapItem item = m_heaps[i].RemoveMin();
|
|
||||||
m_lookupTable.Remove(item.LocalID);
|
|
||||||
value = item.Value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
value = default(EntityUpdate);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void Reprioritize(UpdatePriorityHandler handler)
|
|
||||||
{
|
|
||||||
MinHeapItem item;
|
|
||||||
double priority;
|
|
||||||
|
|
||||||
foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
|
|
||||||
{
|
|
||||||
if (lookup.Heap.TryGetValue(lookup.Handle, out item))
|
|
||||||
{
|
|
||||||
priority = item.Priority;
|
|
||||||
if (handler(ref priority, item.LocalID))
|
|
||||||
{
|
|
||||||
if (lookup.Heap.ContainsHandle(lookup.Handle))
|
|
||||||
lookup.Heap[lookup.Handle] =
|
|
||||||
new MinHeapItem(priority, item.Value, item.LocalID, this.m_comparison);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.Warn("[LLCLIENTVIEW]: UpdatePriorityHandler returned false, dropping update");
|
|
||||||
lookup.Heap.Remove(lookup.Handle);
|
|
||||||
this.m_lookupTable.Remove(item.LocalID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region MinHeapItem
|
|
||||||
private struct MinHeapItem : IComparable<MinHeapItem>
|
|
||||||
{
|
|
||||||
private double priority;
|
|
||||||
private EntityUpdate value;
|
|
||||||
private uint local_id;
|
|
||||||
private Comparison<double> comparison;
|
|
||||||
|
|
||||||
internal MinHeapItem(double priority, EntityUpdate value, uint local_id) :
|
|
||||||
this(priority, value, local_id, Comparer<double>.Default) { }
|
|
||||||
internal MinHeapItem(double priority, EntityUpdate value, uint local_id, IComparer<double> comparer) :
|
|
||||||
this(priority, value, local_id, new Comparison<double>(comparer.Compare)) { }
|
|
||||||
internal MinHeapItem(double priority, EntityUpdate value, uint local_id, Comparison<double> comparison)
|
|
||||||
{
|
|
||||||
this.priority = priority;
|
|
||||||
this.value = value;
|
|
||||||
this.local_id = local_id;
|
|
||||||
this.comparison = comparison;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal double Priority { get { return this.priority; } }
|
|
||||||
internal EntityUpdate Value { get { return this.value; } }
|
|
||||||
internal uint LocalID { get { return this.local_id; } }
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.Append("[");
|
|
||||||
sb.Append(this.priority.ToString());
|
|
||||||
sb.Append(",");
|
|
||||||
if (this.value != null)
|
|
||||||
sb.Append(this.value.ToString());
|
|
||||||
sb.Append("]");
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int CompareTo(MinHeapItem other)
|
|
||||||
{
|
|
||||||
return this.comparison(this.priority, other.priority);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region LookupItem
|
|
||||||
private struct LookupItem
|
|
||||||
{
|
|
||||||
internal MinHeap<MinHeapItem> Heap;
|
|
||||||
internal IHandle Handle;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct PacketProcessor
|
public struct PacketProcessor
|
||||||
{
|
{
|
||||||
public PacketMethod method;
|
public PacketMethod method;
|
||||||
|
@ -11886,8 +11819,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
public static OSD BuildEvent(string eventName, OSD eventBody)
|
public static OSD BuildEvent(string eventName, OSD eventBody)
|
||||||
{
|
{
|
||||||
OSDMap osdEvent = new OSDMap(2);
|
OSDMap osdEvent = new OSDMap(2);
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
/// <summary>Caches packed throttle information</summary>
|
/// <summary>Caches packed throttle information</summary>
|
||||||
private byte[] m_packedThrottles;
|
private byte[] m_packedThrottles;
|
||||||
|
|
||||||
private int m_defaultRTO = 3000;
|
private int m_defaultRTO = 1000; // 1sec is the recommendation in the RFC
|
||||||
private int m_maxRTO = 60000;
|
private int m_maxRTO = 60000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -557,7 +557,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
|
int rto = (int)(SRTT + Math.Max(m_udpServer.TickCountResolution, K * RTTVAR));
|
||||||
|
|
||||||
// Clamp the retransmission timeout to manageable values
|
// Clamp the retransmission timeout to manageable values
|
||||||
rto = Utils.Clamp(RTO, m_defaultRTO, m_maxRTO);
|
rto = Utils.Clamp(rto, m_defaultRTO, m_maxRTO);
|
||||||
|
|
||||||
RTO = rto;
|
RTO = rto;
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,10 @@ namespace OpenMetaverse
|
||||||
|
|
||||||
IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort);
|
IPEndPoint ipep = new IPEndPoint(m_localBindAddress, m_udpPort);
|
||||||
|
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[UDPBASE]: Binding UDP listener using internal IP address config {0}:{1}",
|
||||||
|
ipep.Address, ipep.Port);
|
||||||
|
|
||||||
m_udpSocket = new Socket(
|
m_udpSocket = new Socket(
|
||||||
AddressFamily.InterNetwork,
|
AddressFamily.InterNetwork,
|
||||||
SocketType.Dgram,
|
SocketType.Dgram,
|
||||||
|
|
|
@ -0,0 +1,245 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSimulator 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;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Framework.Client;
|
||||||
|
using log4net;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
{
|
||||||
|
public class PriorityQueue
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
internal delegate bool UpdatePriorityHandler(ref uint priority, ISceneEntity entity);
|
||||||
|
|
||||||
|
// Heap[0] for self updates
|
||||||
|
// Heap[1..12] for entity updates
|
||||||
|
|
||||||
|
internal const uint m_numberOfQueues = 12;
|
||||||
|
|
||||||
|
private MinHeap<MinHeapItem>[] m_heaps = new MinHeap<MinHeapItem>[m_numberOfQueues];
|
||||||
|
private Dictionary<uint, LookupItem> m_lookupTable;
|
||||||
|
private uint m_nextQueue = 0;
|
||||||
|
private UInt64 m_nextRequest = 0;
|
||||||
|
|
||||||
|
private object m_syncRoot = new object();
|
||||||
|
public object SyncRoot {
|
||||||
|
get { return this.m_syncRoot; }
|
||||||
|
}
|
||||||
|
|
||||||
|
internal PriorityQueue() : this(MinHeap<MinHeapItem>.DEFAULT_CAPACITY) { }
|
||||||
|
|
||||||
|
internal PriorityQueue(int capacity)
|
||||||
|
{
|
||||||
|
m_lookupTable = new Dictionary<uint, LookupItem>(capacity);
|
||||||
|
|
||||||
|
for (int i = 0; i < m_heaps.Length; ++i)
|
||||||
|
m_heaps[i] = new MinHeap<MinHeapItem>(capacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal int Count
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
for (int i = 0; i < m_heaps.Length; ++i)
|
||||||
|
count += m_heaps[i].Count;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Enqueue(uint pqueue, EntityUpdate value)
|
||||||
|
{
|
||||||
|
LookupItem lookup;
|
||||||
|
|
||||||
|
uint localid = value.Entity.LocalId;
|
||||||
|
UInt64 entry = m_nextRequest++;
|
||||||
|
if (m_lookupTable.TryGetValue(localid, out lookup))
|
||||||
|
{
|
||||||
|
entry = lookup.Heap[lookup.Handle].EntryOrder;
|
||||||
|
value.Flags |= lookup.Heap[lookup.Handle].Value.Flags;
|
||||||
|
lookup.Heap.Remove(lookup.Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
|
||||||
|
lookup.Heap = m_heaps[pqueue];
|
||||||
|
lookup.Heap.Add(new MinHeapItem(pqueue, entry, value), ref lookup.Handle);
|
||||||
|
m_lookupTable[localid] = lookup;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal bool TryDequeue(out EntityUpdate value, out Int32 timeinqueue)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_numberOfQueues; ++i)
|
||||||
|
{
|
||||||
|
// To get the fair queing, we cycle through each of the
|
||||||
|
// queues when finding an element to dequeue, this code
|
||||||
|
// assumes that the distribution of updates in the queues
|
||||||
|
// is polynomial, probably quadractic (eg distance of PI * R^2)
|
||||||
|
uint h = (uint)((m_nextQueue + i) % m_numberOfQueues);
|
||||||
|
if (m_heaps[h].Count > 0)
|
||||||
|
{
|
||||||
|
m_nextQueue = (uint)((h + 1) % m_numberOfQueues);
|
||||||
|
|
||||||
|
MinHeapItem item = m_heaps[h].RemoveMin();
|
||||||
|
m_lookupTable.Remove(item.Value.Entity.LocalId);
|
||||||
|
timeinqueue = Util.EnvironmentTickCountSubtract(item.EntryTime);
|
||||||
|
value = item.Value;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
timeinqueue = 0;
|
||||||
|
value = default(EntityUpdate);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void Reprioritize(UpdatePriorityHandler handler)
|
||||||
|
{
|
||||||
|
MinHeapItem item;
|
||||||
|
foreach (LookupItem lookup in new List<LookupItem>(this.m_lookupTable.Values))
|
||||||
|
{
|
||||||
|
if (lookup.Heap.TryGetValue(lookup.Handle, out item))
|
||||||
|
{
|
||||||
|
uint pqueue = item.PriorityQueue;
|
||||||
|
uint localid = item.Value.Entity.LocalId;
|
||||||
|
|
||||||
|
if (handler(ref pqueue, item.Value.Entity))
|
||||||
|
{
|
||||||
|
// unless the priority queue has changed, there is no need to modify
|
||||||
|
// the entry
|
||||||
|
pqueue = Util.Clamp<uint>(pqueue, 0, m_numberOfQueues - 1);
|
||||||
|
if (pqueue != item.PriorityQueue)
|
||||||
|
{
|
||||||
|
lookup.Heap.Remove(lookup.Handle);
|
||||||
|
|
||||||
|
LookupItem litem = lookup;
|
||||||
|
litem.Heap = m_heaps[pqueue];
|
||||||
|
litem.Heap.Add(new MinHeapItem(pqueue, item), ref litem.Handle);
|
||||||
|
m_lookupTable[localid] = litem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// m_log.WarnFormat("[PQUEUE]: UpdatePriorityHandler returned false for {0}",item.Value.Entity.UUID);
|
||||||
|
lookup.Heap.Remove(lookup.Handle);
|
||||||
|
this.m_lookupTable.Remove(localid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
string s = "";
|
||||||
|
for (int i = 0; i < m_numberOfQueues; i++)
|
||||||
|
{
|
||||||
|
if (s != "") s += ",";
|
||||||
|
s += m_heaps[i].Count.ToString();
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region MinHeapItem
|
||||||
|
private struct MinHeapItem : IComparable<MinHeapItem>
|
||||||
|
{
|
||||||
|
private EntityUpdate value;
|
||||||
|
internal EntityUpdate Value {
|
||||||
|
get {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint pqueue;
|
||||||
|
internal uint PriorityQueue {
|
||||||
|
get {
|
||||||
|
return this.pqueue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Int32 entrytime;
|
||||||
|
internal Int32 EntryTime {
|
||||||
|
get {
|
||||||
|
return this.entrytime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private UInt64 entryorder;
|
||||||
|
internal UInt64 EntryOrder
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
return this.entryorder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal MinHeapItem(uint pqueue, MinHeapItem other)
|
||||||
|
{
|
||||||
|
this.entrytime = other.entrytime;
|
||||||
|
this.entryorder = other.entryorder;
|
||||||
|
this.value = other.value;
|
||||||
|
this.pqueue = pqueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal MinHeapItem(uint pqueue, UInt64 entryorder, EntityUpdate value)
|
||||||
|
{
|
||||||
|
this.entrytime = Util.EnvironmentTickCount();
|
||||||
|
this.entryorder = entryorder;
|
||||||
|
this.value = value;
|
||||||
|
this.pqueue = pqueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return String.Format("[{0},{1},{2}]",pqueue,entryorder,value.Entity.LocalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int CompareTo(MinHeapItem other)
|
||||||
|
{
|
||||||
|
// I'm assuming that the root part of an SOG is added to the update queue
|
||||||
|
// before the component parts
|
||||||
|
return Comparer<UInt64>.Default.Compare(this.EntryOrder, other.EntryOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region LookupItem
|
||||||
|
private struct LookupItem
|
||||||
|
{
|
||||||
|
internal MinHeap<MinHeapItem> Heap;
|
||||||
|
internal IHandle Handle;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Interfaces;
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
|
@ -77,7 +77,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// </value>
|
/// </value>
|
||||||
private Stream m_loadStream;
|
private Stream m_loadStream;
|
||||||
|
|
||||||
protected bool m_controlFileLoaded;
|
/// <summary>
|
||||||
|
/// FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things
|
||||||
|
/// (I thought they weren't). We will need to bump the version number and perform this check on all
|
||||||
|
/// subsequent IAR versions only
|
||||||
|
/// </summary>
|
||||||
|
protected bool m_controlFileLoaded = true;
|
||||||
protected bool m_assetsLoaded;
|
protected bool m_assetsLoaded;
|
||||||
protected bool m_inventoryNodesLoaded;
|
protected bool m_inventoryNodesLoaded;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Xml;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
@ -205,11 +206,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
||||||
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
|
List<SceneObjectGroup> objectGroups, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
// HACK: This is only working for lists containing a single item!
|
|
||||||
// It's just a hack to make this WIP compile and run. Nothing
|
|
||||||
// currently calls this with multiple items.
|
|
||||||
UUID ret = UUID.Zero;
|
UUID ret = UUID.Zero;
|
||||||
|
|
||||||
|
// The following code groups the SOG's by owner. No objects
|
||||||
|
// belonging to different people can be coalesced, for obvious
|
||||||
|
// reasons.
|
||||||
Dictionary<UUID, List<SceneObjectGroup>> deletes =
|
Dictionary<UUID, List<SceneObjectGroup>> deletes =
|
||||||
new Dictionary<UUID, List<SceneObjectGroup>>();
|
new Dictionary<UUID, List<SceneObjectGroup>>();
|
||||||
|
|
||||||
|
@ -221,20 +222,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
deletes[g.OwnerID].Add(g);
|
deletes[g.OwnerID].Add(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (List<SceneObjectGroup> objlist in deletes.Values)
|
// This is pethod scoped and will be returned. It will be the
|
||||||
{
|
// last created asset id
|
||||||
foreach (SceneObjectGroup g in objlist)
|
|
||||||
ret = DeleteToInventory(action, folderID, g, remoteClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
private UUID DeleteToInventory(DeRezAction action, UUID folderID,
|
|
||||||
SceneObjectGroup objectGroup, IClientAPI remoteClient)
|
|
||||||
{
|
|
||||||
UUID assetID = UUID.Zero;
|
UUID assetID = UUID.Zero;
|
||||||
|
|
||||||
|
// Each iteration is really a separate asset being created,
|
||||||
|
// with distinct destinations as well.
|
||||||
|
foreach (List<SceneObjectGroup> objlist in deletes.Values)
|
||||||
|
{
|
||||||
|
Dictionary<UUID, string> xmlStrings =
|
||||||
|
new Dictionary<UUID, string>();
|
||||||
|
|
||||||
|
foreach (SceneObjectGroup objectGroup in objlist)
|
||||||
|
{
|
||||||
Vector3 inventoryStoredPosition = new Vector3
|
Vector3 inventoryStoredPosition = new Vector3
|
||||||
(((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
|
(((objectGroup.AbsolutePosition.X > (int)Constants.RegionSize)
|
||||||
? 250
|
? 250
|
||||||
|
@ -249,10 +249,70 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
objectGroup.AbsolutePosition = inventoryStoredPosition;
|
||||||
|
|
||||||
|
// Make sure all bits but the ones we want are clear
|
||||||
|
// on take.
|
||||||
|
// This will be applied to the current perms, so
|
||||||
|
// it will do what we want.
|
||||||
|
objectGroup.RootPart.NextOwnerMask &=
|
||||||
|
((uint)PermissionMask.Copy |
|
||||||
|
(uint)PermissionMask.Transfer |
|
||||||
|
(uint)PermissionMask.Modify);
|
||||||
|
objectGroup.RootPart.NextOwnerMask |=
|
||||||
|
(uint)PermissionMask.Move;
|
||||||
|
|
||||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
|
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
|
||||||
|
|
||||||
objectGroup.AbsolutePosition = originalPosition;
|
objectGroup.AbsolutePosition = originalPosition;
|
||||||
|
|
||||||
|
xmlStrings[objectGroup.UUID] = sceneObjectXml;
|
||||||
|
}
|
||||||
|
|
||||||
|
string itemXml;
|
||||||
|
|
||||||
|
if (objlist.Count > 1)
|
||||||
|
{
|
||||||
|
float minX, minY, minZ;
|
||||||
|
float maxX, maxY, maxZ;
|
||||||
|
|
||||||
|
Vector3[] offsets = m_Scene.GetCombinedBoundingBox(objlist,
|
||||||
|
out minX, out maxX, out minY, out maxY,
|
||||||
|
out minZ, out maxZ);
|
||||||
|
|
||||||
|
// CreateWrapper
|
||||||
|
XmlDocument itemDoc = new XmlDocument();
|
||||||
|
XmlElement root = itemDoc.CreateElement("", "CoalescedObject", "");
|
||||||
|
itemDoc.AppendChild(root);
|
||||||
|
|
||||||
|
// Embed the offsets into the group XML
|
||||||
|
for ( int i = 0 ; i < objlist.Count ; i++ )
|
||||||
|
{
|
||||||
|
XmlDocument doc = new XmlDocument();
|
||||||
|
SceneObjectGroup g = objlist[i];
|
||||||
|
doc.LoadXml(xmlStrings[g.UUID]);
|
||||||
|
XmlElement e = (XmlElement)doc.SelectSingleNode("/SceneObjectGroup");
|
||||||
|
e.SetAttribute("offsetx", offsets[i].X.ToString());
|
||||||
|
e.SetAttribute("offsety", offsets[i].Y.ToString());
|
||||||
|
e.SetAttribute("offsetz", offsets[i].Z.ToString());
|
||||||
|
|
||||||
|
XmlNode objectNode = itemDoc.ImportNode(e, true);
|
||||||
|
root.AppendChild(objectNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
float sizeX = maxX - minX;
|
||||||
|
float sizeY = maxY - minY;
|
||||||
|
float sizeZ = maxZ - minZ;
|
||||||
|
|
||||||
|
root.SetAttribute("x", sizeX.ToString());
|
||||||
|
root.SetAttribute("y", sizeY.ToString());
|
||||||
|
root.SetAttribute("z", sizeZ.ToString());
|
||||||
|
|
||||||
|
itemXml = itemDoc.InnerXml;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemXml = xmlStrings[objlist[0].UUID];
|
||||||
|
}
|
||||||
|
|
||||||
// Get the user info of the item destination
|
// Get the user info of the item destination
|
||||||
//
|
//
|
||||||
UUID userID = UUID.Zero;
|
UUID userID = UUID.Zero;
|
||||||
|
@ -273,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// All returns / deletes go to the object owner
|
// All returns / deletes go to the object owner
|
||||||
//
|
//
|
||||||
|
|
||||||
userID = objectGroup.RootPart.OwnerID;
|
userID = objlist[0].RootPart.OwnerID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userID == UUID.Zero) // Can't proceed
|
if (userID == UUID.Zero) // Can't proceed
|
||||||
|
@ -292,7 +352,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
if (DeRezAction.SaveToExistingUserInventoryItem == action)
|
if (DeRezAction.SaveToExistingUserInventoryItem == action)
|
||||||
{
|
{
|
||||||
item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID);
|
item = new InventoryItemBase(objlist[0].RootPart.FromUserInventoryItemID, userID);
|
||||||
item = m_Scene.InventoryService.GetItem(item);
|
item = m_Scene.InventoryService.GetItem(item);
|
||||||
|
|
||||||
//item = userInfo.RootFolder.FindItem(
|
//item = userInfo.RootFolder.FindItem(
|
||||||
|
@ -302,7 +362,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
|
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
|
||||||
objectGroup.Name, objectGroup.UUID);
|
objlist[0].Name, objlist[0].UUID);
|
||||||
return UUID.Zero;
|
return UUID.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +375,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// Deleting someone else's item
|
// Deleting someone else's item
|
||||||
//
|
//
|
||||||
if (remoteClient == null ||
|
if (remoteClient == null ||
|
||||||
objectGroup.OwnerID != remoteClient.AgentId)
|
objlist[0].OwnerID != remoteClient.AgentId)
|
||||||
{
|
{
|
||||||
|
|
||||||
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
folder = m_Scene.InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||||
|
@ -344,7 +404,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (remoteClient == null ||
|
if (remoteClient == null ||
|
||||||
objectGroup.OwnerID != remoteClient.AgentId)
|
objlist[0].OwnerID != remoteClient.AgentId)
|
||||||
{
|
{
|
||||||
// Taking copy of another person's item. Take to
|
// Taking copy of another person's item. Take to
|
||||||
// Objects folder.
|
// Objects folder.
|
||||||
|
@ -365,9 +425,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
//
|
//
|
||||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
|
||||||
{
|
{
|
||||||
if (objectGroup.RootPart.FromFolderID != UUID.Zero)
|
if (objlist[0].RootPart.FromFolderID != UUID.Zero)
|
||||||
{
|
{
|
||||||
InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID);
|
InventoryFolderBase f = new InventoryFolderBase(objlist[0].RootPart.FromFolderID, userID);
|
||||||
folder = m_Scene.InventoryService.GetFolder(f);
|
folder = m_Scene.InventoryService.GetFolder(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,20 +443,32 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new InventoryItemBase();
|
item = new InventoryItemBase();
|
||||||
item.CreatorId = objectGroup.RootPart.CreatorID.ToString();
|
// Can't know creator is the same, so null it in inventory
|
||||||
item.CreatorData = objectGroup.RootPart.CreatorData;
|
if (objlist.Count > 1)
|
||||||
|
item.CreatorId = UUID.Zero.ToString();
|
||||||
|
else
|
||||||
|
item.CreatorId = objlist[0].RootPart.CreatorID.ToString();
|
||||||
item.ID = UUID.Random();
|
item.ID = UUID.Random();
|
||||||
item.InvType = (int)InventoryType.Object;
|
item.InvType = (int)InventoryType.Object;
|
||||||
item.Folder = folder.ID;
|
item.Folder = folder.ID;
|
||||||
item.Owner = userID;
|
item.Owner = userID;
|
||||||
|
if (objlist.Count > 1)
|
||||||
|
{
|
||||||
|
item.Flags = (uint)InventoryItemFlags.ObjectHasMultipleItems;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
item.SaleType = objlist[0].RootPart.ObjectSaleType;
|
||||||
|
item.SalePrice = objlist[0].RootPart.SalePrice;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetBase asset = CreateAsset(
|
AssetBase asset = CreateAsset(
|
||||||
objectGroup.GetPartName(objectGroup.RootPart.LocalId),
|
objlist[0].GetPartName(objlist[0].RootPart.LocalId),
|
||||||
objectGroup.GetPartDescription(objectGroup.RootPart.LocalId),
|
objlist[0].GetPartDescription(objlist[0].RootPart.LocalId),
|
||||||
(sbyte)AssetType.Object,
|
(sbyte)AssetType.Object,
|
||||||
Utils.StringToBytes(sceneObjectXml),
|
Utils.StringToBytes(itemXml),
|
||||||
objectGroup.OwnerID.ToString());
|
objlist[0].OwnerID.ToString());
|
||||||
m_Scene.AssetService.Store(asset);
|
m_Scene.AssetService.Store(asset);
|
||||||
assetID = asset.FullID;
|
assetID = asset.FullID;
|
||||||
|
|
||||||
|
@ -409,9 +481,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
item.AssetID = asset.FullID;
|
item.AssetID = asset.FullID;
|
||||||
|
|
||||||
if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
uint effectivePerms = (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify | PermissionMask.Move) | 7;
|
||||||
|
foreach (SceneObjectGroup grp in objlist)
|
||||||
|
effectivePerms &= grp.GetEffectivePermissions();
|
||||||
|
effectivePerms |= (uint)PermissionMask.Move;
|
||||||
|
|
||||||
|
if (remoteClient != null && (remoteClient.AgentId != objlist[0].RootPart.OwnerID) && m_Scene.Permissions.PropagatePermissions())
|
||||||
{
|
{
|
||||||
uint perms = objectGroup.GetEffectivePermissions();
|
uint perms = effectivePerms;
|
||||||
uint nextPerms = (perms & 7) << 13;
|
uint nextPerms = (perms & 7) << 13;
|
||||||
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
if ((nextPerms & (uint)PermissionMask.Copy) == 0)
|
||||||
perms &= ~(uint)PermissionMask.Copy;
|
perms &= ~(uint)PermissionMask.Copy;
|
||||||
|
@ -420,32 +497,24 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
if ((nextPerms & (uint)PermissionMask.Modify) == 0)
|
||||||
perms &= ~(uint)PermissionMask.Modify;
|
perms &= ~(uint)PermissionMask.Modify;
|
||||||
|
|
||||||
// Make sure all bits but the ones we want are clear
|
item.BasePermissions = perms & objlist[0].RootPart.NextOwnerMask;
|
||||||
// on take.
|
|
||||||
// This will be applied to the current perms, so
|
|
||||||
// it will do what we want.
|
|
||||||
objectGroup.RootPart.NextOwnerMask &=
|
|
||||||
((uint)PermissionMask.Copy |
|
|
||||||
(uint)PermissionMask.Transfer |
|
|
||||||
(uint)PermissionMask.Modify);
|
|
||||||
objectGroup.RootPart.NextOwnerMask |=
|
|
||||||
(uint)PermissionMask.Move;
|
|
||||||
|
|
||||||
item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
|
|
||||||
item.CurrentPermissions = item.BasePermissions;
|
item.CurrentPermissions = item.BasePermissions;
|
||||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
item.NextPermissions = perms & objlist[0].RootPart.NextOwnerMask;
|
||||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
|
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & objlist[0].RootPart.NextOwnerMask;
|
||||||
item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
|
item.GroupPermissions = objlist[0].RootPart.GroupMask & objlist[0].RootPart.NextOwnerMask;
|
||||||
|
|
||||||
item.Flags |= (uint)InventoryItemFlags.ObjectSlamPerm;
|
// Magic number badness. Maybe this deserves an enum.
|
||||||
|
// bit 4 (16) is the "Slam" bit, it means treat as passed
|
||||||
|
// and apply next owner perms on rez
|
||||||
|
item.CurrentPermissions |= 16; // Slam!
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item.BasePermissions = objectGroup.GetEffectivePermissions();
|
item.BasePermissions = effectivePerms;
|
||||||
item.CurrentPermissions = objectGroup.GetEffectivePermissions();
|
item.CurrentPermissions = effectivePerms;
|
||||||
item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
|
item.NextPermissions = objlist[0].RootPart.NextOwnerMask & effectivePerms;
|
||||||
item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
|
item.EveryOnePermissions = objlist[0].RootPart.EveryoneMask & effectivePerms;
|
||||||
item.GroupPermissions = objectGroup.RootPart.GroupMask;
|
item.GroupPermissions = objlist[0].RootPart.GroupMask & effectivePerms;
|
||||||
|
|
||||||
item.CurrentPermissions &=
|
item.CurrentPermissions &=
|
||||||
((uint)PermissionMask.Copy |
|
((uint)PermissionMask.Copy |
|
||||||
|
@ -455,7 +524,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
7); // Preserve folded permissions
|
7); // Preserve folded permissions
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add the new fields (Flags, Sale info, etc)
|
|
||||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||||
item.Description = asset.Description;
|
item.Description = asset.Description;
|
||||||
item.Name = asset.Name;
|
item.Name = asset.Name;
|
||||||
|
@ -476,7 +544,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return assetID;
|
return assetID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,8 +552,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rez an object into the scene from the user's inventory
|
/// Rez an object into the scene from the user's inventory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
/// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing
|
/// FIXME: It would be really nice if inventory access modules didn't also actually do the work of rezzing
|
||||||
/// things to the scene. The caller should be doing that, I think.
|
/// things to the scene. The caller should be doing that, I think.
|
||||||
|
/// </remarks>
|
||||||
/// <param name="remoteClient"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="itemID"></param>
|
/// <param name="itemID"></param>
|
||||||
/// <param name="RayEnd"></param>
|
/// <param name="RayEnd"></param>
|
||||||
|
@ -502,21 +572,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
|
||||||
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
|
bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment)
|
||||||
{
|
{
|
||||||
// Work out position details
|
// m_log.DebugFormat("[INVENTORY ACCESS MODULE]: RezObject for {0}, item {1}", remoteClient.Name, itemID);
|
||||||
byte bRayEndIsIntersection = (byte)0;
|
|
||||||
|
|
||||||
if (RayEndIsIntersection)
|
|
||||||
{
|
|
||||||
bRayEndIsIntersection = (byte)1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
bRayEndIsIntersection = (byte)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
byte bRayEndIsIntersection = (byte)(RayEndIsIntersection ? 1 : 0);
|
||||||
Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
|
Vector3 scale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||||
|
|
||||||
|
|
||||||
Vector3 pos = m_Scene.GetNewRezLocation(
|
Vector3 pos = m_Scene.GetNewRezLocation(
|
||||||
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
|
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
|
||||||
BypassRayCast, bRayEndIsIntersection, true, scale, false);
|
BypassRayCast, bRayEndIsIntersection, true, scale, false);
|
||||||
|
@ -531,6 +590,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString());
|
AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString());
|
||||||
|
|
||||||
|
SceneObjectGroup group = null;
|
||||||
|
|
||||||
if (rezAsset != null)
|
if (rezAsset != null)
|
||||||
{
|
{
|
||||||
UUID itemId = UUID.Zero;
|
UUID itemId = UUID.Zero;
|
||||||
|
@ -539,34 +600,78 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
// item that it came from. This allows us to enable 'save object to inventory'
|
// item that it came from. This allows us to enable 'save object to inventory'
|
||||||
if (!m_Scene.Permissions.BypassPermissions())
|
if (!m_Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy)
|
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy && (item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||||
{
|
{
|
||||||
itemId = item.ID;
|
itemId = item.ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||||
{
|
{
|
||||||
// Brave new fullperm world
|
// Brave new fullperm world
|
||||||
//
|
|
||||||
itemId = item.ID;
|
itemId = item.ID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string xmlData = Utils.BytesToString(rezAsset.Data);
|
string xmlData = Utils.BytesToString(rezAsset.Data);
|
||||||
SceneObjectGroup group
|
List<SceneObjectGroup> objlist =
|
||||||
= SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
|
new List<SceneObjectGroup>();
|
||||||
|
List<Vector3> veclist = new List<Vector3>();
|
||||||
|
|
||||||
Util.FireAndForget(delegate { AddUserData(group); });
|
XmlDocument doc = new XmlDocument();
|
||||||
|
doc.LoadXml(xmlData);
|
||||||
|
XmlElement e = (XmlElement)doc.SelectSingleNode("/CoalescedObject");
|
||||||
|
if (e == null || attachment) // Single
|
||||||
|
{
|
||||||
|
SceneObjectGroup g =
|
||||||
|
SceneObjectSerializer.FromOriginalXmlFormat(
|
||||||
|
itemId, xmlData);
|
||||||
|
objlist.Add(g);
|
||||||
|
veclist.Add(new Vector3(0, 0, 0));
|
||||||
|
|
||||||
group.RootPart.FromFolderID = item.Folder;
|
float offsetHeight = 0;
|
||||||
|
pos = m_Scene.GetNewRezLocation(
|
||||||
|
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
|
||||||
|
BypassRayCast, bRayEndIsIntersection, true, g.GetAxisAlignedBoundingBox(out offsetHeight), false);
|
||||||
|
pos.Z += offsetHeight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlElement coll = (XmlElement)e;
|
||||||
|
float bx = Convert.ToSingle(coll.GetAttribute("x"));
|
||||||
|
float by = Convert.ToSingle(coll.GetAttribute("y"));
|
||||||
|
float bz = Convert.ToSingle(coll.GetAttribute("z"));
|
||||||
|
Vector3 bbox = new Vector3(bx, by, bz);
|
||||||
|
|
||||||
// If it's rezzed in world, select it. Much easier to
|
pos = m_Scene.GetNewRezLocation(RayStart, RayEnd,
|
||||||
// find small items.
|
RayTargetID, Quaternion.Identity,
|
||||||
//
|
BypassRayCast, bRayEndIsIntersection, true,
|
||||||
if (!attachment)
|
bbox, false);
|
||||||
group.RootPart.CreateSelected = true;
|
|
||||||
|
pos -= bbox / 2;
|
||||||
|
|
||||||
|
XmlNodeList groups = e.SelectNodes("SceneObjectGroup");
|
||||||
|
foreach (XmlNode n in groups)
|
||||||
|
{
|
||||||
|
SceneObjectGroup g =
|
||||||
|
SceneObjectSerializer.FromOriginalXmlFormat(
|
||||||
|
itemId, n.OuterXml);
|
||||||
|
objlist.Add(g);
|
||||||
|
XmlElement el = (XmlElement)n;
|
||||||
|
float x = Convert.ToSingle(el.GetAttribute("offsetx"));
|
||||||
|
float y = Convert.ToSingle(el.GetAttribute("offsety"));
|
||||||
|
float z = Convert.ToSingle(el.GetAttribute("offsetz"));
|
||||||
|
veclist.Add(new Vector3(x, y, z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int primcount = 0;
|
||||||
|
foreach (SceneObjectGroup g in objlist)
|
||||||
|
primcount += g.PrimCount;
|
||||||
|
|
||||||
if (!m_Scene.Permissions.CanRezObject(
|
if (!m_Scene.Permissions.CanRezObject(
|
||||||
group.PrimCount, remoteClient.AgentId, pos)
|
primcount, remoteClient.AgentId, pos)
|
||||||
&& !attachment)
|
&& !attachment)
|
||||||
{
|
{
|
||||||
// The client operates in no fail mode. It will
|
// The client operates in no fail mode. It will
|
||||||
|
@ -579,42 +684,49 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0 ; i < objlist.Count ; i++ )
|
||||||
|
{
|
||||||
|
group = objlist[i];
|
||||||
|
|
||||||
|
Vector3 storedPosition = group.AbsolutePosition;
|
||||||
|
if (group.UUID == UUID.Zero)
|
||||||
|
{
|
||||||
|
m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 3");
|
||||||
|
}
|
||||||
|
group.RootPart.FromFolderID = item.Folder;
|
||||||
|
|
||||||
|
// If it's rezzed in world, select it. Much easier to
|
||||||
|
// find small items.
|
||||||
|
//
|
||||||
|
if (!attachment)
|
||||||
|
{
|
||||||
|
group.RootPart.CreateSelected = true;
|
||||||
|
foreach (SceneObjectPart child in group.Parts)
|
||||||
|
child.CreateSelected = true;
|
||||||
|
}
|
||||||
group.ResetIDs();
|
group.ResetIDs();
|
||||||
|
|
||||||
if (attachment)
|
if (attachment)
|
||||||
{
|
{
|
||||||
group.RootPart.Flags |= PrimFlags.Phantom;
|
group.RootPart.Flags |= PrimFlags.Phantom;
|
||||||
group.RootPart.IsAttachment = true;
|
group.RootPart.IsAttachment = true;
|
||||||
|
}
|
||||||
|
|
||||||
// If we're rezzing an attachment then don't ask
|
// If we're rezzing an attachment then don't ask
|
||||||
// AddNewSceneObject() to update the client since
|
// AddNewSceneObject() to update the client since
|
||||||
// we'll be doing that later on. Scheduling more
|
// we'll be doing that later on. Scheduling more than
|
||||||
// than one full update during the attachment
|
// one full update during the attachment
|
||||||
// process causes some clients to fail to display
|
// process causes some clients to fail to display the
|
||||||
// the attachment properly.
|
// attachment properly.
|
||||||
// Also, don't persist attachments.
|
|
||||||
m_Scene.AddNewSceneObject(group, false, false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_Scene.AddNewSceneObject(group, true, false);
|
m_Scene.AddNewSceneObject(group, true, false);
|
||||||
}
|
|
||||||
|
|
||||||
// m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z);
|
// if attachment we set it's asset id so object updates
|
||||||
// if attachment we set it's asset id so object updates can reflect that
|
// can reflect that, if not, we set it's position in world.
|
||||||
// if not, we set it's position in world.
|
|
||||||
if (!attachment)
|
if (!attachment)
|
||||||
{
|
{
|
||||||
group.ScheduleGroupForFullUpdate();
|
group.ScheduleGroupForFullUpdate();
|
||||||
|
|
||||||
float offsetHeight = 0;
|
group.AbsolutePosition = pos + veclist[i];
|
||||||
pos = m_Scene.GetNewRezLocation(
|
|
||||||
RayStart, RayEnd, RayTargetID, Quaternion.Identity,
|
|
||||||
BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false);
|
|
||||||
pos.Z += offsetHeight;
|
|
||||||
group.AbsolutePosition = pos;
|
|
||||||
// m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -622,6 +734,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
SceneObjectPart rootPart = null;
|
SceneObjectPart rootPart = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
rootPart = group.GetChildPart(group.UUID);
|
rootPart = group.GetChildPart(group.UUID);
|
||||||
|
@ -636,22 +749,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment);
|
m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since renaming the item in the inventory does not affect the name stored
|
// Since renaming the item in the inventory does not
|
||||||
// in the serialization, transfer the correct name from the inventory to the
|
// affect the name stored in the serialization, transfer
|
||||||
|
// the correct name from the inventory to the
|
||||||
// object itself before we rez.
|
// object itself before we rez.
|
||||||
rootPart.Name = item.Name;
|
rootPart.Name = item.Name;
|
||||||
rootPart.Description = item.Description;
|
rootPart.Description = item.Description;
|
||||||
|
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectSlamSale) != 0)
|
|
||||||
{
|
|
||||||
rootPart.ObjectSaleType = item.SaleType;
|
rootPart.ObjectSaleType = item.SaleType;
|
||||||
rootPart.SalePrice = item.SalePrice;
|
rootPart.SalePrice = item.SalePrice;
|
||||||
}
|
|
||||||
|
|
||||||
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
|
||||||
if ((rootPart.OwnerID != item.Owner) ||
|
if ((rootPart.OwnerID != item.Owner) ||
|
||||||
(item.CurrentPermissions & 16) != 0 || // Magic number
|
(item.CurrentPermissions & 16) != 0)
|
||||||
(item.Flags & (uint)InventoryItemFlags.ObjectSlamPerm) != 0)
|
|
||||||
{
|
{
|
||||||
//Need to kill the for sale here
|
//Need to kill the for sale here
|
||||||
rootPart.ObjectSaleType = 0;
|
rootPart.ObjectSaleType = 0;
|
||||||
|
@ -661,12 +770,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
{
|
{
|
||||||
foreach (SceneObjectPart part in group.Parts)
|
foreach (SceneObjectPart part in group.Parts)
|
||||||
{
|
{
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
if ((item.Flags & (uint)InventoryItemFlags.ObjectHasMultipleItems) == 0)
|
||||||
|
{
|
||||||
part.EveryoneMask = item.EveryOnePermissions;
|
part.EveryoneMask = item.EveryOnePermissions;
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
|
||||||
part.NextOwnerMask = item.NextPermissions;
|
part.NextOwnerMask = item.NextPermissions;
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
}
|
||||||
part.GroupMask = item.GroupPermissions;
|
part.GroupMask = 0; // DO NOT propagate here
|
||||||
}
|
}
|
||||||
|
|
||||||
group.ApplyNextOwnerPermissions();
|
group.ApplyNextOwnerPermissions();
|
||||||
|
@ -675,19 +784,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
foreach (SceneObjectPart part in group.Parts)
|
foreach (SceneObjectPart part in group.Parts)
|
||||||
{
|
{
|
||||||
if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
|
if ((part.OwnerID != item.Owner) ||
|
||||||
|
(item.CurrentPermissions & 16) != 0)
|
||||||
{
|
{
|
||||||
part.LastOwnerID = part.OwnerID;
|
part.LastOwnerID = part.OwnerID;
|
||||||
part.OwnerID = item.Owner;
|
part.OwnerID = item.Owner;
|
||||||
part.Inventory.ChangeInventoryOwner(item.Owner);
|
part.Inventory.ChangeInventoryOwner(item.Owner);
|
||||||
part.GroupMask = 0; // DO NOT propagate here
|
part.GroupMask = 0; // DO NOT propagate here
|
||||||
}
|
}
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteEveryone) != 0)
|
|
||||||
part.EveryoneMask = item.EveryOnePermissions;
|
part.EveryoneMask = item.EveryOnePermissions;
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteNextOwner) != 0)
|
|
||||||
part.NextOwnerMask = item.NextPermissions;
|
part.NextOwnerMask = item.NextPermissions;
|
||||||
if ((item.Flags & (uint)InventoryItemFlags.ObjectOverwriteGroup) != 0)
|
|
||||||
part.GroupMask = item.GroupPermissions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rootPart.TrimPermissions();
|
rootPart.TrimPermissions();
|
||||||
|
@ -695,9 +801,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
if (!attachment)
|
if (!attachment)
|
||||||
{
|
{
|
||||||
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
|
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
|
||||||
{
|
|
||||||
group.ClearPartAttachmentData();
|
group.ClearPartAttachmentData();
|
||||||
}
|
|
||||||
|
|
||||||
// Fire on_rez
|
// Fire on_rez
|
||||||
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
|
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
|
||||||
|
@ -705,6 +809,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
rootPart.ScheduleFullUpdate();
|
rootPart.ScheduleFullUpdate();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_Scene.Permissions.BypassPermissions())
|
if (!m_Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
@ -721,9 +826,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rootPart.ParentGroup;
|
|
||||||
}
|
}
|
||||||
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
public void SendProfileToClient(ScenePresence presence)
|
public void SendProfileToClient(ScenePresence presence)
|
||||||
{
|
{
|
||||||
IClientAPI client = presence.ControllingClient;
|
IClientAPI client = presence.ControllingClient;
|
||||||
if (m_enableWindlight)
|
if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid)
|
||||||
{
|
{
|
||||||
if (presence.IsChildAgent == false)
|
if (presence.IsChildAgent == false)
|
||||||
{
|
{
|
||||||
|
@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
|
||||||
public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl)
|
public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl)
|
||||||
{
|
{
|
||||||
IClientAPI client = presence.ControllingClient;
|
IClientAPI client = presence.ControllingClient;
|
||||||
if (m_enableWindlight)
|
if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid)
|
||||||
{
|
{
|
||||||
if (presence.IsChildAgent == false)
|
if (presence.IsChildAgent == false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,14 +111,12 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules
|
||||||
{
|
{
|
||||||
if ((SMTPConfig = m_Config.Configs["SMTP"]) == null)
|
if ((SMTPConfig = m_Config.Configs["SMTP"]) == null)
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[SMTP] SMTP server not configured");
|
|
||||||
m_Enabled = false;
|
m_Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SMTPConfig.GetBoolean("enabled", false))
|
if (!SMTPConfig.GetBoolean("enabled", false))
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[SMTP] module disabled in configuration");
|
|
||||||
m_Enabled = false;
|
m_Enabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,10 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Security;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
@ -100,8 +102,24 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
|
|
||||||
public HttpRequestModule()
|
public HttpRequestModule()
|
||||||
{
|
{
|
||||||
|
ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool ValidateServerCertificate(
|
||||||
|
object sender,
|
||||||
|
X509Certificate certificate,
|
||||||
|
X509Chain chain,
|
||||||
|
SslPolicyErrors sslPolicyErrors)
|
||||||
|
{
|
||||||
|
HttpWebRequest Request = (HttpWebRequest)sender;
|
||||||
|
|
||||||
|
if (Request.Headers.Get("NoVerifyCert") != null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return chain.Build(new X509Certificate2(certificate));
|
||||||
|
}
|
||||||
#region IHttpRequestModule Members
|
#region IHttpRequestModule Members
|
||||||
|
|
||||||
public UUID MakeHttpRequest(string url, string parameters, string body)
|
public UUID MakeHttpRequest(string url, string parameters, string body)
|
||||||
|
@ -141,8 +159,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
|
case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
|
||||||
|
htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
|
||||||
// TODO implement me
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
* Not sure how important ordering is is here - the next first
|
* Not sure how important ordering is is here - the next first
|
||||||
* one completed in the list is returned, based soley on its list
|
* one completed in the list is returned, based soley on its list
|
||||||
* position, not the order in which the request was started or
|
* position, not the order in which the request was started or
|
||||||
* finsihed. I thought about setting up a queue for this, but
|
* finished. I thought about setting up a queue for this, but
|
||||||
* it will need some refactoring and this works 'enough' right now
|
* it will need some refactoring and this works 'enough' right now
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -282,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
public string HttpMethod = "GET";
|
public string HttpMethod = "GET";
|
||||||
public string HttpMIMEType = "text/plain;charset=utf-8";
|
public string HttpMIMEType = "text/plain;charset=utf-8";
|
||||||
public int HttpTimeout;
|
public int HttpTimeout;
|
||||||
// public bool HttpVerifyCert = true; // not implemented
|
public bool HttpVerifyCert = true;
|
||||||
private Thread httpThread;
|
private Thread httpThread;
|
||||||
|
|
||||||
// Request info
|
// Request info
|
||||||
|
@ -344,6 +361,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
|
||||||
Request.Method = HttpMethod;
|
Request.Method = HttpMethod;
|
||||||
Request.ContentType = HttpMIMEType;
|
Request.ContentType = HttpMIMEType;
|
||||||
|
|
||||||
|
if(!HttpVerifyCert)
|
||||||
|
{
|
||||||
|
// We could hijack Connection Group Name to identify
|
||||||
|
// a desired security exception. But at the moment we'll use a dummy header instead.
|
||||||
|
// Request.ConnectionGroupName = "NoVerify";
|
||||||
|
Request.Headers.Add("NoVerifyCert", "true");
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Request.ConnectionGroupName="Verify";
|
||||||
|
// }
|
||||||
if (proxyurl != null && proxyurl.Length > 0)
|
if (proxyurl != null && proxyurl.Length > 0)
|
||||||
{
|
{
|
||||||
if (proxyexcepts != null && proxyexcepts.Length > 0)
|
if (proxyexcepts != null && proxyexcepts.Length > 0)
|
||||||
|
|
|
@ -200,12 +200,13 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
}
|
}
|
||||||
Scene.RegionInfo.RegionSettings.Save();
|
Scene.RegionInfo.RegionSettings.Save();
|
||||||
TriggerRegionInfoChange();
|
TriggerRegionInfoChange();
|
||||||
|
sendRegionHandshakeToAll();
|
||||||
sendRegionInfoPacketToAll();
|
sendRegionInfoPacketToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
|
private void handleCommitEstateTerrainTextureRequest(IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
sendRegionHandshakeToAll();
|
// sendRegionHandshakeToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegionTerrainSettings(float WaterHeight,
|
public void setRegionTerrainSettings(float WaterHeight,
|
||||||
|
@ -274,8 +275,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.AddEstateUser(user);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.AddEstateUser(user);
|
Scene.RegionInfo.EstateSettings.AddEstateUser(user);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
|
|
||||||
TriggerEstateInfoChange();
|
TriggerEstateInfoChange();
|
||||||
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
|
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
|
||||||
}
|
}
|
||||||
|
@ -289,10 +307,26 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.RemoveEstateUser(user);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
|
Scene.RegionInfo.EstateSettings.RemoveEstateUser(user);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
TriggerEstateInfoChange();
|
|
||||||
|
|
||||||
|
TriggerEstateInfoChange();
|
||||||
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
|
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AccessOptions, Scene.RegionInfo.EstateSettings.EstateAccess, Scene.RegionInfo.EstateSettings.EstateID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -304,8 +338,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.AddEstateGroup(user);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.AddEstateGroup(user);
|
Scene.RegionInfo.EstateSettings.AddEstateGroup(user);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
|
|
||||||
TriggerEstateInfoChange();
|
TriggerEstateInfoChange();
|
||||||
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
|
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
|
||||||
}
|
}
|
||||||
|
@ -318,10 +369,26 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.RemoveEstateGroup(user);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
|
Scene.RegionInfo.EstateSettings.RemoveEstateGroup(user);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
TriggerEstateInfoChange();
|
|
||||||
|
|
||||||
|
TriggerEstateInfoChange();
|
||||||
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
|
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.AllowedGroups, Scene.RegionInfo.EstateSettings.EstateGroups, Scene.RegionInfo.EstateSettings.EstateID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -349,6 +416,29 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
if (!alreadyInList)
|
if (!alreadyInList)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
EstateBan bitem = new EstateBan();
|
||||||
|
|
||||||
|
bitem.BannedUserID = user;
|
||||||
|
bitem.EstateID = (uint)estateID;
|
||||||
|
bitem.BannedHostAddress = "0.0.0.0";
|
||||||
|
bitem.BannedHostIPMask = "0.0.0.0";
|
||||||
|
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.AddBan(bitem);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EstateBan item = new EstateBan();
|
EstateBan item = new EstateBan();
|
||||||
|
|
||||||
item.BannedUserID = user;
|
item.BannedUserID = user;
|
||||||
|
@ -358,6 +448,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.AddBan(item);
|
Scene.RegionInfo.EstateSettings.AddBan(item);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
|
|
||||||
TriggerEstateInfoChange();
|
TriggerEstateInfoChange();
|
||||||
|
|
||||||
ScenePresence s = Scene.GetScenePresence(user);
|
ScenePresence s = Scene.GetScenePresence(user);
|
||||||
|
@ -403,8 +494,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
|
|
||||||
if (alreadyInList && listitem != null)
|
if (alreadyInList && listitem != null)
|
||||||
{
|
{
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.RemoveBan(user);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
|
Scene.RegionInfo.EstateSettings.RemoveBan(listitem.BannedUserID);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
|
|
||||||
TriggerEstateInfoChange();
|
TriggerEstateInfoChange();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -424,8 +532,25 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.AddEstateManager(user);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.AddEstateManager(user);
|
Scene.RegionInfo.EstateSettings.AddEstateManager(user);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
|
|
||||||
TriggerEstateInfoChange();
|
TriggerEstateInfoChange();
|
||||||
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
|
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
|
||||||
}
|
}
|
||||||
|
@ -438,10 +563,26 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
{
|
{
|
||||||
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions())
|
||||||
{
|
{
|
||||||
|
if ((estateAccessType & 1) != 0) // All estates
|
||||||
|
{
|
||||||
|
List<int> estateIDs = Scene.EstateDataService.GetEstatesByOwner(Scene.RegionInfo.EstateSettings.EstateOwner);
|
||||||
|
EstateSettings estateSettings;
|
||||||
|
|
||||||
|
foreach (int estateID in estateIDs)
|
||||||
|
{
|
||||||
|
if (estateID != Scene.RegionInfo.EstateSettings.EstateID)
|
||||||
|
{
|
||||||
|
estateSettings = Scene.EstateDataService.LoadEstateSettings(estateID);
|
||||||
|
estateSettings.RemoveEstateManager(user);
|
||||||
|
estateSettings.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
|
Scene.RegionInfo.EstateSettings.RemoveEstateManager(user);
|
||||||
Scene.RegionInfo.EstateSettings.Save();
|
Scene.RegionInfo.EstateSettings.Save();
|
||||||
TriggerEstateInfoChange();
|
|
||||||
|
|
||||||
|
TriggerEstateInfoChange();
|
||||||
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
|
remote_client.SendEstateList(invoice, (int)Constants.EstateAccessCodex.EstateManagers, Scene.RegionInfo.EstateSettings.EstateManagers, Scene.RegionInfo.EstateSettings.EstateID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -133,16 +133,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return new List<ILandObject>();
|
return new List<ILandObject>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsLandPrimCountTainted()
|
|
||||||
{
|
|
||||||
if (m_landManagementModule != null)
|
|
||||||
{
|
|
||||||
return m_landManagementModule.IsLandPrimCountTainted();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsForcefulBansAllowed()
|
public bool IsForcefulBansAllowed()
|
||||||
{
|
{
|
||||||
if (m_landManagementModule != null)
|
if (m_landManagementModule != null)
|
||||||
|
|
|
@ -62,8 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
public class LandManagementModule : INonSharedRegionModule
|
public class LandManagementModule : INonSharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private static readonly string remoteParcelRequestPath = "0009/";
|
private static readonly string remoteParcelRequestPath = "0009/";
|
||||||
|
|
||||||
|
@ -72,6 +71,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
protected Commander m_commander = new Commander("land");
|
protected Commander m_commander = new Commander("land");
|
||||||
|
|
||||||
protected IUserManagement m_userManager;
|
protected IUserManagement m_userManager;
|
||||||
|
protected IPrimCountModule m_primCountModule;
|
||||||
|
|
||||||
// Minimum for parcels to work is 64m even if we don't actually use them.
|
// Minimum for parcels to work is 64m even if we don't actually use them.
|
||||||
#pragma warning disable 0429
|
#pragma warning disable 0429
|
||||||
|
@ -88,7 +88,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
/// </value>
|
/// </value>
|
||||||
private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
|
private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
|
||||||
|
|
||||||
private bool m_landPrimCountTainted;
|
|
||||||
private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
|
private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
|
||||||
|
|
||||||
private bool m_allowedForcefulBans = true;
|
private bool m_allowedForcefulBans = true;
|
||||||
|
@ -121,18 +120,18 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
|
m_scene.EventManager.OnParcelPrimCountAdd += EventManagerOnParcelPrimCountAdd;
|
||||||
m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
|
m_scene.EventManager.OnParcelPrimCountUpdate += EventManagerOnParcelPrimCountUpdate;
|
||||||
|
m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
|
||||||
|
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
||||||
|
|
||||||
m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
|
m_scene.EventManager.OnAvatarEnteringNewParcel += EventManagerOnAvatarEnteringNewParcel;
|
||||||
m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement;
|
m_scene.EventManager.OnClientMovement += EventManagerOnClientMovement;
|
||||||
m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
|
m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
|
||||||
m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
|
m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
|
||||||
m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
|
m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
|
||||||
m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
|
m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
|
||||||
m_scene.EventManager.OnObjectBeingRemovedFromScene += EventManagerOnObjectBeingRemovedFromScene;
|
|
||||||
m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
|
m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
|
||||||
m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
|
m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
|
||||||
m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
|
m_scene.EventManager.OnSetAllowForcefulBan += EventManagerOnSetAllowedForcefulBan;
|
||||||
m_scene.EventManager.OnRequestParcelPrimCountUpdate += EventManagerOnRequestParcelPrimCountUpdate;
|
|
||||||
m_scene.EventManager.OnParcelPrimCountTainted += EventManagerOnParcelPrimCountTainted;
|
|
||||||
m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
|
m_scene.EventManager.OnRegisterCaps += EventManagerOnRegisterCaps;
|
||||||
m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
|
m_scene.EventManager.OnPluginConsole += EventManagerOnPluginConsole;
|
||||||
|
|
||||||
|
@ -147,6 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
{
|
{
|
||||||
m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
|
m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
|
||||||
|
m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveRegion(Scene scene)
|
public void RemoveRegion(Scene scene)
|
||||||
|
@ -306,10 +306,14 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
/// <returns>The parcel created.</returns>
|
/// <returns>The parcel created.</returns>
|
||||||
protected ILandObject CreateDefaultParcel()
|
protected ILandObject CreateDefaultParcel()
|
||||||
{
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
|
ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
|
||||||
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
|
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
|
||||||
fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
|
fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
|
||||||
|
|
||||||
return AddLandObject(fullSimParcel);
|
return AddLandObject(fullSimParcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +583,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[LAND]: Invalid local land ID {0}", landLocalID);
|
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,6 +595,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
ILandObject new_land = land.Copy();
|
ILandObject new_land = land.Copy();
|
||||||
|
|
||||||
|
// Only now can we add the prim counts to the land object - we rely on the global ID which is generated
|
||||||
|
// as a random UUID inside LandData initialization
|
||||||
|
if (m_primCountModule != null)
|
||||||
|
new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
|
||||||
|
|
||||||
lock (m_landList)
|
lock (m_landList)
|
||||||
{
|
{
|
||||||
int newLandLocalID = ++m_lastLandLocalID;
|
int newLandLocalID = ++m_lastLandLocalID;
|
||||||
|
@ -603,6 +612,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
if (landBitmap[x, y])
|
if (landBitmap[x, y])
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}",
|
||||||
|
// new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
m_landIDList[x, y] = newLandLocalID;
|
m_landIDList[x, y] = newLandLocalID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -630,7 +643,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
if (m_landIDList[x, y] == local_id)
|
if (m_landIDList[x, y] == local_id)
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[LAND]: Not removing land object {0}; still being used at {1}, {2}",
|
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}",
|
||||||
local_id, x, y);
|
local_id, x, y);
|
||||||
return;
|
return;
|
||||||
//throw new Exception("Could not remove land object. Still being used at " + x + ", " + y);
|
//throw new Exception("Could not remove land object. Still being used at " + x + ", " + y);
|
||||||
|
@ -732,8 +745,16 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
// Corner case. If an autoreturn happens during sim startup
|
// Corner case. If an autoreturn happens during sim startup
|
||||||
// we will come here with the list uninitialized
|
// we will come here with the list uninitialized
|
||||||
//
|
//
|
||||||
|
int landId = m_landIDList[x, y];
|
||||||
|
|
||||||
|
// if (landId == 0)
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[LAND MANAGEMENT MODULE]: No land object found at ({0}, {1}) on {2}",
|
||||||
|
// x, y, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
if (m_landList.ContainsKey(m_landIDList[x, y]))
|
if (m_landList.ContainsKey(m_landIDList[x, y]))
|
||||||
return m_landList[m_landIDList[x, y]];
|
return m_landList[m_landIDList[x, y]];
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -751,13 +772,14 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4]))
|
|
||||||
return m_landList[m_landIDList[x / 4, y / 4]];
|
return m_landList[m_landIDList[x / 4, y / 4]];
|
||||||
//else
|
|
||||||
// return null;
|
|
||||||
}
|
}
|
||||||
catch (IndexOutOfRangeException)
|
catch (IndexOutOfRangeException)
|
||||||
{
|
{
|
||||||
|
// m_log.WarnFormat(
|
||||||
|
// "[LAND MANAGEMENT MODULE]: Tried to retrieve land object from out of bounds co-ordinate ({0},{1}) in {2}",
|
||||||
|
// x, y, m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -767,34 +789,24 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
#region Parcel Modification
|
#region Parcel Modification
|
||||||
|
|
||||||
public void ResetAllLandPrimCounts()
|
public void ResetOverMeRecords()
|
||||||
{
|
{
|
||||||
lock (m_landList)
|
lock (m_landList)
|
||||||
{
|
{
|
||||||
foreach (LandObject p in m_landList.Values)
|
foreach (LandObject p in m_landList.Values)
|
||||||
{
|
{
|
||||||
p.ResetLandPrimCounts();
|
p.ResetOverMeRecord();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EventManagerOnParcelPrimCountTainted()
|
|
||||||
{
|
|
||||||
m_landPrimCountTainted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsLandPrimCountTainted()
|
|
||||||
{
|
|
||||||
return m_landPrimCountTainted;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj)
|
public void EventManagerOnParcelPrimCountAdd(SceneObjectGroup obj)
|
||||||
{
|
{
|
||||||
Vector3 position = obj.AbsolutePosition;
|
Vector3 position = obj.AbsolutePosition;
|
||||||
ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
|
ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
|
||||||
if (landUnderPrim != null)
|
if (landUnderPrim != null)
|
||||||
{
|
{
|
||||||
landUnderPrim.AddPrimToCount(obj);
|
((LandObject)landUnderPrim).AddPrimOverMe(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -804,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
foreach (LandObject p in m_landList.Values)
|
foreach (LandObject p in m_landList.Values)
|
||||||
{
|
{
|
||||||
p.RemovePrimFromCount(obj);
|
p.RemovePrimFromOverMe(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -837,8 +849,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
foreach (LandObject p in landOwnersAndParcels[owner])
|
foreach (LandObject p in landOwnersAndParcels[owner])
|
||||||
{
|
{
|
||||||
simArea += p.LandData.Area;
|
simArea += p.LandData.Area;
|
||||||
simPrims += p.LandData.OwnerPrims + p.LandData.OtherPrims + p.LandData.GroupPrims +
|
simPrims += p.PrimCounts.Total;
|
||||||
p.LandData.SelectedPrims;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (LandObject p in landOwnersAndParcels[owner])
|
foreach (LandObject p in landOwnersAndParcels[owner])
|
||||||
|
@ -851,7 +862,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
public void EventManagerOnParcelPrimCountUpdate()
|
public void EventManagerOnParcelPrimCountUpdate()
|
||||||
{
|
{
|
||||||
ResetAllLandPrimCounts();
|
// m_log.DebugFormat(
|
||||||
|
// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}",
|
||||||
|
// m_scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
ResetOverMeRecords();
|
||||||
EntityBase[] entities = m_scene.Entities.GetEntities();
|
EntityBase[] entities = m_scene.Entities.GetEntities();
|
||||||
foreach (EntityBase obj in entities)
|
foreach (EntityBase obj in entities)
|
||||||
{
|
{
|
||||||
|
@ -864,15 +879,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FinalizeLandPrimCountUpdate();
|
FinalizeLandPrimCountUpdate();
|
||||||
m_landPrimCountTainted = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EventManagerOnRequestParcelPrimCountUpdate()
|
public void EventManagerOnRequestParcelPrimCountUpdate()
|
||||||
{
|
{
|
||||||
ResetAllLandPrimCounts();
|
ResetOverMeRecords();
|
||||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||||
FinalizeLandPrimCountUpdate();
|
FinalizeLandPrimCountUpdate();
|
||||||
m_landPrimCountTainted = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -936,8 +949,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
m_landList[startLandObjectIndex].ForceUpdateLandInfo();
|
m_landList[startLandObjectIndex].ForceUpdateLandInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
EventManagerOnParcelPrimCountTainted();
|
|
||||||
|
|
||||||
//Now add the new land object
|
//Now add the new land object
|
||||||
ILandObject result = AddLandObject(newLand);
|
ILandObject result = AddLandObject(newLand);
|
||||||
UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
|
UpdateLandObject(startLandObject.LandData.LocalID, startLandObject.LandData);
|
||||||
|
@ -1004,7 +1015,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
performFinalLandJoin(masterLandObject, slaveLandObject);
|
performFinalLandJoin(masterLandObject, slaveLandObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EventManagerOnParcelPrimCountTainted();
|
|
||||||
|
|
||||||
masterLandObject.SendLandUpdateToAvatarsOverMe();
|
masterLandObject.SendLandUpdateToAvatarsOverMe();
|
||||||
}
|
}
|
||||||
|
@ -1194,11 +1204,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
if (land != null)
|
if (land != null)
|
||||||
{
|
{
|
||||||
|
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||||
m_landList[local_id].SendLandObjectOwners(remote_client);
|
m_landList[local_id].SendLandObjectOwners(remote_client);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[PARCEL]: Invalid land object {0} passed for parcel object owner request", local_id);
|
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1425,8 +1436,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
|
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
IClientAPI client;
|
IClientAPI client;
|
||||||
if (! m_scene.TryGetClient(agentID, out client)) {
|
if (!m_scene.TryGetClient(agentID, out client))
|
||||||
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
|
{
|
||||||
|
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID);
|
||||||
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
|
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1475,7 +1487,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
|
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID);
|
||||||
}
|
}
|
||||||
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
|
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
|
||||||
}
|
}
|
||||||
|
@ -1533,17 +1545,17 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
catch (LLSD.LLSDParseException e)
|
catch (LLSD.LLSDParseException e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message);
|
m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message);
|
||||||
m_log.ErrorFormat("[LAND] ... in request {0}", request);
|
m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: ... in request {0}", request);
|
||||||
}
|
}
|
||||||
catch (InvalidCastException)
|
catch (InvalidCastException)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[LAND] Wrong type in request {0}", request);
|
m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse();
|
LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse();
|
||||||
response.parcel_id = parcelID;
|
response.parcel_id = parcelID;
|
||||||
m_log.DebugFormat("[LAND] got parcelID {0}", parcelID);
|
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID);
|
||||||
|
|
||||||
return LLSDHelpers.SerialiseLLSDReply(response);
|
return LLSDHelpers.SerialiseLLSDReply(response);
|
||||||
}
|
}
|
||||||
|
@ -1564,7 +1576,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
ExtendedLandData extLandData = new ExtendedLandData();
|
ExtendedLandData extLandData = new ExtendedLandData();
|
||||||
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
|
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
|
||||||
out extLandData.X, out extLandData.Y);
|
out extLandData.X, out extLandData.Y);
|
||||||
m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
|
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
|
||||||
extLandData.RegionHandle, extLandData.X, extLandData.Y);
|
extLandData.RegionHandle, extLandData.X, extLandData.Y);
|
||||||
|
|
||||||
// for this region or for somewhere else?
|
// for this region or for somewhere else?
|
||||||
|
@ -1605,7 +1617,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
|
||||||
}
|
}
|
||||||
// we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
|
// we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
|
||||||
m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
|
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...",
|
||||||
data.LandData.Name, data.RegionHandle);
|
data.LandData.Name, data.RegionHandle);
|
||||||
// HACK for now
|
// HACK for now
|
||||||
RegionInfo r = new RegionInfo();
|
RegionInfo r = new RegionInfo();
|
||||||
|
@ -1616,7 +1628,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
|
remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_log.Debug("[LAND] got no parcelinfo; not sending");
|
m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
|
public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
|
||||||
|
|
|
@ -64,8 +64,6 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ILandObject Members
|
|
||||||
|
|
||||||
public int GetPrimsFree()
|
public int GetPrimsFree()
|
||||||
{
|
{
|
||||||
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
m_scene.EventManager.TriggerParcelPrimCountUpdate();
|
||||||
|
@ -80,6 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
set { m_landData = value; }
|
set { m_landData = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IPrimCounts PrimCounts { get; set; }
|
||||||
|
|
||||||
public UUID RegionUUID
|
public UUID RegionUUID
|
||||||
{
|
{
|
||||||
get { return m_scene.RegionInfo.RegionID; }
|
get { return m_scene.RegionInfo.RegionID; }
|
||||||
|
@ -211,6 +211,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return simMax;
|
return simMax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Packet Request Handling
|
#region Packet Request Handling
|
||||||
|
@ -241,7 +242,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
|
|
||||||
remote_client.SendLandProperties(seq_id,
|
remote_client.SendLandProperties(seq_id,
|
||||||
snap_selection, request_result, LandData,
|
snap_selection, request_result, this,
|
||||||
(float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
|
(float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
|
||||||
GetParcelMaxPrimCount(this),
|
GetParcelMaxPrimCount(this),
|
||||||
GetSimulatorMaxPrimCount(this), regionFlags);
|
GetSimulatorMaxPrimCount(this), regionFlags);
|
||||||
|
@ -700,23 +701,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return LandBitmap;
|
return LandBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Full sim land object creation
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool[,] BasicFullRegionLandBitmap()
|
public bool[,] BasicFullRegionLandBitmap()
|
||||||
{
|
{
|
||||||
return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
|
return GetSquareLandBitmap(0, 0, (int) Constants.RegionSize, (int) Constants.RegionSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used to modify the bitmap between the x and y points. Points use 64 scale
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="start_x"></param>
|
|
||||||
/// <param name="start_y"></param>
|
|
||||||
/// <param name="end_x"></param>
|
|
||||||
/// <param name="end_y"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
|
public bool[,] GetSquareLandBitmap(int start_x, int start_y, int end_x, int end_y)
|
||||||
{
|
{
|
||||||
bool[,] tempBitmap = new bool[64,64];
|
bool[,] tempBitmap = new bool[64,64];
|
||||||
|
@ -907,9 +896,12 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
lock (primsOverMe)
|
lock (primsOverMe)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[LAND OBJECT]: Request for SendLandObjectOwners() from {0} with {1} known prims on region",
|
||||||
|
// remote_client.Name, primsOverMe.Count);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (SceneObjectGroup obj in primsOverMe)
|
foreach (SceneObjectGroup obj in primsOverMe)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -921,7 +913,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
catch (NullReferenceException)
|
catch (NullReferenceException)
|
||||||
{
|
{
|
||||||
m_log.Info("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel");
|
m_log.Error("[LAND]: " + "Got Null Reference when searching land owners from the parcel panel");
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -948,6 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
public Dictionary<UUID, int> GetLandObjectOwners()
|
public Dictionary<UUID, int> GetLandObjectOwners()
|
||||||
{
|
{
|
||||||
Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>();
|
Dictionary<UUID, int> ownersAndCount = new Dictionary<UUID, int>();
|
||||||
|
|
||||||
lock (primsOverMe)
|
lock (primsOverMe)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -984,8 +977,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
|
public void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client)
|
||||||
{
|
{
|
||||||
Dictionary<UUID,List<SceneObjectGroup>> returns =
|
// m_log.DebugFormat(
|
||||||
new Dictionary<UUID,List<SceneObjectGroup>>();
|
// "[LAND OBJECT]: Request to return objects in {0} from {1}", LandData.Name, remote_client.Name);
|
||||||
|
|
||||||
|
Dictionary<UUID,List<SceneObjectGroup>> returns = new Dictionary<UUID,List<SceneObjectGroup>>();
|
||||||
|
|
||||||
lock (primsOverMe)
|
lock (primsOverMe)
|
||||||
{
|
{
|
||||||
|
@ -1058,81 +1053,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
#region Object Adding/Removing from Parcel
|
#region Object Adding/Removing from Parcel
|
||||||
|
|
||||||
public void ResetLandPrimCounts()
|
public void ResetOverMeRecord()
|
||||||
{
|
{
|
||||||
LandData.GroupPrims = 0;
|
|
||||||
LandData.OwnerPrims = 0;
|
|
||||||
LandData.OtherPrims = 0;
|
|
||||||
LandData.SelectedPrims = 0;
|
|
||||||
|
|
||||||
|
|
||||||
lock (primsOverMe)
|
lock (primsOverMe)
|
||||||
primsOverMe.Clear();
|
primsOverMe.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddPrimToCount(SceneObjectGroup obj)
|
public void AddPrimOverMe(SceneObjectGroup obj)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[LAND OBJECT]: Adding scene object {0} {1} over {2}", obj.Name, obj.LocalId, LandData.Name);
|
||||||
UUID prim_owner = obj.OwnerID;
|
|
||||||
int prim_count = obj.PrimCount;
|
|
||||||
|
|
||||||
if (obj.IsSelected)
|
|
||||||
{
|
|
||||||
LandData.SelectedPrims += prim_count;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (prim_owner == LandData.OwnerID)
|
|
||||||
{
|
|
||||||
LandData.OwnerPrims += prim_count;
|
|
||||||
}
|
|
||||||
else if ((obj.GroupID == LandData.GroupID ||
|
|
||||||
prim_owner == LandData.GroupID) &&
|
|
||||||
LandData.GroupID != UUID.Zero)
|
|
||||||
{
|
|
||||||
LandData.GroupPrims += prim_count;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LandData.OtherPrims += prim_count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lock (primsOverMe)
|
lock (primsOverMe)
|
||||||
primsOverMe.Add(obj);
|
primsOverMe.Add(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemovePrimFromCount(SceneObjectGroup obj)
|
public void RemovePrimFromOverMe(SceneObjectGroup obj)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[LAND OBJECT]: Removing scene object {0} {1} from over {2}", obj.Name, obj.LocalId, LandData.Name);
|
||||||
|
|
||||||
lock (primsOverMe)
|
lock (primsOverMe)
|
||||||
{
|
|
||||||
if (primsOverMe.Contains(obj))
|
|
||||||
{
|
|
||||||
UUID prim_owner = obj.OwnerID;
|
|
||||||
int prim_count = obj.PrimCount;
|
|
||||||
|
|
||||||
if (prim_owner == LandData.OwnerID)
|
|
||||||
{
|
|
||||||
LandData.OwnerPrims -= prim_count;
|
|
||||||
}
|
|
||||||
else if (obj.GroupID == LandData.GroupID ||
|
|
||||||
prim_owner == LandData.GroupID)
|
|
||||||
{
|
|
||||||
LandData.GroupPrims -= prim_count;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LandData.OtherPrims -= prim_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
primsOverMe.Remove(obj);
|
primsOverMe.Remove(obj);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1155,5 +1096,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
LandData.MusicURL = url;
|
LandData.MusicURL = url;
|
||||||
SendLandUpdateToAvatarsOverMe();
|
SendLandUpdateToAvatarsOverMe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
public int Owner = 0;
|
public int Owner = 0;
|
||||||
public int Group = 0;
|
public int Group = 0;
|
||||||
public int Others = 0;
|
public int Others = 0;
|
||||||
public Dictionary <UUID, int> Users =
|
public int Selected = 0;
|
||||||
new Dictionary <UUID, int>();
|
public Dictionary <UUID, int> Users = new Dictionary <UUID, int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
|
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log =
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
||||||
|
|
||||||
private Scene m_Scene;
|
private Scene m_Scene;
|
||||||
private Dictionary<UUID, PrimCounts> m_PrimCounts =
|
private Dictionary<UUID, PrimCounts> m_PrimCounts =
|
||||||
|
@ -64,10 +63,15 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
private Dictionary<UUID, ParcelCounts> m_ParcelCounts =
|
private Dictionary<UUID, ParcelCounts> m_ParcelCounts =
|
||||||
new Dictionary<UUID, ParcelCounts>();
|
new Dictionary<UUID, ParcelCounts>();
|
||||||
|
|
||||||
// For now, a simple simwide taint to get this up. Later parcel based
|
/// <value>
|
||||||
// taint to allow recounting a parcel if only ownership has changed
|
/// For now, a simple simwide taint to get this up. Later parcel based
|
||||||
// without recounting the whole sim.
|
/// taint to allow recounting a parcel if only ownership has changed
|
||||||
|
/// without recounting the whole sim.
|
||||||
|
///
|
||||||
|
/// We start out tainted so that the first get call resets the various prim counts.
|
||||||
|
/// <value>
|
||||||
private bool m_Tainted = true;
|
private bool m_Tainted = true;
|
||||||
|
|
||||||
private Object m_TaintLock = new Object();
|
private Object m_TaintLock = new Object();
|
||||||
|
|
||||||
public Type ReplaceableInterface
|
public Type ReplaceableInterface
|
||||||
|
@ -83,12 +87,14 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
m_Scene = scene;
|
m_Scene = scene;
|
||||||
|
|
||||||
m_Scene.EventManager.OnParcelPrimCountAdd +=
|
m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
|
||||||
OnParcelPrimCountAdd;
|
|
||||||
|
m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
|
||||||
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
|
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
|
||||||
OnObjectBeingRemovedFromScene;
|
OnObjectBeingRemovedFromScene;
|
||||||
m_Scene.EventManager.OnParcelPrimCountTainted +=
|
m_Scene.EventManager.OnParcelPrimCountTainted +=
|
||||||
OnParcelPrimCountTainted;
|
OnParcelPrimCountTainted;
|
||||||
|
m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegionLoaded(Scene scene)
|
public void RegionLoaded(Scene scene)
|
||||||
|
@ -116,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
if (!m_Tainted)
|
if (!m_Tainted)
|
||||||
AddObject(obj);
|
AddObject(obj);
|
||||||
|
// else
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted",
|
||||||
|
// obj.Name, m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
if (!m_Tainted)
|
if (!m_Tainted)
|
||||||
RemoveObject(obj);
|
RemoveObject(obj);
|
||||||
|
// else
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted",
|
||||||
|
// obj.Name, m_Scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnParcelPrimCountTainted()
|
private void OnParcelPrimCountTainted()
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
lock (m_TaintLock)
|
lock (m_TaintLock)
|
||||||
m_Tainted = true;
|
m_Tainted = true;
|
||||||
}
|
}
|
||||||
|
@ -163,8 +181,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
Vector3 pos = obj.AbsolutePosition;
|
Vector3 pos = obj.AbsolutePosition;
|
||||||
ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
|
||||||
|
|
||||||
|
// If for some reason there is no land object (perhaps the object is out of bounds) then we can't count it
|
||||||
|
if (landObject == null)
|
||||||
|
{
|
||||||
|
// m_log.WarnFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: Found no land object for {0} at position ({1}, {2}) on {3}",
|
||||||
|
// obj.Name, pos.X, pos.Y, m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LandData landData = landObject.LandData;
|
LandData landData = landObject.LandData;
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: Adding object {0} with {1} parts to prim count for parcel {2} on {3}",
|
||||||
|
// obj.Name, obj.Parts.Length, landData.Name, m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}",
|
||||||
|
// obj.Name, obj.OwnerID, landData.OwnerID);
|
||||||
|
|
||||||
ParcelCounts parcelCounts;
|
ParcelCounts parcelCounts;
|
||||||
if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
|
if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
|
||||||
{
|
{
|
||||||
|
@ -177,11 +214,17 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
else
|
else
|
||||||
parcelCounts.Users[obj.OwnerID] = partCount;
|
parcelCounts.Users[obj.OwnerID] = partCount;
|
||||||
|
|
||||||
|
if (obj.IsSelected)
|
||||||
|
{
|
||||||
|
parcelCounts.Selected += partCount;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (landData.IsGroupOwned)
|
if (landData.IsGroupOwned)
|
||||||
{
|
{
|
||||||
if (obj.OwnerID == landData.GroupID)
|
if (obj.OwnerID == landData.GroupID)
|
||||||
parcelCounts.Owner += partCount;
|
parcelCounts.Owner += partCount;
|
||||||
else if (obj.GroupID == landData.GroupID)
|
else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
|
||||||
parcelCounts.Group += partCount;
|
parcelCounts.Group += partCount;
|
||||||
else
|
else
|
||||||
parcelCounts.Others += partCount;
|
parcelCounts.Others += partCount;
|
||||||
|
@ -190,21 +233,26 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
if (obj.OwnerID == landData.OwnerID)
|
if (obj.OwnerID == landData.OwnerID)
|
||||||
parcelCounts.Owner += partCount;
|
parcelCounts.Owner += partCount;
|
||||||
else if (obj.GroupID == landData.GroupID)
|
|
||||||
parcelCounts.Group += partCount;
|
|
||||||
else
|
else
|
||||||
parcelCounts.Others += partCount;
|
parcelCounts.Others += partCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: Call under Taint Lock
|
// NOTE: Call under Taint Lock
|
||||||
private void RemoveObject(SceneObjectGroup obj)
|
private void RemoveObject(SceneObjectGroup obj)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID);
|
||||||
|
|
||||||
|
// Currently this is being done by tainting the count instead.
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPrimCounts GetPrimCounts(UUID parcelID)
|
public IPrimCounts GetPrimCounts(UUID parcelID)
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
PrimCounts primCounts;
|
PrimCounts primCounts;
|
||||||
|
|
||||||
lock (m_PrimCounts)
|
lock (m_PrimCounts)
|
||||||
|
@ -218,8 +266,16 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
return primCounts;
|
return primCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the number of prims on the parcel that are owned by the parcel owner.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int GetOwnerCount(UUID parcelID)
|
public int GetOwnerCount(UUID parcelID)
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
lock (m_TaintLock)
|
lock (m_TaintLock)
|
||||||
{
|
{
|
||||||
if (m_Tainted)
|
if (m_Tainted)
|
||||||
|
@ -227,13 +283,25 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
ParcelCounts counts;
|
ParcelCounts counts;
|
||||||
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||||
return counts.Owner;
|
count = counts.Owner;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}",
|
||||||
|
// parcelID, m_Scene.RegionInfo.RegionName, count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the number of prims on the parcel that have been set to the group that owns the parcel.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int GetGroupCount(UUID parcelID)
|
public int GetGroupCount(UUID parcelID)
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
lock (m_TaintLock)
|
lock (m_TaintLock)
|
||||||
{
|
{
|
||||||
if (m_Tainted)
|
if (m_Tainted)
|
||||||
|
@ -241,13 +309,25 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
ParcelCounts counts;
|
ParcelCounts counts;
|
||||||
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||||
return counts.Group;
|
count = counts.Group;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}",
|
||||||
|
// parcelID, m_Scene.RegionInfo.RegionName, count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int GetOthersCount(UUID parcelID)
|
public int GetOthersCount(UUID parcelID)
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
lock (m_TaintLock)
|
lock (m_TaintLock)
|
||||||
{
|
{
|
||||||
if (m_Tainted)
|
if (m_Tainted)
|
||||||
|
@ -255,13 +335,83 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
ParcelCounts counts;
|
ParcelCounts counts;
|
||||||
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||||
return counts.Others;
|
count = counts.Others;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}",
|
||||||
|
// parcelID, m_Scene.RegionInfo.RegionName, count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the number of selected prims.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int GetSelectedCount(UUID parcelID)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
lock (m_TaintLock)
|
||||||
|
{
|
||||||
|
if (m_Tainted)
|
||||||
|
Recount();
|
||||||
|
|
||||||
|
ParcelCounts counts;
|
||||||
|
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||||
|
count = counts.Selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}",
|
||||||
|
// parcelID, m_Scene.RegionInfo.RegionName, count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the total count of owner, group and others prims on the parcel.
|
||||||
|
/// FIXME: Need to do selected prims once this is reimplemented.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int GetTotalCount(UUID parcelID)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
lock (m_TaintLock)
|
||||||
|
{
|
||||||
|
if (m_Tainted)
|
||||||
|
Recount();
|
||||||
|
|
||||||
|
ParcelCounts counts;
|
||||||
|
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
|
||||||
|
{
|
||||||
|
count = counts.Owner;
|
||||||
|
count += counts.Group;
|
||||||
|
count += counts.Others;
|
||||||
|
count += counts.Selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}",
|
||||||
|
// parcelID, m_Scene.RegionInfo.RegionName, count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the number of prims that are in the entire simulator for the owner of this parcel.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int GetSimulatorCount(UUID parcelID)
|
public int GetSimulatorCount(UUID parcelID)
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
lock (m_TaintLock)
|
lock (m_TaintLock)
|
||||||
{
|
{
|
||||||
if (m_Tainted)
|
if (m_Tainted)
|
||||||
|
@ -272,14 +422,27 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
if (m_SimwideCounts.TryGetValue(owner, out val))
|
if (m_SimwideCounts.TryGetValue(owner, out val))
|
||||||
return val;
|
count = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}",
|
||||||
|
// parcelID, m_Scene.RegionInfo.RegionName, count);
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the number of prims that a particular user owns on this parcel.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parcelID"></param>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public int GetUserCount(UUID parcelID, UUID userID)
|
public int GetUserCount(UUID parcelID, UUID userID)
|
||||||
{
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
lock (m_TaintLock)
|
lock (m_TaintLock)
|
||||||
{
|
{
|
||||||
if (m_Tainted)
|
if (m_Tainted)
|
||||||
|
@ -290,15 +453,22 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
if (counts.Users.TryGetValue(userID, out val))
|
if (counts.Users.TryGetValue(userID, out val))
|
||||||
return val;
|
count = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}",
|
||||||
|
// userID, parcelID, m_Scene.RegionInfo.RegionName, count);
|
||||||
|
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: This method MUST be called while holding the taint lock!
|
// NOTE: This method MUST be called while holding the taint lock!
|
||||||
private void Recount()
|
private void Recount()
|
||||||
{
|
{
|
||||||
|
// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName);
|
||||||
|
|
||||||
m_OwnerMap.Clear();
|
m_OwnerMap.Clear();
|
||||||
m_SimwideCounts.Clear();
|
m_SimwideCounts.Clear();
|
||||||
m_ParcelCounts.Clear();
|
m_ParcelCounts.Clear();
|
||||||
|
@ -311,6 +481,9 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
|
|
||||||
m_OwnerMap[landData.GlobalID] = landData.OwnerID;
|
m_OwnerMap[landData.GlobalID] = landData.OwnerID;
|
||||||
m_SimwideCounts[landData.OwnerID] = 0;
|
m_SimwideCounts[landData.OwnerID] = 0;
|
||||||
|
// m_log.DebugFormat(
|
||||||
|
// "[PRIM COUNT MODULE]: Initializing parcel count for {0} on {1}",
|
||||||
|
// landData.Name, m_Scene.RegionInfo.RegionName);
|
||||||
m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
|
m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,6 +495,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
if (!m_OwnerMap.ContainsKey(k))
|
if (!m_OwnerMap.ContainsKey(k))
|
||||||
m_PrimCounts.Remove(k);
|
m_PrimCounts.Remove(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Tainted = false;
|
m_Tainted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -364,6 +538,22 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int Selected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_Parent.GetSelectedCount(m_ParcelID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Total
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return m_Parent.GetTotalCount(m_ParcelID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int Simulator
|
public int Simulator
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -0,0 +1,382 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSimulator 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.Reflection;
|
||||||
|
using log4net.Config;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.Assets;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Tests.Common;
|
||||||
|
using OpenSim.Tests.Common.Mock;
|
||||||
|
using OpenSim.Tests.Common.Setup;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.CoreModules.World.Land.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class PrimCountModuleTests
|
||||||
|
{
|
||||||
|
protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000");
|
||||||
|
protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000");
|
||||||
|
protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999");
|
||||||
|
protected TestScene m_scene;
|
||||||
|
protected PrimCountModule m_pcm;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A parcel that covers the entire sim except for a 1 unit wide strip on the eastern side.
|
||||||
|
/// </summary>
|
||||||
|
protected ILandObject m_lo;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A parcel that covers just the eastern strip of the sim.
|
||||||
|
/// </summary>
|
||||||
|
protected ILandObject m_lo2;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
m_pcm = new PrimCountModule();
|
||||||
|
LandManagementModule lmm = new LandManagementModule();
|
||||||
|
m_scene = SceneSetupHelpers.SetupScene();
|
||||||
|
SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
|
||||||
|
|
||||||
|
int xParcelDivider = (int)Constants.RegionSize - 1;
|
||||||
|
|
||||||
|
ILandObject lo = new LandObject(m_userId, false, m_scene);
|
||||||
|
lo.LandData.Name = "m_lo";
|
||||||
|
lo.SetLandBitmap(
|
||||||
|
lo.GetSquareLandBitmap(0, 0, xParcelDivider, (int)Constants.RegionSize));
|
||||||
|
m_lo = lmm.AddLandObject(lo);
|
||||||
|
|
||||||
|
ILandObject lo2 = new LandObject(m_userId, false, m_scene);
|
||||||
|
lo2.SetLandBitmap(
|
||||||
|
lo2.GetSquareLandBitmap(xParcelDivider, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
|
||||||
|
lo2.LandData.Name = "m_lo2";
|
||||||
|
m_lo2 = lmm.AddLandObject(lo2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test that counts before we do anything are correct.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestInitialCounts()
|
||||||
|
{
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test count after a parcel owner owned object is added.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestAddOwnerObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||||
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(3));
|
||||||
|
|
||||||
|
// Add a second object and retest
|
||||||
|
SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
|
||||||
|
m_scene.AddNewSceneObject(sog2, false);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(5));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(5));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(5));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(5));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test count after a parcel owner owned copied object is added.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestCopyOwnerObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||||
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
|
m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(6));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(6));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(6));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(6));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test that parcel counts update correctly when an object is moved between parcels, where that movement
|
||||||
|
/// is not done directly by the user/
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestMoveOwnerObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||||
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
|
SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, "b", 0x10);
|
||||||
|
m_scene.AddNewSceneObject(sog2, false);
|
||||||
|
|
||||||
|
// Move the first scene object to the eastern strip parcel
|
||||||
|
sog.AbsolutePosition = new Vector3(254, 2, 2);
|
||||||
|
|
||||||
|
IPrimCounts pclo1 = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
Assert.That(pclo1.Owner, Is.EqualTo(2));
|
||||||
|
Assert.That(pclo1.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Total, Is.EqualTo(2));
|
||||||
|
Assert.That(pclo1.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Users[m_userId], Is.EqualTo(2));
|
||||||
|
Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Simulator, Is.EqualTo(5));
|
||||||
|
|
||||||
|
IPrimCounts pclo2 = m_lo2.PrimCounts;
|
||||||
|
|
||||||
|
Assert.That(pclo2.Owner, Is.EqualTo(3));
|
||||||
|
Assert.That(pclo2.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Total, Is.EqualTo(3));
|
||||||
|
Assert.That(pclo2.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Users[m_userId], Is.EqualTo(3));
|
||||||
|
Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Simulator, Is.EqualTo(5));
|
||||||
|
|
||||||
|
// Now move it back again
|
||||||
|
sog.AbsolutePosition = new Vector3(2, 2, 2);
|
||||||
|
|
||||||
|
Assert.That(pclo1.Owner, Is.EqualTo(5));
|
||||||
|
Assert.That(pclo1.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Total, Is.EqualTo(5));
|
||||||
|
Assert.That(pclo1.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Users[m_userId], Is.EqualTo(5));
|
||||||
|
Assert.That(pclo1.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pclo1.Simulator, Is.EqualTo(5));
|
||||||
|
|
||||||
|
Assert.That(pclo2.Owner, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Total, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Users[m_userId], Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pclo2.Simulator, Is.EqualTo(5));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test count after a parcel owner owned object is removed.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestRemoveOwnerObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1), false);
|
||||||
|
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
|
||||||
|
m_scene.AddNewSceneObject(sogToDelete, false);
|
||||||
|
m_scene.DeleteSceneObject(sogToDelete, false);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAddGroupObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
m_lo.DeedToGroup(m_groupId);
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
|
||||||
|
sog.GroupID = m_groupId;
|
||||||
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
|
||||||
|
// Is this desired behaviour? Not totally sure.
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3));
|
||||||
|
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test count after a parcel owner owned object is removed.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestRemoveGroupObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
m_lo.DeedToGroup(m_groupId);
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, "a", 0x1);
|
||||||
|
sogToKeep.GroupID = m_groupId;
|
||||||
|
m_scene.AddNewSceneObject(sogToKeep, false);
|
||||||
|
|
||||||
|
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, "b", 0x10);
|
||||||
|
m_scene.AddNewSceneObject(sogToDelete, false);
|
||||||
|
m_scene.DeleteSceneObject(sogToDelete, false);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAddOthersObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "a", 0x01);
|
||||||
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRemoveOthersObject()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, "a", 0x1), false);
|
||||||
|
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, "b", 0x10);
|
||||||
|
m_scene.AddNewSceneObject(sogToDelete, false);
|
||||||
|
m_scene.DeleteSceneObject(sogToDelete, false);
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(1));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test the count is correct after is has been tainted.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestTaint()
|
||||||
|
{
|
||||||
|
TestHelper.InMethod();
|
||||||
|
IPrimCounts pc = m_lo.PrimCounts;
|
||||||
|
|
||||||
|
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, "a", 0x01);
|
||||||
|
m_scene.AddNewSceneObject(sog, false);
|
||||||
|
|
||||||
|
m_pcm.TaintPrimCount();
|
||||||
|
|
||||||
|
Assert.That(pc.Owner, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Group, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Others, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Total, Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Selected, Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Users[m_userId], Is.EqualTo(3));
|
||||||
|
Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
|
||||||
|
Assert.That(pc.Simulator, Is.EqualTo(3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue