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

avinationmerge
meta7 2010-08-30 11:42:17 -07:00
commit 35d6181b78
81 changed files with 3201 additions and 2665 deletions

View File

@ -89,7 +89,6 @@ namespace OpenSim.Data.MSSQL
Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>(); Dictionary<UUID, SceneObjectGroup> objects = new Dictionary<UUID, SceneObjectGroup>();
SceneObjectGroup grp = null; SceneObjectGroup grp = null;
string sql = "SELECT *, " + string sql = "SELECT *, " +
"sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " + "sort = CASE WHEN prims.UUID = prims.SceneGroupID THEN 0 ELSE 1 END " +
"FROM prims " + "FROM prims " +
@ -232,7 +231,7 @@ namespace OpenSim.Data.MSSQL
/// <param name="regionUUID"></param> /// <param name="regionUUID"></param>
public void StoreObject(SceneObjectGroup obj, UUID regionUUID) public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{ {
_Log.InfoFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count); _Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlConnection conn = new SqlConnection(m_connectionString))
{ {
@ -291,7 +290,6 @@ namespace OpenSim.Data.MSSQL
} }
} }
} }
} }
/// <summary> /// <summary>

View File

@ -239,6 +239,7 @@ namespace OpenSim.Data.MySQL
ExecuteNonQuery(cmd); ExecuteNonQuery(cmd);
} }
cmd.Dispose(); cmd.Dispose();
} }
} }
@ -676,7 +677,8 @@ namespace OpenSim.Data.MySQL
"MusicURL, PassHours, PassPrice, SnapshotUUID, " + "MusicURL, PassHours, PassPrice, SnapshotUUID, " +
"UserLocationX, UserLocationY, UserLocationZ, " + "UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " + "UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, Dwell) values (" + "AuthbuyerID, OtherCleanTime, Dwell, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"?UUID, ?RegionUUID, " + "?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " + "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
"?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@ -686,7 +688,8 @@ namespace OpenSim.Data.MySQL
"?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " + "?MusicURL, ?PassHours, ?PassPrice, ?SnapshotUUID, " +
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " + "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?Dwell)"; "?AuthbuyerID, ?OtherCleanTime, ?Dwell, ?MediaType, ?MediaDescription, "+
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@ -1346,6 +1349,14 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
} }
newData.MediaDescription = (string) row["MediaDescription"];
newData.MediaType = (string) row["MediaType"];
newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
return newData; return newData;
@ -1650,6 +1661,14 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID); cmd.Parameters.AddWithValue("AuthBuyerID", land.AuthBuyerID);
cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime); cmd.Parameters.AddWithValue("OtherCleanTime", land.OtherCleanTime);
cmd.Parameters.AddWithValue("Dwell", land.Dwell); cmd.Parameters.AddWithValue("Dwell", land.Dwell);
cmd.Parameters.AddWithValue("MediaDescription", land.MediaDescription);
cmd.Parameters.AddWithValue("MediaType", land.MediaType);
cmd.Parameters.AddWithValue("MediaWidth", land.MediaWidth);
cmd.Parameters.AddWithValue("MediaHeight", land.MediaHeight);
cmd.Parameters.AddWithValue("MediaLoop", land.MediaLoop);
cmd.Parameters.AddWithValue("ObscureMusic", land.ObscureMusic);
cmd.Parameters.AddWithValue("ObscureMedia", land.ObscureMedia);
} }
/// <summary> /// <summary>

View File

@ -801,9 +801,19 @@ ALTER TABLE `regionwindlight` CHANGE COLUMN `cloud_scroll_x` `cloud_scroll_x` F
COMMIT; COMMIT;
:VERSION 35 #--------------------- :VERSION 35 #---------------------
-- Added post 0.7
BEGIN; BEGIN;
ALTER TABLE prims ADD COLUMN MediaURL varchar(255); ALTER TABLE prims ADD COLUMN MediaURL varchar(255);
ALTER TABLE primshapes ADD COLUMN Media TEXT; ALTER TABLE primshapes ADD COLUMN Media TEXT;
COMMIT; COMMIT;
:VERSION 36 #---------------------
BEGIN;
ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ;
ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
COMMIT;

View File

@ -446,3 +446,13 @@ update land
where AuthbuyerID not like '%-%'; where AuthbuyerID not like '%-%';
COMMIT; COMMIT;
:VERSION 19
BEGIN ;
ALTER TABLE `land` ADD COLUMN `MediaType` VARCHAR(32) NOT NULL DEFAULT 'none/none' ;
ALTER TABLE `land` ADD COLUMN `MediaDescription` VARCHAR(255) NOT NULL DEFAULT '';
ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0';
ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE;
COMMIT ;

View File

@ -1762,6 +1762,12 @@ namespace OpenSim.Data.SQLite
row["AuthbuyerID"] = land.AuthBuyerID.ToString(); row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime; row["OtherCleanTime"] = land.OtherCleanTime;
row["Dwell"] = land.Dwell; row["Dwell"] = land.Dwell;
row["MediaType"] = land.MediaType;
row["MediaDescription"] = land.MediaDescription;
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
row["MediaLoop"] = land.MediaLoop.ToString();
row["ObscureMusic"] = land.ObscureMusic.ToString();
row["ObscureMedia"] = land.ObscureMedia.ToString();
} }
/// <summary> /// <summary>

View File

@ -37,11 +37,6 @@ using log4net;
using System.Reflection; using System.Reflection;
using System.Data.Common; using System.Data.Common;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// DBMS-specific: // DBMS-specific:
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using OpenSim.Data.MySQL; using OpenSim.Data.MySQL;
@ -52,7 +47,6 @@ using OpenSim.Data.MSSQL;
using Mono.Data.Sqlite; using Mono.Data.Sqlite;
using OpenSim.Data.SQLite; using OpenSim.Data.SQLite;
namespace OpenSim.Data.Tests namespace OpenSim.Data.Tests
{ {

View File

@ -37,10 +37,6 @@ using log4net;
using System.Reflection; using System.Reflection;
using System.Data.Common; using System.Data.Common;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// DBMS-specific: // DBMS-specific:
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using OpenSim.Data.MySQL; using OpenSim.Data.MySQL;

View File

@ -40,10 +40,6 @@ using log4net;
using System.Reflection; using System.Reflection;
using System.Data.Common; using System.Data.Common;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// DBMS-specific: // DBMS-specific:
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using OpenSim.Data.MySQL; using OpenSim.Data.MySQL;

View File

@ -90,6 +90,78 @@ namespace OpenSim.Framework
private Vector3 _userLookAt = new Vector3(); private Vector3 _userLookAt = new Vector3();
private int _dwell = 0; private int _dwell = 0;
private int _otherCleanTime = 0; private int _otherCleanTime = 0;
private string _mediaType = "none/none";
private string _mediaDescription = "";
private int _mediaHeight = 0;
private int _mediaWidth = 0;
private bool _mediaLoop = false;
private bool _obscureMusic = false;
private bool _obscureMedia = false;
/// <summary>
/// Whether to obscure parcel media URL
/// </summary>
[XmlIgnore]
public bool ObscureMedia {
get {
return _obscureMedia;
}
set {
_obscureMedia = value;
}
}
/// <summary>
/// Whether to obscure parcel music URL
/// </summary>
[XmlIgnore]
public bool ObscureMusic {
get {
return _obscureMusic;
}
set {
_obscureMusic = value;
}
}
/// <summary>
/// Whether to loop parcel media
/// </summary>
[XmlIgnore]
public bool MediaLoop {
get {
return _mediaLoop;
}
set {
_mediaLoop = value;
}
}
/// <summary>
/// Height of parcel media render
/// </summary>
[XmlIgnore]
public int MediaHeight {
get {
return _mediaHeight;
}
set {
_mediaHeight = value;
}
}
/// <summary>
/// Width of parcel media render
/// </summary>
[XmlIgnore]
public int MediaWidth {
get {
return _mediaWidth;
}
set {
_mediaWidth = value;
}
}
/// <summary> /// <summary>
/// Upper corner of the AABB for the parcel /// Upper corner of the AABB for the parcel
@ -358,20 +430,6 @@ namespace OpenSim.Framework
} }
} }
private int[] _mediaSize = new int[2];
public int[] MediaSize
{
get
{
return _mediaSize;
}
set
{
_mediaSize = value;
}
}
private string _mediaType = "";
public string MediaType public string MediaType
{ {
get get
@ -586,6 +644,17 @@ namespace OpenSim.Framework
} }
} }
/// <summary>
/// parcel media description
/// </summary>
public string MediaDescription {
get {
return _mediaDescription;
}
set {
_mediaDescription = value;
}
}
public LandData() public LandData()
{ {
@ -635,6 +704,13 @@ namespace OpenSim.Framework
landData._userLookAt = _userLookAt; landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime; landData._otherCleanTime = _otherCleanTime;
landData._dwell = _dwell; landData._dwell = _dwell;
landData._mediaType = _mediaType;
landData._mediaDescription = _mediaDescription;
landData._mediaWidth = _mediaWidth;
landData._mediaHeight = _mediaHeight;
landData._mediaLoop = _mediaLoop;
landData._obscureMusic = _obscureMusic;
landData._obscureMedia = _obscureMedia;
landData._parcelAccessList.Clear(); landData._parcelAccessList.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)

View File

@ -49,5 +49,12 @@ namespace OpenSim.Framework
public UUID SnapshotID; public UUID SnapshotID;
public Vector3 UserLocation; public Vector3 UserLocation;
public Vector3 UserLookAt; public Vector3 UserLookAt;
public string MediaType;
public string MediaDescription;
public int MediaHeight;
public int MediaWidth;
public bool MediaLoop;
public bool ObscureMusic;
public bool ObscureMedia;
} }
} }

View File

@ -47,5 +47,6 @@ namespace OpenSim.Framework
public bool useEstateSun; public bool useEstateSun;
public float waterHeight; public float waterHeight;
public string simName; public string simName;
public string regionType;
} }
} }

View File

@ -33,8 +33,6 @@ namespace OpenSim.Framework
{ {
public class RegionSettings public class RegionSettings
{ {
private ConfigurationMember configMember;
public delegate void SaveDelegate(RegionSettings rs); public delegate void SaveDelegate(RegionSettings rs);
public event SaveDelegate OnSave; public event SaveDelegate OnSave;
@ -47,202 +45,6 @@ namespace OpenSim.Framework
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f"); public static readonly UUID DEFAULT_TERRAIN_TEXTURE_3 = new UUID("179cdabd-398a-9b6b-1391-4dc333ba321f");
public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2"); public static readonly UUID DEFAULT_TERRAIN_TEXTURE_4 = new UUID("beb169c7-11ea-fff2-efe5-0f24dc881df2");
public RegionSettings()
{
if (configMember == null)
{
try
{
configMember = new ConfigurationMember(Path.Combine(Util.configDir(), "estate_settings.xml"), "ESTATE SETTINGS", LoadConfigurationOptions, HandleIncomingConfiguration, true);
configMember.performConfigurationRetrieve();
}
catch (Exception)
{
}
}
}
public void LoadConfigurationOptions()
{
configMember.addConfigurationOption("region_flags",
ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
String.Empty, "336723974", true);
configMember.addConfigurationOption("max_agents",
ConfigurationOption.ConfigurationTypes.TYPE_INT32,
String.Empty, "40", true);
configMember.addConfigurationOption("object_bonus_factor",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "1.0", true);
configMember.addConfigurationOption("sim_access",
ConfigurationOption.ConfigurationTypes.TYPE_INT32,
String.Empty, "21", true);
configMember.addConfigurationOption("terrain_base_0",
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
String.Empty, DEFAULT_TERRAIN_TEXTURE_1.ToString(), true);
configMember.addConfigurationOption("terrain_base_1",
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
String.Empty, DEFAULT_TERRAIN_TEXTURE_2.ToString(), true);
configMember.addConfigurationOption("terrain_base_2",
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
String.Empty, DEFAULT_TERRAIN_TEXTURE_3.ToString(), true);
configMember.addConfigurationOption("terrain_base_3",
ConfigurationOption.ConfigurationTypes.TYPE_UUID,
String.Empty, DEFAULT_TERRAIN_TEXTURE_4.ToString(), true);
configMember.addConfigurationOption("terrain_start_height_0",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "10.0", true);
configMember.addConfigurationOption("terrain_start_height_1",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "10.0", true);
configMember.addConfigurationOption("terrain_start_height_2",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "10.0", true);
configMember.addConfigurationOption("terrain_start_height_3",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "10.0", true);
configMember.addConfigurationOption("terrain_height_range_0",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "60.0", true);
configMember.addConfigurationOption("terrain_height_range_1",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "60.0", true);
configMember.addConfigurationOption("terrain_height_range_2",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "60.0", true);
configMember.addConfigurationOption("terrain_height_range_3",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "60.0", true);
configMember.addConfigurationOption("region_water_height",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "20.0", true);
configMember.addConfigurationOption("terrain_raise_limit",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "100.0", true);
configMember.addConfigurationOption("terrain_lower_limit",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "-100.0", true);
configMember.addConfigurationOption("sun_hour",
ConfigurationOption.ConfigurationTypes.TYPE_DOUBLE,
String.Empty, "0.0", true);
}
public bool HandleIncomingConfiguration(string key, object value)
{
switch (key)
{
case "region_flags":
RegionFlags flags = (RegionFlags)(uint)value;
m_BlockTerraform =
(flags & RegionFlags.BlockTerraform) != 0;
m_BlockFly =
(flags & RegionFlags.NoFly) != 0;
m_AllowDamage =
(flags & RegionFlags.AllowDamage) != 0;
m_RestrictPushing =
(flags & RegionFlags.RestrictPushObject) != 0;
m_AllowLandResell =
(flags & RegionFlags.BlockLandResell) == 0;
m_AllowLandJoinDivide =
(flags & RegionFlags.AllowParcelChanges) != 0;
m_BlockShowInSearch =
((uint)flags & (1 << 29)) != 0;
m_DisableScripts =
(flags & RegionFlags.SkipScripts) != 0;
m_DisableCollisions =
(flags & RegionFlags.SkipCollisions) != 0;
m_DisablePhysics =
(flags & RegionFlags.SkipPhysics) != 0;
m_FixedSun =
(flags & RegionFlags.SunFixed) != 0;
m_Sandbox =
(flags & RegionFlags.Sandbox) != 0;
break;
case "max_agents":
m_AgentLimit = (int)value;
break;
case "object_bonus_factor":
m_ObjectBonus = (double)value;
break;
case "sim_access":
int access = (int)value;
if (access <= 13)
m_Maturity = 0;
else
m_Maturity = 1;
break;
case "terrain_base_0":
m_TerrainTexture1 = (UUID)value;
break;
case "terrain_base_1":
m_TerrainTexture2 = (UUID)value;
break;
case "terrain_base_2":
m_TerrainTexture3 = (UUID)value;
break;
case "terrain_base_3":
m_TerrainTexture4 = (UUID)value;
break;
case "terrain_start_height_0":
m_Elevation1SW = (double)value;
break;
case "terrain_start_height_1":
m_Elevation1NW = (double)value;
break;
case "terrain_start_height_2":
m_Elevation1SE = (double)value;
break;
case "terrain_start_height_3":
m_Elevation1NE = (double)value;
break;
case "terrain_height_range_0":
m_Elevation2SW = (double)value;
break;
case "terrain_height_range_1":
m_Elevation2NW = (double)value;
break;
case "terrain_height_range_2":
m_Elevation2SE = (double)value;
break;
case "terrain_height_range_3":
m_Elevation2NE = (double)value;
break;
case "region_water_height":
m_WaterHeight = (double)value;
break;
case "terrain_raise_limit":
m_TerrainRaiseLimit = (double)value;
break;
case "terrain_lower_limit":
m_TerrainLowerLimit = (double)value;
break;
case "sun_hour":
m_SunPosition = (double)value;
break;
}
return true;
}
public void Save() public void Save()
{ {
if (OnSave != null) if (OnSave != null)

View File

@ -81,12 +81,17 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: {1}", requestUrl, e.Message); m_log.DebugFormat("[FORMS]: exception occured on sending request to {0}: " + e.ToString(), requestUrl);
} }
finally finally
{ {
if (requestStream != null) // If this is closed, it will be disposed internally,
requestStream.Close(); // but the above write is asynchronous and may hit after
// we're through here. So the thread handling that will
// throw and put us back into the catch above. Isn't
// .NET great?
//if (requestStream != null)
// requestStream.Close();
// Let's not close this // Let's not close this
//buffer.Close(); //buffer.Close();
@ -112,7 +117,7 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
catch (Exception e) catch (Exception e)
{ {
m_log.DebugFormat("[FORMS]: exception occured on receiving reply {0}", e.Message); m_log.DebugFormat("[FORMS]: exception occured on receiving reply " + e.ToString());
} }
finally finally
{ {

View File

@ -37,6 +37,7 @@ using System.Xml;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenMetaverse.Messages.Linden;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Client; using OpenSim.Framework.Client;
@ -328,7 +329,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an /// thread servicing the m_primFullUpdates queue after a kill. If this happens the object persists as an
/// ownerless phantom. /// ownerless phantom.
/// ///
/// All manipulation of this set has to occur under a m_primFullUpdate.SyncRoot lock /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
/// ///
/// </value> /// </value>
protected HashSet<uint> m_killRecord; protected HashSet<uint> m_killRecord;
@ -394,18 +395,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public string ActiveGroupName { get { return m_activeGroupName; } } public string ActiveGroupName { get { return m_activeGroupName; } }
public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
/// <summary> /// <summary>
/// First name of the agent/avatar represented by the client /// First name of the agent/avatar represented by the client
/// </summary> /// </summary>
public string FirstName { get { return m_firstName; } } public string FirstName { get { return m_firstName; } }
/// <summary> /// <summary>
/// Last name of the agent/avatar represented by the client /// Last name of the agent/avatar represented by the client
/// </summary> /// </summary>
public string LastName { get { return m_lastName; } } public string LastName { get { return m_lastName; } }
/// <summary> /// <summary>
/// Full name of the client (first name and last name) /// Full name of the client (first name and last name)
/// </summary> /// </summary>
public string Name { get { return FirstName + " " + LastName; } } public string Name { get { return FirstName + " " + LastName; } }
public uint CircuitCode { get { return m_circuitCode; } } public uint CircuitCode { get { return m_circuitCode; } }
public int MoneyBalance { get { return m_moneyBalance; } } public int MoneyBalance { get { return m_moneyBalance; } }
public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@ -742,7 +747,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handshake.RegionInfo3.CPURatio = 1; handshake.RegionInfo3.CPURatio = 1;
handshake.RegionInfo3.ColoName = Utils.EmptyBytes; handshake.RegionInfo3.ColoName = Utils.EmptyBytes;
handshake.RegionInfo3.ProductName = Utils.EmptyBytes; handshake.RegionInfo3.ProductName = Util.StringToBytes256(regionInfo.RegionType);
handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes; handshake.RegionInfo3.ProductSKU = Utils.EmptyBytes;
OutPacket(handshake, ThrottleOutPacketType.Task); OutPacket(handshake, ThrottleOutPacketType.Task);
@ -2743,7 +2748,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
DirPlacesReplyPacket.StatusDataBlock[] status = DirPlacesReplyPacket.StatusDataBlock[] status =
new DirPlacesReplyPacket.StatusDataBlock[0]; new DirPlacesReplyPacket.StatusDataBlock[0];
int i = 0; packet.QueryReplies = replies;
packet.StatusData = status;
foreach (DirPlacesReplyData d in data) foreach (DirPlacesReplyData d in data)
{ {
int idx = replies.Length; int idx = replies.Length;
@ -2779,11 +2786,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
replies = new DirPlacesReplyPacket.QueryRepliesBlock[0]; replies = new DirPlacesReplyPacket.QueryRepliesBlock[0];
status = new DirPlacesReplyPacket.StatusDataBlock[0]; status = new DirPlacesReplyPacket.StatusDataBlock[0];
} }
} }
if (replies.Length > 0) if (replies.Length > 0 || data.Length == 0)
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
} }
@ -4143,7 +4149,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
rinfopack.RegionInfo2.HardMaxAgents = uint.MaxValue; rinfopack.RegionInfo2.HardMaxAgents = uint.MaxValue;
rinfopack.RegionInfo2.HardMaxObjects = uint.MaxValue; rinfopack.RegionInfo2.HardMaxObjects = uint.MaxValue;
rinfopack.RegionInfo2.MaxAgents32 = uint.MaxValue; rinfopack.RegionInfo2.MaxAgents32 = uint.MaxValue;
rinfopack.RegionInfo2.ProductName = Utils.EmptyBytes; rinfopack.RegionInfo2.ProductName = Util.StringToBytes256(args.regionType);
rinfopack.RegionInfo2.ProductSKU = Utils.EmptyBytes; rinfopack.RegionInfo2.ProductSKU = Utils.EmptyBytes;
rinfopack.HasVariableBlocks = true; rinfopack.HasVariableBlocks = true;
@ -4215,94 +4221,101 @@ namespace OpenSim.Region.ClientStack.LindenUDP
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, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{ {
ParcelPropertiesPacket updatePacket = (ParcelPropertiesPacket)PacketPool.Instance.GetPacket(PacketType.ParcelProperties); ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
// TODO: don't create new blocks if recycling an old packet
updatePacket.ParcelData.AABBMax = landData.AABBMax; updateMessage.AABBMax = landData.AABBMax;
updatePacket.ParcelData.AABBMin = landData.AABBMin; updateMessage.AABBMin = landData.AABBMin;
updatePacket.ParcelData.Area = landData.Area; updateMessage.Area = landData.Area;
updatePacket.ParcelData.AuctionID = landData.AuctionID; updateMessage.AuctionID = landData.AuctionID;
updatePacket.ParcelData.AuthBuyerID = landData.AuthBuyerID; updateMessage.AuthBuyerID = landData.AuthBuyerID;
updatePacket.ParcelData.Bitmap = landData.Bitmap; updateMessage.Bitmap = landData.Bitmap;
updatePacket.ParcelData.Desc = Utils.StringToBytes(landData.Description); updateMessage.Desc = landData.Description;
updatePacket.ParcelData.Category = (byte)landData.Category; updateMessage.Category = landData.Category;
updatePacket.ParcelData.ClaimDate = landData.ClaimDate; updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate);
updatePacket.ParcelData.ClaimPrice = landData.ClaimPrice; updateMessage.ClaimPrice = landData.ClaimPrice;
updatePacket.ParcelData.GroupID = landData.GroupID; updateMessage.GroupID = landData.GroupID;
updatePacket.ParcelData.GroupPrims = landData.GroupPrims; updateMessage.GroupPrims = landData.GroupPrims;
updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; updateMessage.IsGroupOwned = landData.IsGroupOwned;
updatePacket.ParcelData.LandingType = landData.LandingType; updateMessage.LandingType = (LandingType) landData.LandingType;
updatePacket.ParcelData.LocalID = landData.LocalID; updateMessage.LocalID = landData.LocalID;
if (landData.Area > 0) if (landData.Area > 0)
{ {
updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; updateMessage.MaxPrims = parcelObjectCapacity;
} }
else else
{ {
updatePacket.ParcelData.MaxPrims = 0; updateMessage.MaxPrims = 0;
} }
updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; updateMessage.MediaAutoScale = Convert.ToBoolean(landData.MediaAutoScale);
updatePacket.ParcelData.MediaID = landData.MediaID; updateMessage.MediaID = landData.MediaID;
updatePacket.ParcelData.MediaURL = Util.StringToBytes256(landData.MediaURL); updateMessage.MediaURL = landData.MediaURL;
updatePacket.ParcelData.MusicURL = Util.StringToBytes256(landData.MusicURL); updateMessage.MusicURL = landData.MusicURL;
updatePacket.ParcelData.Name = Util.StringToBytes256(landData.Name); updateMessage.Name = landData.Name;
updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime; updateMessage.OtherCleanTime = landData.OtherCleanTime;
updatePacket.ParcelData.OtherCount = 0; //TODO: Unimplemented updateMessage.OtherCount = 0; //TODO: Unimplemented
updatePacket.ParcelData.OtherPrims = landData.OtherPrims; updateMessage.OtherPrims = landData.OtherPrims;
updatePacket.ParcelData.OwnerID = landData.OwnerID; updateMessage.OwnerID = landData.OwnerID;
updatePacket.ParcelData.OwnerPrims = landData.OwnerPrims; updateMessage.OwnerPrims = landData.OwnerPrims;
updatePacket.ParcelData.ParcelFlags = landData.Flags; updateMessage.ParcelFlags = (ParcelFlags) landData.Flags;
updatePacket.ParcelData.ParcelPrimBonus = simObjectBonusFactor; updateMessage.ParcelPrimBonus = simObjectBonusFactor;
updatePacket.ParcelData.PassHours = landData.PassHours; updateMessage.PassHours = landData.PassHours;
updatePacket.ParcelData.PassPrice = landData.PassPrice; updateMessage.PassPrice = landData.PassPrice;
updatePacket.ParcelData.PublicCount = 0; //TODO: Unimplemented updateMessage.PublicCount = 0; //TODO: Unimplemented
updatePacket.ParcelData.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
updatePacket.ParcelData.RegionDenyIdentified = (regionFlags & (uint)RegionFlags.DenyIdentified) > 0; updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0;
updatePacket.ParcelData.RegionDenyTransacted = (regionFlags & (uint)RegionFlags.DenyTransacted) > 0;
updatePacket.ParcelData.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
updatePacket.ParcelData.RentPrice = 0; //updateMessage.RegionDenyIdentified = (regionFlags & (uint)RegionFlags.DenyIdentified) > 0;
updatePacket.ParcelData.RequestResult = request_result; //updateMessage.RegionDenyTransacted = (regionFlags & (uint)RegionFlags.DenyTransacted) > 0;
updatePacket.ParcelData.SalePrice = landData.SalePrice;
updatePacket.ParcelData.SelectedPrims = landData.SelectedPrims; updateMessage.RentPrice = 0;
updatePacket.ParcelData.SelfCount = 0; //TODO: Unimplemented updateMessage.RequestResult = (ParcelResult) request_result;
updatePacket.ParcelData.SequenceID = sequence_id; updateMessage.SalePrice = landData.SalePrice;
updateMessage.SelectedPrims = landData.SelectedPrims;
updateMessage.SelfCount = 0; //TODO: Unimplemented
updateMessage.SequenceID = sequence_id;
if (landData.SimwideArea > 0) if (landData.SimwideArea > 0)
{ {
updatePacket.ParcelData.SimWideMaxPrims = parcelObjectCapacity; updateMessage.SimWideMaxPrims = parcelObjectCapacity;
} }
else else
{ {
updatePacket.ParcelData.SimWideMaxPrims = 0; updateMessage.SimWideMaxPrims = 0;
} }
updatePacket.ParcelData.SimWideTotalPrims = landData.SimwidePrims; updateMessage.SimWideTotalPrims = landData.SimwidePrims;
updatePacket.ParcelData.SnapSelection = snap_selection; updateMessage.SnapSelection = snap_selection;
updatePacket.ParcelData.SnapshotID = landData.SnapshotID; updateMessage.SnapshotID = landData.SnapshotID;
updatePacket.ParcelData.Status = (byte)landData.Status; updateMessage.Status = (ParcelStatus) landData.Status;
updatePacket.ParcelData.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims + updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims +
landData.SelectedPrims; landData.SelectedPrims;
updatePacket.ParcelData.UserLocation = landData.UserLocation; updateMessage.UserLocation = landData.UserLocation;
updatePacket.ParcelData.UserLookAt = landData.UserLookAt; updateMessage.UserLookAt = landData.UserLookAt;
updatePacket.Header.Zerocoded = true;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
try try
{ {
IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>(); IEventQueue eq = Scene.RequestModuleInterface<IEventQueue>();
if (eq != null) if (eq != null)
{ {
eq.ParcelProperties(updatePacket, this.AgentId); eq.ParcelProperties(updateMessage, this.AgentId);
} else {
m_log.Warn("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("Unable to send parcel data via eventqueue - exception: " + ex.ToString());
m_log.Warn("sending parcel data via UDP");
OutPacket(updatePacket, ThrottleOutPacketType.Task);
} }
} }
@ -8995,7 +9008,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (handlerGodKickUser != null) if (handlerGodKickUser != null)
{ {
handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID, handlerGodKickUser(gkupack.UserInfo.GodID, gkupack.UserInfo.GodSessionID,
gkupack.UserInfo.AgentID, (uint)0, gkupack.UserInfo.Reason); gkupack.UserInfo.AgentID, gkupack.UserInfo.KickFlags, gkupack.UserInfo.Reason);
} }
} }
else else

View File

@ -427,7 +427,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence)) if (m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
{ {
if (!m_scene.Permissions.CanRezObject( if (!m_scene.Permissions.CanRezObject(
part.ParentGroup.Children.Count, remoteClient.AgentId, presence.AbsolutePosition)) part.ParentGroup.PrimCount, remoteClient.AgentId, presence.AbsolutePosition))
return; return;
presence.Appearance.DetachAttachment(itemID); presence.Appearance.DetachAttachment(itemID);
@ -471,12 +471,86 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
SceneObjectSerializer.ToOriginalXmlFormat(group); SceneObjectSerializer.ToOriginalXmlFormat(group);
group.DetachToInventoryPrep(); group.DetachToInventoryPrep();
m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString());
m_scene.UpdateKnownItem(remoteClient, group,group.GetFromItemID(), group.OwnerID); UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
m_scene.DeleteSceneObject(group, false); m_scene.DeleteSceneObject(group, false);
return; return;
} }
} }
} }
} }
public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos)
{
// If this is an attachment, then we need to save the modified
// object back into the avatar's inventory. First we save the
// attachment point information, then we update the relative
// positioning (which caused this method to get driven in the
// first place. Then we have to mark the object as NOT an
// attachment. This is necessary in order to correctly save
// and retrieve GroupPosition information for the attachment.
// Then we save the asset back into the appropriate inventory
// entry. Finally, we restore the object's attachment status.
byte attachmentPoint = sog.GetAttachmentPoint();
sog.UpdateGroupPosition(pos);
sog.RootPart.IsAttachment = false;
sog.AbsolutePosition = sog.RootPart.AttachedPos;
UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
sog.SetAttachmentPoint(attachmentPoint);
}
/// <summary>
/// Update the attachment asset for the new sog details if they have changed.
/// </summary>
///
/// This is essential for preserving attachment attributes such as permission. Unlike normal scene objects,
/// these details are not stored on the region.
///
/// <param name="remoteClient"></param>
/// <param name="grp"></param>
/// <param name="itemID"></param>
/// <param name="agentID"></param>
protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
{
if (grp != null)
{
if (!grp.HasGroupChanged)
{
m_log.WarnFormat("[ATTACHMENTS MODULE]: Save request for {0} which is unchanged", grp.UUID);
return;
}
m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Updating asset for attachment {0}, attachpoint {1}",
grp.UUID, grp.GetAttachmentPoint());
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = m_scene.InventoryService.GetItem(item);
if (item != null)
{
AssetBase asset = m_scene.CreateAsset(
grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
m_scene.AssetService.Store(asset);
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
m_scene.InventoryService.UpdateItem(item);
// this gets called when the agent logs off!
if (remoteClient != null)
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
}
}
} }
} }

View File

@ -132,8 +132,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
{ {
UUID toAgentID = new UUID(im.toAgentID); UUID toAgentID = new UUID(im.toAgentID);
//m_log.DebugFormat("[INSTANT MESSAGE]: Attempting delivery of IM from {0} to {1}", im.fromAgentName, toAgentID.ToString());
// Try root avatar only first // Try root avatar only first
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
@ -176,6 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
} }
} }
m_log.DebugFormat("[INSTANT MESSAGE]: Delivering IM to {0} via XMLRPC", im.toAgentID);
SendGridInstantMessageViaXMLRPC(im, result); SendGridInstantMessageViaXMLRPC(im, result);
return; return;

View File

@ -261,7 +261,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
while (archivePath.Length > 0) while (archivePath.Length > 0)
{ {
m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); // m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
if (resolvedFolders.ContainsKey(archivePath)) if (resolvedFolders.ContainsKey(archivePath))
{ {

View File

@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// </summary> /// </summary>
public static class InventoryArchiveUtils public static class InventoryArchiveUtils
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings // Character used for escaping the path delimter ("\/") and itself ("\\") in human escaped strings
public static readonly char ESCAPE_CHARACTER = '\\'; public static readonly char ESCAPE_CHARACTER = '\\';
@ -121,6 +121,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
return foundFolders; return foundFolders;
} }
// If the path isn't just / then trim any starting extraneous slashes
path = path.TrimStart(new char[] { PATH_DELIMITER });
// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Adjusted path in FindFolderByPath() is [{0}]", path);
string[] components = SplitEscapedPath(path); string[] components = SplitEscapedPath(path);
components[0] = UnescapePath(components[0]); components[0] = UnescapePath(components[0]);
@ -199,6 +204,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
public static InventoryItemBase FindItemByPath( public static InventoryItemBase FindItemByPath(
IInventoryService inventoryService, InventoryFolderBase startFolder, string path) IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
{ {
// If the path isn't just / then trim any starting extraneous slashes
path = path.TrimStart(new char[] { PATH_DELIMITER });
string[] components = SplitEscapedPath(path); string[] components = SplitEscapedPath(path);
components[0] = UnescapePath(components[0]); components[0] = UnescapePath(components[0]);

View File

@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
InventoryItemBase inventoryItem = null; InventoryItemBase inventoryItem = null;
InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID); InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
bool foundStar = false; bool saveFolderContentsOnly = false;
// Eliminate double slashes and any leading / on the path. // Eliminate double slashes and any leading / on the path.
string[] components string[] components
@ -234,7 +234,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// folder itself. This may get more sophisicated later on // folder itself. This may get more sophisicated later on
if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD) if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
{ {
foundStar = true; saveFolderContentsOnly = true;
maxComponentIndex--; maxComponentIndex--;
} }
@ -281,10 +281,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
inventoryFolder.Name, inventoryFolder.ID, m_invPath); inventoryFolder.Name,
inventoryFolder.ID,
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath );
//recurse through all dirs getting dirs and files //recurse through all dirs getting dirs and files
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !foundStar); SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
} }
else if (inventoryItem != null) else if (inventoryItem != null)
{ {

View File

@ -55,6 +55,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{ {
protected ManualResetEvent mre = new ManualResetEvent(false); protected ManualResetEvent mre = new ManualResetEvent(false);
/// <summary>
/// Stream of data representing a common IAR that can be reused in load tests.
/// </summary>
protected MemoryStream m_iarStream;
protected UserAccount m_ua1
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr",
LastName = "Tiddles" };
protected UserAccount m_ua2
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord",
LastName = "Lucan" };
string m_item1Name = "b.lsl";
private void SaveCompleted( private void SaveCompleted(
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
Exception reportedException) Exception reportedException)
@ -62,6 +79,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
mre.Set(); mre.Set();
} }
[SetUp]
public void Init()
{
ConstructDefaultIarForTestLoad();
}
protected void ConstructDefaultIarForTestLoad()
{
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = m_item1Name;
item1.AssetID = UUID.Random();
item1.GroupID = UUID.Random();
item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
//item1.CreatorId = userUuid.ToString();
//item1.CreatorId = "00000000-0000-0000-0000-000000000444";
item1.Owner = UUID.Zero;
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
tar.Close();
m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
}
/// <summary> /// <summary>
/// Test saving an inventory path to a V0.1 OpenSim Inventory Archive /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
/// (subject to change since there is no fixed format yet). /// (subject to change since there is no fixed format yet).
@ -122,6 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
MemoryStream archiveWriteStream = new MemoryStream(); MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted; archiverModule.OnInventoryArchiveSaved += SaveCompleted;
// Test saving a particular path
mre.Reset(); mre.Reset();
archiverModule.ArchiveInventory( archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
@ -148,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
while (tar.ReadEntry(out filePath, out tarEntryType) != null) while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{ {
Console.WriteLine("Got {0}", filePath); // Console.WriteLine("Got {0}", filePath);
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath) // if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
// { // {
@ -296,6 +343,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// TODO: Test presence of more files and contents of files. // TODO: Test presence of more files and contents of files.
} }
/// <summary>
/// Test that things work when the load path specified starts with a slash
/// </summary>
[Test]
public void TestLoadIarPathStartsWithSlash()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
}
/// <summary> /// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// an account exists with the creator name. /// an account exists with the creator name.
@ -308,34 +379,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod(); TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Mr";
string userLastName = "Tiddles";
UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000555");
string userItemCreatorFirstName = "Lord";
string userItemCreatorLastName = "Lucan";
UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
string item1Name = "b.lsl";
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1Name, UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = item1Name;
item1.AssetID = UUID.Random();
item1.GroupID = UUID.Random();
item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
//item1.CreatorId = userUuid.ToString();
//item1.CreatorId = "00000000-0000-0000-0000-000000000444";
item1.Owner = UUID.Zero;
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
tar.Close();
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
SerialiserModule serialiserModule = new SerialiserModule(); SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
@ -344,15 +387,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory( UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
scene, userFirstName, userLastName, userUuid, "meowfood"); UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
UserProfileTestUtils.CreateUserWithInventory(
scene, userItemCreatorFirstName, userItemCreatorLastName, userItemCreatorUuid, "hampshire");
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1 InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, item1Name); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
@ -362,31 +403,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), // foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
// "Loaded item non-uuid creator doesn't match original"); // "Loaded item non-uuid creator doesn't match original");
Assert.That( Assert.That(
foundItem1.CreatorId, Is.EqualTo(userItemCreatorUuid.ToString()), foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match original"); "Loaded item non-uuid creator doesn't match original");
Assert.That( Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(userItemCreatorUuid), foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID),
"Loaded item uuid creator doesn't match original"); "Loaded item uuid creator doesn't match original");
Assert.That(foundItem1.Owner, Is.EqualTo(userUuid), Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID),
"Loaded item owner doesn't match inventory reciever"); "Loaded item owner doesn't match inventory reciever");
// Now try loading to a root child folder // Now try loading to a root child folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, userUuid, "xA"); UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
archiverModule.DearchiveInventory(userFirstName, userLastName, "xA", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);
InventoryItemBase foundItem2 InventoryItemBase foundItem2
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xA/" + item1Name); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);
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, userUuid, "xB/xC"); UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
archiverModule.DearchiveInventory(userFirstName, userLastName, "xB/xC", "meowfood", archiveReadStream); archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);
InventoryItemBase foundItem3 InventoryItemBase foundItem3
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, "xB/xC/" + item1Name); = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);
Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3"); Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
} }

View File

@ -32,7 +32,6 @@ using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
@ -92,7 +91,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>(); m_TransferModule = m_Scenelist[0].RequestModuleInterface<IMessageTransferModule>();
if (m_TransferModule == null) if (m_TransferModule == null)
{ {
m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); m_log.Error("[INVENTORY TRANSFER]: No Message transfer module found, transfers will be local only");
m_Enabled = false; m_Enabled = false;
m_Scenelist.Clear(); m_Scenelist.Clear();
@ -185,7 +184,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
UUID folderID = new UUID(im.binaryBucket, 1); UUID folderID = new UUID(im.binaryBucket, 1);
m_log.DebugFormat("[AGENT INVENTORY]: Inserting original folder {0} "+ m_log.DebugFormat("[INVENTORY TRANSFER]: Inserting original folder {0} "+
"into agent {1}'s inventory", "into agent {1}'s inventory",
folderID, new UUID(im.toAgentID)); folderID, new UUID(im.toAgentID));
@ -221,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
UUID itemID = new UUID(im.binaryBucket, 1); UUID itemID = new UUID(im.binaryBucket, 1);
m_log.DebugFormat("[AGENT INVENTORY]: (giving) Inserting item {0} "+ m_log.DebugFormat("[INVENTORY TRANSFER]: (giving) Inserting item {0} "+
"into agent {1}'s inventory", "into agent {1}'s inventory",
itemID, new UUID(im.toAgentID)); itemID, new UUID(im.toAgentID));
@ -288,10 +287,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// inventory is loaded. Courtesy of the above bulk update, // inventory is loaded. Courtesy of the above bulk update,
// It will have been pushed to the client, too // It will have been pushed to the client, too
// //
//CachedUserInfo userInfo =
// scene.CommsManager.UserProfileCacheService.
// GetUserDetails(client.AgentId);
IInventoryService invService = scene.InventoryService; IInventoryService invService = scene.InventoryService;
InventoryFolderBase trashFolder = InventoryFolderBase trashFolder =

View File

@ -200,6 +200,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}",
finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID);
// Check that these are not the same coordinates
if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX &&
finalDestination.RegionLocY == sp.Scene.RegionInfo.RegionLocY)
{
// Can't do. Viewer crashes
sp.ControllingClient.SendTeleportFailed("Space warp! You would crash. Move to a different region and try again.");
return;
}
// //
// This is it // This is it
// //
@ -446,6 +455,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// Now let's make it officially a child agent // Now let's make it officially a child agent
sp.MakeChildAgent(); sp.MakeChildAgent();
sp.Scene.CleanDroppedAttachments();
// Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg))

View File

@ -34,6 +34,7 @@ using System.Threading;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Messages.Linden;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
@ -137,10 +138,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
{ {
if (!queues.ContainsKey(agentId)) if (!queues.ContainsKey(agentId))
{ {
/*
m_log.DebugFormat( m_log.DebugFormat(
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
agentId, m_scene.RegionInfo.RegionName); agentId, m_scene.RegionInfo.RegionName);
*/
queues[agentId] = new Queue<OSD>(); queues[agentId] = new Queue<OSD>();
} }
@ -200,7 +202,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
private void ClientClosed(UUID AgentID, Scene scene) private void ClientClosed(UUID AgentID, Scene scene)
{ {
m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName); //m_log.DebugFormat("[EVENTQUEUE]: Closed client {0} in region {1}", AgentID, m_scene.RegionInfo.RegionName);
int count = 0; int count = 0;
while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5) while (queues.ContainsKey(AgentID) && queues[AgentID].Count > 0 && count++ < 5)
@ -284,7 +286,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
// Reuse open queues. The client does! // Reuse open queues. The client does!
if (m_AvatarQueueUUIDMapping.ContainsKey(agentID)) if (m_AvatarQueueUUIDMapping.ContainsKey(agentID))
{ {
m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!"); //m_log.DebugFormat("[EVENTQUEUE]: Found Existing UUID!");
EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID]; EventQueueGetUUID = m_AvatarQueueUUIDMapping[agentID];
} }
else else
@ -365,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
{ {
// Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
array.Add(EventQueueHelper.KeepAliveEvent()); array.Add(EventQueueHelper.KeepAliveEvent());
m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName); //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", pAgentId, m_scene.RegionInfo.RegionName);
} }
else else
{ {
@ -394,8 +396,8 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
responsedata["keepalive"] = false; responsedata["keepalive"] = false;
responsedata["reusecontext"] = false; responsedata["reusecontext"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events); responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", pAgentId, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
return responsedata; return responsedata;
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
} }
public Hashtable NoEvents(UUID requestID, UUID agentID) public Hashtable NoEvents(UUID requestID, UUID agentID)
@ -461,7 +463,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
{ {
// Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say! // Send it a fake event to keep the client polling! It doesn't like 502s like the proxys say!
array.Add(EventQueueHelper.KeepAliveEvent()); array.Add(EventQueueHelper.KeepAliveEvent());
m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName); //m_log.DebugFormat("[EVENTQUEUE]: adding fake event for {0} in region {1}", agentID, m_scene.RegionInfo.RegionName);
} }
else else
{ {
@ -697,9 +699,9 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
//m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item); //m_log.InfoFormat("########### eq ChatterBoxSessionAgentListUpdates #############\n{0}", item);
} }
public void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID) public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
{ {
OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesPacket); OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
Enqueue(item, avatarID); Enqueue(item, avatarID);
} }

View File

@ -30,6 +30,7 @@ using System.Net;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenMetaverse.Messages.Linden;
namespace OpenSim.Region.CoreModules.Framework.EventQueue namespace OpenSim.Region.CoreModules.Framework.EventQueue
{ {
@ -309,116 +310,6 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
return chatterBoxSessionAgentListUpdates; return chatterBoxSessionAgentListUpdates;
} }
public static OSD ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket)
{
OSDMap parcelProperties = new OSDMap();
OSDMap body = new OSDMap();
OSDArray ageVerificationBlock = new OSDArray();
OSDMap ageVerificationMap = new OSDMap();
ageVerificationMap.Add("RegionDenyAgeUnverified",
OSD.FromBoolean(parcelPropertiesPacket.AgeVerificationBlock.RegionDenyAgeUnverified));
ageVerificationBlock.Add(ageVerificationMap);
body.Add("AgeVerificationBlock", ageVerificationBlock);
// LL sims send media info in this event queue message but it's not in the UDP
// packet we construct this event queue message from. This should be refactored in
// other areas of the code so it can all be send in the same message. Until then we will
// still send the media info via UDP
//OSDArray mediaData = new OSDArray();
//OSDMap mediaDataMap = new OSDMap();
//mediaDataMap.Add("MediaDesc", OSD.FromString(""));
//mediaDataMap.Add("MediaHeight", OSD.FromInteger(0));
//mediaDataMap.Add("MediaLoop", OSD.FromInteger(0));
//mediaDataMap.Add("MediaType", OSD.FromString("type/type"));
//mediaDataMap.Add("MediaWidth", OSD.FromInteger(0));
//mediaDataMap.Add("ObscureMedia", OSD.FromInteger(0));
//mediaDataMap.Add("ObscureMusic", OSD.FromInteger(0));
//mediaData.Add(mediaDataMap);
//body.Add("MediaData", mediaData);
OSDArray parcelData = new OSDArray();
OSDMap parcelDataMap = new OSDMap();
OSDArray AABBMax = new OSDArray(3);
AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.X));
AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Y));
AABBMax.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMax.Z));
parcelDataMap.Add("AABBMax", AABBMax);
OSDArray AABBMin = new OSDArray(3);
AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.X));
AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Y));
AABBMin.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.AABBMin.Z));
parcelDataMap.Add("AABBMin", AABBMin);
parcelDataMap.Add("Area", OSD.FromInteger(parcelPropertiesPacket.ParcelData.Area));
parcelDataMap.Add("AuctionID", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.AuctionID)));
parcelDataMap.Add("AuthBuyerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.AuthBuyerID));
parcelDataMap.Add("Bitmap", OSD.FromBinary(parcelPropertiesPacket.ParcelData.Bitmap));
parcelDataMap.Add("Category", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Category));
parcelDataMap.Add("ClaimDate", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimDate));
parcelDataMap.Add("ClaimPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.ClaimPrice));
parcelDataMap.Add("Desc", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Desc)));
parcelDataMap.Add("GroupID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.GroupID));
parcelDataMap.Add("GroupPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.GroupPrims));
parcelDataMap.Add("IsGroupOwned", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.IsGroupOwned));
parcelDataMap.Add("LandingType", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LandingType));
parcelDataMap.Add("LocalID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.LocalID));
parcelDataMap.Add("MaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.MaxPrims));
parcelDataMap.Add("MediaAutoScale", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.MediaAutoScale));
parcelDataMap.Add("MediaID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.MediaID));
parcelDataMap.Add("MediaURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MediaURL)));
parcelDataMap.Add("MusicURL", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.MusicURL)));
parcelDataMap.Add("Name", OSD.FromString(Utils.BytesToString(parcelPropertiesPacket.ParcelData.Name)));
parcelDataMap.Add("OtherCleanTime", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCleanTime));
parcelDataMap.Add("OtherCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherCount));
parcelDataMap.Add("OtherPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OtherPrims));
parcelDataMap.Add("OwnerID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.OwnerID));
parcelDataMap.Add("OwnerPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.OwnerPrims));
parcelDataMap.Add("ParcelFlags", OSD.FromBinary(uintToByteArray(parcelPropertiesPacket.ParcelData.ParcelFlags)));
parcelDataMap.Add("ParcelPrimBonus", OSD.FromReal(parcelPropertiesPacket.ParcelData.ParcelPrimBonus));
parcelDataMap.Add("PassHours", OSD.FromReal(parcelPropertiesPacket.ParcelData.PassHours));
parcelDataMap.Add("PassPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PassPrice));
parcelDataMap.Add("PublicCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.PublicCount));
parcelDataMap.Add("RegionDenyAnonymous", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyAnonymous));
parcelDataMap.Add("RegionDenyIdentified", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyIdentified));
parcelDataMap.Add("RegionDenyTransacted", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionDenyTransacted));
parcelDataMap.Add("RegionPushOverride", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.RegionPushOverride));
parcelDataMap.Add("RentPrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RentPrice));
parcelDataMap.Add("RequestResult", OSD.FromInteger(parcelPropertiesPacket.ParcelData.RequestResult));
parcelDataMap.Add("SalePrice", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SalePrice));
parcelDataMap.Add("SelectedPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelectedPrims));
parcelDataMap.Add("SelfCount", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SelfCount));
parcelDataMap.Add("SequenceID", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SequenceID));
parcelDataMap.Add("SimWideMaxPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideMaxPrims));
parcelDataMap.Add("SimWideTotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.SimWideTotalPrims));
parcelDataMap.Add("SnapSelection", OSD.FromBoolean(parcelPropertiesPacket.ParcelData.SnapSelection));
parcelDataMap.Add("SnapshotID", OSD.FromUUID(parcelPropertiesPacket.ParcelData.SnapshotID));
parcelDataMap.Add("Status", OSD.FromInteger((int)parcelPropertiesPacket.ParcelData.Status));
parcelDataMap.Add("TotalPrims", OSD.FromInteger(parcelPropertiesPacket.ParcelData.TotalPrims));
OSDArray UserLocation = new OSDArray(3);
UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.X));
UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Y));
UserLocation.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLocation.Z));
parcelDataMap.Add("UserLocation", UserLocation);
OSDArray UserLookAt = new OSDArray(3);
UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.X));
UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Y));
UserLookAt.Add(OSD.FromReal(parcelPropertiesPacket.ParcelData.UserLookAt.Z));
parcelDataMap.Add("UserLookAt", UserLookAt);
parcelData.Add(parcelDataMap);
body.Add("ParcelData", parcelData);
parcelProperties.Add("body", body);
parcelProperties.Add("message", OSD.FromString("ParcelProperties"));
return parcelProperties;
}
public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket) public static OSD GroupMembership(AgentGroupDataUpdatePacket groupUpdatePacket)
{ {
OSDMap groupUpdate = new OSDMap(); OSDMap groupUpdate = new OSDMap();
@ -495,5 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
return placesReply; return placesReply;
} }
public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
{
OSDMap message = new OSDMap();
message.Add("message", OSD.FromString("ParcelProperties"));
OSD message_body = parcelPropertiesMessage.Serialize();
message.Add("body", message_body);
return message;
}
} }
} }

View File

@ -549,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
} }
if (!m_Scene.Permissions.CanRezObject( if (!m_Scene.Permissions.CanRezObject(
group.Children.Count, remoteClient.AgentId, pos) group.PrimCount, remoteClient.AgentId, pos)
&& !attachment) && !attachment)
{ {
// The client operates in no fail mode. It will // The client operates in no fail mode. It will
@ -629,7 +629,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.Name = item.Name; rootPart.Name = item.Name;
rootPart.Description = item.Description; rootPart.Description = item.Description;
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
group.SetGroup(remoteClient.ActiveGroupId, remoteClient); group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0) if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)

View File

@ -27,15 +27,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using Nini.Config; using Nini.Config;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
{ {
public abstract class BaseInventoryConnector : IInventoryService public abstract class BaseInventoryConnector : IInventoryService

View File

@ -161,6 +161,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
/// <returns></returns> /// <returns></returns>
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
{ {
m_log.DebugFormat("[INVENTORY CACHE]: Getting folder for asset type {0} for user {1}", type, userID);
Dictionary<AssetType, InventoryFolderBase> folders = null; Dictionary<AssetType, InventoryFolderBase> folders = null;
lock (m_InventoryCache) lock (m_InventoryCache)
@ -177,9 +179,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
if ((folders != null) && folders.ContainsKey(type)) if ((folders != null) && folders.ContainsKey(type))
{ {
m_log.DebugFormat(
"[INVENTORY CACHE]: Returning folder {0} as type {1} for {2}", folders[type], type, userID);
return folders[type]; return folders[type];
} }
m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
return null; return null;
} }

View File

@ -216,13 +216,40 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.PurgeFolder(folder); return m_InventoryService.PurgeFolder(folder);
} }
/// <summary>
/// Add a new item to the user's inventory
/// </summary>
/// <param name="item"></param>
/// <returns>true if the item was successfully added</returns>
public bool AddItem(InventoryItemBase item) public bool AddItem(InventoryItemBase item)
{ {
// m_log.DebugFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
// item.Name, item.Owner, item.Folder);
if (UUID.Zero == item.Folder)
{
InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (f != null)
{
// m_log.DebugFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
// f.Name, (AssetType)f.Type, item.Name);
item.Folder = f.ID;
}
else
{
f = m_InventoryService.GetRootFolder(item.Owner);
if (f != null)
{
item.Folder = f.ID;
}
else
{
// m_log.WarnFormat(
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
// item.Owner, item.Name);
return false;
}
}
}
return m_InventoryService.AddItem(item); return m_InventoryService.AddItem(item);
} }
@ -236,7 +263,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_InventoryService.UpdateItem(item); return m_InventoryService.UpdateItem(item);
} }
public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) public bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
{ {
return m_InventoryService.MoveItems(ownerID, items); return m_InventoryService.MoveItems(ownerID, items);

View File

@ -75,7 +75,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
base.Init(source); base.Init(source);
} }
#region ISharedRegionModule #region ISharedRegionModule
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)

View File

@ -229,6 +229,30 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
if (item == null) if (item == null)
return false; return false;
if (UUID.Zero == item.Folder)
{
InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
if (f != null)
{
item.Folder = f.ID;
}
else
{
f = m_RemoteConnector.GetRootFolder(item.Owner);
if (f != null)
{
item.Folder = f.ID;
}
else
{
m_log.WarnFormat(
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
item.Owner, item.Name);
return false;
}
}
}
return m_RemoteConnector.AddItem(item); return m_RemoteConnector.AddItem(item);
} }
@ -294,9 +318,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
return m_RemoteConnector.GetAssetPermissions(userID, assetID); return m_RemoteConnector.GetAssetPermissions(userID, assetID);
} }
#endregion #endregion
} }
} }

View File

@ -243,7 +243,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// to the same scene (when this is possible). // to the same scene (when this is possible).
sceneObject.ResetIDs(); sceneObject.ResetIDs();
foreach (SceneObjectPart part in sceneObject.Children.Values) List<SceneObjectPart> partList = null;
lock (sceneObject.Children)
partList = new List<SceneObjectPart>(sceneObject.Children.Values);
foreach (SceneObjectPart part in partList)
{
if (!ResolveUserUuid(part.CreatorID))
part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
if (!ResolveUserUuid(part.OwnerID))
part.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
if (!ResolveUserUuid(part.LastOwnerID))
part.LastOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
// And zap any troublesome sit target information
part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
part.SitTargetPosition = new Vector3(0, 0, 0);
// Fix ownership/creator of inventory items
// Not doing so results in inventory items
// being no copy/no mod for everyone
lock (part.TaskInventory)
{ {
if (!ResolveUserUuid(part.CreatorID)) if (!ResolveUserUuid(part.CreatorID))
part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@ -264,8 +286,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
part.TaskInventory.LockItemsForRead(true); part.TaskInventory.LockItemsForRead(true);
TaskInventoryDictionary inv = part.TaskInventory; TaskInventoryDictionary inv = part.TaskInventory;
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
{
if (!ResolveUserUuid(kvp.Value.OwnerID))
{ {
if (!ResolveUserUuid(kvp.Value.OwnerID)) if (!ResolveUserUuid(kvp.Value.OwnerID))
{ {
@ -276,9 +296,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner; kvp.Value.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;
} }
} }
}
part.TaskInventory.LockItemsForRead(false); part.TaskInventory.LockItemsForRead(false);
} }
}
if (m_scene.AddRestoredSceneObject(sceneObject, true, false)) if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
{ {

View File

@ -684,6 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun; args.useEstateSun = m_scene.RegionInfo.RegionSettings.UseEstateSun;
args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight;
args.simName = m_scene.RegionInfo.RegionName; args.simName = m_scene.RegionInfo.RegionName;
args.regionType = m_scene.RegionInfo.RegionType;
remote_client.SendRegionInfoToEstateMenu(args); remote_client.SendRegionInfoToEstateMenu(args);
} }

View File

@ -33,6 +33,8 @@ using System.Reflection;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenMetaverse.Messages.Linden;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
@ -1078,7 +1080,6 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
for (int y = 0; y < inc_y; y++) for (int y = 0; y < inc_y; y++)
{ {
ILandObject currentParcel = GetLandObject(start_x + x, start_y + y); ILandObject currentParcel = GetLandObject(start_x + x, start_y + y);
if (currentParcel != null) if (currentParcel != null)
@ -1378,8 +1379,68 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
return RemoteParcelRequest(request, path, param, agentID, caps); return RemoteParcelRequest(request, path, param, agentID, caps);
})); }));
UUID parcelCapID = UUID.Random();
caps.RegisterHandler("ParcelPropertiesUpdate",
new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
delegate(string request, string path, string param,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
return ProcessPropertiesUpdate(request, path, param, agentID, caps);
}));
}
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
{
IClientAPI client;
if ( ! m_scene.TryGetClient(agentID, out client) ) {
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() );
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
} }
ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
properties.Deserialize(args);
LandUpdateArgs land_update = new LandUpdateArgs();
int parcelID = properties.LocalID;
land_update.AuthBuyerID = properties.AuthBuyerID;
land_update.Category = properties.Category;
land_update.Desc = properties.Desc;
land_update.GroupID = properties.GroupID;
land_update.LandingType = (byte) properties.Landing;
land_update.MediaAutoScale = (byte) Convert.ToInt32(properties.MediaAutoScale);
land_update.MediaID = properties.MediaID;
land_update.MediaURL = properties.MediaURL;
land_update.MusicURL = properties.MusicURL;
land_update.Name = properties.Name;
land_update.ParcelFlags = (uint) properties.ParcelFlags;
land_update.PassHours = (int) properties.PassHours;
land_update.PassPrice = (int) properties.PassPrice;
land_update.SalePrice = (int) properties.SalePrice;
land_update.SnapshotID = properties.SnapshotID;
land_update.UserLocation = properties.UserLocation;
land_update.UserLookAt = properties.UserLookAt;
land_update.MediaDescription = properties.MediaDesc;
land_update.MediaType = properties.MediaType;
land_update.MediaWidth = properties.MediaWidth;
land_update.MediaHeight = properties.MediaHeight;
land_update.MediaLoop = properties.MediaLoop;
land_update.ObscureMusic = properties.ObscureMusic;
land_update.ObscureMedia = properties.ObscureMedia;
ILandObject land;
lock (m_landList)
{
m_landList.TryGetValue(parcelID, out land);
}
if (land != null) {
land.UpdateLandProperties(land_update, client);
} else {
m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
}
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
// we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
// "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
// So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x

View File

@ -229,6 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.SnapshotID = args.SnapshotID; newData.SnapshotID = args.SnapshotID;
newData.UserLocation = args.UserLocation; newData.UserLocation = args.UserLocation;
newData.UserLookAt = args.UserLookAt; newData.UserLookAt = args.UserLookAt;
newData.MediaType = args.MediaType;
newData.MediaDescription = args.MediaDescription;
newData.MediaWidth = args.MediaWidth;
newData.MediaHeight = args.MediaHeight;
newData.MediaLoop = args.MediaLoop;
newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMedia = args.ObscureMedia;
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);

View File

@ -128,7 +128,10 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
group.SetOwnerId(remoteClient.AgentId); group.SetOwnerId(remoteClient.AgentId);
group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId); group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
if (m_scene.Permissions.PropagatePermissions()) if (m_scene.Permissions.PropagatePermissions())
{ {

View File

@ -227,8 +227,13 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
SceneObjectGroup mapdot = (SceneObjectGroup)obj; SceneObjectGroup mapdot = (SceneObjectGroup)obj;
Color mapdotspot = Color.Gray; // Default color when prim color is white Color mapdotspot = Color.Gray; // Default color when prim color is white
// Loop over prim in group // Loop over prim in group
foreach (SceneObjectPart part in mapdot.Children.Values) List<SceneObjectPart> partList = null;
lock (mapdot.Children)
partList = new List<SceneObjectPart>(mapdot.Children.Values);
foreach (SceneObjectPart part in partList)
{ {
if (part == null) if (part == null)
continue; continue;

View File

@ -142,9 +142,18 @@ namespace OpenSim.Region.DataSnapshot.Providers
node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString(); node.InnerText = m_scene.RegionInfo.RegionSettings.RegionUUID.ToString();
xmlobject.AppendChild(node); xmlobject.AppendChild(node);
if (land != null && land.LandData != null)
{
node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", ""); node = nodeFactory.CreateNode(XmlNodeType.Element, "parceluuid", "");
node.InnerText = land.LandData.GlobalID.ToString(); node.InnerText = land.LandData.GlobalID.ToString();
xmlobject.AppendChild(node); xmlobject.AppendChild(node);
}
else
{
// Something is wrong with this object. Let's not list it.
m_log.WarnFormat("[DATASNAPSHOT]: Bad data for object {0} ({1}) in region {2}", obj.Name, obj.UUID, m_scene.RegionInfo.RegionName);
continue;
}
node = nodeFactory.CreateNode(XmlNodeType.Element, "location", ""); node = nodeFactory.CreateNode(XmlNodeType.Element, "location", "");
Vector3 loc = obj.AbsolutePosition; Vector3 loc = obj.AbsolutePosition;

View File

@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Xml; using System.Xml;
using log4net; using log4net;
using OpenSim.Region.DataSnapshot.Interfaces; using OpenSim.Region.DataSnapshot.Interfaces;
@ -98,6 +99,8 @@ namespace OpenSim.Region.DataSnapshot
{ {
String path = DataFileNameFragment(provider.GetParentScene, provider.Name); String path = DataFileNameFragment(provider.GetParentScene, provider.Name);
try
{
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
{ {
snapXWriter.Formatting = Formatting.Indented; snapXWriter.Formatting = Formatting.Indented;
@ -106,6 +109,12 @@ namespace OpenSim.Region.DataSnapshot
snapXWriter.WriteEndDocument(); snapXWriter.WriteEndDocument();
} }
} }
catch (Exception e)
{
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
}
}
//mark provider as not stale, parent scene as stale //mark provider as not stale, parent scene as stale
provider.Stale = false; provider.Stale = false;
@ -185,6 +194,8 @@ namespace OpenSim.Region.DataSnapshot
//save snapshot //save snapshot
String path = DataFileNameScene(scene); String path = DataFileNameScene(scene);
try
{
using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default)) using (XmlTextWriter snapXWriter = new XmlTextWriter(path, Encoding.Default))
{ {
snapXWriter.Formatting = Formatting.Indented; snapXWriter.Formatting = Formatting.Indented;
@ -192,6 +203,11 @@ namespace OpenSim.Region.DataSnapshot
regionElement.WriteTo(snapXWriter); regionElement.WriteTo(snapXWriter);
snapXWriter.WriteEndDocument(); snapXWriter.WriteEndDocument();
} }
}
catch (Exception e)
{
m_log.WarnFormat("[DATASNAPSHOT]: Exception on writing to file {0}: {1}", path, e.Message);
}
m_scenes[scene] = false; m_scenes[scene] = false;
@ -206,15 +222,23 @@ namespace OpenSim.Region.DataSnapshot
#region Helpers #region Helpers
private string DataFileNameFragment(Scene scene, String fragmentName) private string DataFileNameFragment(Scene scene, String fragmentName)
{ {
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName + "_" + fragmentName, "xml")); return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName + "_" + fragmentName), "xml"));
} }
private string DataFileNameScene(Scene scene) private string DataFileNameScene(Scene scene)
{ {
return Path.Combine(m_directory, Path.ChangeExtension(scene.RegionInfo.RegionName, "xml")); return Path.Combine(m_directory, Path.ChangeExtension(Sanitize(scene.RegionInfo.RegionName), "xml"));
//return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml"); //return (m_snapsDir + Path.DirectorySeparatorChar + scene.RegionInfo.RegionName + ".xml");
} }
private static string Sanitize(string name)
{
string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars()));
string invalidReStr = string.Format(@"[{0}]", invalidChars);
string newname = Regex.Replace(name, invalidReStr, "_");
return newname.Replace('.', '_');
}
private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc) private XmlNode MakeRegionNode(Scene scene, XmlDocument basedoc)
{ {
XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", ""); XmlNode docElement = basedoc.CreateNode(XmlNodeType.Element, "region", "");

View File

@ -136,5 +136,13 @@ namespace OpenSim.Region.Framework.Interfaces
/// A <see cref="IClientAPI"/> /// A <see cref="IClientAPI"/>
/// </param> /// </param>
void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
/// <summary>
/// Update the position of an attachment
/// </summary>
/// <param name="client"></param>
/// <param name="sog"></param>
/// <param name="pos"></param>
void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos);
} }
} }

View File

@ -29,6 +29,7 @@ using System.Collections.Generic;
using System.Collections; using System.Collections;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
{ {
@ -156,6 +157,17 @@ namespace OpenSim.Region.Framework.Interfaces
/// </returns> /// </returns>
IList<TaskInventoryItem> GetInventoryItems(string name); IList<TaskInventoryItem> GetInventoryItems(string name);
/// <summary>
/// Get the scene object referenced by an inventory item.
/// </summary>
///
/// This is returned in a 'rez ready' state. That is, name, description, permissions and other details have
/// been adjusted to reflect the part and item from which it originates.
///
/// <param name="item"></param>
/// <returns>The scene object. Null if the scene object asset couldn't be found</returns>
SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item);
/// <summary> /// <summary>
/// Update an existing inventory item. /// Update an existing inventory item.
/// </summary> /// </summary>

View File

@ -28,6 +28,7 @@
using System.Net; using System.Net;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Packets; using OpenMetaverse.Packets;
using OpenMetaverse.Messages.Linden;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
namespace OpenSim.Region.Framework.Interfaces namespace OpenSim.Region.Framework.Interfaces
@ -54,7 +55,7 @@ namespace OpenSim.Region.Framework.Interfaces
uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket); uint ttl, UUID transactionID, bool fromGroup, byte[] binaryBucket);
void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat, void ChatterBoxSessionAgentListUpdates(UUID sessionID, UUID fromAgent, UUID toAgent, bool canVoiceChat,
bool isModerator, bool textMute); bool isModerator, bool textMute);
void ParcelProperties(ParcelPropertiesPacket parcelPropertiesPacket, UUID avatarID); void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID);
void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID); void GroupMembership(AgentGroupDataUpdatePacket groupUpdate, UUID avatarID);
} }
} }

View File

@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Scenes
public class Prioritizer public class Prioritizer
{ {
private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// This is added to the priority of all child prims, to make sure that the root prim update is sent to the /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
@ -75,7 +75,6 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
default: default:
throw new InvalidOperationException("UpdatePrioritizationScheme not defined."); throw new InvalidOperationException("UpdatePrioritizationScheme not defined.");
break;
} }
// Adjust priority so that root prims are sent to the viewer first. This is especially important for // Adjust priority so that root prims are sent to the viewer first. This is especially important for
@ -122,9 +121,16 @@ namespace OpenSim.Region.Framework.Scenes
// Use group position for child prims // Use group position for child prims
Vector3 entityPos; Vector3 entityPos;
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; {
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
// before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else else
{
entityPos = entity.AbsolutePosition; entityPos = entity.AbsolutePosition;
}
return Vector3.DistanceSquared(presencePos, entityPos); return Vector3.DistanceSquared(presencePos, entityPos);
} }
@ -157,7 +163,9 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
else else
{
entityPos = entity.AbsolutePosition; entityPos = entity.AbsolutePosition;
}
if (!presence.IsChildAgent) if (!presence.IsChildAgent)
{ {

View File

@ -122,7 +122,7 @@ namespace OpenSim.Region.Framework.Scenes
else else
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Agent {1} could not add item {2} {3}", "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
AgentID, item.Name, item.ID); AgentID, item.Name, item.ID);
return; return;
@ -984,7 +984,6 @@ namespace OpenSim.Region.Framework.Scenes
private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId) private InventoryItemBase CreateAgentInventoryItemFromTask(UUID destAgent, SceneObjectPart part, UUID itemId)
{ {
Console.WriteLine("CreateAgentInventoryItemFromTask");
TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId);
if (null == taskItem) if (null == taskItem)
@ -1055,7 +1054,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="itemID"></param> /// <param name="itemID"></param>
public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId)
{ {
m_log.Info("Adding task inventory"); m_log.DebugFormat(
"[PRIM INVENTORY]: Adding item {0} from {1} to folder {2} for {3}",
itemId, part.Name, folderId, remoteClient.Name);
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId);
if (agentItem == null) if (agentItem == null)
@ -1121,7 +1123,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <see>MoveTaskInventoryItem</see> /// <see>MoveTaskInventoryItem</see>
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="folderID"></param> /// <param name="folderID">
/// The user inventory folder to move (or copy) the item to. If null, then the most
/// suitable system folder is used (e.g. the Objects folder for objects). If there is no suitable folder, then
/// the item is placed in the user's root inventory folder
/// </param>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId)
@ -1846,53 +1852,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
{
SceneObjectGroup objectGroup = grp;
if (objectGroup != null)
{
if (!grp.HasGroupChanged)
{
m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID);
return;
}
m_log.InfoFormat(
"[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}",
grp.UUID, grp.GetAttachmentPoint());
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
item = InventoryService.GetItem(item);
if (item != null)
{
AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.LocalId),
objectGroup.GetPartDescription(objectGroup.LocalId),
(sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml),
remoteClient.AgentId);
AssetService.Store(asset);
item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = asset.Name;
item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object;
InventoryService.UpdateItem(item);
// this gets called when the agent loggs off!
if (remoteClient != null)
{
remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
}
}
}
public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
{ {
itemID = UUID.Zero; itemID = UUID.Zero;
@ -2013,95 +1972,32 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart sourcePart, TaskInventoryItem item, SceneObjectPart sourcePart, TaskInventoryItem item,
Vector3 pos, Quaternion rot, Vector3 vel, int param) Vector3 pos, Quaternion rot, Vector3 vel, int param)
{ {
// Rez object if (null == item)
if (item != null)
{
UUID ownerID = item.OwnerID;
AssetBase rezAsset = AssetService.Get(item.AssetID.ToString());
if (rezAsset != null)
{
string xmlData = Utils.BytesToString(rezAsset.Data);
SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos))
{
return null; return null;
}
group.ResetIDs();
AddNewSceneObject(group, true); SceneObjectGroup group = sourcePart.Inventory.GetRezReadySceneObject(item);
// we set it's position in world. if (null == group)
group.AbsolutePosition = pos; return null;
SceneObjectPart rootPart = group.GetChildPart(group.UUID); if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos))
return null;
// Since renaming the item in the inventory does not affect the name stored
// in the serialization, transfer the correct name from the inventory to the
// object itself before we rez.
rootPart.Name = item.Name;
rootPart.Description = item.Description;
List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
group.SetGroup(sourcePart.GroupID, null);
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
{
if (Permissions.PropagatePermissions())
{
foreach (SceneObjectPart part in partList)
{
part.EveryoneMask = item.EveryonePermissions;
part.NextOwnerMask = item.NextPermissions;
}
group.ApplyNextOwnerPermissions();
}
}
foreach (SceneObjectPart part in partList)
{
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
{
part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
part.Inventory.ChangeInventoryOwner(item.OwnerID);
}
part.EveryoneMask = item.EveryonePermissions;
part.NextOwnerMask = item.NextPermissions;
}
rootPart.TrimPermissions();
if (group.RootPart.Shape.PCode == (byte)PCode.Prim)
{
group.ClearPartAttachmentData();
}
group.UpdateGroupRotationR(rot);
//group.ApplyPhysics(m_physicalPrim);
if (group.RootPart.PhysActor != null && group.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
{
group.RootPart.ApplyImpulse((vel * group.GetMass()), false);
group.Velocity = vel;
rootPart.ScheduleFullUpdate();
}
group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
rootPart.ScheduleFullUpdate();
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
{ {
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
sourcePart.Inventory.RemoveInventoryItem(item.ItemID); sourcePart.Inventory.RemoveInventoryItem(item.ItemID);
} }
return rootPart.ParentGroup;
}
}
return null; AddNewSceneObject(group, true, pos, rot, vel);
// 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.
group.CreateScriptInstances(param, true, DefaultScriptEngine, 2);
group.ScheduleGroupForFullUpdate();
return group;
} }
public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId)
@ -2161,7 +2057,11 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetGroup(groupID, remoteClient); sog.SetGroup(groupID, remoteClient);
sog.ScheduleGroupForFullUpdate(); sog.ScheduleGroupForFullUpdate();
foreach (SceneObjectPart child in sog.Children.Values) List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart child in partList)
child.Inventory.ChangeInventoryOwner(ownerID); child.Inventory.ChangeInventoryOwner(ownerID);
} }
else else
@ -2172,7 +2072,11 @@ namespace OpenSim.Region.Framework.Scenes
if (sog.GroupID != groupID) if (sog.GroupID != groupID)
continue; continue;
foreach (SceneObjectPart child in sog.Children.Values) List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart child in partList)
{ {
child.LastOwnerID = child.OwnerID; child.LastOwnerID = child.OwnerID;
child.Inventory.ChangeInventoryOwner(groupID); child.Inventory.ChangeInventoryOwner(groupID);
@ -2181,7 +2085,6 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetOwnerId(groupID); sog.SetOwnerId(groupID);
sog.ApplyNextOwnerPermissions(); sog.ApplyNextOwnerPermissions();
} }
} }
foreach (uint localID in localIDs) foreach (uint localID in localIDs)

View File

@ -161,16 +161,25 @@ namespace OpenSim.Region.Framework.Scenes
// We also need to check the children of this prim as they // We also need to check the children of this prim as they
// can be selected as well and send property information // can be selected as well and send property information
bool foundPrim = false; bool foundPrim = false;
foreach (KeyValuePair<UUID, SceneObjectPart> child in ((SceneObjectGroup) ent).Children)
SceneObjectGroup sog = ent as SceneObjectGroup;
List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
foreach (SceneObjectPart part in partList)
{ {
if (child.Value.LocalId == primLocalID) if (part.LocalId == primLocalID)
{ {
child.Value.GetProperties(remoteClient); part.GetProperties(remoteClient);
foundPrim = true; foundPrim = true;
break; break;
} }
} }
if (foundPrim) break;
if (foundPrim)
break;
} }
} }
} }

View File

@ -42,7 +42,6 @@ using OpenMetaverse.Imaging;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Scripting;
@ -399,6 +398,7 @@ namespace OpenSim.Region.Framework.Scenes
private bool m_firstHeartbeat = true; private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object(); private object m_deleting_scene_object = new object();
private object m_cleaningAttachments = new object();
// the minimum time that must elapse before a changed object will be considered for persisted // the minimum time that must elapse before a changed object will be considered for persisted
public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L; public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
@ -1790,8 +1790,9 @@ namespace OpenSim.Region.Framework.Scenes
if (group.RootPart == null) if (group.RootPart == null)
{ {
m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", m_log.ErrorFormat(
group.Children == null ? 0 : group.Children.Count); "[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children",
group.Children == null ? 0 : group.PrimCount);
} }
AddRestoredSceneObject(group, true, true); AddRestoredSceneObject(group, true, true);
@ -2052,6 +2053,23 @@ namespace OpenSim.Region.Framework.Scenes
return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates); return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
} }
/// <summary>
/// Add a newly created object to the scene.
/// </summary>
///
/// This method does not send updates to the client - callers need to handle this themselves.
/// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object</param>
/// <param name="rot">Rotation of the object</param>
/// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
/// <returns></returns>
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{
return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel);
}
/// <summary> /// <summary>
/// Delete every object from the scene. This does not include attachments worn by avatars. /// Delete every object from the scene. This does not include attachments worn by avatars.
/// </summary> /// </summary>
@ -2113,7 +2131,11 @@ namespace OpenSim.Region.Framework.Scenes
group.RemoveScriptInstances(true); group.RemoveScriptInstances(true);
} }
foreach (SceneObjectPart part in group.Children.Values) List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
foreach (SceneObjectPart part in partList)
{ {
if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0))
{ {
@ -2125,6 +2147,7 @@ namespace OpenSim.Region.Framework.Scenes
part.PhysActor = null; part.PhysActor = null;
} }
} }
// if (rootPart.PhysActor != null) // if (rootPart.PhysActor != null)
// { // {
// PhysicsScene.RemovePrim(rootPart.PhysActor); // PhysicsScene.RemovePrim(rootPart.PhysActor);
@ -2481,15 +2504,17 @@ namespace OpenSim.Region.Framework.Scenes
// Force allocation of new LocalId // Force allocation of new LocalId
// //
lock (sceneObject.Children)
{
foreach (SceneObjectPart p in sceneObject.Children.Values) foreach (SceneObjectPart p in sceneObject.Children.Values)
p.LocalId = 0; p.LocalId = 0;
}
if (sceneObject.IsAttachmentCheckFull()) // Attachment if (sceneObject.IsAttachmentCheckFull()) // Attachment
{ {
sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez);
sceneObject.RootPart.AddFlag(PrimFlags.Phantom); sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
// Don't sent a full update here because this will cause full updates to be sent twice for // Don't sent a full update here because this will cause full updates to be sent twice for
// attachments on region crossings, resulting in viewer glitches. // attachments on region crossings, resulting in viewer glitches.
AddRestoredSceneObject(sceneObject, false, false, false); AddRestoredSceneObject(sceneObject, false, false, false);
@ -2502,7 +2527,6 @@ namespace OpenSim.Region.Framework.Scenes
if (sp != null) if (sp != null)
{ {
SceneObjectGroup grp = sceneObject; SceneObjectGroup grp = sceneObject;
m_log.DebugFormat( m_log.DebugFormat(
@ -3210,6 +3234,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.Debug("[Scene] Beginning OnRemovePresence"); m_log.Debug("[Scene] Beginning OnRemovePresence");
m_eventManager.TriggerOnRemovePresence(agentID); m_eventManager.TriggerOnRemovePresence(agentID);
m_log.Debug("[Scene] Finished OnRemovePresence"); m_log.Debug("[Scene] Finished OnRemovePresence");
ForEachClient( ForEachClient(
delegate(IClientAPI client) delegate(IClientAPI client)
{ {
@ -3245,6 +3270,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_log.Debug("[Scene] Done. Firing RemoveCircuit"); m_log.Debug("[Scene] Done. Firing RemoveCircuit");
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
CleanDroppedAttachments();
m_log.Debug("[Scene] The avatar has left the building"); m_log.Debug("[Scene] The avatar has left the building");
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));
//m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true)); //m_log.InfoFormat("[SCENE] Memory post GC {0}", System.GC.GetTotalMemory(true));
@ -3443,6 +3469,8 @@ namespace OpenSim.Region.Framework.Scenes
if (vialogin) if (vialogin)
{ {
CleanDroppedAttachments();
if (TestBorderCross(agent.startpos, Cardinals.E)) if (TestBorderCross(agent.startpos, Cardinals.E))
{ {
Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E); Border crossedBorder = GetCrossedBorder(agent.startpos, Cardinals.E);
@ -3694,18 +3722,6 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
private ILandObject GetParcelAtPoint(float x, float y)
{
foreach (var parcel in AllParcels())
{
if (parcel.ContainsPoint((int)x,(int)y))
{
return parcel;
}
}
return null;
}
/// <summary> /// <summary>
/// Update an AgentCircuitData object with new information /// Update an AgentCircuitData object with new information
/// </summary> /// </summary>
@ -5041,5 +5057,45 @@ namespace OpenSim.Region.Framework.Scenes
throw new Exception(error); throw new Exception(error);
} }
} }
public void CleanDroppedAttachments()
{
List<SceneObjectGroup> objectsToDelete =
new List<SceneObjectGroup>();
lock (m_cleaningAttachments)
{
ForEachSOG(delegate (SceneObjectGroup grp)
{
if (grp.RootPart.Shape.State != 0 && (!objectsToDelete.Contains(grp)))
{
UUID agentID = grp.OwnerID;
if (agentID == UUID.Zero)
{
objectsToDelete.Add(grp);
return;
}
ScenePresence sp = GetScenePresence(agentID);
if (sp == null)
{
objectsToDelete.Add(grp);
return;
}
}
});
}
if (objectsToDelete.Count > 0)
{
m_log.DebugFormat("[SCENE]: Starting delete of {0} dropped attachments", objectsToDelete.Count);
foreach (SceneObjectGroup grp in objectsToDelete)
{
m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
DeleteSceneObject(grp, true);
}
m_log.Debug("[SCENE]: Finished dropped attachment deletion");
}
}
} }
} }

View File

@ -70,7 +70,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// A user will arrive shortly, set up appropriate credentials so it can connect /// A user will arrive shortly, set up appropriate credentials so it can connect
/// </summary> /// </summary>
public event ExpectUserDelegate OnExpectUser; // public event ExpectUserDelegate OnExpectUser;
/// <summary> /// <summary>
/// A Prim will arrive shortly /// A Prim will arrive shortly
@ -80,7 +80,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// A new prim has arrived /// A new prim has arrived
/// </summary> /// </summary>
public event PrimCrossing OnPrimCrossingIntoRegion; // public event PrimCrossing OnPrimCrossingIntoRegion;
///// <summary> ///// <summary>
///// A New Region is up and available ///// A New Region is up and available
@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// We have a child agent for this avatar and we're getting a status update about it /// We have a child agent for this avatar and we're getting a status update about it
/// </summary> /// </summary>
public event ChildAgentUpdate OnChildAgentUpdate; // public event ChildAgentUpdate OnChildAgentUpdate;
//public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar; //public event RemoveKnownRegionsFromAvatarList OnRemoveKnownRegionFromAvatar;
/// <summary> /// <summary>

View File

@ -104,7 +104,6 @@ namespace OpenSim.Region.Framework.Scenes
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>(); protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>();
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>(); protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
private readonly Object m_dictionary_lock = new Object();
private Object m_updateLock = new Object(); private Object m_updateLock = new Object();
@ -150,11 +149,10 @@ namespace OpenSim.Region.Framework.Scenes
m_scenePresencesLock.ExitWriteLock(); m_scenePresencesLock.ExitWriteLock();
} }
lock (m_dictionary_lock) lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID.Clear(); SceneObjectGroupsByFullID.Clear();
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID.Clear(); SceneObjectGroupsByLocalID.Clear();
}
Entities.Clear(); Entities.Clear();
} }
@ -315,6 +313,42 @@ namespace OpenSim.Region.Framework.Scenes
return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates);
} }
/// <summary>
/// Add a newly created object to the scene.
/// </summary>
///
/// This method does not send updates to the client - callers need to handle this themselves.
/// <param name="sceneObject"></param>
/// <param name="attachToBackup"></param>
/// <param name="pos">Position of the object</param>
/// <param name="rot">Rotation of the object</param>
/// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
/// <returns></returns>
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{
AddNewSceneObject(sceneObject, true, false);
// we set it's position in world.
sceneObject.AbsolutePosition = pos;
if (sceneObject.RootPart.Shape.PCode == (byte)PCode.Prim)
{
sceneObject.ClearPartAttachmentData();
}
sceneObject.UpdateGroupRotationR(rot);
//group.ApplyPhysics(m_physicalPrim);
if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero)
{
sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false);
sceneObject.Velocity = vel;
}
return true;
}
/// <summary> /// <summary>
/// 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.
@ -350,6 +384,8 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE GRAPH]: Adding object {0} {1} to region {2}", // "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
lock (sceneObject.Children)
{
if (m_parentScene.m_clampPrimSize) if (m_parentScene.m_clampPrimSize)
{ {
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in sceneObject.Children.Values)
@ -367,35 +403,36 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
m_numPrim += sceneObject.Children.Count;
}
sceneObject.AttachToScene(m_parentScene); sceneObject.AttachToScene(m_parentScene);
if (sendClientUpdates) if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate(); sceneObject.ScheduleGroupForFullUpdate();
Entities.Add(sceneObject); Entities.Add(sceneObject);
m_numPrim += sceneObject.Children.Count;
if (attachToBackup) if (attachToBackup)
{
sceneObject.AttachToBackup(); sceneObject.AttachToBackup();
}
if (OnObjectCreate != null) if (OnObjectCreate != null)
{
OnObjectCreate(sceneObject); OnObjectCreate(sceneObject);
}
lock (m_dictionary_lock) lock (SceneObjectGroupsByFullID)
{ {
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in sceneObject.Children.Values)
{
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
} }
} }
}
return true; return true;
} }
@ -408,24 +445,32 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (Entities.ContainsKey(uuid)) if (Entities.ContainsKey(uuid))
{ {
SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid];
if (!resultOfObjectLinked) if (!resultOfObjectLinked)
{ {
m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; m_numPrim -= grp.PrimCount;
if ((((SceneObjectGroup)Entities[uuid]).RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
{ RemovePhysicalPrim(grp.PrimCount);
RemovePhysicalPrim(((SceneObjectGroup)Entities[uuid]).Children.Count);
}
} }
if (OnObjectRemove != null) if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]); OnObjectRemove(Entities[uuid]);
lock (m_dictionary_lock) lock (SceneObjectGroupsByFullID)
{ {
SceneObjectGroupsByFullID.Remove(uuid); foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(((SceneObjectGroup)Entities[uuid]).LocalId); SceneObjectGroupsByFullID.Remove(part.UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
} }
lock (SceneObjectGroupsByLocalID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(part.LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
Entities.Remove(uuid); Entities.Remove(uuid);
//SceneObjectGroup part; //SceneObjectGroup part;
//((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
@ -884,7 +929,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog))
{ {
if (sog.HasChildPrim(localID))
return sog; return sog;
SceneObjectGroupsByLocalID.Remove(localID);
} }
} }
@ -920,8 +967,14 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
{ {
lock (sog.Children)
{
if (sog.Children.ContainsKey(fullID))
return sog; return sog;
} }
SceneObjectGroupsByFullID.Remove(fullID);
}
} }
List<EntityBase> EntityList = GetEntities(); List<EntityBase> EntityList = GetEntities();
@ -1087,9 +1140,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param> /// <param name="action"></param>
protected internal void ForEachSOG(Action<SceneObjectGroup> action) protected internal void ForEachSOG(Action<SceneObjectGroup> action)
{ {
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values); List<EntityBase> objlist = Entities.GetAllByType<SceneObjectGroup>();
foreach (SceneObjectGroup obj in objlist) foreach (EntityBase ent in objlist)
{ {
SceneObjectGroup obj = (SceneObjectGroup)ent;
try try
{ {
action(obj); action(obj);
@ -1293,37 +1348,21 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="localID"></param> /// <param name="localID"></param>
/// <param name="pos"></param> /// <param name="pos"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
protected internal void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient) public void UpdatePrimPosition(uint localID, Vector3 pos, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null) if (group != null)
{ {
// Vector3 oldPos = group.AbsolutePosition;
if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
{ {
if (m_parentScene.AttachmentsModule != null)
// If this is an attachment, then we need to save the modified m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos);
// object back into the avatar's inventory. First we save the
// attachment point information, then we update the relative
// positioning (which caused this method to get driven in the
// first place. Then we have to mark the object as NOT an
// attachment. This is necessary in order to correctly save
// and retrieve GroupPosition information for the attachment.
// Then we save the asset back into the appropriate inventory
// entry. Finally, we restore the object's attachment status.
byte attachmentPoint = group.GetAttachmentPoint();
group.UpdateGroupPosition(pos);
group.RootPart.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos;
m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
group.SetAttachmentPoint(attachmentPoint);
} }
else else
{ {
if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)
&& m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos))
{ {
group.UpdateGroupPosition(pos); group.UpdateGroupPosition(pos);
} }
@ -1332,14 +1371,19 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// /// Update the texture entry of the given prim.
/// </summary> /// </summary>
///
/// A texture entry is an object that contains details of all the textures of the prim's face. In this case,
/// the texture is given in its byte serialized form.
///
/// <param name="localID"></param> /// <param name="localID"></param>
/// <param name="texture"></param> /// <param name="texture"></param>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient) protected internal void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient)
{ {
SceneObjectGroup group = GetGroupByPrim(localID); SceneObjectGroup group = GetGroupByPrim(localID);
if (group != null) if (group != null)
{ {
if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId))
@ -1630,7 +1674,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (part != null) if (part != null)
{ {
if (part.ParentGroup.Children.Count != 1) // Skip single if (part.ParentGroup.PrimCount != 1) // Skip single
{ {
if (part.LinkNum < 2) // Root if (part.LinkNum < 2) // Root
rootParts.Add(part); rootParts.Add(part);
@ -1669,8 +1713,15 @@ namespace OpenSim.Region.Framework.Scenes
// However, editing linked parts and unlinking may be different // However, editing linked parts and unlinking may be different
// //
SceneObjectGroup group = root.ParentGroup; SceneObjectGroup group = root.ParentGroup;
List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Children.Values);
int numChildren = group.Children.Count; List<SceneObjectPart> newSet = null;
int numChildren = -1;
lock (group.Children)
{
newSet = new List<SceneObjectPart>(group.Children.Values);
numChildren = group.PrimCount;
}
// If there are prims left in a link set, but the root is // If there are prims left in a link set, but the root is
// slated for unlink, we need to do this // slated for unlink, we need to do this
@ -1722,8 +1773,6 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart newRoot = newSet[0]; SceneObjectPart newRoot = newSet[0];
newSet.RemoveAt(0); newSet.RemoveAt(0);
List<uint> linkIDs = new List<uint>();
foreach (SceneObjectPart newChild in newSet) foreach (SceneObjectPart newChild in newSet)
newChild.UpdateFlag = 0; newChild.UpdateFlag = 0;
@ -1760,7 +1809,11 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
foreach (KeyValuePair<UUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children) SceneObjectGroup sog = ent as SceneObjectGroup;
lock (sog.Children)
{
foreach (KeyValuePair<UUID, SceneObjectPart> subent in sog.Children)
{ {
if (subent.Value.LocalId == localID) if (subent.Value.LocalId == localID)
{ {
@ -1770,6 +1823,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
}
//Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
//aka ObjectFlags.JointWheel = IncludeInSearch //aka ObjectFlags.JointWheel = IncludeInSearch
@ -1830,7 +1884,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup original = GetGroupByPrim(originalPrimID); SceneObjectGroup original = GetGroupByPrim(originalPrimID);
if (original != null) if (original != null)
{ {
if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition)) if (m_parentScene.Permissions.CanDuplicateObject(
original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
{ {
SceneObjectGroup copy = original.Copy(true); SceneObjectGroup copy = original.Copy(true);
copy.AbsolutePosition = copy.AbsolutePosition + offset; copy.AbsolutePosition = copy.AbsolutePosition + offset;

View File

@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public int PrimCount public int PrimCount
{ {
get { return m_parts.Count; } get { lock (m_parts) { return m_parts.Count; } }
} }
protected Quaternion m_rotation = Quaternion.Identity; protected Quaternion m_rotation = Quaternion.Identity;
@ -398,6 +398,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <value> /// <value>
/// The parts of this scene object group. You must lock this property before using it. /// The parts of this scene object group. You must lock this property before using it.
/// If you're doing anything other than reading values, please take a copy of the values rather than locking
/// the dictionary for the entirety of the operation. This increases liveness and reduces the danger of deadlock
/// If you want to know the number of children, consider using the PrimCount property instead
/// </value> /// </value>
public Dictionary<UUID, SceneObjectPart> Children public Dictionary<UUID, SceneObjectPart> Children
{ {
@ -521,7 +524,16 @@ namespace OpenSim.Region.Framework.Scenes
public override UUID UUID public override UUID UUID
{ {
get { return m_rootPart.UUID; } get { return m_rootPart.UUID; }
set { m_rootPart.UUID = value; } set
{
m_rootPart.UUID = value;
lock (m_parts)
{
m_parts.Remove(m_rootPart.UUID);
m_parts.Add(m_rootPart.UUID, m_rootPart);
}
}
} }
public UUID OwnerID public UUID OwnerID
@ -742,7 +754,8 @@ namespace OpenSim.Region.Framework.Scenes
if (m_rootPart.LocalId == 0) if (m_rootPart.LocalId == 0)
m_rootPart.LocalId = m_scene.AllocateLocalId(); m_rootPart.LocalId = m_scene.AllocateLocalId();
// No need to lock here since the object isn't yet in a scene lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)
{ {
if (Object.ReferenceEquals(part, m_rootPart)) if (Object.ReferenceEquals(part, m_rootPart))
@ -758,6 +771,7 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentID = m_rootPart.LocalId; part.ParentID = m_rootPart.LocalId;
//m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID);
} }
}
ApplyPhysics(m_scene.m_physicalPrim); ApplyPhysics(m_scene.m_physicalPrim);
@ -1238,10 +1252,13 @@ namespace OpenSim.Region.Framework.Scenes
m_rootPart.AttachedAvatar = agentID; m_rootPart.AttachedAvatar = agentID;
//Anakin Lohner bug #3839 //Anakin Lohner bug #3839
lock (m_parts)
{
foreach (SceneObjectPart p in m_parts.Values) foreach (SceneObjectPart p in m_parts.Values)
{ {
p.AttachedAvatar = agentID; p.AttachedAvatar = agentID;
} }
}
if (m_rootPart.PhysActor != null) if (m_rootPart.PhysActor != null)
{ {
@ -1308,11 +1325,15 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = detachedpos; AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero; m_rootPart.AttachedAvatar = UUID.Zero;
//Anakin Lohner bug #3839 //Anakin Lohner bug #3839
lock (m_parts)
{
foreach (SceneObjectPart p in m_parts.Values) foreach (SceneObjectPart p in m_parts.Values)
{ {
p.AttachedAvatar = UUID.Zero; p.AttachedAvatar = UUID.Zero;
} }
}
m_rootPart.SetParentLocalId(0); m_rootPart.SetParentLocalId(0);
SetAttachmentPoint((byte)0); SetAttachmentPoint((byte)0);
@ -1337,11 +1358,15 @@ namespace OpenSim.Region.Framework.Scenes
} }
m_rootPart.AttachedAvatar = UUID.Zero; m_rootPart.AttachedAvatar = UUID.Zero;
//Anakin Lohner bug #3839 //Anakin Lohner bug #3839
lock (m_parts)
{
foreach (SceneObjectPart p in m_parts.Values) foreach (SceneObjectPart p in m_parts.Values)
{ {
p.AttachedAvatar = UUID.Zero; p.AttachedAvatar = UUID.Zero;
} }
}
m_rootPart.SetParentLocalId(0); m_rootPart.SetParentLocalId(0);
//m_rootPart.SetAttachmentPoint((byte)0); //m_rootPart.SetAttachmentPoint((byte)0);
@ -1406,8 +1431,7 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentID = 0; part.ParentID = 0;
part.LinkNum = 0; part.LinkNum = 0;
// No locking required since the SOG should not be in the scene yet - one can't change root parts after lock (m_parts)
// the scene object has been attached to the scene
m_parts.Add(m_rootPart.UUID, m_rootPart); m_parts.Add(m_rootPart.UUID, m_rootPart);
} }
@ -1928,14 +1952,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
/// <summary> /// <summary>
/// /// Copy the given part as the root part of this scene object.
/// </summary> /// </summary>
/// <param name="part"></param> /// <param name="part"></param>
/// <param name="cAgentID"></param> /// <param name="cAgentID"></param>
/// <param name="cGroupID"></param> /// <param name="cGroupID"></param>
public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
{ {
SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed)); SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed));
} }
public void ScriptSetPhysicsStatus(bool UsePhysics) public void ScriptSetPhysicsStatus(bool UsePhysics)
@ -2234,8 +2258,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void ResetIDs() public void ResetIDs()
{ {
// As this is only ever called for prims which are not currently part of the scene (and hence lock (m_parts)
// not accessible by clients), there should be no need to lock {
List<SceneObjectPart> partsList = new List<SceneObjectPart>(m_parts.Values); List<SceneObjectPart> partsList = new List<SceneObjectPart>(m_parts.Values);
m_parts.Clear(); m_parts.Clear();
foreach (SceneObjectPart part in partsList) foreach (SceneObjectPart part in partsList)
@ -2244,6 +2268,7 @@ namespace OpenSim.Region.Framework.Scenes
m_parts.Add(part.UUID, part); m_parts.Add(part.UUID, part);
} }
} }
}
/// <summary> /// <summary>
/// ///
@ -2283,7 +2308,7 @@ namespace OpenSim.Region.Framework.Scenes
// return; // return;
lockPartsForRead(true); lockPartsForRead(true);
{
bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0);
if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f))
@ -2298,14 +2323,14 @@ namespace OpenSim.Region.Framework.Scenes
lastPhysGroupRot = GroupRotation; lastPhysGroupRot = GroupRotation;
} }
foreach (SceneObjectPart part in m_parts.Values) List<SceneObjectPart> partList = null;
partList = new List<SceneObjectPart>(m_parts.Values);
foreach (SceneObjectPart part in partList)
{ {
if (!IsSelected) if (!IsSelected)
part.UpdateLookAt(); part.UpdateLookAt();
part.SendScheduledUpdates(); part.SendScheduledUpdates();
}
} }
lockPartsForRead(false); lockPartsForRead(false);
} }
@ -2479,10 +2504,15 @@ namespace OpenSim.Region.Framework.Scenes
public SceneObjectPart GetChildPart(UUID primID) public SceneObjectPart GetChildPart(UUID primID)
{ {
SceneObjectPart childPart = null; SceneObjectPart childPart = null;
lock (m_parts)
{
if (m_parts.ContainsKey(primID)) if (m_parts.ContainsKey(primID))
{ {
childPart = m_parts[primID]; childPart = m_parts[primID];
} }
}
return childPart; return childPart;
} }
@ -2519,8 +2549,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns></returns> /// <returns></returns>
public bool HasChildPrim(UUID primID) public bool HasChildPrim(UUID primID)
{ {
if (m_parts.ContainsKey(primID)) lock (m_parts)
{ {
if (m_parts.ContainsKey(primID))
return true; return true;
} }
@ -3132,9 +3163,12 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdatePermissions(UUID AgentID, byte field, uint localID, public void UpdatePermissions(UUID AgentID, byte field, uint localID,
uint mask, byte addRemTF) uint mask, byte addRemTF)
{ {
foreach (SceneObjectPart part in m_parts.Values) List<SceneObjectPart> partList = null;
part.UpdatePermissions(AgentID, field, localID, mask, lock (m_parts)
addRemTF); partList = new List<SceneObjectPart>(m_parts.Values);
foreach (SceneObjectPart part in partList)
part.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
HasGroupChanged = true; HasGroupChanged = true;
} }

View File

@ -4756,21 +4756,9 @@ namespace OpenSim.Region.Framework.Scenes
if (ParentGroup == null || ParentGroup.IsDeleted) if (ParentGroup == null || ParentGroup.IsDeleted)
return; return;
Vector3 lPos = OffsetPosition; if (IsAttachment && ParentGroup.RootPart != this)
if (IsAttachment)
{
if (ParentGroup.RootPart != this)
return; return;
lPos = ParentGroup.RootPart.AttachedPos;
}
else
{
if (ParentGroup.RootPart == this)
lPos = AbsolutePosition;
}
// Causes this thread to dig into the Client Thread Data. // Causes this thread to dig into the Client Thread Data.
// Remember your locking here! // Remember your locking here!
remoteClient.SendPrimUpdate(this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); remoteClient.SendPrimUpdate(this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);

View File

@ -37,6 +37,7 @@ using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Scripting;
using OpenSim.Region.Framework.Scenes.Serialization;
namespace OpenSim.Region.Framework.Scenes namespace OpenSim.Region.Framework.Scenes
{ {
@ -722,6 +723,70 @@ namespace OpenSim.Region.Framework.Scenes
return items; return items;
} }
public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item)
{
AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
if (null == rezAsset)
{
m_log.WarnFormat(
"[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}",
item.AssetID, item.Name, m_part.Name);
return null;
}
string xmlData = Utils.BytesToString(rezAsset.Data);
SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
group.ResetIDs();
SceneObjectPart rootPart = group.GetChildPart(group.UUID);
// Since renaming the item in the inventory does not affect the name stored
// in the serialization, transfer the correct name from the inventory to the
// object itself before we rez.
rootPart.Name = item.Name;
rootPart.Description = item.Description;
List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
group.SetGroup(m_part.GroupID, null);
if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
{
if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions())
{
foreach (SceneObjectPart part in partList)
{
part.EveryoneMask = item.EveryonePermissions;
part.NextOwnerMask = item.NextPermissions;
}
group.ApplyNextOwnerPermissions();
}
}
foreach (SceneObjectPart part in partList)
{
if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0)
{
part.LastOwnerID = part.OwnerID;
part.OwnerID = item.OwnerID;
part.Inventory.ChangeInventoryOwner(item.OwnerID);
}
part.EveryoneMask = item.EveryonePermissions;
part.NextOwnerMask = item.NextPermissions;
}
rootPart.TrimPermissions();
return group;
}
/// <summary> /// <summary>
/// Update an existing inventory item. /// Update an existing inventory item.
/// </summary> /// </summary>
@ -1197,6 +1262,5 @@ namespace OpenSim.Region.Framework.Scenes
Items.LockItemsForRead(false); Items.LockItemsForRead(false);
} }
} }
} }

View File

@ -2668,15 +2668,15 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_perfMonMS = Util.EnvironmentTickCount(); m_perfMonMS = Util.EnvironmentTickCount();
PhysicsActor actor = m_physicsActor;
Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
Vector3 pos = m_pos; Vector3 pos = m_pos;
pos.Z += m_appearance.HipOffset; pos.Z += m_appearance.HipOffset;
//m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
remoteClient.SendPrimUpdate(this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); remoteClient.SendPrimUpdate(
this,
PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
| PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
m_scene.StatsReporter.AddAgentUpdates(1); m_scene.StatsReporter.AddAgentUpdates(1);

View File

@ -134,7 +134,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
sop.Text = RandomName(); sop.Text = RandomName();
sop.SitName = RandomName(); sop.SitName = RandomName();
sop.TouchName = RandomName(); sop.TouchName = RandomName();
sop.ObjectFlags |= (uint)PrimFlags.Phantom; sop.Flags |= PrimFlags.Phantom;
SceneObjectGroup sog = new SceneObjectGroup(sop); SceneObjectGroup sog = new SceneObjectGroup(sop);
scene.AddNewSceneObject(sog, false); scene.AddNewSceneObject(sog, false);

View File

@ -0,0 +1,143 @@
/*
* 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 System.Text;
using System.Threading;
using System.Timers;
using Timer=System.Timers.Timer;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.Framework.Tests
{
[TestFixture]
public class TaskInventoryTests
{
protected UserAccount CreateUser(Scene scene)
{
string userFirstName = "Jock";
string userLastName = "Stirrup";
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)
{
string part1Name = "part1";
UUID part1Id = UUID.Parse("10000000-0000-0000-0000-000000000000");
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)
{
AssetNotecard nc = new AssetNotecard("Hello World!");
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>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
/// </summary>
/// This should place it in the most suitable user folder.
[Test]
public void TestMoveTaskInventoryItem()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount user1 = CreateUser(scene);
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1);
InventoryFolderBase folder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
// Perform test
scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID);
InventoryItemBase ncUserItem
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem");
Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found");
}
/// <summary>
/// Test MoveTaskInventoryItem where the item has no parent folder assigned.
/// </summary>
/// This should place it in the most suitable user folder.
[Test]
public void TestMoveTaskInventoryItemNoParent()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount user1 = CreateUser(scene);
SceneObjectGroup sog1 = CreateSO1(scene, user1.PrincipalID);
SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 = CreateSOItem1(scene, sop1);
// Perform test
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
InventoryItemBase ncUserItem
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");
Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found");
}
}
}

View File

@ -121,6 +121,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
continue; continue;
temp = (SceneObjectGroup) currObj; temp = (SceneObjectGroup) currObj;
lock (temp.Children)
{
if (m_CMEntityHash.ContainsKey(temp.UUID)) if (m_CMEntityHash.ContainsKey(temp.UUID))
{ {
foreach (SceneObjectPart part in temp.Children.Values) foreach (SceneObjectPart part in temp.Children.Values)
@ -133,6 +135,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
missingList.Add(part); missingList.Add(part);
} }
} }
}
return missingList; return missingList;
} }

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -167,10 +167,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group) public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group)
{ {
// Deal with new parts not revisioned that have been deleted. // Deal with new parts not revisioned that have been deleted.
lock (group.Children)
{
foreach (SceneObjectPart part in group.Children.Values) foreach (SceneObjectPart part in group.Children.Values)
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID)) if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID); m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID);
} }
}
/// <summary> /// <summary>
/// Retrieves the latest revision of a region in xml form, /// Retrieves the latest revision of a region in xml form,
@ -207,8 +210,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
{ {
temp = SceneObjectSerializer.FromXml2Format(xml); temp = SceneObjectSerializer.FromXml2Format(xml);
temp.SetScene(scene); temp.SetScene(scene);
lock (temp.Children)
{
foreach (SceneObjectPart part in temp.Children.Values) foreach (SceneObjectPart part in temp.Children.Values)
part.RegionHandle = scene.RegionInfo.RegionHandle; part.RegionHandle = scene.RegionInfo.RegionHandle;
}
ReplacementList.Add(temp.UUID, (EntityBase)temp); ReplacementList.Add(temp.UUID, (EntityBase)temp);
} }
catch (Exception e) catch (Exception e)
@ -338,6 +346,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
System.Collections.ArrayList auraList = new System.Collections.ArrayList(); System.Collections.ArrayList auraList = new System.Collections.ArrayList();
if (group == null) if (group == null)
return null; return null;
lock (group.Children)
{
foreach (SceneObjectPart part in group.Children.Values) foreach (SceneObjectPart part in group.Children.Values)
{ {
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID)) if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
@ -347,6 +358,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]); auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
} }
} }
}
return auraList; return auraList;
} }

View File

@ -186,10 +186,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
((ContentManagementEntity)m_model.MetaEntityCollection.Entities[group.UUID]).SendFullDiffUpdateToAll(); ((ContentManagementEntity)m_model.MetaEntityCollection.Entities[group.UUID]).SendFullDiffUpdateToAll();
// Deal with new parts not revisioned that have been deleted. // Deal with new parts not revisioned that have been deleted.
lock (group.Children)
{
foreach (SceneObjectPart part in group.Children.Values) foreach (SceneObjectPart part in group.Children.Values)
if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID)) if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID))
((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll(); ((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
} }
}
public void SendMetaEntitiesToNewClient(IClientAPI client) public void SendMetaEntitiesToNewClient(IClientAPI client)
{ {

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -131,6 +131,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
DiffersFromSceneGroup = false; DiffersFromSceneGroup = false;
// if group is not contained in scene's list // if group is not contained in scene's list
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
{
lock (m_UnchangedEntity.Children)
{ {
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
{ {
@ -157,6 +159,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
} }
// otherwise, scene will not contain the part. note: a group can not remove a part without changing group id // otherwise, scene will not contain the part. note: a group can not remove a part without changing group id
} }
}
// a deleted part has no where to point a beam particle system, // a deleted part has no where to point a beam particle system,
// if a metapart had a particle system (maybe it represented a moved part) remove it // if a metapart had a particle system (maybe it represented a moved part) remove it
@ -180,8 +183,10 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary> /// </summary>
public bool HasChildPrim(UUID uuid) public bool HasChildPrim(UUID uuid)
{ {
lock (m_UnchangedEntity.Children)
if (m_UnchangedEntity.Children.ContainsKey(uuid)) if (m_UnchangedEntity.Children.ContainsKey(uuid))
return true; return true;
return false; return false;
} }
@ -189,10 +194,14 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId. /// Check if the revisioned scene object group that this CMEntity is based off of contains a child with the given LocalId.
/// </summary> /// </summary>
public bool HasChildPrim(uint localID) public bool HasChildPrim(uint localID)
{
lock (m_UnchangedEntity.Children)
{ {
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values) foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
if (part.LocalId == localID) if (part.LocalId == localID)
return true; return true;
}
return false; return false;
} }
@ -228,6 +237,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
// Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user // Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
// had originally saved. // had originally saved.
// m_Entity will NOT necessarily be the same entity as the user had saved. // m_Entity will NOT necessarily be the same entity as the user had saved.
lock (m_UnchangedEntity.Children)
{
foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values) foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values)
{ {
//This is the part that we use to show changes. //This is the part that we use to show changes.
@ -309,6 +320,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
DiffersFromSceneGroup = true; DiffersFromSceneGroup = true;
} }
} }
}
return changed; return changed;
} }

View File

@ -150,6 +150,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
{ {
//make new uuids //make new uuids
Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>(); Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>();
lock (m_Entity.Children)
{
foreach (SceneObjectPart part in m_Entity.Children.Values) foreach (SceneObjectPart part in m_Entity.Children.Values)
{ {
part.ResetIDs(part.LinkNum); part.ResetIDs(part.LinkNum);
@ -160,6 +163,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
m_Entity.RootPart.PhysActor = null; m_Entity.RootPart.PhysActor = null;
m_Entity.Children = parts; m_Entity.Children = parts;
} }
}
#endregion Protected Methods #endregion Protected Methods
@ -173,14 +177,19 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
//This deletes the group without removing from any databases. //This deletes the group without removing from any databases.
//This is important because we are not IN any database. //This is important because we are not IN any database.
//m_Entity.FakeDeleteGroup(); //m_Entity.FakeDeleteGroup();
lock (m_Entity.Children)
{
foreach (SceneObjectPart part in m_Entity.Children.Values) foreach (SceneObjectPart part in m_Entity.Children.Values)
client.SendKillObject(m_Entity.RegionHandle, part.LocalId); client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
} }
}
/// <summary> /// <summary>
/// Sends a kill object message to all clients, effectively "hiding" the metaentity even though it's still on the server. /// Sends a kill object message to all clients, effectively "hiding" the metaentity even though it's still on the server.
/// </summary> /// </summary>
public virtual void HideFromAll() public virtual void HideFromAll()
{
lock (m_Entity.Children)
{ {
foreach (SceneObjectPart part in m_Entity.Children.Values) foreach (SceneObjectPart part in m_Entity.Children.Values)
{ {
@ -190,6 +199,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
); );
} }
} }
}
public void SendFullUpdate(IClientAPI client) public void SendFullUpdate(IClientAPI client)
{ {

View File

@ -185,14 +185,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
get get
{ {
SceneObjectPart my = GetSOP(); SceneObjectPart my = GetSOP();
int total = my.ParentGroup.Children.Count; IObject[] rets = null;
IObject[] rets = new IObject[total]; int total = my.ParentGroup.PrimCount;
rets = new IObject[total];
int i = 0; int i = 0;
foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children)
List<SceneObjectPart> partList = null;
lock (my.ParentGroup.Children)
partList = new List<SceneObjectPart>(my.ParentGroup.Children.Values);
foreach (SceneObjectPart part in partList)
{ {
rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security); rets[i++] = new SOPObject(m_rootScene, part.LocalId, m_security);
} }
return rets; return rets;

View File

@ -293,7 +293,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
case ScriptBaseClass.LINK_SET: case ScriptBaseClass.LINK_SET:
if (m_host.ParentGroup != null) if (m_host.ParentGroup != null)
{
lock (m_host.ParentGroup.Children)
return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
}
return ret; return ret;
case ScriptBaseClass.LINK_ROOT: case ScriptBaseClass.LINK_ROOT:
@ -308,7 +311,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.LINK_ALL_OTHERS: case ScriptBaseClass.LINK_ALL_OTHERS:
if (m_host.ParentGroup == null) if (m_host.ParentGroup == null)
return new List<SceneObjectPart>(); return new List<SceneObjectPart>();
lock (m_host.ParentGroup.Children)
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
if (ret.Contains(m_host)) if (ret.Contains(m_host))
ret.Remove(m_host); ret.Remove(m_host);
return ret; return ret;
@ -316,7 +322,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.LINK_ALL_CHILDREN: case ScriptBaseClass.LINK_ALL_CHILDREN:
if (m_host.ParentGroup == null) if (m_host.ParentGroup == null)
return new List<SceneObjectPart>(); return new List<SceneObjectPart>();
lock (m_host.ParentGroup.Children)
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values); ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
if (ret.Contains(m_host.ParentGroup.RootPart)) if (ret.Contains(m_host.ParentGroup.RootPart))
ret.Remove(m_host.ParentGroup.RootPart); ret.Remove(m_host.ParentGroup.RootPart);
return ret; return ret;
@ -1272,6 +1281,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (group == null) if (group == null)
return; return;
bool allow = true; bool allow = true;
lock (group.Children)
{
foreach (SceneObjectPart part in group.Children.Values) foreach (SceneObjectPart part in group.Children.Values)
{ {
if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
@ -1280,6 +1292,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break; break;
} }
} }
}
if (!allow) if (!allow)
return; return;
@ -2120,7 +2133,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (part.ParentGroup.RootPart == part) if (part.ParentGroup.RootPart == part)
{ {
if ((targetPos.z < ground) && disable_underground_movement) if ((targetPos.z < ground) && disable_underground_movement && m_host.AttachmentPoint == 0)
targetPos.z = ground; targetPos.z = ground;
SceneObjectGroup parent = part.ParentGroup; SceneObjectGroup parent = part.ParentGroup;
LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos); LSL_Vector real_vec = SetPosAdjust(currentPos, targetPos);
@ -2152,17 +2165,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected LSL_Vector GetPartLocalPos(SceneObjectPart part) protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (part.ParentID != 0) if (part.ParentID == 0)
{
return new LSL_Vector(part.AbsolutePosition.X,
part.AbsolutePosition.Y,
part.AbsolutePosition.Z);
}
else
{
if (m_host.IsRoot)
{
return new LSL_Vector(m_host.AttachedPos.X,
m_host.AttachedPos.Y,
m_host.AttachedPos.Z);
}
else
{ {
return new LSL_Vector(part.OffsetPosition.X, return new LSL_Vector(part.OffsetPosition.X,
part.OffsetPosition.Y, part.OffsetPosition.Y,
part.OffsetPosition.Z); part.OffsetPosition.Z);
} }
else
{
return new LSL_Vector(part.AbsolutePosition.X,
part.AbsolutePosition.Y,
part.AbsolutePosition.Z);
} }
} }
@ -3748,7 +3770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentGroup.Children.Count > 1) if (m_host.ParentGroup.PrimCount > 1)
{ {
return m_host.LinkNum; return m_host.LinkNum;
} }
@ -3869,6 +3891,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.LINK_ALL_OTHERS: case ScriptBaseClass.LINK_ALL_OTHERS:
case ScriptBaseClass.LINK_ALL_CHILDREN: case ScriptBaseClass.LINK_ALL_CHILDREN:
case ScriptBaseClass.LINK_THIS: case ScriptBaseClass.LINK_THIS:
lock (parentPrim.Children)
{
foreach (SceneObjectPart part in parentPrim.Children.Values) foreach (SceneObjectPart part in parentPrim.Children.Values)
{ {
if (part.UUID != m_host.UUID) if (part.UUID != m_host.UUID)
@ -3878,6 +3902,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
break; break;
}
default: default:
childPrim = parentPrim.GetLinkNumPart(linknum); childPrim = parentPrim.GetLinkNumPart(linknum);
if (childPrim.UUID == m_host.UUID) if (childPrim.UUID == m_host.UUID)
@ -3953,27 +3978,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (parentPrim.RootPart.AttachmentPoint != 0) if (parentPrim.RootPart.AttachmentPoint != 0)
return; // Fail silently if attached return; // Fail silently if attached
lock (parentPrim.Children)
{
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values); List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
parts.Remove(parentPrim.RootPart); parts.Remove(parentPrim.RootPart);
if (parts.Count > 0)
{
try
{
parts[0].ParentGroup.areUpdatesSuspended = true;
foreach (SceneObjectPart part in parts) foreach (SceneObjectPart part in parts)
{ {
parentPrim.DelinkFromGroup(part.LocalId, true); parentPrim.DelinkFromGroup(part.LocalId, true);
parentPrim.TriggerScriptChangedEvent(Changed.LINK); parentPrim.TriggerScriptChangedEvent(Changed.LINK);
} }
}
finally
{
parts[0].ParentGroup.areUpdatesSuspended = false;
}
}
parentPrim.HasGroupChanged = true; parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate(); parentPrim.ScheduleGroupForFullUpdate();
} }
}
public LSL_String llGetLinkKey(int linknum) public LSL_String llGetLinkKey(int linknum)
{ {
@ -4179,8 +4197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
// destination is an avatar // destination is an avatar
InventoryItemBase agentItem = InventoryItemBase agentItem = World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
if (agentItem == null) if (agentItem == null)
return; return;
@ -4190,7 +4207,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
byte[] objBytes = agentItem.ID.GetBytes(); byte[] objBytes = agentItem.ID.GetBytes();
Array.Copy(objBytes, 0, bucket, 1, 16); Array.Copy(objBytes, 0, bucket, 1, 16);
Console.WriteLine("Giving inventory");
GridInstantMessage msg = new GridInstantMessage(World, GridInstantMessage msg = new GridInstantMessage(World,
m_host.UUID, m_host.Name+", an object owned by "+ m_host.UUID, m_host.Name+", an object owned by "+
resolveName(m_host.OwnerID)+",", destId, resolveName(m_host.OwnerID)+",", destId,
@ -4538,7 +4554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
partItemID = item.ItemID; partItemID = item.ItemID;
int linkNumber = m_host.LinkNum; int linkNumber = m_host.LinkNum;
if (m_host.ParentGroup.Children.Count == 1) if (m_host.ParentGroup.PrimCount == 1)
linkNumber = 0; linkNumber = 0;
object[] resobj = new object[] object[] resobj = new object[]
@ -9595,8 +9611,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// we send to all // we send to all
landData.MediaID = new UUID(texture); landData.MediaID = new UUID(texture);
landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0; landData.MediaAutoScale = autoAlign ? (byte)1 : (byte)0;
landData.MediaSize[0] = width; landData.MediaWidth = width;
landData.MediaSize[1] = height; landData.MediaHeight = height;
landData.MediaType = mediaType; landData.MediaType = mediaType;
// do that one last, it will cause a ParcelPropertiesUpdate // do that one last, it will cause a ParcelPropertiesUpdate
@ -9682,8 +9698,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType)); list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaType));
break; break;
case ParcelMediaCommandEnum.Size: case ParcelMediaCommandEnum.Size:
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[0])); list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaWidth));
list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaSize[1])); list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaHeight));
break; break;
default: default:
ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;

View File

@ -73,9 +73,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false))
m_LSFunctionsEnabled = true; m_LSFunctionsEnabled = true;
if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false))
m_LSFunctionsEnabled = true;
m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>();
if (m_comms == null) if (m_comms == null)
m_LSFunctionsEnabled = false; m_LSFunctionsEnabled = false;
@ -250,22 +247,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (toadd.Length > 0) if (toadd.Length > 0)
{ {
values.Add(new LSL_Integer(rule)); values.Add(rule);
values.Add(toadd.Data[0]); values.Add(toadd.Data[0]);
} }
idx++; idx++;
} }
return values; return values;
} }
private RegionLightShareData getWindlightProfileFromRules(LSL_List rules) private RegionLightShareData getWindlightProfileFromRules(LSL_List rules)
{ {
RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone(); RegionLightShareData wl = (RegionLightShareData)m_host.ParentGroup.Scene.RegionInfo.WindlightSettings.Clone();
LSL_List values = new LSL_List(); // LSL_List values = new LSL_List();
int idx = 0; int idx = 0;
while (idx < rules.Length) while (idx < rules.Length)
{ {

View File

@ -209,6 +209,8 @@ namespace OpenSim.Region.ScriptEngine.Shared
else else
Type = 0x02; // Passive Type = 0x02; // Passive
lock (part.ParentGroup.Children)
{
foreach (SceneObjectPart p in part.ParentGroup.Children.Values) foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
{ {
if (p.Inventory.ContainsScripts()) if (p.Inventory.ContainsScripts())
@ -217,6 +219,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
break; break;
} }
} }
}
Position = new LSL_Types.Vector3(part.AbsolutePosition.X, Position = new LSL_Types.Vector3(part.AbsolutePosition.X,
part.AbsolutePosition.Y, part.AbsolutePosition.Y,

View File

@ -1373,7 +1373,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
sdoc.LoadXml(xml); sdoc.LoadXml(xml);
} }
catch (System.Xml.XmlException e) catch (System.Xml.XmlException)
{ {
loadedState = false; loadedState = false;
} }

View File

@ -156,8 +156,6 @@ namespace OpenSim.Services.Connectors
sendData["METHOD"] = "storefriend"; sendData["METHOD"] = "storefriend";
string reqString = ServerUtils.BuildQueryString(sendData);
string reply = string.Empty; string reply = string.Empty;
try try
{ {
@ -199,8 +197,6 @@ namespace OpenSim.Services.Connectors
sendData["FRIEND"] = Friend; sendData["FRIEND"] = Friend;
sendData["METHOD"] = "deletefriend"; sendData["METHOD"] = "deletefriend";
string reqString = ServerUtils.BuildQueryString(sendData);
string reply = string.Empty; string reply = string.Empty;
try try
{ {
@ -232,10 +228,8 @@ namespace OpenSim.Services.Connectors
m_log.DebugFormat("[FRIENDS CONNECTOR]: DeleteFriend received null reply"); m_log.DebugFormat("[FRIENDS CONNECTOR]: DeleteFriend received null reply");
return false; return false;
} }
#endregion #endregion
} }
} }

View File

@ -31,11 +31,9 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.Imaging; using OpenMetaverse.Imaging;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
@ -50,7 +48,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013"); // private static UUID m_HGMapImage = new UUID("00000000-0000-1111-9999-000000000013");
private IAssetService m_AssetService; private IAssetService m_AssetService;

View File

@ -32,12 +32,10 @@ using System.IO;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.Simulation; using OpenSim.Services.Connectors.Simulation;
using GridRegion = OpenSim.Services.Interfaces.GridRegion; using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using log4net; using log4net;
@ -243,7 +241,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
{ {
response = request.Send(m_ServerURL, 10000); response = request.Send(m_ServerURL, 10000);
} }
catch (Exception e) catch (Exception)
{ {
return null; return null;
} }
@ -308,13 +306,12 @@ namespace OpenSim.Services.Connectors.Hypergrid
} }
} }
catch (Exception e) catch (Exception)
{ {
return null; return null;
} }
return null; return null;
} }
public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName) public bool AgentIsComingHome(UUID sessionID, string thisGridExternalName)

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -53,7 +53,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private static string ZeroID = UUID.Zero.ToString(); // private static string ZeroID = UUID.Zero.ToString();
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private string m_userServerUrl = String.Empty; private string m_userServerUrl = String.Empty;
private object m_gestureSyncRoot = new object(); // private object m_gestureSyncRoot = new object();
#region ISharedRegionModule #region ISharedRegionModule
@ -687,12 +687,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
for (int i = 0; i < items.Count; i++) for (int i = 0; i < items.Count; i++)
itemIDs[i] = items[i].AsUUID().ToString(); itemIDs[i] = items[i].AsUUID().ToString();
NameValueCollection requestArgs = new NameValueCollection // NameValueCollection requestArgs = new NameValueCollection
{ // {
{ "RequestMethod", "GetInventoryNodes" }, // { "RequestMethod", "GetInventoryNodes" },
{ "OwnerID", userID.ToString() }, // { "OwnerID", userID.ToString() },
{ "Items", String.Join(",", itemIDs) } // { "Items", String.Join(",", itemIDs) }
}; // };
// FIXME: Implement this in SimianGrid // FIXME: Implement this in SimianGrid
return new List<InventoryItemBase>(0); return new List<InventoryItemBase>(0);
@ -708,12 +708,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// the user's inventory</returns> /// the user's inventory</returns>
public int GetAssetPermissions(UUID userID, UUID assetID) public int GetAssetPermissions(UUID userID, UUID assetID)
{ {
NameValueCollection requestArgs = new NameValueCollection // NameValueCollection requestArgs = new NameValueCollection
{ // {
{ "RequestMethod", "GetInventoryNodes" }, // { "RequestMethod", "GetInventoryNodes" },
{ "OwnerID", userID.ToString() }, // { "OwnerID", userID.ToString() },
{ "AssetID", assetID.ToString() } // { "AssetID", assetID.ToString() }
}; // };
// FIXME: Implement this in SimianGrid // FIXME: Implement this in SimianGrid
return (int)PermissionMask.All; return (int)PermissionMask.All;

View File

@ -1,4 +1,4 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
@ -349,24 +349,24 @@ namespace OpenSim.Services.Connectors.SimianGrid
return null; return null;
} }
private OSDMap GetSessionData(UUID sessionID) // private OSDMap GetSessionData(UUID sessionID)
{ // {
m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID); // m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
//
NameValueCollection requestArgs = new NameValueCollection // NameValueCollection requestArgs = new NameValueCollection
{ // {
{ "RequestMethod", "GetSession" }, // { "RequestMethod", "GetSession" },
{ "SessionID", sessionID.ToString() } // { "SessionID", sessionID.ToString() }
}; // };
//
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
if (response["Success"].AsBoolean()) // if (response["Success"].AsBoolean())
return response; // return response;
else // else
m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID); // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
//
return null; // return null;
} // }
private List<PresenceInfo> GetSessions(UUID userID) private List<PresenceInfo> GetSessions(UUID userID)
{ {

View File

@ -141,8 +141,11 @@ namespace OpenSim.Services.Interfaces
/// <summary> /// <summary>
/// Add a new item to the user's inventory /// Add a new item to the user's inventory
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item">
/// <returns>true if the item was successfully added</returns> /// The item to be added. If item.FolderID == UUID.Zero then the item is added to the most suitable system
/// folder. If there is no suitable folder then the item is added to the user's root inventory folder.
/// </param>
/// <returns>true if the item was successfully added, false if it was not</returns>
bool AddItem(InventoryItemBase item); bool AddItem(InventoryItemBase item);
/// <summary> /// <summary>

View File

@ -268,6 +268,8 @@ namespace OpenSim.Services.InventoryService
public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
{ {
// m_log.DebugFormat("[INVENTORY SERVICE]: Looking for folder type {0} for user {1}", type, userID);
InventoryFolderBase root = m_Database.getUserRootFolder(userID); InventoryFolderBase root = m_Database.getUserRootFolder(userID);
if (root != null) if (root != null)
{ {
@ -276,9 +278,14 @@ namespace OpenSim.Services.InventoryService
foreach (InventoryFolderBase folder in folders) foreach (InventoryFolderBase folder in folders)
{ {
if (folder.Type == (short)type) if (folder.Type == (short)type)
{
// m_log.DebugFormat(
// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type);
return folder; return folder;
} }
} }
}
// we didn't find any folder of that type. Return the root folder // we didn't find any folder of that type. Return the root folder
// hopefully the root folder is not null. If it is, too bad // hopefully the root folder is not null. If it is, too bad

View File

@ -157,6 +157,8 @@ namespace OpenSim.Services.InventoryService
protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID) protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID)
{ {
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting system folders for {0}", principalID);
XInventoryFolder[] allFolders = m_Database.GetFolders( XInventoryFolder[] allFolders = m_Database.GetFolders(
new string[] { "agentID" }, new string[] { "agentID" },
new string[] { principalID.ToString() }); new string[] { principalID.ToString() });
@ -170,6 +172,9 @@ namespace OpenSim.Services.InventoryService
return false; return false;
}); });
// m_log.DebugFormat(
// "[XINVENTORY SERVICE]: Found {0} system folders for {1}", sysFolders.Length, principalID);
return sysFolders; return sysFolders;
} }
@ -186,7 +191,7 @@ namespace OpenSim.Services.InventoryService
foreach (XInventoryFolder x in allFolders) foreach (XInventoryFolder x in allFolders)
{ {
//m_log.DebugFormat("[XINVENTORY]: Adding folder {0} to skeleton", x.folderName); //m_log.DebugFormat("[XINVENTORY SERVICE]: Adding folder {0} to skeleton", x.folderName);
folders.Add(ConvertToOpenSim(x)); folders.Add(ConvertToOpenSim(x));
} }
@ -214,12 +219,21 @@ namespace OpenSim.Services.InventoryService
public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
{ {
// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID);
XInventoryFolder[] folders = m_Database.GetFolders( XInventoryFolder[] folders = m_Database.GetFolders(
new string[] { "agentID", "type"}, new string[] { "agentID", "type"},
new string[] { principalID.ToString(), ((int)type).ToString() }); new string[] { principalID.ToString(), ((int)type).ToString() });
if (folders.Length == 0) if (folders.Length == 0)
{
// m_log.WarnFormat("[XINVENTORY SERVICE]: Found no folder for type {0} for user {1}", type, principalID);
return null; return null;
}
// m_log.DebugFormat(
// "[XINVENTORY SERVICE]: Found folder {0} {1} for type {2} for user {3}",
// folders[0].folderName, folders[0].folderID, type, principalID);
return ConvertToOpenSim(folders[0]); return ConvertToOpenSim(folders[0]);
} }
@ -230,7 +244,7 @@ namespace OpenSim.Services.InventoryService
// connector. So we disregard the principal and look // connector. So we disregard the principal and look
// by ID. // by ID.
// //
m_log.DebugFormat("[XINVENTORY]: Fetch contents for folder {0}", folderID.ToString()); m_log.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString());
InventoryCollection inventory = new InventoryCollection(); InventoryCollection inventory = new InventoryCollection();
inventory.UserID = principalID; inventory.UserID = principalID;
inventory.Folders = new List<InventoryFolderBase>(); inventory.Folders = new List<InventoryFolderBase>();
@ -349,6 +363,9 @@ namespace OpenSim.Services.InventoryService
public virtual bool AddItem(InventoryItemBase item) public virtual bool AddItem(InventoryItemBase item)
{ {
// m_log.DebugFormat(
// "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner);
return m_Database.StoreItem(ConvertFromOpenSim(item)); return m_Database.StoreItem(ConvertFromOpenSim(item));
} }

View File

@ -37,13 +37,9 @@ namespace OpenSim.Tests.Common.Mock
{ {
public class MockInventoryService : IInventoryService public class MockInventoryService : IInventoryService
{ {
public MockInventoryService() public MockInventoryService() {}
{
}
public MockInventoryService(IConfigSource config) public MockInventoryService(IConfigSource config) {}
{
}
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
@ -140,7 +136,7 @@ namespace OpenSim.Tests.Common.Mock
public bool AddItem(InventoryItemBase item) public bool AddItem(InventoryItemBase item)
{ {
return false; return true;
} }
public bool UpdateItem(InventoryItemBase item) public bool UpdateItem(InventoryItemBase item)

View File

@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common.Mock
/// </summary> /// </summary>
public class TestInventoryDataPlugin : IInventoryDataPlugin public class TestInventoryDataPlugin : IInventoryDataPlugin
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <value> /// <value>
/// Inventory folders /// Inventory folders
@ -84,15 +84,20 @@ namespace OpenSim.Tests.Common.Mock
public List<InventoryItemBase> getInventoryInFolder(UUID folderID) public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
{ {
// m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0}", folderID); InventoryFolderBase folder = m_folders[folderID];
// m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0} {1}", folder.Name, folder.ID);
List<InventoryItemBase> items = new List<InventoryItemBase>(); List<InventoryItemBase> items = new List<InventoryItemBase>();
foreach (InventoryItemBase item in m_items.Values) foreach (InventoryItemBase item in m_items.Values)
{ {
if (item.Folder == folderID) if (item.Folder == folderID)
{
// m_log.DebugFormat("[MOCK INV DB]: getInventoryInFolder() adding item {0}", item.Name);
items.Add(item); items.Add(item);
} }
}
return items; return items;
} }
@ -111,13 +116,23 @@ namespace OpenSim.Tests.Common.Mock
public List<InventoryFolderBase> getInventoryFolders(UUID parentID) public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
{ {
InventoryFolderBase parentFolder = m_folders[parentID];
// m_log.DebugFormat("[MOCK INV DB]: Getting folders in folder {0} {1}", parentFolder.Name, parentFolder.ID);
List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
foreach (InventoryFolderBase folder in m_folders.Values) foreach (InventoryFolderBase folder in m_folders.Values)
{ {
if (folder.ParentID == parentID) if (folder.ParentID == parentID)
{
// m_log.DebugFormat(
// "[MOCK INV DB]: Found folder {0} {1} in {2} {3}",
// folder.Name, folder.ID, parentFolder.Name, parentFolder.ID);
folders.Add(folder); folders.Add(folder);
} }
}
return folders; return folders;
} }
@ -137,6 +152,10 @@ namespace OpenSim.Tests.Common.Mock
public void addInventoryFolder(InventoryFolderBase folder) public void addInventoryFolder(InventoryFolderBase folder)
{ {
// m_log.DebugFormat(
// "[MOCK INV DB]: Adding inventory folder {0} {1} type {2}",
// folder.Name, folder.ID, (AssetType)folder.Type);
m_folders[folder.ID] = folder; m_folders[folder.ID] = folder;
if (folder.ParentID == UUID.Zero) if (folder.ParentID == UUID.Zero)
@ -166,8 +185,10 @@ namespace OpenSim.Tests.Common.Mock
public void addInventoryItem(InventoryItemBase item) public void addInventoryItem(InventoryItemBase item)
{ {
InventoryFolderBase folder = m_folders[item.Folder];
// m_log.DebugFormat( // m_log.DebugFormat(
// "[MOCK INV DB]: Adding inventory item {0} {1} in {2}", item.Name, item.ID, item.Folder); // "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID);
m_items[item.ID] = item; m_items[item.ID] = item;
} }

View File

@ -285,10 +285,16 @@ namespace OpenSim.Tests.Common.Setup
config.AddConfig("Modules"); config.AddConfig("Modules");
config.AddConfig("InventoryService"); config.AddConfig("InventoryService");
config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
if (real) if (real)
{
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
}
else else
{
config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService");
}
config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
inventoryService.Initialise(config); inventoryService.Initialise(config);
inventoryService.AddRegion(testScene); inventoryService.AddRegion(testScene);

View File

@ -127,12 +127,19 @@ namespace OpenSim.Tests.Common.Setup
{ {
UserAccount ua UserAccount ua
= new UserAccount(userId) = new UserAccount(userId)
{ FirstName = firstName, LastName = lastName, ServiceURLs = new Dictionary<string, object>() }; { FirstName = firstName, LastName = lastName };
CreateUserWithInventory(scene, ua, pw);
return ua;
}
public static void CreateUserWithInventory(Scene scene, UserAccount ua, string pw)
{
// FIXME: This should really be set up by UserAccount itself
ua.ServiceURLs = new Dictionary<string, object>();
scene.UserAccountService.StoreUserAccount(ua); scene.UserAccountService.StoreUserAccount(ua);
scene.InventoryService.CreateUserInventory(ua.PrincipalID); scene.InventoryService.CreateUserInventory(ua.PrincipalID);
scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
return ua;
} }
} }
} }

View File

@ -227,7 +227,7 @@
;MapImageModule = "MapImageModule" ;MapImageModule = "MapImageModule"
; Set to false to not generate any maptiles ; Set to false to not generate any maptiles
;GenerateMaptiles = "true" ;GenerateMaptiles = "true"
; Refreah (in seconds) the map tile periodically ; Refresh (in seconds) the map tile periodically
;MaptileRefresh = 0 ;MaptileRefresh = 0
; If not generating maptiles, use this static texture asset ID ; If not generating maptiles, use this static texture asset ID
;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000" ;MaptileStaticUUID = "00000000-0000-0000-0000-000000000000"

View File

@ -100,7 +100,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
[UserAccountService] [UserAccountService]
; for the server connector ; for the server connector
LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService"
; Realm = "usersaccounts" ; Realm = "useraccounts"
; These are for creating new accounts by the service ; These are for creating new accounts by the service
AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService"

View File

@ -57,7 +57,6 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" LocalServiceModule = "OpenSim.Services.GridService.dll:GridService"
; Realm = "regions" ; Realm = "regions"
; AllowDuplicateNames = "True" ; AllowDuplicateNames = "True"
; Check4096 = "False"
;; Next, we can specify properties of regions, including default and fallback regions ;; Next, we can specify properties of regions, including default and fallback regions
;; The syntax is: Region_<RegionName> = "<flags>" ;; The syntax is: Region_<RegionName> = "<flags>"