Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Tom 2011-05-26 03:42:45 -07:00
commit 03525959c9
57 changed files with 674 additions and 213 deletions

View File

@ -74,9 +74,38 @@ namespace OpenSim.Data
bool StoreFolder(XInventoryFolder folder); bool StoreFolder(XInventoryFolder folder);
bool StoreItem(XInventoryItem item); bool StoreItem(XInventoryItem item);
/// <summary>
/// Delete folders where field == val
/// </summary>
/// <param name="field"></param>
/// <param name="val"></param>
/// <returns>true if the delete was successful, false if it was not</returns>
bool DeleteFolders(string field, string val); bool DeleteFolders(string field, string val);
/// <summary>
/// Delete folders where field1 == val1, field2 == val2...
/// </summary>
/// <param name="fields"></param>
/// <param name="vals"></param>
/// <returns>true if the delete was successful, false if it was not</returns>
bool DeleteFolders(string[] fields, string[] vals);
/// <summary>
/// Delete items where field == val
/// </summary>
/// <param name="field"></param>
/// <param name="val"></param>
/// <returns>true if the delete was successful, false if it was not</returns>
bool DeleteItems(string field, string val); bool DeleteItems(string field, string val);
/// <summary>
/// Delete items where field1 == val1, field2 == val2...
/// </summary>
/// <param name="fields"></param>
/// <param name="vals"></param>
/// <returns>true if the delete was successful, false if it was not</returns>
bool DeleteItems(string[] fields, string[] vals);
bool MoveItem(string id, string newParent); bool MoveItem(string id, string newParent);
XInventoryItem[] GetActiveGestures(UUID principalID); XInventoryItem[] GetActiveGestures(UUID principalID);
int GetAssetPermissions(UUID principalID, UUID assetID); int GetAssetPermissions(UUID principalID, UUID assetID);

View File

@ -335,24 +335,35 @@ namespace OpenSim.Data.MSSQL
} }
} }
public virtual bool Delete(string field, string val) public virtual bool Delete(string field, string key)
{ {
return Delete(new string[] { field }, new string[] { key });
}
public virtual bool Delete(string[] fields, string[] keys)
{
if (fields.Length != keys.Length)
return false;
List<string> terms = new List<string>();
using (SqlConnection conn = new SqlConnection(m_ConnectionString)) using (SqlConnection conn = new SqlConnection(m_ConnectionString))
using (SqlCommand cmd = new SqlCommand()) using (SqlCommand cmd = new SqlCommand())
{ {
string deleteCommand = String.Format("DELETE FROM {0} WHERE [{1}] = @{1}", m_Realm, field); for (int i = 0; i < fields.Length; i++)
cmd.CommandText = deleteCommand;
cmd.Parameters.Add(m_database.CreateParameter(field, val));
cmd.Connection = conn;
conn.Open();
if (cmd.ExecuteNonQuery() > 0)
{ {
//m_log.Warn("[MSSQLGenericTable]: " + deleteCommand); cmd.Parameters.Add(m_database.CreateParameter(fields[i], keys[i]));
return true; terms.Add("[" + fields[i] + "] = @" + fields[i]);
} }
return false;
string where = String.Join(" AND ", terms.ToArray());
string query = String.Format("DELETE * FROM {0} WHERE {1}", m_Realm, where);
cmd.Connection = conn;
cmd.CommandText = query;
conn.Open();
return cmd.ExecuteNonQuery() > 0;
} }
} }
} }

View File

@ -79,11 +79,21 @@ namespace OpenSim.Data.MSSQL
return m_Folders.Delete(field, val); return m_Folders.Delete(field, val);
} }
public bool DeleteFolders(string[] fields, string[] vals)
{
return m_Folders.Delete(fields, vals);
}
public bool DeleteItems(string field, string val) public bool DeleteItems(string field, string val)
{ {
return m_Items.Delete(field, val); return m_Items.Delete(field, val);
} }
public bool DeleteItems(string[] fields, string[] vals)
{
return m_Items.Delete(fields, vals);
}
public bool MoveItem(string id, string newParent) public bool MoveItem(string id, string newParent)
{ {
return m_Items.MoveItem(id, newParent); return m_Items.MoveItem(id, newParent);

View File

@ -264,18 +264,33 @@ namespace OpenSim.Data.MySQL
} }
} }
public virtual bool Delete(string field, string val) public virtual bool Delete(string field, string key)
{ {
return Delete(new string[] { field }, new string[] { key });
}
public virtual bool Delete(string[] fields, string[] keys)
{
if (fields.Length != keys.Length)
return false;
List<string> terms = new List<string>();
using (MySqlCommand cmd = new MySqlCommand()) using (MySqlCommand cmd = new MySqlCommand())
{ {
for (int i = 0 ; i < fields.Length ; i++)
{
cmd.Parameters.AddWithValue(fields[i], keys[i]);
terms.Add("`" + fields[i] + "` = ?" + fields[i]);
}
cmd.CommandText = String.Format("delete from {0} where `{1}` = ?{1}", m_Realm, field); string where = String.Join(" and ", terms.ToArray());
cmd.Parameters.AddWithValue(field, val);
if (ExecuteNonQuery(cmd) > 0) string query = String.Format("delete from {0} where {1}", m_Realm, where);
return true;
return false; cmd.CommandText = query;
return ExecuteNonQuery(cmd) > 0;
} }
} }
} }

View File

@ -66,7 +66,7 @@ namespace OpenSim.Data.MySQL
Initialise(connectionString); Initialise(connectionString);
} }
public void Initialise(string connectionString) public virtual void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;
@ -130,7 +130,7 @@ namespace OpenSim.Data.MySQL
public void Dispose() {} public void Dispose() {}
public void StoreObject(SceneObjectGroup obj, UUID regionUUID) public virtual void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{ {
uint flags = obj.RootPart.GetEffectiveObjectFlags(); uint flags = obj.RootPart.GetEffectiveObjectFlags();
@ -258,7 +258,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public void RemoveObject(UUID obj, UUID regionUUID) public virtual void RemoveObject(UUID obj, UUID regionUUID)
{ {
// m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID); // m_log.DebugFormat("[REGION DB]: Deleting scene object {0} from {1} in database", obj, regionUUID);
@ -407,7 +407,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public List<SceneObjectGroup> LoadObjects(UUID regionID) public virtual List<SceneObjectGroup> LoadObjects(UUID regionID)
{ {
const int ROWS_PER_QUERY = 5000; const int ROWS_PER_QUERY = 5000;
@ -576,7 +576,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public void StoreTerrain(double[,] ter, UUID regionID) public virtual void StoreTerrain(double[,] ter, UUID regionID)
{ {
m_log.Info("[REGION DB]: Storing terrain"); m_log.Info("[REGION DB]: Storing terrain");
@ -605,7 +605,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public double[,] LoadTerrain(UUID regionID) public virtual double[,] LoadTerrain(UUID regionID)
{ {
double[,] terrain = null; double[,] terrain = null;
@ -655,7 +655,7 @@ namespace OpenSim.Data.MySQL
return terrain; return terrain;
} }
public void RemoveLandObject(UUID globalID) public virtual void RemoveLandObject(UUID globalID)
{ {
lock (m_dbLock) lock (m_dbLock)
{ {
@ -674,7 +674,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public void StoreLandObject(ILandObject parcel) public virtual void StoreLandObject(ILandObject parcel)
{ {
lock (m_dbLock) lock (m_dbLock)
{ {
@ -731,7 +731,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID) public virtual RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{ {
RegionLightShareData nWP = new RegionLightShareData(); RegionLightShareData nWP = new RegionLightShareData();
nWP.OnSave += StoreRegionWindlightSettings; nWP.OnSave += StoreRegionWindlightSettings;
@ -828,7 +828,7 @@ namespace OpenSim.Data.MySQL
return nWP; return nWP;
} }
public RegionSettings LoadRegionSettings(UUID regionUUID) public virtual RegionSettings LoadRegionSettings(UUID regionUUID)
{ {
RegionSettings rs = null; RegionSettings rs = null;
@ -866,7 +866,7 @@ namespace OpenSim.Data.MySQL
return rs; return rs;
} }
public void StoreRegionWindlightSettings(RegionLightShareData wl) public virtual void StoreRegionWindlightSettings(RegionLightShareData wl)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
@ -969,7 +969,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public void RemoveRegionWindlightSettings(UUID regionID) public virtual void RemoveRegionWindlightSettings(UUID regionID)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{ {
@ -984,7 +984,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public void StoreRegionSettings(RegionSettings rs) public virtual void StoreRegionSettings(RegionSettings rs)
{ {
lock (m_dbLock) lock (m_dbLock)
{ {
@ -1036,7 +1036,7 @@ namespace OpenSim.Data.MySQL
} }
} }
public List<LandData> LoadLandObjects(UUID regionUUID) public virtual List<LandData> LoadLandObjects(UUID regionUUID)
{ {
List<LandData> landData = new List<LandData>(); List<LandData> landData = new List<LandData>();
@ -1802,7 +1802,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml()); cmd.Parameters.AddWithValue("Media", null == s.Media ? null : s.Media.ToXml());
} }
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) public virtual void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{ {
lock (m_dbLock) lock (m_dbLock)
{ {

View File

@ -85,11 +85,21 @@ namespace OpenSim.Data.MySQL
return m_Folders.Delete(field, val); return m_Folders.Delete(field, val);
} }
public bool DeleteFolders(string[] fields, string[] vals)
{
return m_Folders.Delete(fields, vals);
}
public bool DeleteItems(string field, string val) public bool DeleteItems(string field, string val)
{ {
return m_Items.Delete(field, val); return m_Items.Delete(field, val);
} }
public bool DeleteItems(string[] fields, string[] vals)
{
return m_Items.Delete(fields, vals);
}
public bool MoveItem(string id, string newParent) public bool MoveItem(string id, string newParent)
{ {
return m_Items.MoveItem(id, newParent); return m_Items.MoveItem(id, newParent);

View File

@ -258,17 +258,33 @@ namespace OpenSim.Data.SQLite
return false; return false;
} }
public bool Delete(string field, string val) public virtual bool Delete(string field, string key)
{ {
return Delete(new string[] { field }, new string[] { key });
}
public bool Delete(string[] fields, string[] keys)
{
if (fields.Length != keys.Length)
return false;
List<string> terms = new List<string>();
SqliteCommand cmd = new SqliteCommand(); SqliteCommand cmd = new SqliteCommand();
cmd.CommandText = String.Format("delete from {0} where `{1}` = :{1}", m_Realm, field); for (int i = 0 ; i < fields.Length ; i++)
cmd.Parameters.Add(new SqliteParameter(field, val)); {
cmd.Parameters.Add(new SqliteParameter(":" + fields[i], keys[i]));
terms.Add("`" + fields[i] + "` = :" + fields[i]);
}
if (ExecuteNonQuery(cmd, m_Connection) > 0) string where = String.Join(" and ", terms.ToArray());
return true;
return false; string query = String.Format("delete * from {0} where {1}", m_Realm, where);
cmd.CommandText = query;
return ExecuteNonQuery(cmd, m_Connection) > 0;
} }
} }
} }

View File

@ -91,11 +91,21 @@ namespace OpenSim.Data.SQLite
return m_Folders.Delete(field, val); return m_Folders.Delete(field, val);
} }
public bool DeleteFolders(string[] fields, string[] vals)
{
return m_Folders.Delete(fields, vals);
}
public bool DeleteItems(string field, string val) public bool DeleteItems(string field, string val)
{ {
return m_Items.Delete(field, val); return m_Items.Delete(field, val);
} }
public bool DeleteItems(string[] fields, string[] vals)
{
return m_Items.Delete(fields, vals);
}
public bool MoveItem(string id, string newParent) public bool MoveItem(string id, string newParent)
{ {
return m_Items.MoveItem(id, newParent); return m_Items.MoveItem(id, newParent);

View File

@ -33,7 +33,6 @@ using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using Animation = OpenSim.Framework.Animation; using Animation = OpenSim.Framework.Animation;
namespace OpenSim.Framework.Tests namespace OpenSim.Framework.Tests

View File

@ -974,7 +974,7 @@ namespace OpenSim.Framework
} }
catch (Exception e) catch (Exception e)
{ {
m_log.WarnFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e); m_log.DebugFormat("[SynchronousRestObjectRequester]: exception in sending data to {0}: {1}", requestUrl, e);
return deserial; return deserial;
} }
finally finally
@ -999,18 +999,18 @@ namespace OpenSim.Framework
respStream.Close(); respStream.Close();
} }
else else
m_log.WarnFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb); m_log.DebugFormat("[SynchronousRestObjectRequester]: Oops! no content found in response stream from {0} {1}", requestUrl, verb);
} }
} }
catch (System.InvalidOperationException) catch (System.InvalidOperationException)
{ {
// This is what happens when there is invalid XML // This is what happens when there is invalid XML
m_log.WarnFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString()); m_log.DebugFormat("[SynchronousRestObjectRequester]: Invalid XML {0} {1}", requestUrl, typeof(TResponse).ToString());
} }
catch (Exception e) catch (Exception e)
{ {
m_log.WarnFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e); m_log.DebugFormat("[SynchronousRestObjectRequester]: Exception on response from {0} {1}", requestUrl, e);
} }
return deserial; return deserial;

View File

@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{ {
@ -104,7 +103,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();

View File

@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{ {
@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "password"); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password");
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream);
InventoryItemBase coaItem InventoryItemBase coaItem
@ -138,7 +137,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userLastName = "Stirrup"; string userLastName = "Stirrup";
string userPassword = "troll"; string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
// Create asset // Create asset
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040"); UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
@ -229,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
@ -261,8 +260,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "meowfood"); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire"); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
@ -294,7 +293,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod(); TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "password"); UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password");
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1

View File

@ -44,7 +44,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{ {
@ -71,7 +70,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userLastName = "Stirrup"; string userLastName = "Stirrup";
string userPassword = "troll"; string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
// Create asset // Create asset
SceneObjectGroup object1; SceneObjectGroup object1;
@ -184,8 +183,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "meowfood"); UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
@ -194,7 +193,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Now try loading to a root child folder // Now try loading to a root child folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA"); UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA");
MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
@ -203,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2"); Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
// Now try loading to a more deeply nested folder // Now try loading to a more deeply nested folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC"); UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC");
archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
@ -226,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password"); UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userFirstName = "Jock"; string userFirstName = "Jock";
string userLastName = "Stirrup"; string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); UserAccountHelpers.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
// Create asset // Create asset
SceneObjectGroup object1; SceneObjectGroup object1;
@ -328,7 +327,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>(); Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>(); HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
@ -395,13 +394,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
//log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
string folder1ExistingName = "a"; string folder1ExistingName = "a";
string folder2Name = "b"; string folder2Name = "b";
InventoryFolderBase folder1 InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder( = UserInventoryHelpers.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName); scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
@ -446,13 +445,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene);
string folder1ExistingName = "a"; string folder1ExistingName = "a";
string folder2Name = "b"; string folder2Name = "b";
InventoryFolderBase folder1 InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder( = UserInventoryHelpers.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName); scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());

View File

@ -45,7 +45,6 @@ using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
{ {
@ -73,7 +72,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
string userFirstName = "Jock"; string userFirstName = "Jock";
string userLastName = "Stirrup"; string userLastName = "Stirrup";
string userPassword = "troll"; string userPassword = "troll";
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword); UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, m_userId, userPassword);
AgentCircuitData acd = new AgentCircuitData(); AgentCircuitData acd = new AgentCircuitData();
acd.AgentID = m_userId; acd.AgentID = m_userId;

View File

@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests
{ {

View File

@ -40,7 +40,6 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo; using PresenceInfo = OpenSim.Services.Interfaces.PresenceInfo;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence.Tests
{ {

View File

@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;

View File

@ -37,7 +37,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Land.Tests namespace OpenSim.Region.CoreModules.World.Land.Tests
{ {

View File

@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
{ {

View File

@ -35,7 +35,6 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Serialiser.Tests namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
{ {

View File

@ -52,5 +52,7 @@ namespace OpenSim.Region.Framework.Interfaces
ArrayList GetScriptErrors(UUID itemID); ArrayList GetScriptErrors(UUID itemID);
bool HasScript(UUID itemID, out bool running); bool HasScript(UUID itemID, out bool running);
void SaveAllState();
} }
} }

View File

@ -115,6 +115,10 @@ namespace OpenSim.Region.Framework.Scenes
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public delegate void SceneShuttingDownDelegate(Scene scene);
public event SceneShuttingDownDelegate OnSceneShuttingDown;
/// <summary> /// <summary>
/// Fired when an object is touched/grabbed. /// Fired when an object is touched/grabbed.
/// </summary> /// </summary>
@ -2217,5 +2221,26 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
public void TriggerSceneShuttingDown(Scene s)
{
SceneShuttingDownDelegate handler = OnSceneShuttingDown;
if (handler != null)
{
foreach (SceneShuttingDownDelegate d in handler.GetInvocationList())
{
try
{
d(s);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerSceneShuttingDown failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
} }
} }

View File

@ -1423,7 +1423,10 @@ namespace OpenSim.Region.Framework.Scenes
if (item.AssetType == (int)AssetType.Link) if (item.AssetType == (int)AssetType.Link)
{ {
InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID)); InventoryItemBase linkedItem = InventoryService.GetItem(new InventoryItemBase(item.AssetID));
linkedItemFolderIdsToSend.Add(linkedItem.Folder);
// Take care of genuinely broken links where the target doesn't exist
if (linkedItem != null)
linkedItemFolderIdsToSend.Add(linkedItem.Folder);
} }
} }
@ -2142,19 +2145,7 @@ namespace OpenSim.Region.Framework.Scenes
sourcePart.Inventory.RemoveInventoryItem(item.ItemID); sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
} }
AddNewSceneObject(group, true); AddNewSceneObject(group, true, pos, rot, vel);
group.AbsolutePosition = pos;
group.Velocity = vel;
if (rot != null)
group.UpdateGroupRotationR((Quaternion)rot);
// TODO: This needs to be refactored with the similar code in
// SceneGraph.AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
// possibly by allowing this method to take a null rotation.
if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
// We can only call this after adding the scene object, since the scene object references the scene // We can only call this after adding the scene object, since the scene object references the scene
// to find out if scripts should be activated at all. // to find out if scripts should be activated at all.

View File

@ -209,6 +209,7 @@ namespace OpenSim.Region.Framework.Scenes
private Timer m_mapGenerationTimer = new Timer(); private Timer m_mapGenerationTimer = new Timer();
private bool m_generateMaptiles; private bool m_generateMaptiles;
private bool m_useBackup = true;
// private Dictionary<UUID, string[]> m_UserNamesCache = new Dictionary<UUID, string[]>(); // private Dictionary<UUID, string[]> m_UserNamesCache = new Dictionary<UUID, string[]>();
@ -477,6 +478,11 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGraph; } get { return m_sceneGraph; }
} }
public bool UseBackup
{
get { return m_useBackup; }
}
// an instance to the physics plugin's Scene object. // an instance to the physics plugin's Scene object.
public PhysicsScene PhysicsScene public PhysicsScene PhysicsScene
{ {
@ -620,7 +626,7 @@ namespace OpenSim.Region.Framework.Scenes
"delete object uuid <UUID>", "delete object uuid <UUID>",
"Delete object by uuid", HandleDeleteObject); "Delete object by uuid", HandleDeleteObject);
MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", MainConsole.Instance.Commands.AddCommand("region", false, "delete object name",
"delete object name <UUID>", "delete object name <name>",
"Delete object by name", HandleDeleteObject); "Delete object by name", HandleDeleteObject);
//Bind Storage Manager functions to some land manager functions for this scene //Bind Storage Manager functions to some land manager functions for this scene
@ -670,6 +676,9 @@ namespace OpenSim.Region.Framework.Scenes
IConfig startupConfig = m_config.Configs["Startup"]; IConfig startupConfig = m_config.Configs["Startup"];
m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance); m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
m_useBackup = startupConfig.GetBoolean("UseSceneBackup", m_useBackup);
if (!m_useBackup)
m_log.InfoFormat("[SCENE]: Backup has been disabled for {0}", RegionInfo.RegionName);
//Animation states //Animation states
m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
@ -1091,6 +1100,8 @@ namespace OpenSim.Region.Framework.Scenes
shuttingdown = true; shuttingdown = true;
m_log.Debug("[SCENE]: Persisting changed objects"); m_log.Debug("[SCENE]: Persisting changed objects");
EventManager.TriggerSceneShuttingDown(this);
EntityBase[] entities = GetEntities(); EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities) foreach (EntityBase entity in entities)
{ {
@ -2014,16 +2025,17 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Add a newly created object to the scene. /// Add a newly created object to the scene.
/// </summary> /// </summary>
/// /// <remarks>
/// This method does not send updates to the client - callers need to handle this themselves. /// This method does not send updates to the client - callers need to handle this themselves.
/// </remarks>
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param> /// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object</param> /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
/// <param name="rot">Rotation of the object</param> /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param>
/// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
/// <returns></returns> /// <returns></returns>
public bool AddNewSceneObject( public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
{ {
if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel)) if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
{ {
@ -4436,7 +4448,28 @@ namespace OpenSim.Region.Framework.Scenes
// } // }
/// <summary> /// <summary>
/// Get a named prim contained in this scene (will return the first /// Get a group via its UUID
/// </summary>
/// <param name="fullID"></param>
/// <returns>null if no group with that name exists</returns>
public SceneObjectGroup GetSceneObjectGroup(UUID fullID)
{
return m_sceneGraph.GetSceneObjectGroup(fullID);
}
/// <summary>
/// Get a group by name from the scene (will return the first
/// found, if there are more than one prim with the same name)
/// </summary>
/// <param name="name"></param>
/// <returns>null if no group with that name exists</returns>
public SceneObjectGroup GetSceneObjectGroup(string name)
{
return m_sceneGraph.GetSceneObjectGroup(name);
}
/// <summary>
/// Get a prim by name from the scene (will return the first
/// found, if there are more than one prim with the same name) /// found, if there are more than one prim with the same name)
/// </summary> /// </summary>
/// <param name="name"></param> /// <param name="name"></param>

View File

@ -352,24 +352,25 @@ namespace OpenSim.Region.Framework.Scenes
/// This method does not send updates to the client - callers need to handle this themselves. /// This method does not send updates to the client - callers need to handle this themselves.
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param> /// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object</param> /// <param name="pos">Position of the object. If null then the position stored in the object is used.</param>
/// <param name="rot">Rotation of the object</param> /// <param name="rot">Rotation of the object. If null then the rotation stored in the object is used.</param>
/// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
/// <returns></returns> /// <returns></returns>
public bool AddNewSceneObject( public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel)
{ {
AddNewSceneObject(sceneObject, true, false); AddNewSceneObject(sceneObject, true, false);
// we set it's position in world. if (pos != null)
sceneObject.AbsolutePosition = pos; sceneObject.AbsolutePosition = (Vector3)pos;
if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim) if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim)
{ {
sceneObject.ClearPartAttachmentData(); sceneObject.ClearPartAttachmentData();
} }
sceneObject.UpdateGroupRotationR(rot); if (rot != null)
sceneObject.UpdateGroupRotationR((Quaternion)rot);
//group.ApplyPhysics(m_physicalPrim); //group.ApplyPhysics(m_physicalPrim);
if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
@ -385,6 +386,9 @@ namespace OpenSim.Region.Framework.Scenes
/// Add an object to the scene. This will both update the scene, and send information about the /// Add an object to the scene. This will both update the scene, and send information about the
/// new object to all clients interested in the scene. /// new object to all clients interested in the scene.
/// </summary> /// </summary>
/// <remarks>
/// The object's stored position, rotation and velocity are used.
/// </remarks>
/// <param name="sceneObject"></param> /// <param name="sceneObject"></param>
/// <param name="attachToBackup"> /// <param name="attachToBackup">
/// If true, the object is made persistent into the scene. /// If true, the object is made persistent into the scene.
@ -1047,6 +1051,51 @@ namespace OpenSim.Region.Framework.Scenes
return result; return result;
} }
/// <summary>
/// Get a group in the scene
/// </summary>
/// <param name="fullID">UUID of the group</param>
/// <returns>null if no such group was found</returns>
protected internal SceneObjectGroup GetSceneObjectGroup(UUID fullID)
{
lock (SceneObjectGroupsByFullID)
{
if (SceneObjectGroupsByFullID.ContainsKey(fullID))
return SceneObjectGroupsByFullID[fullID];
}
return null;
}
/// <summary>
/// Get a group by name from the scene (will return the first
/// found, if there are more than one prim with the same name)
/// </summary>
/// <param name="name"></param>
/// <returns>null if the part was not found</returns>
protected internal SceneObjectGroup GetSceneObjectGroup(string name)
{
SceneObjectGroup so = null;
Entities.Find(
delegate(EntityBase entity)
{
if (entity is SceneObjectGroup)
{
if (entity.Name == name)
{
so = (SceneObjectGroup)entity;
return true;
}
}
return false;
}
);
return so;
}
/// <summary> /// <summary>
/// Get a part contained in this scene. /// Get a part contained in this scene.
/// </summary> /// </summary>
@ -1061,7 +1110,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// Get a named prim contained in this scene (will return the first /// Get a prim by name from the scene (will return the first
/// found, if there are more than one prim with the same name) /// found, if there are more than one prim with the same name)
/// </summary> /// </summary>
/// <param name="name"></param> /// <param name="name"></param>

View File

@ -1613,7 +1613,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
if (HasGroupChanged) if (m_scene.UseBackup && HasGroupChanged)
{ {
// don't backup while it's selected or you're asking for changes mid stream. // don't backup while it's selected or you're asking for changes mid stream.
if (isTimeToPersist() || forcedBackup) if (isTimeToPersist() || forcedBackup)

View File

@ -145,7 +145,6 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 StatusSandboxPos; public Vector3 StatusSandboxPos;
// TODO: This needs to be persisted in next XML version update!
[XmlIgnore] [XmlIgnore]
public int[] PayPrice = {-2,-2,-2,-2,-2}; public int[] PayPrice = {-2,-2,-2,-2,-2};

View File

@ -341,6 +341,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl); m_SOPXmlProcessors.Add("MediaUrl", ProcessMediaUrl);
m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
m_SOPXmlProcessors.Add("PayPrice0", ProcessPayPrice0);
m_SOPXmlProcessors.Add("PayPrice1", ProcessPayPrice1);
m_SOPXmlProcessors.Add("PayPrice2", ProcessPayPrice2);
m_SOPXmlProcessors.Add("PayPrice3", ProcessPayPrice3);
m_SOPXmlProcessors.Add("PayPrice4", ProcessPayPrice4);
#endregion #endregion
#region TaskInventoryXmlProcessors initialization #region TaskInventoryXmlProcessors initialization
@ -698,6 +703,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{ {
obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty));
} }
private static void ProcessPayPrice0(SceneObjectPart obj, XmlTextReader reader)
{
obj.PayPrice[0] = (int)reader.ReadElementContentAsInt("PayPrice0", String.Empty);
}
private static void ProcessPayPrice1(SceneObjectPart obj, XmlTextReader reader)
{
obj.PayPrice[1] = (int)reader.ReadElementContentAsInt("PayPrice1", String.Empty);
}
private static void ProcessPayPrice2(SceneObjectPart obj, XmlTextReader reader)
{
obj.PayPrice[2] = (int)reader.ReadElementContentAsInt("PayPrice2", String.Empty);
}
private static void ProcessPayPrice3(SceneObjectPart obj, XmlTextReader reader)
{
obj.PayPrice[3] = (int)reader.ReadElementContentAsInt("PayPrice3", String.Empty);
}
private static void ProcessPayPrice4(SceneObjectPart obj, XmlTextReader reader)
{
obj.PayPrice[4] = (int)reader.ReadElementContentAsInt("PayPrice4", String.Empty);
}
#endregion #endregion
#region TaskInventoryXmlProcessors #region TaskInventoryXmlProcessors
@ -1069,7 +1100,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); shp.Media = PrimitiveBaseShape.MediaList.FromXml(value);
} }
#endregion #endregion
////////// Write ///////// ////////// Write /////////
@ -1175,6 +1205,11 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString()); writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());
writer.WriteElementString("PayPrice1", sop.PayPrice[1].ToString());
writer.WriteElementString("PayPrice2", sop.PayPrice[2].ToString());
writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());
writer.WriteEndElement(); writer.WriteEndElement();
} }

View File

@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -37,7 +37,6 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -34,7 +34,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -34,7 +34,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -37,7 +37,6 @@ using OpenSim.Region.CoreModules.World.Permissions;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -35,7 +35,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using log4net; using log4net;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests

View File

@ -40,7 +40,6 @@ using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups; using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -44,7 +44,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -43,7 +43,6 @@ using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests
{ {

View File

@ -36,7 +36,6 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
using System.Threading; using System.Threading;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests

View File

@ -46,55 +46,55 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Tests namespace OpenSim.Region.Framework.Tests
{ {
[TestFixture] [TestFixture]
public class TaskInventoryTests public class TaskInventoryTests
{ {
protected UserAccount CreateUser(Scene scene) [Test]
public void TestRezObjectFromInventoryItem()
{ {
string userFirstName = "Jock"; TestHelper.InMethod();
string userLastName = "Stirrup"; // log4net.Config.XmlConfigurator.Configure();
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
}
protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) Scene scene = SceneSetupHelpers.SetupScene();
{ UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
string part1Name = "part1"; SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000"); SceneObjectPart sop1 = sog1.RootPart;
SceneObjectPart part1
= new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = part1Name, UUID = part1Id };
return new SceneObjectGroup(part1);
}
protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) // Create an object embedded inside the first
{ UUID taskSceneObjectItemId = UUID.Parse("00000000-0000-0000-0000-100000000000");
AssetNotecard nc = new AssetNotecard(); TaskInventoryItem taskSceneObjectItem
nc.BodyText = "Hello World!"; = TaskInventoryHelpers.AddSceneObject(scene, sop1, "tso", taskSceneObjectItemId);
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
scene.AssetService.Store(ncAsset);
TaskInventoryItem ncItem
= new TaskInventoryItem
{ Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid,
Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
part.Inventory.AddInventoryItem(ncItem, true);
return ncItem; scene.AddSceneObject(sog1);
Vector3 rezPos = new Vector3(10, 10, 10);
Quaternion rezRot = new Quaternion(0.5f, 0.5f, 0.5f, 0.5f);
Vector3 rezVel = new Vector3(2, 2, 2);
scene.RezObject(sop1, taskSceneObjectItem, rezPos, rezRot, rezVel, 0);
SceneObjectGroup rezzedObject = scene.GetSceneObjectGroup("tso");
Assert.That(rezzedObject, Is.Not.Null);
Assert.That(rezzedObject.AbsolutePosition, Is.EqualTo(rezPos));
// Velocity doesn't get applied, probably because there is no physics in tests (yet)
// Assert.That(rezzedObject.Velocity, Is.EqualTo(rezVel));
Assert.That(rezzedObject.Velocity, Is.EqualTo(Vector3.Zero));
// Confusingly, this isn't the rezzedObject.Rotation
Assert.That(rezzedObject.RootPart.RotationOffset, Is.EqualTo(rezRot));
} }
/// <summary> /// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned. /// Test MoveTaskInventoryItem where the item has no parent folder assigned.
/// </summary> /// </summary>
/// <remarks>
/// This should place it in the most suitable user folder. /// This should place it in the most suitable user folder.
/// </remarks>
[Test] [Test]
public void TestMoveTaskInventoryItem() public void TestMoveTaskInventoryItem()
{ {
@ -102,10 +102,11 @@ namespace OpenSim.Region.Framework.Tests
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
UserAccount user1 = CreateUser(scene); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart; SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
InventoryFolderBase folder InventoryFolderBase folder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
@ -128,10 +129,10 @@ namespace OpenSim.Region.Framework.Tests
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene(); Scene scene = SceneSetupHelpers.SetupScene();
UserAccount user1 = CreateUser(scene); UserAccount user1 = UserAccountHelpers.CreateUserWithInventory(scene);
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID); SceneObjectGroup sog1 = SceneSetupHelpers.CreateSceneObject(1, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart; SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1); TaskInventoryItem sopItem1 = TaskInventoryHelpers.AddNotecard(scene, sop1);
// Perform test // Perform test
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);

View File

@ -33,7 +33,6 @@ using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Setup;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
namespace OpenSim.Region.Framework.Scenes.Tests namespace OpenSim.Region.Framework.Scenes.Tests

View File

@ -35,7 +35,6 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
{ {

View File

@ -58,12 +58,9 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Config Settings Documentation. /// Config Settings Documentation.
/// At the TOP LEVEL, e.g. in OpenSim.ini, we have the following options: /// Each configuration setting can be specified in two places: OpenSim.ini or Regions.ini.
/// EACH REGION, in OpenSim.ini, can have the following settings under the [AutoBackupModule] section. /// If specified in Regions.ini, the settings should be within the region's section name.
/// IMPORTANT: You may optionally specify the key name as follows for a per-region key: [Region Name].[Key Name] /// If specified in OpenSim.ini, the settings should be within the [AutoBackupModule] section.
/// Example: My region is named Foo.
/// If I wanted to specify the "AutoBackupInterval" key just for this region, I would name my key "Foo.AutoBackupInterval", under the [AutoBackupModule] section of OpenSim.ini.
/// Instead of specifying them on a per-region basis, you can also omit the region name to specify the default setting for all regions.
/// Region-specific settings take precedence. /// Region-specific settings take precedence.
/// ///
/// AutoBackupModuleEnabled: True/False. Default: False. If True, use the auto backup module. This setting does not support per-region basis. /// AutoBackupModuleEnabled: True/False. Default: False. If True, use the auto backup module. This setting does not support per-region basis.
@ -71,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
/// AutoBackup: True/False. Default: False. If True, activate auto backup functionality. /// AutoBackup: True/False. Default: False. If True, activate auto backup functionality.
/// This is the only required option for enabling auto-backup; the other options have sane defaults. /// This is the only required option for enabling auto-backup; the other options have sane defaults.
/// If False for a particular region, the auto-backup module becomes a no-op for the region, and all other AutoBackup* settings are ignored. /// If False for a particular region, the auto-backup module becomes a no-op for the region, and all other AutoBackup* settings are ignored.
/// If False globally (the default), only regions that specifically override this with "FooRegion.AutoBackup = true" will get AutoBackup functionality. /// If False globally (the default), only regions that specifically override it in Regions.ini will get AutoBackup functionality.
/// AutoBackupInterval: Double, non-negative value. Default: 720 (12 hours). /// AutoBackupInterval: Double, non-negative value. Default: 720 (12 hours).
/// The number of minutes between each backup attempt. /// The number of minutes between each backup attempt.
/// If a negative or zero value is given, it is equivalent to setting AutoBackup = False. /// If a negative or zero value is given, it is equivalent to setting AutoBackup = False.
@ -281,21 +278,21 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
{ {
string sRegionName; string sRegionName;
string sRegionLabel; string sRegionLabel;
string prepend; // string prepend;
AutoBackupModuleState state; AutoBackupModuleState state;
if (parseDefault) if (parseDefault)
{ {
sRegionName = null; sRegionName = null;
sRegionLabel = "DEFAULT"; sRegionLabel = "DEFAULT";
prepend = ""; // prepend = "";
state = this.m_defaultState; state = this.m_defaultState;
} }
else else
{ {
sRegionName = scene.RegionInfo.RegionName; sRegionName = scene.RegionInfo.RegionName;
sRegionLabel = sRegionName; sRegionLabel = sRegionName;
prepend = sRegionName + "."; // prepend = sRegionName + ".";
state = null; state = null;
} }

View File

@ -1553,7 +1553,8 @@ namespace OpenSim.Region.Physics.OdePlugin
removeprims = new List<OdePrim>(); removeprims = new List<OdePrim>();
} }
removeprims.Add(chr); removeprims.Add(chr);
m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!"); /// Commented this because it triggers on every bullet
//m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed. Removed it from the active prim list. This needs to be fixed!");
} }
} }
} }

View File

@ -46,6 +46,7 @@ using OpenSim.Region.CoreModules.World.Land;
using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.CoreModules.World.Terrain;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Framework.Scenes.Animation; using OpenSim.Region.Framework.Scenes.Animation;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;
@ -3635,12 +3636,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return m_ScriptEngine.GetStartParameter(m_itemID); return m_ScriptEngine.GetStartParameter(m_itemID);
} }
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
{
m_host.AddScriptLPS(1);
NotImplemented("llGodLikeRezObject");
}
public void llRequestPermissions(string agent, int perm) public void llRequestPermissions(string agent, int perm)
{ {
UUID agentID = new UUID(); UUID agentID = new UUID();
@ -4305,7 +4300,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AbsolutePosition.ToString(), m_host.AbsolutePosition.ToString(),
agentItem.ID, true, m_host.AbsolutePosition, agentItem.ID, true, m_host.AbsolutePosition,
bucket); bucket);
if (m_TransferModule != null) if (m_TransferModule != null)
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
@ -4618,12 +4612,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.CollisionSoundVolume = (float)impact_volume; m_host.CollisionSoundVolume = (float)impact_volume;
} }
public void llCollisionSprite(string impact_sprite)
{
m_host.AddScriptLPS(1);
NotImplemented("llCollisionSprite");
}
public LSL_String llGetAnimation(string id) public LSL_String llGetAnimation(string id)
{ {
// This should only return a value if the avatar is in the same region // This should only return a value if the avatar is in the same region
@ -4887,6 +4875,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return result; return result;
} }
public LSL_Integer llGetLinkNumberOfSides(int link)
{
m_host.AddScriptLPS(1);
SceneObjectPart linkedPart;
if (link == ScriptBaseClass.LINK_ROOT)
linkedPart = m_host.ParentGroup.RootPart;
else if (link == ScriptBaseClass.LINK_THIS)
linkedPart = m_host;
else
linkedPart = m_host.ParentGroup.GetLinkNumPart(link);
return GetNumberOfSides(linkedPart);
}
public LSL_Integer llGetNumberOfSides() public LSL_Integer llGetNumberOfSides()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -5947,11 +5951,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ScriptSleep(100); ScriptSleep(100);
} }
public void llSetSoundQueueing(int queue)
{
m_host.AddScriptLPS(1);
}
public void llSetSoundRadius(double radius) public void llSetSoundRadius(double radius)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
@ -10984,6 +10983,121 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_SayShoutCount = 0; m_SayShoutCount = 0;
} }
#region Not Implemented
//
// Listing the unimplemented lsl functions here, please move
// them from this region as they are completed
//
public void llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options)
{
m_host.AddScriptLPS(1);
NotImplemented("llCastRay");
}
public void llGetEnv(LSL_String name)
{
m_host.AddScriptLPS(1);
NotImplemented("llGetEnv");
}
public void llGetSPMaxMemory()
{
m_host.AddScriptLPS(1);
NotImplemented("llGetSPMaxMemory");
}
public virtual LSL_Integer llGetUsedMemory()
{
m_host.AddScriptLPS(1);
NotImplemented("llGetUsedMemory");
return 0;
}
public void llRegionSayTo( LSL_Key target, LSL_Integer channel, LSL_String msg )
{
m_host.AddScriptLPS(1);
NotImplemented("llRegionSayTo");
}
public void llScriptProfiler( LSL_Integer flags )
{
m_host.AddScriptLPS(1);
//NotImplemented("llScriptProfiler");
}
public void llSetSoundQueueing(int queue)
{
m_host.AddScriptLPS(1);
}
public void llCollisionSprite(string impact_sprite)
{
m_host.AddScriptLPS(1);
NotImplemented("llCollisionSprite");
}
public void llGodLikeRezObject(string inventory, LSL_Vector pos)
{
m_host.AddScriptLPS(1);
if (!World.Permissions.IsGod(m_host.OwnerID))
NotImplemented("llGodLikeRezObject");
AssetBase rezAsset = World.AssetService.Get(inventory);
if (rezAsset == null)
{
llSay(0, "Asset not found");
return;
}
SceneObjectGroup group = null;
try
{
string xmlData = Utils.BytesToString(rezAsset.Data);
group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
}
catch
{
llSay(0, "Asset not found");
return;
}
if (group == null)
{
llSay(0, "Asset not found");
return;
}
group.RootPart.AttachPoint = group.RootPart.Shape.State;
group.RootPart.AttachOffset = group.AbsolutePosition;
group.ResetIDs();
Vector3 llpos = new Vector3((float)pos.x, (float)pos.y, (float)pos.z);
World.AddNewSceneObject(group, true, llpos, Quaternion.Identity, Vector3.Zero);
group.CreateScriptInstances(0, true, World.DefaultScriptEngine, 3);
group.ScheduleGroupForFullUpdate();
// objects rezzed with this method are die_at_edge by default.
group.RootPart.SetDieAtEdge(true);
group.ResumeScripts();
m_ScriptEngine.PostObjectEvent(m_host.LocalId, new EventParams(
"object_rez", new Object[] {
new LSL_String(
group.RootPart.UUID.ToString()) },
new DetectParams[0]));
}
#endregion
} }
public class NotecardCache public class NotecardCache

View File

@ -121,6 +121,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
LSL_Float llGetEnergy(); LSL_Float llGetEnergy();
LSL_Vector llGetForce(); LSL_Vector llGetForce();
LSL_Integer llGetFreeMemory(); LSL_Integer llGetFreeMemory();
LSL_Integer llGetUsedMemory();
LSL_Integer llGetFreeURLs(); LSL_Integer llGetFreeURLs();
LSL_Vector llGetGeometricCenter(); LSL_Vector llGetGeometricCenter();
LSL_Float llGetGMTclock(); LSL_Float llGetGMTclock();

View File

@ -461,6 +461,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
return m_LSL_Functions.llGetFreeMemory(); return m_LSL_Functions.llGetFreeMemory();
} }
public LSL_Integer llGetUsedMemory()
{
return m_LSL_Functions.llGetUsedMemory();
}
public LSL_Integer llGetFreeURLs() public LSL_Integer llGetFreeURLs()
{ {
return m_LSL_Functions.llGetFreeURLs(); return m_LSL_Functions.llGetFreeURLs();

View File

@ -1530,6 +1530,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
public struct LSLInteger public struct LSLInteger
{ {
public int value; public int value;
private static readonly Regex castRegex = new Regex(@"(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*(-?|\+?)[0-9][0-9]*)");
#region Constructors #region Constructors
public LSLInteger(int i) public LSLInteger(int i)
@ -1549,9 +1550,10 @@ namespace OpenSim.Region.ScriptEngine.Shared
public LSLInteger(string s) public LSLInteger(string s)
{ {
Regex r = new Regex("(^[ ]*0[xX][0-9A-Fa-f][0-9A-Fa-f]*)|(^[ ]*-?[0-9][0-9]*)"); Match m = castRegex.Match(s);
Match m = r.Match(s);
string v = m.Groups[0].Value; string v = m.Groups[0].Value;
// Leading plus sign is allowed, but ignored
v = v.Replace("+", "");
if (v == String.Empty) if (v == String.Empty)
{ {

View File

@ -29,7 +29,6 @@ using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Tests.Common; using OpenSim.Tests.Common;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Tests.Common.Setup;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using Nini.Config; using Nini.Config;
using OpenSim.Region.ScriptEngine.Shared.Api; using OpenSim.Region.ScriptEngine.Shared.Api;

View File

@ -29,7 +29,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using Nini.Config; using Nini.Config;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Tests.Common.Setup;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenMetaverse; using OpenMetaverse;

View File

@ -461,11 +461,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return 0; return 0;
} }
public object DoMaintenance(object p) public void SaveAllState()
{ {
object[] parms = (object[])p;
int sleepTime = (int)parms[0];
foreach (IScriptInstance inst in m_Scripts.Values) foreach (IScriptInstance inst in m_Scripts.Values)
{ {
if (inst.EventTime() > m_EventLimit) if (inst.EventTime() > m_EventLimit)
@ -475,6 +472,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine
inst.Start(); inst.Start();
} }
} }
}
public object DoMaintenance(object p)
{
object[] parms = (object[])p;
int sleepTime = (int)parms[0];
SaveAllState();
System.Threading.Thread.Sleep(sleepTime); System.Threading.Thread.Sleep(sleepTime);

View File

@ -393,6 +393,10 @@ namespace OpenSim.Services.InventoryService
public virtual bool UpdateItem(InventoryItemBase item) public virtual bool UpdateItem(InventoryItemBase item)
{ {
if (!m_AllowDelete)
if (item.AssetType == (sbyte)AssetType.Link || item.AssetType == (sbyte)AssetType.LinkFolder)
return false;
return m_Database.StoreItem(ConvertFromOpenSim(item)); return m_Database.StoreItem(ConvertFromOpenSim(item));
} }
@ -411,12 +415,30 @@ namespace OpenSim.Services.InventoryService
public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs) public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
{ {
if (!m_AllowDelete) if (!m_AllowDelete)
return false; {
// We must still allow links and links to folders to be deleted, otherwise they will build up
// Just use the ID... *facepalms* // in the player's inventory until they can no longer log in. Deletions of links due to code bugs or
// // similar is inconvenient but on a par with accidental movement of items. The original item is never
foreach (UUID id in itemIDs) // touched.
m_Database.DeleteItems("inventoryID", id.ToString()); foreach (UUID id in itemIDs)
{
if (!m_Database.DeleteItems(
new string[] { "inventoryID", "assetType" },
new string[] { id.ToString(), ((sbyte)AssetType.Link).ToString() }));
{
m_Database.DeleteItems(
new string[] { "inventoryID", "assetType" },
new string[] { id.ToString(), ((sbyte)AssetType.LinkFolder).ToString() });
}
}
}
else
{
// Just use the ID... *facepalms*
//
foreach (UUID id in itemIDs)
m_Database.DeleteItems("inventoryID", id.ToString());
}
return true; return true;
} }

View File

@ -59,7 +59,21 @@ namespace OpenSim.Tests.Common
} }
/// <summary> /// <summary>
/// Create an asset from the given scene object. /// Create an asset from the given object.
/// </summary>
/// <param name="assetUuidTail">
/// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
/// will be used.
/// </param>
/// <param name="sog"></param>
/// <returns></returns>
public static AssetBase CreateAsset(int assetUuidTail, SceneObjectGroup sog)
{
return CreateAsset(new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", assetUuidTail)), sog);
}
/// <summary>
/// Create an asset from the given object.
/// </summary> /// </summary>
/// <param name="assetUuid"></param> /// <param name="assetUuid"></param>
/// <param name="sog"></param> /// <param name="sog"></param>
@ -76,7 +90,7 @@ namespace OpenSim.Tests.Common
/// <summary> /// <summary>
/// Create an asset from the given scene object. /// Create an asset from the given scene object.
/// </summary> /// </summary>
/// <param name="assetUuidTailZ"> /// <param name="assetUuidTail">
/// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}" /// The hexadecimal last part of the UUID for the asset created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
/// will be used. /// will be used.
/// </param> /// </param>

View File

@ -34,9 +34,9 @@ using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
namespace OpenSim.Tests.Common.Setup namespace OpenSim.Tests.Common
{ {
public class BaseRequestHandlerTestHelper public class BaseRequestHandlerHelpers
{ {
private static string[] m_emptyStringArray = new string[] { }; private static string[] m_emptyStringArray = new string[] { };

View File

@ -49,7 +49,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Mock;
namespace OpenSim.Tests.Common.Setup namespace OpenSim.Tests.Common
{ {
/// <summary> /// <summary>
/// Helpers for setting up scenes. /// Helpers for setting up scenes.

View File

@ -0,0 +1,89 @@
/*
* 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 OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common
{
/// <summary>
/// Utility functions for carrying out task inventory tests.
/// </summary>
///
public static class TaskInventoryHelpers
{
/// <summary>
/// Add a notecard item to the given part.
/// </summary>
/// <param name="scene"></param>
/// <param name="part"></param>
/// <returns>The item that was added</returns>
public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part)
{
AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
= AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
scene.AssetService.Store(ncAsset);
TaskInventoryItem ncItem
= new TaskInventoryItem
{ Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid,
Type = (int)AssetType.Notecard, InvType = (int)InventoryType.Notecard };
part.Inventory.AddInventoryItem(ncItem, true);
return ncItem;
}
/// <summary>
/// Add a scene object item to the given part.
/// </summary>
/// <param name="scene"></param>
/// <param name="sop"></param>
/// <param name="itemName"></param>
/// <param name="id"></param>
public static TaskInventoryItem AddSceneObject(Scene scene, SceneObjectPart sop, string itemName, UUID id)
{
SceneObjectGroup taskSceneObject = SceneSetupHelpers.CreateSceneObject(1, UUID.Zero);
AssetBase taskSceneObjectAsset = AssetHelpers.CreateAsset(0x10, taskSceneObject);
scene.AssetService.Store(taskSceneObjectAsset);
TaskInventoryItem taskSceneObjectItem
= new TaskInventoryItem
{ Name = itemName, AssetID = taskSceneObjectAsset.FullID, ItemID = id,
Type = (int)AssetType.Object, InvType = (int)InventoryType.Object };
sop.Inventory.AddInventoryItem(taskSceneObjectItem, true);
return taskSceneObjectItem;
}
}
}

View File

@ -31,12 +31,12 @@ using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common.Setup namespace OpenSim.Tests.Common
{ {
/// <summary> /// <summary>
/// Utility functions for carrying out user profile related tests. /// Utility functions for carrying out user profile related tests.
/// </summary> /// </summary>
public static class UserProfileTestUtils public static class UserAccountHelpers
{ {
// /// <summary> // /// <summary>
// /// Create a test user with a standard inventory // /// Create a test user with a standard inventory

View File

@ -34,9 +34,9 @@ using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common namespace OpenSim.Tests.Common
{ {
/// <summary> /// <summary>
/// Utility functions for carrying out user inventory related tests. /// Utility functions for carrying out user inventory tests.
/// </summary> /// </summary>
public static class UserInventoryTestUtils public static class UserInventoryHelpers
{ {
public static readonly string PATH_DELIMITER = "/"; public static readonly string PATH_DELIMITER = "/";