- add OpenSim.Framework.AssetMetadata class. AssetBase is now composed of it

- trim trailing whitespace
0.6.3-post-fixes
Mike Mazur 2009-02-04 00:01:36 +00:00
parent 1adb8c33b2
commit 0c03a48fb2
33 changed files with 861 additions and 810 deletions

View File

@ -195,7 +195,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
#endregion Interface #endregion Interface
/// <summary> /// <summary>
/// The only parameter we recognize is a UUID.If an asset with this identification is /// The only parameter we recognize is a UUID.If an asset with this identification is
/// found, it's content, base-64 encoded, is returned to the client. /// found, it's content, base-64 encoded, is returned to the client.
/// </summary> /// </summary>
@ -218,12 +218,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty); rdata.writer.WriteStartElement(String.Empty,"Asset",String.Empty);
rdata.writer.WriteAttributeString("id", asset.ID.ToString()); rdata.writer.WriteAttributeString("id", asset.Metadata.ID);
rdata.writer.WriteAttributeString("name", asset.Name); rdata.writer.WriteAttributeString("name", asset.Metadata.Name);
rdata.writer.WriteAttributeString("desc", asset.Description); rdata.writer.WriteAttributeString("desc", asset.Metadata.Description);
rdata.writer.WriteAttributeString("type", asset.Type.ToString()); rdata.writer.WriteAttributeString("type", asset.Metadata.Type.ToString());
rdata.writer.WriteAttributeString("local", asset.Local.ToString()); rdata.writer.WriteAttributeString("local", asset.Metadata.Local.ToString());
rdata.writer.WriteAttributeString("temporary", asset.Temporary.ToString()); rdata.writer.WriteAttributeString("temporary", asset.Metadata.Temporary.ToString());
rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length);
@ -274,19 +274,19 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
modified = (asset != null); modified = (asset != null);
created = !modified; created = !modified;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = uuid; asset.Metadata.FullID = uuid;
asset.Name = xml.GetAttribute("name"); asset.Metadata.Name = xml.GetAttribute("name");
asset.Description = xml.GetAttribute("desc"); asset.Metadata.Description = xml.GetAttribute("desc");
asset.Type = SByte.Parse(xml.GetAttribute("type")); asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type"));
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", ""));
if (asset.ID != rdata.Parameters[0]) if (asset.Metadata.ID != rdata.Parameters[0])
{ {
Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}", Rest.Log.WarnFormat("{0} URI and payload disagree on UUID U:{1} vs P:{2}",
MsgId, rdata.Parameters[0], asset.ID); MsgId, rdata.Parameters[0], asset.Metadata.ID);
} }
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
@ -300,14 +300,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (created) if (created)
{ {
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeCreated); rdata.Complete(Rest.HttpStatusCodeCreated);
} }
else else
{ {
if (modified) if (modified)
{ {
rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeOK); rdata.Complete(Rest.HttpStatusCodeOK);
} }
else else
@ -354,27 +354,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
modified = (asset != null); modified = (asset != null);
created = !modified; created = !modified;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = uuid; asset.Metadata.FullID = uuid;
asset.Name = xml.GetAttribute("name"); asset.Metadata.Name = xml.GetAttribute("name");
asset.Description = xml.GetAttribute("desc"); asset.Metadata.Description = xml.GetAttribute("desc");
asset.Type = SByte.Parse(xml.GetAttribute("type")); asset.Metadata.Type = SByte.Parse(xml.GetAttribute("type"));
asset.Local = Int32.Parse(xml.GetAttribute("local")) != 0; asset.Metadata.Local = Int32.Parse(xml.GetAttribute("local")) != 0;
asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Metadata.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0;
asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", ""));
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
if (created) if (created)
{ {
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeCreated); rdata.Complete(Rest.HttpStatusCodeCreated);
} }
else else
{ {
if (modified) if (modified)
{ {
rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Name, asset.FullID)); rdata.appendStatus(String.Format("<p> Modified asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.FullID));
rdata.Complete(Rest.HttpStatusCodeOK); rdata.Complete(Rest.HttpStatusCodeOK);
} }
else else

View File

@ -353,7 +353,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
default : default :
Rest.Log.WarnFormat("{0} Method {1} not supported for {2}", Rest.Log.WarnFormat("{0} Method {1} not supported for {2}",
MsgId, rdata.method, rdata.path); MsgId, rdata.method, rdata.path);
rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed, rdata.Fail(Rest.HttpStatusCodeMethodNotAllowed,
String.Format("{0} not supported", rdata.method)); String.Format("{0} not supported", rdata.method));
break; break;
} }
@ -488,12 +488,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (AssetBase asset in entity.Assets) foreach (AssetBase asset in entity.Assets)
{ {
Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
MsgId, asset.ID, asset.Type, asset.Name); MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
created = true; created = true;
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>",
asset.Name, asset.ID)); asset.Metadata.Name, asset.Metadata.ID));
if (Rest.DEBUG && Rest.DumpAsset) if (Rest.DEBUG && Rest.DumpAsset)
{ {
@ -691,14 +691,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (AssetBase asset in entity.Assets) foreach (AssetBase asset in entity.Assets)
{ {
Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}",
MsgId, asset.ID, asset.Type, asset.Name); MsgId, asset.Metadata.ID, asset.Metadata.Type, asset.Metadata.Name);
// The asset was validated during the collection process // The asset was validated during the collection process
Rest.AssetServices.AddAsset(asset); Rest.AssetServices.AddAsset(asset);
created = true; created = true;
rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Name, asset.ID)); rdata.appendStatus(String.Format("<p> Created asset {0}, UUID {1} <p>", asset.Metadata.Name, asset.Metadata.ID));
if (Rest.DEBUG && Rest.DumpAsset) if (Rest.DEBUG && Rest.DumpAsset)
{ {
@ -1083,7 +1083,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} {1}: Resource {2} not found", Rest.Log.DebugFormat("{0} {1}: Resource {2} not found",
MsgId, rdata.method, rdata.path); MsgId, rdata.method, rdata.path);
rdata.Fail(Rest.HttpStatusCodeNotFound, rdata.Fail(Rest.HttpStatusCodeNotFound,
String.Format("resource {0}:{1} not found", rdata.method, rdata.path)); String.Format("resource {0}:{1} not found", rdata.method, rdata.path));
return null; /* Never reached */ return null; /* Never reached */
@ -1324,7 +1324,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.writer.WriteAttributeString("everyone", String.Empty, i.EveryOnePermissions.ToString("X")); rdata.writer.WriteAttributeString("everyone", String.Empty, i.EveryOnePermissions.ToString("X"));
rdata.writer.WriteAttributeString("base", String.Empty, i.BasePermissions.ToString("X")); rdata.writer.WriteAttributeString("base", String.Empty, i.BasePermissions.ToString("X"));
rdata.writer.WriteEndElement(); rdata.writer.WriteEndElement();
rdata.writer.WriteElementString("Asset", i.AssetID.ToString()); rdata.writer.WriteElementString("Asset", i.AssetID.ToString());
rdata.writer.WriteEndElement(); rdata.writer.WriteEndElement();
@ -1458,7 +1458,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
case XmlNodeType.Element: case XmlNodeType.Element:
Rest.Log.DebugFormat("{0} StartElement: <{1}>", Rest.Log.DebugFormat("{0} StartElement: <{1}>",
MsgId, ic.xml.Name); MsgId, ic.xml.Name);
switch (ic.xml.Name) switch (ic.xml.Name)
{ {
case "Folder": case "Folder":
@ -1486,7 +1486,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
MsgId, ic.xml.Name); MsgId, ic.xml.Name);
break; break;
} }
// This stinks, but the ReadElement call above not only reads // This stinks, but the ReadElement call above not only reads
// the imbedded data, but also consumes the end tag for Asset // the imbedded data, but also consumes the end tag for Asset
// and moves the element pointer on to the containing Item's // and moves the element pointer on to the containing Item's
@ -1498,7 +1498,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Validate(ic); Validate(ic);
} }
break; break;
case XmlNodeType.EndElement : case XmlNodeType.EndElement :
switch (ic.xml.Name) switch (ic.xml.Name)
{ {
@ -1526,7 +1526,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
break; break;
} }
break; break;
default: default:
Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>", Rest.Log.DebugFormat("{0} Ignoring: <{1}>:<{2}>",
MsgId, ic.xml.NodeType, ic.xml.Value); MsgId, ic.xml.NodeType, ic.xml.Value);
@ -1868,7 +1868,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// only if the size is non-zero. // only if the size is non-zero.
else else
{ {
AssetBase asset = null; AssetBase asset = null;
string b64string = null; string b64string = null;
@ -1884,10 +1884,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
asset = new AssetBase(uuid, name); asset = new AssetBase(uuid, name);
asset.Description = desc; asset.Metadata.Description = desc;
asset.Type = type; // type == 0 == texture asset.Metadata.Type = type; // type == 0 == texture
asset.Local = local; asset.Metadata.Local = local;
asset.Temporary = temp; asset.Metadata.Temporary = temp;
b64string = ic.xml.ReadElementContentAsString(); b64string = ic.xml.ReadElementContentAsString();
@ -1911,8 +1911,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
ic.Item.AssetID = uuid; ic.Item.AssetID = uuid;
} }
ic.Push(asset); ic.Push(asset);
} }
} }
@ -2039,10 +2039,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (ic.Asset != null) if (ic.Asset != null)
{ {
if (ic.Asset.Name == String.Empty) if (ic.Asset.Metadata.Name == String.Empty)
ic.Asset.Name = ic.Item.Name; ic.Asset.Metadata.Name = ic.Item.Name;
if (ic.Asset.Description == String.Empty) if (ic.Asset.Metadata.Description == String.Empty)
ic.Asset.Description = ic.Item.Description; ic.Asset.Metadata.Description = ic.Item.Description;
} }
// Assign permissions // Assign permissions
@ -2139,7 +2139,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
try try
{ {
ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true); ic.Asset.Data = OpenJPEG.EncodeFromImage(temp, true);
} }
catch (DllNotFoundException) catch (DllNotFoundException)
{ {
Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name); Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name);
@ -2201,7 +2201,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This is the callback method required by the inventory watchdog. The /// This is the callback method required by the inventory watchdog. The
/// requestor issues an inventory request and then blocks until the /// requestor issues an inventory request and then blocks until the
/// request completes, or this method signals the monitor. /// request completes, or this method signals the monitor.
/// </summary> /// </summary>

View File

@ -132,12 +132,12 @@ namespace OpenSim.Data.MSSQL
{ {
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
// Region Main // Region Main
asset.FullID = new UUID((string)reader["id"]); asset.Metadata.FullID = new UUID((string)reader["id"]);
asset.Name = (string)reader["name"]; asset.Metadata.Name = (string)reader["name"];
asset.Description = (string)reader["description"]; asset.Metadata.Description = (string)reader["description"];
asset.Type = Convert.ToSByte(reader["assetType"]); asset.Metadata.Type = Convert.ToSByte(reader["assetType"]);
asset.Local = Convert.ToBoolean(reader["local"]); asset.Metadata.Local = Convert.ToBoolean(reader["local"]);
asset.Temporary = Convert.ToBoolean(reader["temporary"]); asset.Metadata.Temporary = Convert.ToBoolean(reader["temporary"]);
asset.Data = (byte[])reader["data"]; asset.Data = (byte[])reader["data"];
return asset; return asset;
} }
@ -152,7 +152,7 @@ namespace OpenSim.Data.MSSQL
/// <param name="asset">the asset</param> /// <param name="asset">the asset</param>
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.Metadata.FullID))
{ {
return; return;
} }
@ -163,12 +163,12 @@ namespace OpenSim.Data.MSSQL
"(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)")) "(@id, @name, @description, @assetType, @local, @temporary, @create_time, @access_time, @data)"))
{ {
int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000);
command.Parameters.Add(database.CreateParameter("id", asset.FullID)); command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID));
command.Parameters.Add(database.CreateParameter("name", asset.Name)); command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name));
command.Parameters.Add(database.CreateParameter("description", asset.Description)); command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description));
command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type));
command.Parameters.Add(database.CreateParameter("local", asset.Local)); command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local));
command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary));
command.Parameters.Add(database.CreateParameter("access_time", now)); command.Parameters.Add(database.CreateParameter("access_time", now));
command.Parameters.Add(database.CreateParameter("create_time", now)); command.Parameters.Add(database.CreateParameter("create_time", now));
command.Parameters.Add(database.CreateParameter("data", asset.Data)); command.Parameters.Add(database.CreateParameter("data", asset.Data));
@ -192,14 +192,14 @@ namespace OpenSim.Data.MSSQL
"data = @data where " + "data = @data where " +
"id = @keyId;")) "id = @keyId;"))
{ {
command.Parameters.Add(database.CreateParameter("id", asset.FullID)); command.Parameters.Add(database.CreateParameter("id", asset.Metadata.FullID));
command.Parameters.Add(database.CreateParameter("name", asset.Name)); command.Parameters.Add(database.CreateParameter("name", asset.Metadata.Name));
command.Parameters.Add(database.CreateParameter("description", asset.Description)); command.Parameters.Add(database.CreateParameter("description", asset.Metadata.Description));
command.Parameters.Add(database.CreateParameter("assetType", asset.Type)); command.Parameters.Add(database.CreateParameter("assetType", asset.Metadata.Type));
command.Parameters.Add(database.CreateParameter("local", asset.Local)); command.Parameters.Add(database.CreateParameter("local", asset.Metadata.Local));
command.Parameters.Add(database.CreateParameter("temporary", asset.Temporary)); command.Parameters.Add(database.CreateParameter("temporary", asset.Metadata.Temporary));
command.Parameters.Add(database.CreateParameter("data", asset.Data)); command.Parameters.Add(database.CreateParameter("data", asset.Data));
command.Parameters.Add(database.CreateParameter("@keyId", asset.FullID)); command.Parameters.Add(database.CreateParameter("@keyId", asset.Metadata.FullID));
try try
{ {

View File

@ -139,18 +139,18 @@ namespace OpenSim.Data.MySQL
{ {
asset = new AssetBase(); asset = new AssetBase();
asset.Data = (byte[]) dbReader["data"]; asset.Data = (byte[]) dbReader["data"];
asset.Description = (string) dbReader["description"]; asset.Metadata.Description = (string) dbReader["description"];
asset.FullID = assetID; asset.Metadata.FullID = assetID;
try try
{ {
asset.Local = (bool)dbReader["local"]; asset.Metadata.Local = (bool)dbReader["local"];
} }
catch (System.InvalidCastException) catch (System.InvalidCastException)
{ {
asset.Local = false; asset.Metadata.Local = false;
} }
asset.Name = (string) dbReader["name"]; asset.Metadata.Name = (string) dbReader["name"];
asset.Type = (sbyte) dbReader["assetType"]; asset.Metadata.Type = (sbyte) dbReader["assetType"];
} }
dbReader.Close(); dbReader.Close();
cmd.Dispose(); cmd.Dispose();
@ -178,8 +178,8 @@ namespace OpenSim.Data.MySQL
{ {
lock (_dbConnection) lock (_dbConnection)
{ {
//m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID));
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.Metadata.FullID))
{ {
//m_log.Info("[ASSET DB]: Asset exists already, ignoring."); //m_log.Info("[ASSET DB]: Asset exists already, ignoring.");
return; return;
@ -200,12 +200,12 @@ namespace OpenSim.Data.MySQL
{ {
// create unix epoch time // create unix epoch time
int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000);
cmd.Parameters.AddWithValue("?id", asset.FullID.ToString()); cmd.Parameters.AddWithValue("?id", asset.Metadata.ID);
cmd.Parameters.AddWithValue("?name", asset.Name); cmd.Parameters.AddWithValue("?name", asset.Metadata.Name);
cmd.Parameters.AddWithValue("?description", asset.Description); cmd.Parameters.AddWithValue("?description", asset.Metadata.Description);
cmd.Parameters.AddWithValue("?assetType", asset.Type); cmd.Parameters.AddWithValue("?assetType", asset.Metadata.Type);
cmd.Parameters.AddWithValue("?local", asset.Local); cmd.Parameters.AddWithValue("?local", asset.Metadata.Local);
cmd.Parameters.AddWithValue("?temporary", asset.Temporary); cmd.Parameters.AddWithValue("?temporary", asset.Metadata.Temporary);
cmd.Parameters.AddWithValue("?create_time", now); cmd.Parameters.AddWithValue("?create_time", now);
cmd.Parameters.AddWithValue("?access_time", now); cmd.Parameters.AddWithValue("?access_time", now);
cmd.Parameters.AddWithValue("?data", asset.Data); cmd.Parameters.AddWithValue("?data", asset.Data);
@ -218,7 +218,7 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat( m_log.ErrorFormat(
"[ASSETS DB]: " + "[ASSETS DB]: " +
"MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString()
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name);
_dbConnection.Reconnect(); _dbConnection.Reconnect();
} }
} }
@ -241,7 +241,7 @@ namespace OpenSim.Data.MySQL
{ {
// create unix epoch time // create unix epoch time
int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000); int now = (int)((System.DateTime.Now.Ticks - TicksToEpoch) / 10000000);
cmd.Parameters.AddWithValue("?id", asset.FullID.ToString()); cmd.Parameters.AddWithValue("?id", asset.Metadata.ID);
cmd.Parameters.AddWithValue("?access_time", now); cmd.Parameters.AddWithValue("?access_time", now);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Dispose(); cmd.Dispose();
@ -252,7 +252,7 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat( m_log.ErrorFormat(
"[ASSETS DB]: " + "[ASSETS DB]: " +
"MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString() "MySql failure updating access_time for asset {0} with name {1}" + Environment.NewLine + e.ToString()
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + Environment.NewLine + "Attempting reconnection", asset.Metadata.FullID, asset.Metadata.Name);
_dbConnection.Reconnect(); _dbConnection.Reconnect();
} }
} }

View File

@ -69,7 +69,7 @@ namespace OpenSim.Data.NHibernate
private void Save(AssetBase asset) private void Save(AssetBase asset)
{ {
AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.FullID); AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.Metadata.FullID);
if (temp == null) if (temp == null)
{ {
manager.Save(asset); manager.Save(asset);
@ -78,13 +78,13 @@ namespace OpenSim.Data.NHibernate
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.Metadata.FullID);
Save(asset); Save(asset);
} }
override public void UpdateAsset(AssetBase asset) override public void UpdateAsset(AssetBase asset)
{ {
m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.Metadata.FullID);
manager.Update(asset); manager.Update(asset);
} }

View File

@ -125,8 +125,8 @@ namespace OpenSim.Data.SQLite
/// <param name="asset">Asset Base</param> /// <param name="asset">Asset Base</param>
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
//m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.FullID)); //m_log.Info("[ASSET DB]: Creating Asset " + Util.ToRawUuidString(asset.Metadata.FullID));
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.Metadata.FullID))
{ {
//m_log.Info("[ASSET DB]: Asset exists already, ignoring."); //m_log.Info("[ASSET DB]: Asset exists already, ignoring.");
} }
@ -136,12 +136,12 @@ namespace OpenSim.Data.SQLite
{ {
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID)));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -162,12 +162,12 @@ namespace OpenSim.Data.SQLite
{ {
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.Metadata.FullID)));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", asset.Metadata.Name));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", asset.Metadata.Description));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Metadata.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Metadata.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Metadata.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -181,14 +181,14 @@ namespace OpenSim.Data.SQLite
/// <param name="asset"></param> /// <param name="asset"></param>
private static void LogAssetLoad(AssetBase asset) private static void LogAssetLoad(AssetBase asset)
{ {
string temporary = asset.Temporary ? "Temporary" : "Stored"; string temporary = asset.Metadata.Temporary ? "Temporary" : "Stored";
string local = asset.Local ? "Local" : "Remote"; string local = asset.Metadata.Local ? "Local" : "Remote";
int assetLength = (asset.Data != null) ? asset.Data.Length : 0; int assetLength = (asset.Data != null) ? asset.Data.Length : 0;
m_log.Info("[ASSET DB]: " + m_log.Info("[ASSET DB]: " +
string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)", string.Format("Loaded {6} {5} Asset: [{0}][{3}] \"{1}\":{2} ({7} bytes)",
asset.FullID, asset.Name, asset.Description, asset.Type, asset.Metadata.FullID, asset.Metadata.Name, asset.Metadata.Description, asset.Metadata.Type,
temporary, local, assetLength)); temporary, local, assetLength));
} }
@ -246,12 +246,12 @@ namespace OpenSim.Data.SQLite
// back out. Not enough time to figure it out yet. // back out. Not enough time to figure it out yet.
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = new UUID((String) row["UUID"]); asset.Metadata.FullID = new UUID((String) row["UUID"]);
asset.Name = (String) row["Name"]; asset.Metadata.Name = (String) row["Name"];
asset.Description = (String) row["Description"]; asset.Metadata.Description = (String) row["Description"];
asset.Type = Convert.ToSByte(row["Type"]); asset.Metadata.Type = Convert.ToSByte(row["Type"]);
asset.Local = Convert.ToBoolean(row["Local"]); asset.Metadata.Local = Convert.ToBoolean(row["Local"]);
asset.Temporary = Convert.ToBoolean(row["Temporary"]); asset.Metadata.Temporary = Convert.ToBoolean(row["Temporary"]);
asset.Data = (byte[]) row["Data"]; asset.Data = (byte[]) row["Data"];
return asset; return asset;
} }

View File

@ -61,7 +61,7 @@ namespace OpenSim.Data.Tests
asset1 = new byte[100]; asset1 = new byte[100];
asset1.Initialize(); asset1.Initialize();
} }
[Test] [Test]
public void T001_LoadEmpty() public void T001_LoadEmpty()
{ {
@ -69,7 +69,7 @@ namespace OpenSim.Data.Tests
Assert.That(db.ExistsAsset(uuid2), Is.False); Assert.That(db.ExistsAsset(uuid2), Is.False);
Assert.That(db.ExistsAsset(uuid3), Is.False); Assert.That(db.ExistsAsset(uuid3), Is.False);
} }
[Test] [Test]
public void T010_StoreSimpleAsset() public void T010_StoreSimpleAsset()
{ {
@ -79,22 +79,22 @@ namespace OpenSim.Data.Tests
a1.Data = asset1; a1.Data = asset1;
a2.Data = asset1; a2.Data = asset1;
a3.Data = asset1; a3.Data = asset1;
db.CreateAsset(a1); db.CreateAsset(a1);
db.CreateAsset(a2); db.CreateAsset(a2);
db.CreateAsset(a3); db.CreateAsset(a3);
AssetBase a1a = db.FetchAsset(uuid1); AssetBase a1a = db.FetchAsset(uuid1);
Assert.That(a1.ID, Is.EqualTo(a1a.ID)); Assert.That(a1.Metadata.ID, Is.EqualTo(a1a.Metadata.ID));
Assert.That(a1.Name, Is.EqualTo(a1a.Name)); Assert.That(a1.Metadata.Name, Is.EqualTo(a1a.Metadata.Name));
AssetBase a2a = db.FetchAsset(uuid2); AssetBase a2a = db.FetchAsset(uuid2);
Assert.That(a2.ID, Is.EqualTo(a2a.ID)); Assert.That(a2.Metadata.ID, Is.EqualTo(a2a.Metadata.ID));
Assert.That(a2.Name, Is.EqualTo(a2a.Name)); Assert.That(a2.Metadata.Name, Is.EqualTo(a2a.Metadata.Name));
AssetBase a3a = db.FetchAsset(uuid3); AssetBase a3a = db.FetchAsset(uuid3);
Assert.That(a3.ID, Is.EqualTo(a3a.ID)); Assert.That(a3.Metadata.ID, Is.EqualTo(a3a.Metadata.ID));
Assert.That(a3.Name, Is.EqualTo(a3a.Name)); Assert.That(a3.Metadata.Name, Is.EqualTo(a3a.Metadata.Name));
} }
[Test] [Test]
@ -117,4 +117,4 @@ namespace OpenSim.Data.Tests
// Assert.That(db.ExistsAsset(uuid3), Is.False); // Assert.That(db.ExistsAsset(uuid3), Is.False);
// } // }
} }
} }

View File

@ -26,7 +26,9 @@
*/ */
using System; using System;
using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -34,33 +36,18 @@ namespace OpenSim.Framework
public class AssetBase public class AssetBase
{ {
private byte[] _data; private byte[] _data;
private string _description = String.Empty; private AssetMetadata _metadata;
private UUID _fullid;
private bool _local = false;
private string _name = String.Empty;
private bool _temporary = false;
private sbyte _type;
public AssetBase() public AssetBase()
{ {
Metadata = new AssetMetadata();
} }
public AssetBase(UUID assetId, string name) public AssetBase(UUID assetId, string name)
{ {
FullID = assetId; Metadata = new AssetMetadata();
Name = name; Metadata.FullID = assetId;
} Metadata.Name = name;
public virtual UUID FullID
{
get { return _fullid; }
set { _fullid = value; }
}
public virtual string ID
{
get { return _fullid.ToString(); }
set { _fullid = new UUID(value); }
} }
public virtual byte[] Data public virtual byte[] Data
@ -69,34 +56,98 @@ namespace OpenSim.Framework
set { _data = value; } set { _data = value; }
} }
public virtual sbyte Type public virtual AssetMetadata Metadata
{ {
get { return _type; } get { return _metadata; }
set { _type = value; } set { _metadata = value; }
}
}
[Serializable]
public class AssetMetadata
{
private UUID _fullid;
private string _name = String.Empty;
private string _description = String.Empty;
private DateTime _creation_date;
private sbyte _type;
private string _content_type;
private byte[] _sha1;
private bool _local = false;
private bool _temporary = false;
//private Dictionary<string, Uri> _methods = new Dictionary<string, Uri>();
//private OSDMap _extra_data;
public UUID FullID
{
get { return _fullid; }
set { _fullid = value; }
} }
public virtual string Name public string ID
{
get { return _fullid.ToString(); }
set { _fullid = new UUID(value); }
}
public string Name
{ {
get { return _name; } get { return _name; }
set { _name = value; } set { _name = value; }
} }
public virtual string Description public string Description
{ {
get { return _description; } get { return _description; }
set { _description = value; } set { _description = value; }
} }
public virtual bool Local public DateTime CreationDate
{
get { return _creation_date; }
set { _creation_date = value; }
}
public sbyte Type
{
get { return _type; }
set { _type = value; }
}
public string ContentType
{
get { return _content_type; }
set { _content_type = value; }
}
public byte[] SHA1
{
get { return _sha1; }
set { _sha1 = value; }
}
public bool Local
{ {
get { return _local; } get { return _local; }
set { _local = value; } set { _local = value; }
} }
public virtual bool Temporary public bool Temporary
{ {
get { return _temporary; } get { return _temporary; }
set { _temporary = value; } set { _temporary = value; }
} }
//public Dictionary<string, Uri> Methods
//{
// get { return _methods; }
// set { _methods = value; }
//}
//public OSDMap ExtraData
//{
// get { return _extra_data; }
// set { _extra_data = value; }
//}
} }
} }

View File

@ -40,10 +40,10 @@ namespace OpenSim.Framework
public AssetLandmark(AssetBase a) public AssetLandmark(AssetBase a)
{ {
Data = a.Data; Data = a.Data;
FullID = a.FullID; Metadata.FullID = a.Metadata.FullID;
Type = a.Type; Metadata.Type = a.Metadata.Type;
Name = a.Name; Metadata.Name = a.Metadata.Name;
Description = a.Description; Metadata.Description = a.Metadata.Description;
InternData(); InternData();
} }

View File

@ -145,7 +145,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false); AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false);
newAsset.Type = type; newAsset.Metadata.Type = type;
assets.Add(newAsset); assets.Add(newAsset);
} }
} }

View File

@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary> /// <summary>
/// Manages local cache of assets and their sending to viewers. /// Manages local cache of assets and their sending to viewers.
/// </summary> /// </summary>
/// ///
/// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either
/// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and
/// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and
@ -80,7 +80,7 @@ namespace OpenSim.Framework.Communications.Cache
private Dictionary<UUID, AssetRequestsList> RequestLists; private Dictionary<UUID, AssetRequestsList> RequestLists;
/// <summary> /// <summary>
/// The 'server' from which assets can be requested and to which assets are persisted. /// The 'server' from which assets can be requested and to which assets are persisted.
/// </summary> /// </summary>
private readonly IAssetServer m_assetServer; private readonly IAssetServer m_assetServer;
@ -211,7 +211,7 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
// m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId);
NewAssetRequest req = new NewAssetRequest(callback); NewAssetRequest req = new NewAssetRequest(callback);
AssetRequestsList requestList; AssetRequestsList requestList;
@ -228,10 +228,10 @@ namespace OpenSim.Framework.Communications.Cache
// m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId); // m_log.DebugFormat("[ASSET CACHE]: Adding request for {0} {1}", isTexture ? "texture" : "asset", assetId);
requestList = new AssetRequestsList(); requestList = new AssetRequestsList();
requestList.TimeRequested = DateTime.Now; requestList.TimeRequested = DateTime.Now;
requestList.Requests.Add(req); requestList.Requests.Add(req);
RequestLists.Add(assetId, requestList); RequestLists.Add(assetId, requestList);
m_assetServer.RequestAsset(assetId, isTexture); m_assetServer.RequestAsset(assetId, isTexture);
} }
} }
@ -247,7 +247,7 @@ namespace OpenSim.Framework.Communications.Cache
/// the allowed number of polls. This isn't a very good way of doing things since a single thread /// the allowed number of polls. This isn't a very good way of doing things since a single thread
/// is processing inbound packets, so if the asset server is slow, we could block this for up to /// is processing inbound packets, so if the asset server is slow, we could block this for up to
/// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset() /// the timeout period. Whereever possible we want to use the asynchronous callback GetAsset()
/// ///
/// <param name="assetID"></param> /// <param name="assetID"></param>
/// <param name="isTexture"></param> /// <param name="isTexture"></param>
/// <returns>null if the asset could not be retrieved</returns> /// <returns>null if the asset could not be retrieved</returns>
@ -264,7 +264,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
return asset; return asset;
} }
m_assetServer.RequestAsset(assetID, isTexture); m_assetServer.RequestAsset(assetID, isTexture);
do do
@ -275,7 +275,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
return asset; return asset;
} }
} }
while (--maxPolls > 0); while (--maxPolls > 0);
m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached", m_log.WarnFormat("[ASSET CACHE]: {0} {1} was not received before the retrieval timeout was reached",
@ -290,17 +290,17 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="asset"></param> /// <param name="asset"></param>
public void AddAsset(AssetBase asset) public void AddAsset(AssetBase asset)
{ {
if (!m_memcache.Contains(asset.FullID)) if (!m_memcache.Contains(asset.Metadata.FullID))
{ {
m_log.Info("[CACHE] Caching " + asset.FullID + " for 24 hours from last access"); m_log.Info("[CACHE] Caching " + asset.Metadata.FullID + " for 24 hours from last access");
// Use 24 hour rolling asset cache. // Use 24 hour rolling asset cache.
m_memcache.AddOrUpdate(asset.FullID, asset, TimeSpan.FromHours(24)); m_memcache.AddOrUpdate(asset.Metadata.FullID, asset, TimeSpan.FromHours(24));
// According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the // According to http://wiki.secondlife.com/wiki/AssetUploadRequest, Local signifies that the
// information is stored locally. It could disappear, in which case we could send the // information is stored locally. It could disappear, in which case we could send the
// ImageNotInDatabase packet to tell the client this. // ImageNotInDatabase packet to tell the client this.
// //
// However, this doesn't quite appear to work with local textures that are part of an avatar's // However, this doesn't quite appear to work with local textures that are part of an avatar's
// appearance texture set. Whilst sending an ImageNotInDatabase does trigger an automatic rebake // appearance texture set. Whilst sending an ImageNotInDatabase does trigger an automatic rebake
// and reupload by the client, if those assets aren't pushed to the asset server anyway, then // and reupload by the client, if those assets aren't pushed to the asset server anyway, then
// on crossing onto another region server, other avatars can no longer get the required textures. // on crossing onto another region server, other avatars can no longer get the required textures.
@ -314,7 +314,7 @@ namespace OpenSim.Framework.Communications.Cache
// But for now, we're going to take the easy way out and store local assets globally. // But for now, we're going to take the easy way out and store local assets globally.
// //
// TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView. // TODO: Also, Temporary is now deprecated. We should start ignoring it and not passing it out from LLClientView.
if (!asset.Temporary || asset.Local) if (!asset.Metadata.Temporary || asset.Metadata.Local)
{ {
m_assetServer.StoreAsset(asset); m_assetServer.StoreAsset(asset);
} }
@ -345,25 +345,25 @@ namespace OpenSim.Framework.Communications.Cache
{ {
AssetInfo assetInf = new AssetInfo(asset); AssetInfo assetInf = new AssetInfo(asset);
if (!m_memcache.Contains(assetInf.FullID)) if (!m_memcache.Contains(assetInf.Metadata.FullID))
{ {
m_memcache.AddOrUpdate(assetInf.FullID, assetInf, TimeSpan.FromHours(24)); m_memcache.AddOrUpdate(assetInf.Metadata.FullID, assetInf, TimeSpan.FromHours(24));
if (StatsManager.SimExtraStats != null) if (StatsManager.SimExtraStats != null)
{ {
StatsManager.SimExtraStats.AddAsset(assetInf); StatsManager.SimExtraStats.AddAsset(assetInf);
} }
if (RequestedAssets.ContainsKey(assetInf.FullID)) if (RequestedAssets.ContainsKey(assetInf.Metadata.FullID))
{ {
AssetRequest req = RequestedAssets[assetInf.FullID]; AssetRequest req = RequestedAssets[assetInf.Metadata.FullID];
req.AssetInf = assetInf; req.AssetInf = assetInf;
req.NumPackets = CalculateNumPackets(assetInf.Data); req.NumPackets = CalculateNumPackets(assetInf.Data);
RequestedAssets.Remove(assetInf.FullID); RequestedAssets.Remove(assetInf.Metadata.FullID);
// If it's a direct request for a script, drop it // If it's a direct request for a script, drop it
// because it's a hacked client // because it's a hacked client
if (req.AssetRequestSource != 2 || assetInf.Type != 10) if (req.AssetRequestSource != 2 || assetInf.Metadata.Type != 10)
AssetRequests.Add(req); AssetRequests.Add(req);
} }
} }
@ -373,8 +373,8 @@ namespace OpenSim.Framework.Communications.Cache
lock (RequestLists) lock (RequestLists)
{ {
if (RequestLists.TryGetValue(asset.FullID, out reqList)) if (RequestLists.TryGetValue(asset.Metadata.FullID, out reqList))
RequestLists.Remove(asset.FullID); RequestLists.Remove(asset.Metadata.FullID);
} }
if (reqList != null) if (reqList != null)
@ -385,8 +385,8 @@ namespace OpenSim.Framework.Communications.Cache
foreach (NewAssetRequest req in reqList.Requests) foreach (NewAssetRequest req in reqList.Requests)
{ {
// Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked // Xantor 20080526 are we really calling all the callbacks if multiple queued for 1 request? -- Yes, checked
// m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.FullID); // m_log.DebugFormat("[ASSET CACHE]: Callback for asset {0}", asset.Metadata.FullID);
req.Callback(asset.FullID, asset); req.Callback(asset.Metadata.FullID, asset);
} }
} }
} }
@ -398,12 +398,12 @@ namespace OpenSim.Framework.Communications.Cache
// Remember the fact that this asset could not be found to prevent delays from repeated requests // Remember the fact that this asset could not be found to prevent delays from repeated requests
m_memcache.Add(assetID, null, TimeSpan.FromHours(24)); m_memcache.Add(assetID, null, TimeSpan.FromHours(24));
// Notify requesters for this asset // Notify requesters for this asset
AssetRequestsList reqList; AssetRequestsList reqList;
lock (RequestLists) lock (RequestLists)
{ {
if (RequestLists.TryGetValue(assetID, out reqList)) if (RequestLists.TryGetValue(assetID, out reqList))
RequestLists.Remove(assetID); RequestLists.Remove(assetID);
} }
@ -411,7 +411,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if (StatsManager.SimExtraStats != null) if (StatsManager.SimExtraStats != null)
StatsManager.SimExtraStats.AddAssetRequestTimeAfterCacheMiss(DateTime.Now - reqList.TimeRequested); StatsManager.SimExtraStats.AddAssetRequestTimeAfterCacheMiss(DateTime.Now - reqList.TimeRequested);
foreach (NewAssetRequest req in reqList.Requests) foreach (NewAssetRequest req in reqList.Requests)
{ {
req.Callback(assetID, null); req.Callback(assetID, null);
@ -461,7 +461,7 @@ namespace OpenSim.Framework.Communications.Cache
source = 3; source = 3;
//Console.WriteLine("asset request " + requestID); //Console.WriteLine("asset request " + requestID);
} }
//check to see if asset is in local cache, if not we need to request it from asset server. //check to see if asset is in local cache, if not we need to request it from asset server.
//Console.WriteLine("asset request " + requestID); //Console.WriteLine("asset request " + requestID);
if (!m_memcache.Contains(requestID)) if (!m_memcache.Contains(requestID))
@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
// Scripts cannot be retrieved by direct request // Scripts cannot be retrieved by direct request
if (transferRequest.TransferInfo.SourceType == 2 && asset.Type == 10) if (transferRequest.TransferInfo.SourceType == 2 && asset.Metadata.Type == 10)
return; return;
// The asset is knosn to exist and is in our cache, so add it to the AssetRequests list // The asset is knosn to exist and is in our cache, so add it to the AssetRequests list
@ -520,7 +520,7 @@ namespace OpenSim.Framework.Communications.Cache
//no requests waiting //no requests waiting
return; return;
} }
// if less than 5, do all of them // if less than 5, do all of them
int num = Math.Min(5, AssetRequests.Count); int num = Math.Min(5, AssetRequests.Count);
@ -580,10 +580,10 @@ namespace OpenSim.Framework.Communications.Cache
public AssetInfo(AssetBase aBase) public AssetInfo(AssetBase aBase)
{ {
Data = aBase.Data; Data = aBase.Data;
FullID = aBase.FullID; Metadata.FullID = aBase.Metadata.FullID;
Type = aBase.Type; Metadata.Type = aBase.Metadata.Type;
Name = aBase.Name; Metadata.Name = aBase.Metadata.Name;
Description = aBase.Description; Metadata.Description = aBase.Metadata.Description;
} }
} }
@ -592,10 +592,10 @@ namespace OpenSim.Framework.Communications.Cache
public TextureImage(AssetBase aBase) public TextureImage(AssetBase aBase)
{ {
Data = aBase.Data; Data = aBase.Data;
FullID = aBase.FullID; Metadata.FullID = aBase.Metadata.FullID;
Type = aBase.Type; Metadata.Type = aBase.Metadata.Type;
Name = aBase.Name; Metadata.Name = aBase.Metadata.Name;
Description = aBase.Description; Metadata.Description = aBase.Metadata.Description;
} }
} }
@ -608,7 +608,7 @@ namespace OpenSim.Framework.Communications.Cache
/// A list of requests for assets /// A list of requests for assets
/// </summary> /// </summary>
public List<NewAssetRequest> Requests = new List<NewAssetRequest>(); public List<NewAssetRequest> Requests = new List<NewAssetRequest>();
/// <summary> /// <summary>
/// Record the time that this request was first made. /// Record the time that this request was first made.
/// </summary> /// </summary>

View File

@ -86,11 +86,11 @@ namespace OpenSim.Framework.Communications.Cache
#region Rjindael #region Rjindael
/// <summary> /// <summary>
/// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and /// This class uses a symmetric key algorithm (Rijndael/AES) to encrypt and
/// decrypt data. As long as encryption and decryption routines use the same /// decrypt data. As long as encryption and decryption routines use the same
/// parameters to generate the keys, the keys are guaranteed to be the same. /// parameters to generate the keys, the keys are guaranteed to be the same.
/// The class uses static functions with duplicate code to make it easier to /// The class uses static functions with duplicate code to make it easier to
/// demonstrate encryption and decryption logic. In a real-life application, /// demonstrate encryption and decryption logic. In a real-life application,
/// this may not be the most efficient way of handling encryption, so - as /// this may not be the most efficient way of handling encryption, so - as
/// soon as you feel comfortable with it - you may want to redesign this class. /// soon as you feel comfortable with it - you may want to redesign this class.
/// </summary> /// </summary>
@ -123,11 +123,11 @@ namespace OpenSim.Framework.Communications.Cache
/// </param> /// </param>
/// <param name="initVector"> /// <param name="initVector">
/// Initialization vector (or IV). This value is required to encrypt the /// Initialization vector (or IV). This value is required to encrypt the
/// first block of plaintext data. For RijndaelManaged class IV must be /// first block of plaintext data. For RijndaelManaged class IV must be
/// exactly 16 ASCII characters long. /// exactly 16 ASCII characters long.
/// </param> /// </param>
/// <param name="keySize"> /// <param name="keySize">
/// Size of encryption key in bits. Allowed values are: 128, 192, and 256. /// Size of encryption key in bits. Allowed values are: 128, 192, and 256.
/// Longer keys are more secure than shorter keys. /// Longer keys are more secure than shorter keys.
/// </param> /// </param>
/// <returns> /// <returns>
@ -143,7 +143,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
// Convert strings into byte arrays. // Convert strings into byte arrays.
// Let us assume that strings only contain ASCII codes. // Let us assume that strings only contain ASCII codes.
// If strings include Unicode characters, use Unicode, UTF7, or UTF8 // If strings include Unicode characters, use Unicode, UTF7, or UTF8
// encoding. // encoding.
byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector); byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector);
byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue); byte[] saltValueBytes = Encoding.ASCII.GetBytes(saltValue);
@ -153,8 +153,8 @@ namespace OpenSim.Framework.Communications.Cache
byte[] plainTextBytes = plainText; byte[] plainTextBytes = plainText;
// First, we must create a password, from which the key will be derived. // First, we must create a password, from which the key will be derived.
// This password will be generated from the specified passphrase and // This password will be generated from the specified passphrase and
// salt value. The password will be created using the specified hash // salt value. The password will be created using the specified hash
// algorithm. Password creation can be done in several iterations. // algorithm. Password creation can be done in several iterations.
PasswordDeriveBytes password = new PasswordDeriveBytes( PasswordDeriveBytes password = new PasswordDeriveBytes(
passPhrase, passPhrase,
@ -173,8 +173,8 @@ namespace OpenSim.Framework.Communications.Cache
// (CBC). Use default options for other symmetric key parameters. // (CBC). Use default options for other symmetric key parameters.
symmetricKey.Mode = CipherMode.CBC; symmetricKey.Mode = CipherMode.CBC;
// Generate encryptor from the existing key bytes and initialization // Generate encryptor from the existing key bytes and initialization
// vector. Key size will be defined based on the number of the key // vector. Key size will be defined based on the number of the key
// bytes. // bytes.
ICryptoTransform encryptor = symmetricKey.CreateEncryptor( ICryptoTransform encryptor = symmetricKey.CreateEncryptor(
keyBytes, keyBytes,
@ -265,8 +265,8 @@ namespace OpenSim.Framework.Communications.Cache
// Convert our ciphertext into a byte array. // Convert our ciphertext into a byte array.
byte[] cipherTextBytes = cipherText; byte[] cipherTextBytes = cipherText;
// First, we must create a password, from which the key will be // First, we must create a password, from which the key will be
// derived. This password will be generated from the specified // derived. This password will be generated from the specified
// passphrase and salt value. The password will be created using // passphrase and salt value. The password will be created using
// the specified hash algorithm. Password creation can be done in // the specified hash algorithm. Password creation can be done in
// several iterations. // several iterations.
@ -286,8 +286,8 @@ namespace OpenSim.Framework.Communications.Cache
// (CBC). Use default options for other symmetric key parameters. // (CBC). Use default options for other symmetric key parameters.
symmetricKey.Mode = CipherMode.CBC; symmetricKey.Mode = CipherMode.CBC;
// Generate decryptor from the existing key bytes and initialization // Generate decryptor from the existing key bytes and initialization
// vector. Key size will be defined based on the number of the key // vector. Key size will be defined based on the number of the key
// bytes. // bytes.
ICryptoTransform decryptor = symmetricKey.CreateDecryptor( ICryptoTransform decryptor = symmetricKey.CreateDecryptor(
keyBytes, keyBytes,
@ -320,7 +320,7 @@ namespace OpenSim.Framework.Communications.Cache
for (i = 0; i < decryptedByteCount; i++) for (i = 0; i < decryptedByteCount; i++)
plainText[i] = plainTextBytes[i]; plainText[i] = plainTextBytes[i];
// Return decrypted string. // Return decrypted string.
return plainText; return plainText;
} }
} }
@ -403,17 +403,17 @@ namespace OpenSim.Framework.Communications.Cache
string salt = Convert.ToBase64String(rand); string salt = Convert.ToBase64String(rand);
x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize); x.Data = UtilRijndael.Encrypt(x.Data, file.Secret, salt, "SHA1", 2, file.IVBytes, file.Keysize);
x.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}", x.Metadata.Description = String.Format("ENCASS#:~:#{0}#:~:#{1}#:~:#{2}#:~:#{3}",
"OPENSIM_AES_AF1", "OPENSIM_AES_AF1",
file.AlsoKnownAs, file.AlsoKnownAs,
salt, salt,
x.Description); x.Metadata.Description);
} }
private bool DecryptAssetBase(AssetBase x) private bool DecryptAssetBase(AssetBase x)
{ {
// Check it's encrypted first. // Check it's encrypted first.
if (!x.Description.Contains("ENCASS")) if (!x.Metadata.Description.Contains("ENCASS"))
return true; return true;
// ENCASS:ALG:AKA:SALT:Description // ENCASS:ALG:AKA:SALT:Description
@ -421,7 +421,7 @@ namespace OpenSim.Framework.Communications.Cache
string[] splitchars = new string[1]; string[] splitchars = new string[1];
splitchars[0] = "#:~:#"; splitchars[0] = "#:~:#";
string[] meta = x.Description.Split(splitchars, StringSplitOptions.None); string[] meta = x.Metadata.Description.Split(splitchars, StringSplitOptions.None);
if (meta.Length < 5) if (meta.Length < 5)
{ {
m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt"); m_log.Warn("[ENCASSETS] Recieved Encrypted Asset, but header is corrupt");
@ -432,7 +432,7 @@ namespace OpenSim.Framework.Communications.Cache
if (m_keyfiles.ContainsKey(meta[2])) if (m_keyfiles.ContainsKey(meta[2]))
{ {
RjinKeyfile deckey = m_keyfiles[meta[2]]; RjinKeyfile deckey = m_keyfiles[meta[2]];
x.Description = meta[4]; x.Metadata.Description = meta[4];
switch (meta[1]) switch (meta[1])
{ {
case "OPENSIM_AES_AF1": case "OPENSIM_AES_AF1":
@ -506,7 +506,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
string assetUrl = _assetServerUrl + "/assets/"; string assetUrl = _assetServerUrl + "/assets/";
m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); m_log.InfoFormat("[CRYPTO GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID);
RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
} }

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
public override void StoreAsset(AssetBase asset) public override void StoreAsset(AssetBase asset)
{ {
byte[] idBytes = asset.FullID.Guid.ToByteArray(); byte[] idBytes = asset.Metadata.FullID.Guid.ToByteArray();
string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0] string cdir = m_dir + Path.DirectorySeparatorChar + idBytes[0]
+ Path.DirectorySeparatorChar + idBytes[1]; + Path.DirectorySeparatorChar + idBytes[1];
@ -56,7 +56,7 @@ namespace OpenSim.Framework.Communications.Cache
if (!Directory.Exists(cdir)) if (!Directory.Exists(cdir))
Directory.CreateDirectory(cdir); Directory.CreateDirectory(cdir);
FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.FullID + ".xml", FileMode.Create); FileStream x = new FileStream(cdir + Path.DirectorySeparatorChar + asset.Metadata.FullID + ".xml", FileMode.Create);
m_xs.Serialize(x, asset); m_xs.Serialize(x, asset);
x.Flush(); x.Flush();

View File

@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache
// rc.Request(s); // rc.Request(s);
//m_log.InfoFormat("[ASSET]: Stored {0}", rc); //m_log.InfoFormat("[ASSET]: Stored {0}", rc);
m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.Metadata.FullID);
RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
} }

View File

@ -159,7 +159,7 @@ namespace OpenSim.Framework.Communications.Capabilities
m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest);
m_log.DebugFormat( m_log.DebugFormat(
"[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID); "[CAPS]: Registered seed capability {0} for {1}", capsBase + m_requestPath, m_agentID);
//m_capsHandlers["MapLayer"] = //m_capsHandlers["MapLayer"] =
// new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST", // new LLSDStreamhandler<OSDMapRequest, OSDMapLayerResponse>("POST",
// capsBase + m_mapLayerPath, // capsBase + m_mapLayerPath,
@ -247,9 +247,9 @@ namespace OpenSim.Framework.Communications.Capabilities
//m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName); //m_log.Debug("[CAPS]: Seed Caps Request in region: " + m_regionName);
string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails); string result = LLSDHelpers.SerialiseLLSDReply(m_capsHandlers.CapsDetails);
//m_log.DebugFormat("[CAPS] CapsRequest {0}", result); //m_log.DebugFormat("[CAPS] CapsRequest {0}", result);
return result; return result;
} }
@ -569,7 +569,7 @@ namespace OpenSim.Framework.Communications.Capabilities
m_httpListener.AddStreamHandler( m_httpListener.AddStreamHandler(
new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
string protocol = "http://"; string protocol = "http://";
if (m_httpListener.UseSSL) if (m_httpListener.UseSSL)
@ -648,7 +648,7 @@ namespace OpenSim.Framework.Communications.Capabilities
/// <returns></returns> /// <returns></returns>
public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest) public LLSDAssetUploadResponse NewAgentInventoryRequest(LLSDAssetUploadRequest llsdRequest)
{ {
if (llsdRequest.asset_type == "texture" || if (llsdRequest.asset_type == "texture" ||
llsdRequest.asset_type == "animation" || llsdRequest.asset_type == "animation" ||
llsdRequest.asset_type == "sound") llsdRequest.asset_type == "sound")
{ {
@ -741,9 +741,9 @@ namespace OpenSim.Framework.Communications.Capabilities
AssetBase asset; AssetBase asset;
asset = new AssetBase(); asset = new AssetBase();
asset.FullID = assetID; asset.Metadata.FullID = assetID;
asset.Type = assType; asset.Metadata.Type = assType;
asset.Name = assetName; asset.Metadata.Name = assetName;
asset.Data = data; asset.Data = data;
m_assetCache.AddAsset(asset); m_assetCache.AddAsset(asset);
@ -751,7 +751,7 @@ namespace OpenSim.Framework.Communications.Capabilities
item.Owner = m_agentID; item.Owner = m_agentID;
item.Creator = m_agentID; item.Creator = m_agentID;
item.ID = inventoryItem; item.ID = inventoryItem;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = assetDescription; item.Description = assetDescription;
item.Name = assetName; item.Name = assetName;
item.AssetType = assType; item.AssetType = assType;

View File

@ -141,7 +141,7 @@ namespace OpenSim.Grid.AssetServer
XmlSerializer xs = new XmlSerializer(typeof (AssetBase)); XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
AssetBase asset = (AssetBase) xs.Deserialize(request); AssetBase asset = (AssetBase) xs.Deserialize(request);
m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); m_log.InfoFormat("[REST]: Creating asset {0}", asset.Metadata.FullID);
m_assetProvider.CreateAsset(asset); m_assetProvider.CreateAsset(asset);
return new byte[] {}; return new byte[] {};

View File

@ -63,9 +63,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/* private variables */ /* private variables */
private readonly UUID m_sessionId; private readonly UUID m_sessionId;
private readonly UUID m_secureSessionId = UUID.Zero; private readonly UUID m_secureSessionId = UUID.Zero;
private int m_debugPacketLevel; private int m_debugPacketLevel;
private readonly AssetCache m_assetCache; private readonly AssetCache m_assetCache;
private int m_cachedTextureSerial; private int m_cachedTextureSerial;
private Timer m_clientPingTimer; private Timer m_clientPingTimer;
@ -355,7 +355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (m_groupPowers.ContainsKey(groupID)) if (m_groupPowers.ContainsKey(groupID))
return m_groupPowers[groupID]; return m_groupPowers[groupID];
return 0; return 0;
} }
@ -454,8 +454,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_circuitCode = circuitCode; m_circuitCode = circuitCode;
m_userEndPoint = remoteEP; m_userEndPoint = remoteEP;
m_proxyEndPoint = proxyEP; m_proxyEndPoint = proxyEP;
m_firstName = sessionInfo.LoginInfo.First; m_firstName = sessionInfo.LoginInfo.First;
m_lastName = sessionInfo.LoginInfo.Last; m_lastName = sessionInfo.LoginInfo.Last;
m_startpos = sessionInfo.LoginInfo.StartPos; m_startpos = sessionInfo.LoginInfo.StartPos;
@ -473,7 +473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings); m_PacketHandler = new LLPacketHandler(this, m_networkServer, userSettings);
m_PacketHandler.SynchronizeClient = SynchronizeClient; m_PacketHandler.SynchronizeClient = SynchronizeClient;
m_PacketHandler.OnPacketStats += PopulateStats; m_PacketHandler.OnPacketStats += PopulateStats;
RegisterLocalPacketHandlers(); RegisterLocalPacketHandlers();
m_imageManager = new LLImageManager(this, m_assetCache,Scene.RequestModuleInterface<OpenSim.Region.Environment.Interfaces.IJ2KDecoder>()); m_imageManager = new LLImageManager(this, m_assetCache,Scene.RequestModuleInterface<OpenSim.Region.Environment.Interfaces.IJ2KDecoder>());
} }
@ -501,7 +501,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Shut down timers // Shut down timers
m_clientPingTimer.Stop(); m_clientPingTimer.Stop();
// This is just to give the client a reasonable chance of // This is just to give the client a reasonable chance of
// flushing out all it's packets. There should probably // flushing out all it's packets. There should probably
// be a better mechanism here // be a better mechanism here
@ -538,7 +538,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_log.DebugFormat( m_log.DebugFormat(
"[CLIENT]: Close has been called with shutdownCircuit = {0} for {1} attached to scene {2}", "[CLIENT]: Close has been called with shutdownCircuit = {0} for {1} attached to scene {2}",
shutdownCircuit, Name, m_scene.RegionInfo.RegionName); shutdownCircuit, Name, m_scene.RegionInfo.RegionName);
m_imageManager.Close(); m_imageManager.Close();
m_PacketHandler.Flush(); m_PacketHandler.Flush();
@ -716,14 +716,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
info = packet.Type.ToString(); info = packet.Type.ToString();
} }
Console.WriteLine(m_circuitCode + ":" + direction + ": " + info); Console.WriteLine(m_circuitCode + ":" + direction + ": " + info);
} }
} }
/// <summary> /// <summary>
/// Main packet processing loop for the UDP component of the client session. Both incoming and outgoing /// Main packet processing loop for the UDP component of the client session. Both incoming and outgoing
/// packets are processed here. /// packets are processed here.
/// </summary> /// </summary>
protected virtual void ClientLoop() protected virtual void ClientLoop()
{ {
@ -733,12 +733,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
while (IsActive) while (IsActive)
{ {
LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue(); LLQueItem nextPacket = m_PacketHandler.PacketQueue.Dequeue();
if (nextPacket.Incoming) if (nextPacket.Incoming)
{ {
DebugPacket("IN", nextPacket.Packet); DebugPacket("IN", nextPacket.Packet);
m_PacketHandler.ProcessInPacket(nextPacket); m_PacketHandler.ProcessInPacket(nextPacket);
} }
else else
{ {
DebugPacket("OUT", nextPacket.Packet); DebugPacket("OUT", nextPacket.Packet);
@ -821,14 +821,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_clientThread.Name = "ClientThread"; m_clientThread.Name = "ClientThread";
m_clientThread.IsBackground = true; m_clientThread.IsBackground = true;
m_clientThread.Start(); m_clientThread.Start();
ThreadTracker.Add(m_clientThread); ThreadTracker.Add(m_clientThread);
} }
/// <summary> /// <summary>
/// Run a user session. This method lies at the base of the entire client thread. /// Run a user session. This method lies at the base of the entire client thread.
/// </summary> /// </summary>
protected virtual void RunUserSession() protected virtual void RunUserSession()
{ {
//tell this thread we are using the culture set up for the sim (currently hardcoded to en_US) //tell this thread we are using the culture set up for the sim (currently hardcoded to en_US)
//otherwise it will override this and use the system default //otherwise it will override this and use the system default
Culture.SetCurrentCulture(); Culture.SetCurrentCulture();
@ -838,7 +838,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// This sets up all the timers // This sets up all the timers
InitNewClient(); InitNewClient();
ClientLoop(); ClientLoop();
} }
catch (Exception e) catch (Exception e)
{ {
if (e is ThreadAbortException) if (e is ThreadAbortException)
@ -1065,7 +1065,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event ClassifiedInfoUpdate OnClassifiedInfoUpdate; public event ClassifiedInfoUpdate OnClassifiedInfoUpdate;
public event ClassifiedDelete OnClassifiedDelete; public event ClassifiedDelete OnClassifiedDelete;
public event ClassifiedDelete OnClassifiedGodDelete; public event ClassifiedDelete OnClassifiedGodDelete;
public event EventNotificationAddRequest OnEventNotificationAddRequest; public event EventNotificationAddRequest OnEventNotificationAddRequest;
public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest; public event EventNotificationRemoveRequest OnEventNotificationRemoveRequest;
public event EventGodDelete OnEventGodDelete; public event EventGodDelete OnEventGodDelete;
@ -1078,14 +1078,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void ActivateGesture(UUID assetId, UUID gestureId) public void ActivateGesture(UUID assetId, UUID gestureId)
{ {
} }
public void DeactivateGesture(UUID assetId, UUID gestureId) public void DeactivateGesture(UUID assetId, UUID gestureId)
{ {
} }
// Sound // Sound
public void SoundTrigger(UUID soundId, UUID owerid, UUID Objectid,UUID ParentId,float Gain, Vector3 Position,UInt64 Handle) public void SoundTrigger(UUID soundId, UUID owerid, UUID Objectid,UUID ParentId,float Gain, Vector3 Position,UInt64 Handle)
{ {
} }
#region Scene/Avatar to Client #region Scene/Avatar to Client
@ -1330,7 +1330,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(map, patches); LayerDataPacket layerpack = TerrainCompressor.CreateLandPacket(map, patches);
layerpack.Header.Zerocoded = true; layerpack.Header.Zerocoded = true;
OutPacket(layerpack, ThrottleOutPacketType.Land); OutPacket(layerpack, ThrottleOutPacketType.Land);
} }
@ -1410,11 +1410,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
agentData.child = false; agentData.child = false;
agentData.firstname = m_firstName; agentData.firstname = m_firstName;
agentData.lastname = m_lastName; agentData.lastname = m_lastName;
ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>(); ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
agentData.CapsPath = capsModule.GetCapsPath(m_agentId); agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
agentData.ChildrenCapSeeds = new Dictionary<ulong,string>(capsModule.GetChildrenSeeds(m_agentId)); agentData.ChildrenCapSeeds = new Dictionary<ulong,string>(capsModule.GetChildrenSeeds(m_agentId));
return agentData; return agentData;
} }
@ -1852,21 +1852,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
inventoryReply.Header.Zerocoded = true; inventoryReply.Header.Zerocoded = true;
OutPacket(inventoryReply, ThrottleOutPacketType.Asset); OutPacket(inventoryReply, ThrottleOutPacketType.Asset);
} }
/// <see>IClientAPI.SendBulkUpdateInventory(InventoryFolderBase)</see> /// <see>IClientAPI.SendBulkUpdateInventory(InventoryFolderBase)</see>
public void SendBulkUpdateInventory(InventoryFolderBase folderBase) public void SendBulkUpdateInventory(InventoryFolderBase folderBase)
{ {
// XXX: Nasty temporary move that will be resolved shortly // XXX: Nasty temporary move that will be resolved shortly
InventoryFolderImpl folder = (InventoryFolderImpl)folderBase; InventoryFolderImpl folder = (InventoryFolderImpl)folderBase;
// We will use the same transaction id for all the separate packets to be sent out in this update. // We will use the same transaction id for all the separate packets to be sent out in this update.
UUID transactionId = UUID.Random(); UUID transactionId = UUID.Random();
List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks
= new List<BulkUpdateInventoryPacket.FolderDataBlock>(); = new List<BulkUpdateInventoryPacket.FolderDataBlock>();
SendBulkUpdateInventoryRecursive(folder, ref folderDataBlocks, transactionId); SendBulkUpdateInventoryRecursive(folder, ref folderDataBlocks, transactionId);
if (folderDataBlocks.Count > 0) if (folderDataBlocks.Count > 0)
{ {
// We'll end up with some unsent folder blocks if there were some empty folders at the end of the list // We'll end up with some unsent folder blocks if there were some empty folders at the end of the list
@ -1874,16 +1874,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
BulkUpdateInventoryPacket bulkUpdate BulkUpdateInventoryPacket bulkUpdate
= (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory); = (BulkUpdateInventoryPacket)PacketPool.Instance.GetPacket(PacketType.BulkUpdateInventory);
bulkUpdate.Header.Zerocoded = true; bulkUpdate.Header.Zerocoded = true;
bulkUpdate.AgentData.AgentID = AgentId; bulkUpdate.AgentData.AgentID = AgentId;
bulkUpdate.AgentData.TransactionID = transactionId; bulkUpdate.AgentData.TransactionID = transactionId;
bulkUpdate.FolderData = folderDataBlocks.ToArray(); bulkUpdate.FolderData = folderDataBlocks.ToArray();
//Console.WriteLine("SendBulkUpdateInventory :" + bulkUpdate); //Console.WriteLine("SendBulkUpdateInventory :" + bulkUpdate);
OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
} }
} }
/// <summary> /// <summary>
/// Recursively construct bulk update packets to send folders and items /// Recursively construct bulk update packets to send folders and items
/// </summary> /// </summary>
@ -1891,11 +1891,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="folderDataBlocks"></param> /// <param name="folderDataBlocks"></param>
/// <param name="transactionId"></param> /// <param name="transactionId"></param>
private void SendBulkUpdateInventoryRecursive( private void SendBulkUpdateInventoryRecursive(
InventoryFolderImpl folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks, InventoryFolderImpl folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks,
UUID transactionId) UUID transactionId)
{ {
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
const int MAX_ITEMS_PER_PACKET = 5; const int MAX_ITEMS_PER_PACKET = 5;
// If there are any items then we have to start sending them off in this packet - the next folder will have // If there are any items then we have to start sending them off in this packet - the next folder will have
@ -1909,10 +1909,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bulkUpdate.Header.Zerocoded = true; bulkUpdate.Header.Zerocoded = true;
bulkUpdate.AgentData.AgentID = AgentId; bulkUpdate.AgentData.AgentID = AgentId;
bulkUpdate.AgentData.TransactionID = transactionId; bulkUpdate.AgentData.TransactionID = transactionId;
bulkUpdate.FolderData = folderDataBlocks.ToArray(); bulkUpdate.FolderData = folderDataBlocks.ToArray();
int itemsToSend = (items.Count > MAX_ITEMS_PER_PACKET ? MAX_ITEMS_PER_PACKET : items.Count); int itemsToSend = (items.Count > MAX_ITEMS_PER_PACKET ? MAX_ITEMS_PER_PACKET : items.Count);
bulkUpdate.ItemData = new BulkUpdateInventoryPacket.ItemDataBlock[itemsToSend]; bulkUpdate.ItemData = new BulkUpdateInventoryPacket.ItemDataBlock[itemsToSend];
for (int i = 0; i < itemsToSend; i++) for (int i = 0; i < itemsToSend; i++)
@ -1921,51 +1921,51 @@ namespace OpenSim.Region.ClientStack.LindenUDP
bulkUpdate.ItemData[i] = GenerateBulkUpdateItemDataBlock(items[items.Count - 1]); bulkUpdate.ItemData[i] = GenerateBulkUpdateItemDataBlock(items[items.Count - 1]);
items.RemoveAt(items.Count - 1); items.RemoveAt(items.Count - 1);
} }
//Console.WriteLine("SendBulkUpdateInventoryRecursive :" + bulkUpdate); //Console.WriteLine("SendBulkUpdateInventoryRecursive :" + bulkUpdate);
OutPacket(bulkUpdate, ThrottleOutPacketType.Asset); OutPacket(bulkUpdate, ThrottleOutPacketType.Asset);
folderDataBlocks = new List<BulkUpdateInventoryPacket.FolderDataBlock>(); folderDataBlocks = new List<BulkUpdateInventoryPacket.FolderDataBlock>();
// If we're going to be sending another items packet then it needs to contain just the folder to which those // If we're going to be sending another items packet then it needs to contain just the folder to which those
// items belong. // items belong.
if (items.Count > 0) if (items.Count > 0)
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
} }
List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls(); List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls();
foreach (InventoryFolderImpl subFolder in subFolders) foreach (InventoryFolderImpl subFolder in subFolders)
{ {
SendBulkUpdateInventoryRecursive(subFolder, ref folderDataBlocks, transactionId); SendBulkUpdateInventoryRecursive(subFolder, ref folderDataBlocks, transactionId);
} }
} }
/// <summary> /// <summary>
/// Generate a bulk update inventory data block for the given folder /// Generate a bulk update inventory data block for the given folder
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns></returns> /// <returns></returns>
private BulkUpdateInventoryPacket.FolderDataBlock GenerateBulkUpdateFolderDataBlock(InventoryFolderBase folder) private BulkUpdateInventoryPacket.FolderDataBlock GenerateBulkUpdateFolderDataBlock(InventoryFolderBase folder)
{ {
BulkUpdateInventoryPacket.FolderDataBlock folderBlock = new BulkUpdateInventoryPacket.FolderDataBlock(); BulkUpdateInventoryPacket.FolderDataBlock folderBlock = new BulkUpdateInventoryPacket.FolderDataBlock();
folderBlock.FolderID = folder.ID; folderBlock.FolderID = folder.ID;
folderBlock.ParentID = folder.ParentID; folderBlock.ParentID = folder.ParentID;
folderBlock.Type = -1; folderBlock.Type = -1;
folderBlock.Name = Utils.StringToBytes(folder.Name); folderBlock.Name = Utils.StringToBytes(folder.Name);
return folderBlock; return folderBlock;
} }
/// <summary> /// <summary>
/// Generate a bulk update inventory data block for the given item /// Generate a bulk update inventory data block for the given item
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns></returns> /// <returns></returns>
private BulkUpdateInventoryPacket.ItemDataBlock GenerateBulkUpdateItemDataBlock(InventoryItemBase item) private BulkUpdateInventoryPacket.ItemDataBlock GenerateBulkUpdateItemDataBlock(InventoryItemBase item)
{ {
BulkUpdateInventoryPacket.ItemDataBlock itemBlock = new BulkUpdateInventoryPacket.ItemDataBlock(); BulkUpdateInventoryPacket.ItemDataBlock itemBlock = new BulkUpdateInventoryPacket.ItemDataBlock();
itemBlock.ItemID = item.ID; itemBlock.ItemID = item.ID;
itemBlock.AssetID = item.AssetID; itemBlock.AssetID = item.AssetID;
itemBlock.CreatorID = item.Creator; itemBlock.CreatorID = item.Creator;
@ -1996,7 +1996,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
itemBlock.ItemID, itemBlock.FolderID, itemBlock.ItemID, itemBlock.FolderID,
(uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, 1, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All); (uint)PermissionMask.All);
return itemBlock; return itemBlock;
} }
@ -2396,17 +2396,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(viewertime, ThrottleOutPacketType.Task); OutPacket(viewertime, ThrottleOutPacketType.Task);
*/ */
} }
public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks) public void SendViewerEffect(ViewerEffectPacket.EffectBlock[] effectBlocks)
{ {
ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect); ViewerEffectPacket packet = (ViewerEffectPacket)PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
packet.Effect = effectBlocks; packet.Effect = effectBlocks;
packet.AgentData.AgentID = AgentId; packet.AgentData.AgentID = AgentId;
packet.AgentData.SessionID = SessionId; packet.AgentData.SessionID = SessionId;
packet.Header.Reliable = false; packet.Header.Reliable = false;
packet.Header.Zerocoded = true; packet.Header.Zerocoded = true;
OutPacket(packet, ThrottleOutPacketType.Task); OutPacket(packet, ThrottleOutPacketType.Task);
} }
public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember, public void SendAvatarProperties(UUID avatarID, string aboutText, string bornOn, Byte[] charterMember,
@ -2439,7 +2439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Gesture // Gesture
#region Appearance/ Wearables Methods #region Appearance/ Wearables Methods
public void SendWearables(AvatarWearable[] wearables, int serial) public void SendWearables(AvatarWearable[] wearables, int serial)
{ {
AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate); AgentWearablesUpdatePacket aw = (AgentWearablesUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentWearablesUpdate);
@ -2457,9 +2457,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
awb.AssetID = wearables[i].AssetID; awb.AssetID = wearables[i].AssetID;
awb.ItemID = wearables[i].ItemID; awb.ItemID = wearables[i].ItemID;
aw.WearableData[i] = awb; aw.WearableData[i] = awb;
// m_log.DebugFormat( // m_log.DebugFormat(
// "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}", // "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
// awb.ItemID, awb.AssetID, i, Name); // awb.ItemID, awb.AssetID, i, Name);
} }
@ -2489,7 +2489,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId) public void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId)
{ {
//m_log.DebugFormat("[CLIENT]: Sending animations to {0}", Name); //m_log.DebugFormat("[CLIENT]: Sending animations to {0}", Name);
AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation); AvatarAnimationPacket ani = (AvatarAnimationPacket)PacketPool.Instance.GetPacket(PacketType.AvatarAnimation);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1];
@ -2546,16 +2546,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary> /// <summary>
/// Send a terse positional/rotation/velocity update about an avatar to the client. This avatar can be that of /// Send a terse positional/rotation/velocity update about an avatar to the client. This avatar can be that of
/// the client itself. /// the client itself.
/// </summary> /// </summary>
public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position, public void SendAvatarTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, Vector3 position,
Vector3 velocity, Quaternion rotation) Vector3 velocity, Quaternion rotation)
{ {
if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0) if (rotation.X == rotation.Y && rotation.Y == rotation.Z && rotation.Z == rotation.W && rotation.W == 0)
rotation = Quaternion.Identity; rotation = Quaternion.Identity;
//m_log.DebugFormat("[CLIENT]: Sending rotation {0} for {1} to {2}", rotation, localID, Name); //m_log.DebugFormat("[CLIENT]: Sending rotation {0} for {1} to {2}", rotation, localID, Name);
ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock = ImprovedTerseObjectUpdatePacket.ObjectDataBlock terseBlock =
CreateAvatarImprovedBlock(localID, position, velocity, rotation); CreateAvatarImprovedBlock(localID, position, velocity, rotation);
ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate); ImprovedTerseObjectUpdatePacket terse = (ImprovedTerseObjectUpdatePacket)PacketPool.Instance.GetPacket(PacketType.ImprovedTerseObjectUpdate);
@ -2567,7 +2567,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
terse.Header.Reliable = false; terse.Header.Reliable = false;
terse.Header.Zerocoded = true; terse.Header.Zerocoded = true;
OutPacket(terse, ThrottleOutPacketType.Task); OutPacket(terse, ThrottleOutPacketType.Task);
} }
@ -2593,7 +2593,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
loc.Index = ib; loc.Index = ib;
loc.Header.Reliable = false; loc.Header.Reliable = false;
loc.Header.Zerocoded = true; loc.Header.Zerocoded = true;
OutPacket(loc, ThrottleOutPacketType.Task); OutPacket(loc, ThrottleOutPacketType.Task);
} }
@ -2808,7 +2808,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
im.Header.Zerocoded = true; im.Header.Zerocoded = true;
OutPacket(im, ThrottleOutPacketType.Texture); OutPacket(im, ThrottleOutPacketType.Texture);
} }
public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData) public void SendImageNextPart(ushort partNumber, UUID imageUuid, byte[] imageData)
{ {
ImagePacketPacket im = new ImagePacketPacket(); ImagePacketPacket im = new ImagePacketPacket();
@ -2816,13 +2816,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
im.ImageID.Packet = partNumber; im.ImageID.Packet = partNumber;
im.ImageID.ID = imageUuid; im.ImageID.ID = imageUuid;
im.ImageData.Data = imageData; im.ImageData.Data = imageData;
OutPacket(im, ThrottleOutPacketType.Texture); OutPacket(im, ThrottleOutPacketType.Texture);
} }
public void SendImageNotFound(UUID imageid) public void SendImageNotFound(UUID imageid)
{ {
ImageNotInDatabasePacket notFoundPacket ImageNotInDatabasePacket notFoundPacket
= (ImageNotInDatabasePacket)PacketPool.Instance.GetPacket(PacketType.ImageNotInDatabase); = (ImageNotInDatabasePacket)PacketPool.Instance.GetPacket(PacketType.ImageNotInDatabase);
notFoundPacket.ImageID.ID = imageid; notFoundPacket.ImageID.ID = imageid;
@ -2845,9 +2845,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
pack.Region.ObjectCapacity = stats.ObjectCapacity; pack.Region.ObjectCapacity = stats.ObjectCapacity;
//pack.Region = //stats.RegionBlock; //pack.Region = //stats.RegionBlock;
pack.Stat = stats.StatsBlock; pack.Stat = stats.StatsBlock;
pack.Header.Reliable = false; pack.Header.Reliable = false;
OutPacket(pack, ThrottleOutPacketType.Task); OutPacket(pack, ThrottleOutPacketType.Task);
} }
@ -3129,7 +3129,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned; updatePacket.ParcelData.IsGroupOwned = landData.IsGroupOwned;
updatePacket.ParcelData.LandingType = landData.LandingType; updatePacket.ParcelData.LandingType = landData.LandingType;
updatePacket.ParcelData.LocalID = landData.LocalID; updatePacket.ParcelData.LocalID = landData.LocalID;
if (landData.Area > 0) if (landData.Area > 0)
{ {
updatePacket.ParcelData.MaxPrims = parcelObjectCapacity; updatePacket.ParcelData.MaxPrims = parcelObjectCapacity;
@ -3138,10 +3138,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
updatePacket.ParcelData.MaxPrims = 0; updatePacket.ParcelData.MaxPrims = 0;
} }
updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale; updatePacket.ParcelData.MediaAutoScale = landData.MediaAutoScale;
updatePacket.ParcelData.MediaID = landData.MediaID; updatePacket.ParcelData.MediaID = landData.MediaID;
updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL); updatePacket.ParcelData.MediaURL = LLUtil.StringToPacketBytes(landData.MediaURL);
updatePacket.ParcelData.MusicURL = LLUtil.StringToPacketBytes(landData.MusicURL); updatePacket.ParcelData.MusicURL = LLUtil.StringToPacketBytes(landData.MusicURL);
updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name); updatePacket.ParcelData.Name = Utils.StringToBytes(landData.Name);
updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime; updatePacket.ParcelData.OtherCleanTime = landData.OtherCleanTime;
@ -4162,7 +4162,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary> /// <summary>
/// This is the starting point for sending a simulator packet out to the client. /// This is the starting point for sending a simulator packet out to the client.
/// ///
/// Please do not call this from outside the LindenUDP client stack. /// Please do not call this from outside the LindenUDP client stack.
/// </summary> /// </summary>
/// <param name="NewPack"></param> /// <param name="NewPack"></param>
@ -4244,13 +4244,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (ProcessPacketMethod(Pack)) if (ProcessPacketMethod(Pack))
{ {
//there is a handler registered that handled this packet type //there is a handler registered that handled this packet type
// in the end, we dereference this, so we have to check if it's null // in the end, we dereference this, so we have to check if it's null
if (m_imageManager != null) if (m_imageManager != null)
m_imageManager.ProcessImageQueue(3); m_imageManager.ProcessImageQueue(3);
return; return;
} }
// Main packet processing conditional // Main packet processing conditional
switch (Pack.Type) switch (Pack.Type)
{ {
@ -4266,7 +4266,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.ChatFromViewer: case PacketType.ChatFromViewer:
ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack; ChatFromViewerPacket inchatpack = (ChatFromViewerPacket)Pack;
@ -4296,7 +4296,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerChatFromClient(this, args); handlerChatFromClient(this, args);
} }
break; break;
case PacketType.AvatarPropertiesUpdate: case PacketType.AvatarPropertiesUpdate:
AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack; AvatarPropertiesUpdatePacket Packet = (AvatarPropertiesUpdatePacket)Pack;
@ -4335,7 +4335,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.ImprovedInstantMessage: case PacketType.ImprovedInstantMessage:
ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack; ImprovedInstantMessagePacket msgpack = (ImprovedInstantMessagePacket)Pack;
string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName); string IMfromName = Util.FieldToString(msgpack.MessageBlock.FromAgentName);
@ -4383,7 +4383,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
case PacketType.DeclineFriendship: case PacketType.DeclineFriendship:
DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack; DeclineFriendshipPacket dfriendpack = (DeclineFriendshipPacket)Pack;
if (OnDenyFriendRequest != null) if (OnDenyFriendRequest != null)
{ {
OnDenyFriendRequest(this, OnDenyFriendRequest(this,
@ -4391,7 +4391,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
dfriendpack.TransactionBlock.TransactionID, dfriendpack.TransactionBlock.TransactionID,
null); null);
} }
break; break;
case PacketType.TerminateFriendship: case PacketType.TerminateFriendship:
TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack; TerminateFriendshipPacket tfriendpack = (TerminateFriendshipPacket)Pack;
@ -4404,7 +4404,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerTerminateFriendship(this, listOwnerAgentID, exFriendID); handlerTerminateFriendship(this, listOwnerAgentID, exFriendID);
} }
break; break;
case PacketType.RezObject: case PacketType.RezObject:
RezObjectPacket rezPacket = (RezObjectPacket)Pack; RezObjectPacket rezPacket = (RezObjectPacket)Pack;
@ -4418,8 +4418,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
rezPacket.RezData.FromTaskID); rezPacket.RezData.FromTaskID);
} }
break; break;
case PacketType.DeRezObject: case PacketType.DeRezObject:
DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) Pack; DeRezObjectPacket DeRezPacket = (DeRezObjectPacket) Pack;
handlerDeRezObject = OnDeRezObject; handlerDeRezObject = OnDeRezObject;
if (handlerDeRezObject != null) if (handlerDeRezObject != null)
@ -4427,8 +4427,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
foreach (DeRezObjectPacket.ObjectDataBlock data in foreach (DeRezObjectPacket.ObjectDataBlock data in
DeRezPacket.ObjectData) DeRezPacket.ObjectData)
{ {
// It just so happens that the values on the DeRezAction enumerator match the Destination // It just so happens that the values on the DeRezAction enumerator match the Destination
// values given by a Second Life client // values given by a Second Life client
handlerDeRezObject(this, data.ObjectLocalID, handlerDeRezObject(this, data.ObjectLocalID,
DeRezPacket.AgentBlock.GroupID, DeRezPacket.AgentBlock.GroupID,
(DeRezAction)DeRezPacket.AgentBlock.Destination, (DeRezAction)DeRezPacket.AgentBlock.Destination,
@ -4436,7 +4436,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case PacketType.ModifyLand: case PacketType.ModifyLand:
ModifyLandPacket modify = (ModifyLandPacket)Pack; ModifyLandPacket modify = (ModifyLandPacket)Pack;
//m_log.Info("[LAND]: LAND:" + modify.ToString()); //m_log.Info("[LAND]: LAND:" + modify.ToString());
@ -4461,7 +4461,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.RegionHandshakeReply: case PacketType.RegionHandshakeReply:
handlerRegionHandShakeReply = OnRegionHandShakeReply; handlerRegionHandShakeReply = OnRegionHandShakeReply;
@ -4471,7 +4471,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.AgentWearablesRequest: case PacketType.AgentWearablesRequest:
handlerRequestWearables = OnRequestWearables; handlerRequestWearables = OnRequestWearables;
@ -4488,7 +4488,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.AgentSetAppearance: case PacketType.AgentSetAppearance:
AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack; AgentSetAppearancePacket appear = (AgentSetAppearancePacket)Pack;
@ -4537,7 +4537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case PacketType.RezSingleAttachmentFromInv: case PacketType.RezSingleAttachmentFromInv:
handlerRezSingleAttachment = OnRezSingleAttachmentFromInv; handlerRezSingleAttachment = OnRezSingleAttachmentFromInv;
if (handlerRezSingleAttachment != null) if (handlerRezSingleAttachment != null)
@ -4548,7 +4548,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.DetachAttachmentIntoInv: case PacketType.DetachAttachmentIntoInv:
handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv; handlerDetachAttachmentIntoInv = OnDetachAttachmentIntoInv;
if (handlerDetachAttachmentIntoInv != null) if (handlerDetachAttachmentIntoInv != null)
@ -4561,7 +4561,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerDetachAttachmentIntoInv(itemID, this); handlerDetachAttachmentIntoInv(itemID, this);
} }
break; break;
case PacketType.ObjectAttach: case PacketType.ObjectAttach:
if (OnObjectAttach != null) if (OnObjectAttach != null)
{ {
@ -4578,7 +4578,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case PacketType.ObjectDetach: case PacketType.ObjectDetach:
ObjectDetachPacket dett = (ObjectDetachPacket)Pack; ObjectDetachPacket dett = (ObjectDetachPacket)Pack;
for (int j = 0; j < dett.ObjectData.Length; j++) for (int j = 0; j < dett.ObjectData.Length; j++)
@ -4592,7 +4592,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.ObjectDrop: case PacketType.ObjectDrop:
ObjectDropPacket dropp = (ObjectDropPacket)Pack; ObjectDropPacket dropp = (ObjectDropPacket)Pack;
for (int j = 0; j < dropp.ObjectData.Length; j++) for (int j = 0; j < dropp.ObjectData.Length; j++)
@ -4605,7 +4605,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case PacketType.SetAlwaysRun: case PacketType.SetAlwaysRun:
SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack; SetAlwaysRunPacket run = (SetAlwaysRunPacket)Pack;
@ -4614,7 +4614,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerSetAlwaysRun(this, run.AgentData.AlwaysRun); handlerSetAlwaysRun(this, run.AgentData.AlwaysRun);
break; break;
case PacketType.CompleteAgentMovement: case PacketType.CompleteAgentMovement:
handlerCompleteMovementToRegion = OnCompleteMovementToRegion; handlerCompleteMovementToRegion = OnCompleteMovementToRegion;
if (handlerCompleteMovementToRegion != null) if (handlerCompleteMovementToRegion != null)
@ -4624,7 +4624,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerCompleteMovementToRegion = null; handlerCompleteMovementToRegion = null;
break; break;
case PacketType.AgentUpdate: case PacketType.AgentUpdate:
if (OnAgentUpdate != null) if (OnAgentUpdate != null)
{ {
@ -4653,7 +4653,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa); //agenUpdate.AgentData.ControlFlags, agenUpdate.AgentData.BodyRotationa);
} }
break; break;
case PacketType.AgentAnimation: case PacketType.AgentAnimation:
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack; AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
@ -4680,7 +4680,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case PacketType.AgentRequestSit: case PacketType.AgentRequestSit:
if (OnAgentRequestSit != null) if (OnAgentRequestSit != null)
{ {
@ -4692,7 +4692,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset); agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
} }
break; break;
case PacketType.AgentSit: case PacketType.AgentSit:
if (OnAgentSit != null) if (OnAgentSit != null)
{ {
@ -4705,7 +4705,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
break; break;
case PacketType.SoundTrigger: case PacketType.SoundTrigger:
SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack; SoundTriggerPacket soundTriggerPacket = (SoundTriggerPacket)Pack;
handlerSoundTrigger = OnSoundTrigger; handlerSoundTrigger = OnSoundTrigger;
@ -4718,7 +4718,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.AvatarPickerRequest: case PacketType.AvatarPickerRequest:
AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack; AvatarPickerRequestPacket avRequestQuery = (AvatarPickerRequestPacket)Pack;
AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData; AvatarPickerRequestPacket.AgentDataBlock Requestdata = avRequestQuery.AgentData;
@ -4732,7 +4732,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
Utils.BytesToString(querydata.Name)); Utils.BytesToString(querydata.Name));
} }
break; break;
case PacketType.AgentDataUpdateRequest: case PacketType.AgentDataUpdateRequest:
AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack; AgentDataUpdateRequestPacket avRequestDataUpdatePacket = (AgentDataUpdateRequestPacket)Pack;
@ -5108,10 +5108,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break; break;
case PacketType.ObjectName: case PacketType.ObjectName:
ObjectNamePacket objName = (ObjectNamePacket)Pack; ObjectNamePacket objName = (ObjectNamePacket)Pack;
handlerObjectName = null; handlerObjectName = null;
for (int i = 0; i < objName.ObjectData.Length; i++) for (int i = 0; i < objName.ObjectData.Length; i++)
{ {
handlerObjectName = OnObjectName; handlerObjectName = OnObjectName;
if (handlerObjectName != null) if (handlerObjectName != null)
{ {
@ -5243,7 +5243,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack; ObjectClickActionPacket ocpacket = (ObjectClickActionPacket)Pack;
handlerObjectClickAction = OnObjectClickAction; handlerObjectClickAction = OnObjectClickAction;
if (handlerObjectClickAction != null) if (handlerObjectClickAction != null)
{ {
foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData) foreach (ObjectClickActionPacket.ObjectDataBlock odata in ocpacket.ObjectData)
{ {
@ -5302,7 +5302,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
break; break;
case PacketType.TransferRequest: case PacketType.TransferRequest:
//Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request"); //Console.WriteLine("ClientView.ProcessPackets.cs:ProcessInPacket() - Got transfer request");
TransferRequestPacket transfer = (TransferRequestPacket)Pack; TransferRequestPacket transfer = (TransferRequestPacket)Pack;
//Console.WriteLine("Transfer Request: " + transfer.ToString()); //Console.WriteLine("Transfer Request: " + transfer.ToString());
// Validate inventory transfers // Validate inventory transfers
@ -5346,12 +5346,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (userInfo == null) if (userInfo == null)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[CLIENT]: Could not resolve user {0} for caps inventory update", "[CLIENT]: Could not resolve user {0} for caps inventory update",
AgentId); AgentId);
break; break;
} }
if (userInfo.RootFolder == null) if (userInfo.RootFolder == null)
break; break;
@ -5881,7 +5881,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
break; break;
case PacketType.TeleportLocationRequest: case PacketType.TeleportLocationRequest:
TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack;
// Console.WriteLine(tpLocReq.ToString()); // Console.WriteLine(tpLocReq.ToString());
@ -6693,11 +6693,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// TODO: handle this packet // TODO: handle this packet
//m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet"); //m_log.Warn("[CLIENT]: unhandled ObjectSpinStop packet");
break; break;
case PacketType.InventoryDescendents: case PacketType.InventoryDescendents:
// TODO: handle this packet // TODO: handle this packet
//m_log.Warn("[CLIENT]: unhandled InventoryDescent packet"); //m_log.Warn("[CLIENT]: unhandled InventoryDescent packet");
break; break;
case PacketType.DirPlacesQuery: case PacketType.DirPlacesQuery:
DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack; DirPlacesQueryPacket dirPlacesQueryPacket = (DirPlacesQueryPacket)Pack;
@ -6775,7 +6775,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID); OnEventInfoRequest(this, eventInfoRequestPacket.EventData.EventID);
} }
break; break;
case PacketType.ParcelSetOtherCleanTime: case PacketType.ParcelSetOtherCleanTime:
ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack; ParcelSetOtherCleanTimePacket parcelSetOtherCleanTimePacket = (ParcelSetOtherCleanTimePacket)Pack;
handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime; handlerParcelSetOtherCleanTime = OnParcelSetOtherCleanTime;
@ -7516,7 +7516,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
public void SendAgentOnline(UUID[] agentIDs) public void SendAgentOnline(UUID[] agentIDs)
{ {
OnlineNotificationPacket onp = new OnlineNotificationPacket(); OnlineNotificationPacket onp = new OnlineNotificationPacket();
OnlineNotificationPacket.AgentBlockBlock[] onpb = new OnlineNotificationPacket.AgentBlockBlock[agentIDs.Length]; OnlineNotificationPacket.AgentBlockBlock[] onpb = new OnlineNotificationPacket.AgentBlockBlock[agentIDs.Length];
for (int i = 0; i < agentIDs.Length; i++) for (int i = 0; i < agentIDs.Length; i++)
@ -7682,7 +7682,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
Transfer.TransferInfo.Params = new byte[20]; Transfer.TransferInfo.Params = new byte[20];
Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16); Array.Copy(req.RequestAssetID.GetBytes(), 0, Transfer.TransferInfo.Params, 0, 16);
int assType = req.AssetInf.Type; int assType = req.AssetInf.Metadata.Type;
Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4); Array.Copy(Utils.IntToBytes(assType), 0, Transfer.TransferInfo.Params, 16, 4);
} }
else if (req.AssetRequestSource == 3) else if (req.AssetRequestSource == 3)
@ -7901,7 +7901,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
case "ReliableIsImportant": case "ReliableIsImportant":
return m_PacketHandler.ReliableIsImportant.ToString(); return m_PacketHandler.ReliableIsImportant.ToString();
default: default:
break; break;
} }
@ -8340,7 +8340,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
dg.AgentData = new AgentDropGroupPacket.AgentDataBlock(); dg.AgentData = new AgentDropGroupPacket.AgentDataBlock();
dg.AgentData.AgentID = AgentId; dg.AgentData.AgentID = AgentId;
dg.AgentData.GroupID = groupID; dg.AgentData.GroupID = groupID;
OutPacket(dg, ThrottleOutPacketType.Task); OutPacket(dg, ThrottleOutPacketType.Task);
} }
@ -8352,7 +8352,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
an.AgentData = new AvatarNotesReplyPacket.AgentDataBlock(); an.AgentData = new AvatarNotesReplyPacket.AgentDataBlock();
an.AgentData.AgentID = AgentId; an.AgentData.AgentID = AgentId;
an.Data = new AvatarNotesReplyPacket.DataBlock(); an.Data = new AvatarNotesReplyPacket.DataBlock();
an.Data.TargetID = targetID; an.Data.TargetID = targetID;
an.Data.Notes = Utils.StringToBytes(text); an.Data.Notes = Utils.StringToBytes(text);
@ -8369,7 +8369,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ap.AgentData = new AvatarPicksReplyPacket.AgentDataBlock(); ap.AgentData = new AvatarPicksReplyPacket.AgentDataBlock();
ap.AgentData.AgentID = AgentId; ap.AgentData.AgentID = AgentId;
ap.AgentData.TargetID = targetID; ap.AgentData.TargetID = targetID;
ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count]; ap.Data = new AvatarPicksReplyPacket.DataBlock[picks.Count];
int i = 0; int i = 0;
@ -8393,7 +8393,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ac.AgentData = new AvatarClassifiedReplyPacket.AgentDataBlock(); ac.AgentData = new AvatarClassifiedReplyPacket.AgentDataBlock();
ac.AgentData.AgentID = AgentId; ac.AgentData.AgentID = AgentId;
ac.AgentData.TargetID = targetID; ac.AgentData.TargetID = targetID;
ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count]; ac.Data = new AvatarClassifiedReplyPacket.DataBlock[classifieds.Count];
int i = 0; int i = 0;
@ -8416,7 +8416,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
pd.AgentData = new ParcelDwellReplyPacket.AgentDataBlock(); pd.AgentData = new ParcelDwellReplyPacket.AgentDataBlock();
pd.AgentData.AgentID = AgentId; pd.AgentData.AgentID = AgentId;
pd.Data = new ParcelDwellReplyPacket.DataBlock(); pd.Data = new ParcelDwellReplyPacket.DataBlock();
pd.Data.LocalID = localID; pd.Data.LocalID = localID;
pd.Data.ParcelID = parcelID; pd.Data.ParcelID = parcelID;
@ -8437,7 +8437,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ur.AgentData = new UserInfoReplyPacket.AgentDataBlock(); ur.AgentData = new UserInfoReplyPacket.AgentDataBlock();
ur.AgentData.AgentID = AgentId; ur.AgentData.AgentID = AgentId;
ur.UserData = new UserInfoReplyPacket.UserDataBlock(); ur.UserData = new UserInfoReplyPacket.UserDataBlock();
ur.UserData.IMViaEMail = imViaEmail; ur.UserData.IMViaEMail = imViaEmail;
ur.UserData.DirectoryVisibility = Utils.StringToBytes(Visible); ur.UserData.DirectoryVisibility = Utils.StringToBytes(Visible);

View File

@ -42,7 +42,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
/// <summary> /// <summary>
/// A work in progress, to contain the SL specific file transfer code that is currently in various region modules /// A work in progress, to contain the SL specific file transfer code that is currently in various region modules
/// This file currently contains multiple classes that need to be split out into their own files. /// This file currently contains multiple classes that need to be split out into their own files.
/// </summary> /// </summary>
public class LLFileTransfer : IClientFileTransfer public class LLFileTransfer : IClientFileTransfer
{ {
@ -206,13 +206,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void Initialise(UUID fileID, string fileName) private void Initialise(UUID fileID, string fileName)
{ {
m_asset = new AssetBase(); m_asset = new AssetBase();
m_asset.FullID = fileID; m_asset.Metadata.FullID = fileID;
m_asset.Type = type; m_asset.Metadata.Type = type;
m_asset.Data = new byte[0]; m_asset.Data = new byte[0];
m_asset.Name = fileName; m_asset.Metadata.Name = fileName;
m_asset.Description = "empty"; m_asset.Metadata.Description = "empty";
m_asset.Local = true; m_asset.Metadata.Local = true;
m_asset.Temporary = true; m_asset.Metadata.Temporary = true;
mXferID = Util.GetNextXferID(); mXferID = Util.GetNextXferID();
} }
@ -223,13 +223,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void RequestStartXfer(IClientAPI pRemoteClient) public void RequestStartXfer(IClientAPI pRemoteClient)
{ {
if (!String.IsNullOrEmpty(m_asset.Name)) if (!String.IsNullOrEmpty(m_asset.Metadata.Name))
{ {
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name));
} }
else else
{ {
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]);
} }
} }
@ -238,7 +238,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary> /// </summary>
/// <param name="xferID"></param> /// <param name="xferID"></param>
/// <param name="packetID"></param> /// <param name="packetID"></param>
/// <param name="data"></param> /// <param name="data"></param>
public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
{ {
if (mXferID == xferID) if (mXferID == xferID)
@ -273,7 +273,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerUploadDone = UploadDone; handlerUploadDone = UploadDone;
if (handlerUploadDone != null) if (handlerUploadDone != null)
{ {
handlerUploadDone(m_asset.Name, m_asset.FullID, mXferID, m_asset.Data, remoteClient); handlerUploadDone(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, m_asset.Data, remoteClient);
} }
} }
@ -282,7 +282,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
handlerAbort = UploadAborted; handlerAbort = UploadAborted;
if (handlerAbort != null) if (handlerAbort != null)
{ {
handlerAbort(m_asset.Name, m_asset.FullID, mXferID, remoteClient); handlerAbort(m_asset.Metadata.Name, m_asset.Metadata.FullID, mXferID, remoteClient);
} }
} }
} }
@ -373,4 +373,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
} }

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// Priority Queue for images. Contains lots of data /// Priority Queue for images. Contains lots of data
/// </summary> /// </summary>
private readonly IPriorityQueue<Prio<J2KImage>> pq = new IntervalHeap<Prio<J2KImage>>(); private readonly IPriorityQueue<Prio<J2KImage>> pq = new IntervalHeap<Prio<J2KImage>>();
/// <summary> /// <summary>
/// Dictionary of PriorityQueue handles by AssetId /// Dictionary of PriorityQueue handles by AssetId
/// </summary> /// </summary>
@ -87,7 +87,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//if (req.RequestType == 1) // avatar body texture! //if (req.RequestType == 1) // avatar body texture!
// return; // return;
AddQueueItem(req.RequestedAssetID, (int)req.Priority + 100000); AddQueueItem(req.RequestedAssetID, (int)req.Priority + 100000);
//if (pq[PQHandles[req.RequestedAssetID]].data.Missing) //if (pq[PQHandles[req.RequestedAssetID]].data.Missing)
//{ //{
@ -96,9 +96,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// //
//if (pq[PQHandles[req.RequestedAssetID]].data.HasData && pq[PQHandles[req.RequestedAssetID]].data.Layers.Length > 0) //if (pq[PQHandles[req.RequestedAssetID]].data.HasData && pq[PQHandles[req.RequestedAssetID]].data.Layers.Length > 0)
//{ //{
//} //}
pq[PQHandles[req.RequestedAssetID]].data.requestedUUID = req.RequestedAssetID; pq[PQHandles[req.RequestedAssetID]].data.requestedUUID = req.RequestedAssetID;
pq[PQHandles[req.RequestedAssetID]].data.Priority = (int)req.Priority; pq[PQHandles[req.RequestedAssetID]].data.Priority = (int)req.Priority;
@ -118,7 +118,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return; return;
//Console.WriteLine("AssetCallback for assetId" + assetID); //Console.WriteLine("AssetCallback for assetId" + assetID);
if (asset == null || asset.Data == null) if (asset == null || asset.Data == null)
{ {
lock (pq) lock (pq)
@ -132,12 +132,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
pq[PQHandles[assetID]].data.asset = asset; pq[PQHandles[assetID]].data.asset = asset;
//lock (pq[PQHandles[assetID]].data) //lock (pq[PQHandles[assetID]].data)
pq[PQHandles[assetID]].data.Update((int)pq[PQHandles[assetID]].data.Priority, pq[PQHandles[assetID]].data.CurrentPacket); pq[PQHandles[assetID]].data.Update((int)pq[PQHandles[assetID]].data.Priority, pq[PQHandles[assetID]].data.CurrentPacket);
} }
/// <summary> /// <summary>
@ -174,7 +174,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Is the asset missing? // Is the asset missing?
if (process.data.Missing) if (process.data.Missing)
{ {
//m_client.sendtextur //m_client.sendtextur
pq[h] -= 90000; pq[h] -= 90000;
/* /*
@ -191,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Substitute a blank image // Substitute a blank image
process.data.asset = MissingSubstitute; process.data.asset = MissingSubstitute;
process.data.Missing = false; process.data.Missing = false;
// If the priority is less then -4billion, the client has forgotten about it. // If the priority is less then -4billion, the client has forgotten about it.
if (pq[h] < -400000000) if (pq[h] < -400000000)
{ {
@ -224,7 +224,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
j2kDecodedCallback(process.data.AssetId, new OpenJPEG.J2KLayerInfo[0]); j2kDecodedCallback(process.data.AssetId, new OpenJPEG.J2KLayerInfo[0]);
} }
} // Are we waiting? } // Are we waiting?
else if (!process.data.J2KDecodeWaiting) else if (!process.data.J2KDecodeWaiting)
@ -259,10 +259,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//pq[h] = process; //pq[h] = process;
} }
// uncomment the following line to see the upper most asset and the priority // uncomment the following line to see the upper most asset and the priority
//Console.WriteLine(process.ToString()); //Console.WriteLine(process.ToString());
// Lower priority to give the next image a chance to bubble up // Lower priority to give the next image a chance to bubble up
pq[h] -= 50000; pq[h] -= 50000;
} }
@ -318,7 +318,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
} }
} }
/// <summary> /// <summary>
/// Adds an image to the queue and update priority /// Adds an image to the queue and update priority
@ -336,7 +336,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
h = PQHandles[AssetId]; h = PQHandles[AssetId];
pq[h] = pq[h].SetPriority(priority); pq[h] = pq[h].SetPriority(priority);
} }
else else
{ {
@ -354,7 +354,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void Close() public void Close()
{ {
m_shuttingdown = true; m_shuttingdown = true;
lock (pq) lock (pq)
{ {
while (!pq.IsEmpty) while (!pq.IsEmpty)
@ -362,7 +362,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
pq.DeleteMin(); pq.DeleteMin();
} }
} }
lock (PQHandles) lock (PQHandles)
PQHandles.Clear(); PQHandles.Clear();
@ -423,7 +423,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// </summary> /// </summary>
public UUID AssetId public UUID AssetId
{ {
get { return m_asset_ref.FullID; } get { return m_asset_ref.Metadata.FullID; }
} }
/// <summary> /// <summary>
@ -544,7 +544,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <returns>true if a packet was sent, false if not</returns> /// <returns>true if a packet was sent, false if not</returns>
public bool SendPacket(LLClientView client) public bool SendPacket(LLClientView client)
{ {
// If we've hit the end of the send or if the client set -1, return false. // If we've hit the end of the send or if the client set -1, return false.
if (CurrentPacket > StopPacket || StopPacket == -1) if (CurrentPacket > StopPacket || StopPacket == -1)
return false; return false;
@ -564,7 +564,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
else else
{ {
// Send first packet // Send first packet
byte[] firstImageData = new byte[FIRST_IMAGE_PACKET_SIZE]; byte[] firstImageData = new byte[FIRST_IMAGE_PACKET_SIZE];
try { Buffer.BlockCopy(m_asset_ref.Data, 0, firstImageData, 0, FIRST_IMAGE_PACKET_SIZE); } try { Buffer.BlockCopy(m_asset_ref.Data, 0, firstImageData, 0, FIRST_IMAGE_PACKET_SIZE); }
@ -585,7 +585,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// figure out if we're on the last packet, if so, use the last packet size. If not, use 1000. // figure out if we're on the last packet, if so, use the last packet size. If not, use 1000.
// we know that the total image size is greater then 1000 if we're here // we know that the total image size is greater then 1000 if we're here
int imagePacketSize = (CurrentPacket == (TexturePacketCount() ) ) ? LastPacketSize() : IMAGE_PACKET_SIZE; int imagePacketSize = (CurrentPacket == (TexturePacketCount() ) ) ? LastPacketSize() : IMAGE_PACKET_SIZE;
//if (imagePacketSize > 0) //if (imagePacketSize > 0)
// imagePacketSize = IMAGE_PACKET_SIZE; // imagePacketSize = IMAGE_PACKET_SIZE;
//if (imagePacketSize != 1000) //if (imagePacketSize != 1000)
@ -611,7 +611,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
try { Buffer.BlockCopy(m_asset_ref.Data, CurrentBytePosition(), imageData, 0, imagePacketSize); } try { Buffer.BlockCopy(m_asset_ref.Data, CurrentBytePosition(), imageData, 0, imagePacketSize); }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine(String.Format("Err: srcLen:{0}, BytePos:{1}, desLen:{2}, pktsize:{3}, currpak:{4}, stoppak:{5}, totalpak:{6}", m_asset_ref.Data.Length, CurrentBytePosition(), Console.WriteLine(String.Format("Err: srcLen:{0}, BytePos:{1}, desLen:{2}, pktsize:{3}, currpak:{4}, stoppak:{5}, totalpak:{6}", m_asset_ref.Data.Length, CurrentBytePosition(),
imageData.Length, imagePacketSize, CurrentPacket,StopPacket,TexturePacketCount())); imageData.Length, imagePacketSize, CurrentPacket,StopPacket,TexturePacketCount()));
Console.WriteLine(e.ToString()); Console.WriteLine(e.ToString());
//m_log.Error("Texture data copy failed for " + m_asset_ref.FullID.ToString()); //m_log.Error("Texture data copy failed for " + m_asset_ref.FullID.ToString());
@ -622,7 +622,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Send next packet to the client // Send next packet to the client
client.SendImageNextPart((ushort)(CurrentPacket - 1), requestedUUID, imageData); client.SendImageNextPart((ushort)(CurrentPacket - 1), requestedUUID, imageData);
++CurrentPacket; ++CurrentPacket;
if (atEnd) if (atEnd)
@ -630,7 +630,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true; return true;
} }
} }
/// <summary> /// <summary>
@ -676,7 +676,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public static Prio<D> operator -(Prio<D> tp, int delta) public static Prio<D> operator -(Prio<D> tp, int delta)
{ {
if (tp.priority - delta < 0) if (tp.priority - delta < 0)
return new Prio<D>(tp.data, tp.priority - delta); return new Prio<D>(tp.data, tp.priority - delta);
else else
return new Prio<D>(tp.data, 0); return new Prio<D>(tp.data, 0);

View File

@ -1,29 +1,29 @@
/** /**
* Copyright (c) 2008, Contributors. All rights reserved. * Copyright (c) 2008, Contributors. All rights reserved.
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* * Redistributions of source code must retain the above copyright notice, * * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, * * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* * Neither the name of the Organizations nor the names of Individual * * Neither the name of the Organizations nor the names of Individual
* Contributors may be used to endorse or promote products derived from * Contributors may be used to endorse or promote products derived from
* this software without specific prior written permission. * this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 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 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
@ -73,11 +73,11 @@ namespace OpenSim.Region.Communications.Hypergrid
public BaseHttpServer httpServer; public BaseHttpServer httpServer;
protected List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>(); protected List<RegionInfo> m_regionsOnInstance = new List<RegionInfo>();
// Hyperlink regions are hyperlinks on the map // Hyperlink regions are hyperlinks on the map
protected List<RegionInfo> m_hyperlinkRegions = new List<RegionInfo>(); protected List<RegionInfo> m_hyperlinkRegions = new List<RegionInfo>();
// Known regions are home regions of visiting foreign users. // Known regions are home regions of visiting foreign users.
// They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when // They are not on the map as static hyperlinks. They are dynamic hyperlinks, they go away when
// the visitor goes away. They are mapped to X=0 on the map. // the visitor goes away. They are mapped to X=0 on the map.
// This is key-ed on agent ID // This is key-ed on agent ID
@ -326,13 +326,13 @@ namespace OpenSim.Region.Communications.Hypergrid
//Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width); //Console.WriteLine("Size: " + m.PhysicalDimension.Height + "-" + m.PhysicalDimension.Width);
byte[] imageData = OpenJPEG.EncodeFromImage(m, true); byte[] imageData = OpenJPEG.EncodeFromImage(m, true);
AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString()); AssetBase ass = new AssetBase(UUID.Random(), "region " + info.RegionID.ToString());
info.RegionSettings.TerrainImageID = ass.FullID; info.RegionSettings.TerrainImageID = ass.Metadata.FullID;
ass.Type = (int)AssetType.Texture; ass.Metadata.Type = (int)AssetType.Texture;
ass.Temporary = false; ass.Metadata.Temporary = false;
//imageData.CopyTo(ass.Data, 0); //imageData.CopyTo(ass.Data, 0);
ass.Data = imageData; ass.Data = imageData;
m_assetcache.AddAsset(ass); m_assetcache.AddAsset(ass);
} }
catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke catch (Exception e) // LEGIT: Catching problems caused by OpenJPEG p/invoke
{ {
@ -342,7 +342,7 @@ namespace OpenSim.Region.Communications.Hypergrid
// A little ugly, since this code is exactly the same as OSG1's, and we're already // A little ugly, since this code is exactly the same as OSG1's, and we're already
// calling that for when the region in in grid mode... (for the grid regions) // calling that for when the region in in grid mode... (for the grid regions)
// //
public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y) public virtual LandData RequestLandData (ulong regionHandle, uint x, uint y)
{ {
m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}", m_log.DebugFormat("[HGrid]: requests land data in {0}, at {1}, {2}",
@ -542,23 +542,23 @@ namespace OpenSim.Region.Communications.Hypergrid
m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret); m_log.Info("[HGrid]: InformRegionOfUser: Local grid region " + regInfo.regionSecret);
} }
string capsPath = agentData.CapsPath; string capsPath = agentData.CapsPath;
Hashtable loginParams = new Hashtable(); Hashtable loginParams = new Hashtable();
loginParams["session_id"] = agentData.SessionID.ToString(); loginParams["session_id"] = agentData.SessionID.ToString();
loginParams["secure_session_id"] = agentData.SecureSessionID.ToString(); loginParams["secure_session_id"] = agentData.SecureSessionID.ToString();
loginParams["firstname"] = agentData.firstname; loginParams["firstname"] = agentData.firstname;
loginParams["lastname"] = agentData.lastname; loginParams["lastname"] = agentData.lastname;
loginParams["agent_id"] = agentData.AgentID.ToString(); loginParams["agent_id"] = agentData.AgentID.ToString();
loginParams["circuit_code"] = agentData.circuitcode.ToString(); loginParams["circuit_code"] = agentData.circuitcode.ToString();
loginParams["startpos_x"] = agentData.startpos.X.ToString(); loginParams["startpos_x"] = agentData.startpos.X.ToString();
loginParams["startpos_y"] = agentData.startpos.Y.ToString(); loginParams["startpos_y"] = agentData.startpos.Y.ToString();
loginParams["startpos_z"] = agentData.startpos.Z.ToString(); loginParams["startpos_z"] = agentData.startpos.Z.ToString();
loginParams["caps_path"] = capsPath; loginParams["caps_path"] = capsPath;
CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID); CachedUserInfo u = m_userProfileCache.GetUserDetails(agentData.AgentID);
if (u != null && u.UserProfile != null) if (u != null && u.UserProfile != null)
{ {
loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero loginParams["region_uuid"] = u.UserProfile.HomeRegionID.ToString(); // This seems to be always Zero
//Console.WriteLine(" --------- Home Region UUID -------"); //Console.WriteLine(" --------- Home Region UUID -------");
@ -691,7 +691,7 @@ namespace OpenSim.Region.Communications.Hypergrid
userData.UserServerURI = (string)requestData["userserver_id"]; userData.UserServerURI = (string)requestData["userserver_id"];
userData.UserAssetURI = (string)requestData["assetserver_id"]; userData.UserAssetURI = (string)requestData["assetserver_id"];
userData.UserInventoryURI = (string)requestData["inventoryserver_id"]; userData.UserInventoryURI = (string)requestData["inventoryserver_id"];
UUID rootID = UUID.Zero; UUID rootID = UUID.Zero;
UUID.TryParse((string)requestData["root_folder_id"], out rootID); UUID.TryParse((string)requestData["root_folder_id"], out rootID);
@ -710,7 +710,7 @@ namespace OpenSim.Region.Communications.Hypergrid
m_log.DebugFormat("[HGrid]: Told by user service to prepare for a connection from {0} {1} {2}", m_log.DebugFormat("[HGrid]: Told by user service to prepare for a connection from {0} {1} {2}",
userData.FirstName, userData.SurName, userData.ID); userData.FirstName, userData.SurName, userData.ID);
m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress + m_log.Debug("[HGrid]: home_address: " + userData.UserHomeAddress +
"; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort); "; home_port: " + userData.UserHomePort + "; remoting: " + userData.UserHomeRemotingPort);
@ -926,7 +926,7 @@ namespace OpenSim.Region.Communications.Hypergrid
return true; return true;
} }
public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) public virtual bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
{ {
// If we're here, it's because regionHandle is a remote, non-grided region // If we're here, it's because regionHandle is a remote, non-grided region
m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle); m_log.Info("[HGrid]: InformRegionOfChildAgent for " + regionHandle);
@ -934,7 +934,7 @@ namespace OpenSim.Region.Communications.Hypergrid
RegionInfo regInfo = GetHyperlinkRegion(regionHandle); RegionInfo regInfo = GetHyperlinkRegion(regionHandle);
if (regInfo == null) if (regInfo == null)
return false; return false;
//ulong realHandle = regionHandle; //ulong realHandle = regionHandle;
if (!SendUserInformation(regInfo, agentData)) if (!SendUserInformation(regInfo, agentData))
@ -1184,7 +1184,7 @@ namespace OpenSim.Region.Communications.Hypergrid
#region Methods triggered by calls from external instances #region Methods triggered by calls from external instances
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="regionHandle"></param> /// <param name="regionHandle"></param>
/// <param name="agentData"></param> /// <param name="agentData"></param>
@ -1192,7 +1192,7 @@ namespace OpenSim.Region.Communications.Hypergrid
public void AdjustUserInformation(AgentCircuitData agentData) public void AdjustUserInformation(AgentCircuitData agentData)
{ {
CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID); CachedUserInfo uinfo = m_userProfileCache.GetUserDetails(agentData.AgentID);
if ((uinfo != null) && (uinfo.UserProfile != null) && if ((uinfo != null) && (uinfo.UserProfile != null) &&
(IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData))) (IsLocalUser(uinfo) || !(uinfo.UserProfile is ForeignUserProfileData)))
{ {
//Console.WriteLine("---------------> Local User!"); //Console.WriteLine("---------------> Local User!");
@ -1232,7 +1232,7 @@ namespace OpenSim.Region.Communications.Hypergrid
if (info.RegionHandle == ihandle) if (info.RegionHandle == ihandle)
return info; return info;
} }
return null; return null;
} }
@ -1250,7 +1250,7 @@ namespace OpenSim.Region.Communications.Hypergrid
ohandle = Convert.ToInt64(info.regionSecret); ohandle = Convert.ToInt64(info.regionSecret);
m_log.Info("[HGrid] remote region " + ohandle); m_log.Info("[HGrid] remote region " + ohandle);
} }
catch catch
{ {
m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")"); m_log.Error("[HGrid] Could not convert secret for " + ihandle + " (" + info.regionSecret + ")");
} }

View File

@ -72,7 +72,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
} }
public void HandleXfer(ulong xferID, uint packetID, byte[] data) public void HandleXfer(ulong xferID, uint packetID, byte[] data)
{ {
lock (XferUploaders) lock (XferUploaders)
{ {
foreach (AssetXferUploader uploader in XferUploaders.Values) foreach (AssetXferUploader uploader in XferUploaders.Values)
@ -97,8 +97,8 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
wearableType, nextOwnerMask); wearableType, nextOwnerMask);
} }
} }
/// <summary> /// <summary>
/// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed. /// Get an uploaded asset. If the data is successfully retrieved, the transaction will be removed.
@ -171,10 +171,10 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
"[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}", "[ASSET TRANSACTIONS]: Updating task item {0} in {1} with asset in transaction {2}",
item.Name, part.Name, transactionID); item.Name, part.Name, transactionID);
asset.Name = item.Name; asset.Metadata.Name = item.Name;
asset.Description = item.Description; asset.Metadata.Description = item.Description;
asset.Type = (sbyte)item.Type; asset.Metadata.Type = (sbyte)item.Type;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
@ -206,14 +206,14 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
asset = GetTransactionAsset(transactionID); asset = GetTransactionAsset(transactionID);
} }
if (asset != null && asset.FullID == assetID) if (asset != null && asset.Metadata.FullID == assetID)
{ {
// Assets never get updated, new ones get created // Assets never get updated, new ones get created
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
asset.Name = item.Name; asset.Metadata.Name = item.Name;
asset.Description = item.Description; asset.Metadata.Description = item.Description;
asset.Type = (sbyte)item.AssetType; asset.Metadata.Type = (sbyte)item.AssetType;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
Manager.MyScene.CommsManager.AssetCache.AddAsset(asset); Manager.MyScene.CommsManager.AssetCache.AddAsset(asset);
} }

View File

@ -113,17 +113,17 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
{ {
ourClient = remoteClient; ourClient = remoteClient;
m_asset = new AssetBase(); m_asset = new AssetBase();
m_asset.FullID = assetID; m_asset.Metadata.FullID = assetID;
m_asset.Type = type; m_asset.Metadata.Type = type;
m_asset.Data = data; m_asset.Data = data;
m_asset.Name = "blank"; m_asset.Metadata.Name = "blank";
m_asset.Description = "empty"; m_asset.Metadata.Description = "empty";
m_asset.Local = storeLocal; m_asset.Metadata.Local = storeLocal;
m_asset.Temporary = tempFile; m_asset.Metadata.Temporary = tempFile;
TransactionID = transaction; TransactionID = transaction;
m_storeLocal = storeLocal; m_storeLocal = storeLocal;
if (m_asset.Data.Length > 2) if (m_asset.Data.Length > 2)
{ {
SendCompleteMessage(); SendCompleteMessage();
@ -140,12 +140,12 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
protected void RequestStartXfer() protected void RequestStartXfer()
{ {
XferID = Util.GetNextXferID(); XferID = Util.GetNextXferID();
ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]); ourClient.SendXferRequest(XferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, new byte[0]);
} }
protected void SendCompleteMessage() protected void SendCompleteMessage()
{ {
ourClient.SendAssetUploadCompleteMessage(m_asset.Type, true, m_asset.FullID); ourClient.SendAssetUploadCompleteMessage(m_asset.Metadata.Type, true, m_asset.Metadata.FullID);
m_finished = true; m_finished = true;
if (m_createItem) if (m_createItem)
@ -164,7 +164,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
string filename = string filename =
String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day, String.Format("{6}_{7}_{0:d2}{1:d2}{2:d2}_{3:d2}{4:d2}{5:d2}.dat", now.Year, now.Month, now.Day,
now.Hour, now.Minute, now.Second, m_asset.Name, m_asset.Type); now.Hour, now.Minute, now.Second, m_asset.Metadata.Name, m_asset.Metadata.Type);
SaveAssetToFile(filename, m_asset.Data); SaveAssetToFile(filename, m_asset.Data);
} }
} }
@ -196,9 +196,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
this.invType = invType; this.invType = invType;
this.wearableType = wearableType; this.wearableType = wearableType;
nextPerm = nextOwnerMask; nextPerm = nextOwnerMask;
m_asset.Name = name; m_asset.Metadata.Name = name;
m_asset.Description = description; m_asset.Metadata.Description = description;
m_asset.Type = type; m_asset.Metadata.Type = type;
if (m_finished) if (m_finished)
{ {
@ -211,7 +211,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
} }
} }
private void DoCreateItem() private void DoCreateItem()
{ {
m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset); m_userTransactions.Manager.MyScene.CommsManager.AssetCache.AddAsset(m_asset);
@ -225,7 +225,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
item.Owner = ourClient.AgentId; item.Owner = ourClient.AgentId;
item.Creator = ourClient.AgentId; item.Creator = ourClient.AgentId;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = m_asset.FullID; item.AssetID = m_asset.Metadata.FullID;
item.Description = m_description; item.Description = m_description;
item.Name = m_name; item.Name = m_name;
item.AssetType = type; item.AssetType = type;
@ -245,9 +245,9 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation", "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
ourClient.AgentId); ourClient.AgentId);
} }
} }
/// <summary> /// <summary>
@ -260,7 +260,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction
{ {
return m_asset; return m_asset;
} }
return null; return null;
} }
} }

View File

@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
/// </summary> /// </summary>
private AssetBase m_asset; private AssetBase m_asset;
//public UUID assetID { get { return m_asset.FullID; } } //public UUID assetID { get { return m_asset.Metadata.FullID; } }
// private bool m_cancel = false; // private bool m_cancel = false;
@ -93,7 +93,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
get { return false; } get { return false; }
set set
{ {
// m_cancel = value; // m_cancel = value;
} }
} }
@ -102,7 +102,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
get { return false; } get { return false; }
set set
{ {
// m_sending = value; // m_sending = value;
} }
} }
@ -117,7 +117,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
// See ITextureSender // See ITextureSender
public bool SendTexturePacket() public bool SendTexturePacket()
{ {
//m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.FullID); //m_log.DebugFormat("[TEXTURE SENDER]: Sending packet for {0}", m_asset.Metadata.FullID);
SendPacket(); SendPacket();
counter++; counter++;
@ -154,7 +154,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
{ {
if (NumPackets == 0) if (NumPackets == 0)
{ {
RequestUser.SendImageFirstPart(1, m_asset.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2); RequestUser.SendImageFirstPart(1, m_asset.Metadata.FullID, (uint)m_asset.Data.Length, m_asset.Data, 2);
PacketCounter++; PacketCounter++;
} }
else else
@ -163,7 +163,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
Array.Copy(m_asset.Data, 0, ImageData1, 0, 600); Array.Copy(m_asset.Data, 0, ImageData1, 0, 600);
RequestUser.SendImageFirstPart( RequestUser.SendImageFirstPart(
(ushort)(NumPackets), m_asset.FullID, (uint)m_asset.Data.Length, ImageData1, 2); (ushort)(NumPackets), m_asset.Metadata.FullID, (uint)m_asset.Data.Length, ImageData1, 2);
PacketCounter++; PacketCounter++;
} }
} }
@ -179,11 +179,11 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
catch (ArgumentOutOfRangeException) catch (ArgumentOutOfRangeException)
{ {
m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" + m_log.Error("[TEXTURE SENDER]: Unable to separate texture into multiple packets: Array bounds failure on asset:" +
m_asset.FullID.ToString()); m_asset.Metadata.ID);
return; return;
} }
RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.FullID, imageData); RequestUser.SendImageNextPart((ushort)PacketCounter, m_asset.Metadata.FullID, imageData);
PacketCounter++; PacketCounter++;
} }
} }

View File

@ -46,7 +46,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
public class InventoryArchiveReadRequest public class InventoryArchiveReadRequest
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Scene scene; protected Scene scene;
protected TarArchiveReader archive; protected TarArchiveReader archive;
private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding(); private static System.Text.ASCIIEncoding m_asciiEncoding = new System.Text.ASCIIEncoding();
@ -65,7 +65,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
StringReader sr = new StringReader(contents); StringReader sr = new StringReader(contents);
XmlTextReader reader = new XmlTextReader(sr); XmlTextReader reader = new XmlTextReader(sr);
if (contents.Equals("")) return null; if (contents.Equals("")) return null;
reader.ReadStartElement("InventoryObject"); reader.ReadStartElement("InventoryObject");
@ -79,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
item.InvType = System.Convert.ToInt32(reader.ReadString()); item.InvType = System.Convert.ToInt32(reader.ReadString());
reader.ReadEndElement(); reader.ReadEndElement();
reader.ReadStartElement("CreatorUUID"); reader.ReadStartElement("CreatorUUID");
item.Creator = UUID.Parse(reader.ReadString()); item.Creator = UUID.Parse(reader.ReadString());
reader.ReadEndElement(); reader.ReadEndElement();
reader.ReadStartElement("CreationDate"); reader.ReadStartElement("CreationDate");
item.CreationDate = System.Convert.ToInt32(reader.ReadString()); item.CreationDate = System.Convert.ToInt32(reader.ReadString());
@ -94,7 +94,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
} }
else else
{ {
reader.ReadStartElement("Description"); reader.ReadStartElement("Description");
item.Description = reader.ReadString(); item.Description = reader.ReadString();
reader.ReadEndElement(); reader.ReadEndElement();
} }
@ -145,7 +145,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
int successfulAssetRestores = 0; int successfulAssetRestores = 0;
int failedAssetRestores = 0; int failedAssetRestores = 0;
int successfulItemRestores = 0; int successfulItemRestores = 0;
UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName); UserProfileData userProfile = commsManager.UserService.GetUserProfile(firstName, lastName);
if (null == userProfile) if (null == userProfile)
{ {
@ -157,28 +157,28 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
if (null == userInfo) if (null == userInfo)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[CONSOLE]: Failed to find user info for {0} {1} {2}", "[CONSOLE]: Failed to find user info for {0} {1} {2}",
firstName, lastName, userProfile.ID); firstName, lastName, userProfile.ID);
return; return;
} }
if (!userInfo.HasReceivedInventory) if (!userInfo.HasReceivedInventory)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", "[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}",
firstName, lastName, userProfile.ID); firstName, lastName, userProfile.ID);
return; return;
} }
InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath); InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath);
if (null == inventoryFolder) if (null == inventoryFolder)
{ {
// TODO: Later on, automatically create this folder if it does not exist // TODO: Later on, automatically create this folder if it does not exist
m_log.ErrorFormat("[ARCHIVER]: Inventory path {0} does not exist", invPath); m_log.ErrorFormat("[ARCHIVER]: Inventory path {0} does not exist", invPath);
return; return;
} }
@ -202,17 +202,17 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
else else
{ {
InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data)); InventoryItemBase item = loadInvItem(filePath, m_asciiEncoding.GetString(data));
if (item != null) if (item != null)
{ {
item.Creator = userProfile.ID; item.Creator = userProfile.ID;
item.Owner = userProfile.ID; item.Owner = userProfile.ID;
// Reset folder ID to the one in which we want to load it // Reset folder ID to the one in which we want to load it
// TODO: Properly restore entire folder structure. At the moment all items are dumped in this // TODO: Properly restore entire folder structure. At the moment all items are dumped in this
// single folder no matter where in the saved folder structure they are. // single folder no matter where in the saved folder structure they are.
item.Folder = inventoryFolder.ID; item.Folder = inventoryFolder.ID;
userInfo.AddItem(item); userInfo.AddItem(item);
successfulItemRestores++; successfulItemRestores++;
} }
@ -258,7 +258,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory.Archiver
AssetBase asset = new AssetBase(new UUID(uuid), "RandomName"); AssetBase asset = new AssetBase(new UUID(uuid), "RandomName");
asset.Type = assetType; asset.Metadata.Type = assetType;
asset.Data = data; asset.Data = data;
scene.AssetCache.AddAsset(asset); scene.AssetCache.AddAsset(asset);

View File

@ -231,21 +231,21 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
// Create a new asset for user // Create a new asset for user
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
asset.Data = assetData; asset.Data = assetData;
asset.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000); asset.Metadata.Name = "DynamicImage" + Util.RandomClass.Next(1, 10000);
asset.Type = 0; asset.Metadata.Type = 0;
asset.Description = "dynamic image"; asset.Metadata.Description = "dynamic image";
asset.Local = false; asset.Metadata.Local = false;
asset.Temporary = true; asset.Metadata.Temporary = true;
scene.AssetCache.AddAsset(asset); scene.AssetCache.AddAsset(asset);
LastAssetID = asset.FullID; LastAssetID = asset.Metadata.FullID;
IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>(); IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
if (cacheLayerDecode != null) if (cacheLayerDecode != null)
{ {
cacheLayerDecode.syncdecode(asset.FullID, asset.Data); cacheLayerDecode.syncdecode(asset.Metadata.FullID, asset.Data);
} }
cacheLayerDecode = null; cacheLayerDecode = null;
@ -256,7 +256,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
UUID oldID = tmptex.DefaultTexture.TextureID; UUID oldID = tmptex.DefaultTexture.TextureID;
scene.AssetCache.ExpireAsset(oldID); scene.AssetCache.ExpireAsset(oldID);
tmptex.DefaultTexture.TextureID = asset.FullID; tmptex.DefaultTexture.TextureID = asset.Metadata.FullID;
// I'm pretty sure we always want to force this to true // I'm pretty sure we always want to force this to true
tmptex.DefaultTexture.Fullbright = true; tmptex.DefaultTexture.Fullbright = true;
@ -287,7 +287,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.DynamicTexture
try try
{ {
result = OpenJPEG.EncodeFromImage(joint, true); result = OpenJPEG.EncodeFromImage(joint, true);
} }
catch (Exception) catch (Exception)
{ {
Console.WriteLine( Console.WriteLine(

View File

@ -66,12 +66,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress); m_loadStream = new GZipStream(GetStream(loadPath), CompressionMode.Decompress);
m_errorMessage = String.Empty; m_errorMessage = String.Empty;
} }
public ArchiveReadRequest(Scene scene, Stream loadStream) public ArchiveReadRequest(Scene scene, Stream loadStream)
{ {
m_scene = scene; m_scene = scene;
m_loadStream = loadStream; m_loadStream = loadStream;
} }
/// <summary> /// <summary>
/// Dearchive the region embodied in this request. /// Dearchive the region embodied in this request.
@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
// The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions // The same code can handle dearchiving 0.1 and 0.2 OpenSim Archive versions
DearchiveRegion0DotStar(); DearchiveRegion0DotStar();
} }
private void DearchiveRegion0DotStar() private void DearchiveRegion0DotStar()
{ {
int successfulAssetRestores = 0; int successfulAssetRestores = 0;
@ -98,12 +98,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
byte[] data; byte[] data;
TarArchiveReader.TarEntryType entryType; TarArchiveReader.TarEntryType entryType;
while ((data = archive.ReadEntry(out filePath, out entryType)) != null) while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
{ {
//m_log.DebugFormat( //m_log.DebugFormat(
// "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length); // "[ARCHIVER]: Successfully read {0} ({1} bytes)}", filePath, data.Length);
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType) if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY == entryType)
{ {
m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}", m_log.WarnFormat("[ARCHIVER]: Ignoring directory entry {0}",
filePath); filePath);
@ -133,7 +133,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
LoadRegionSettings(filePath, data); LoadRegionSettings(filePath, data);
} }
} }
//m_log.Debug("[ARCHIVER]: Reached end of archive"); //m_log.Debug("[ARCHIVER]: Reached end of archive");
archive.Close(); archive.Close();
@ -154,10 +154,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
} }
m_log.Info("[ARCHIVER]: Clearing all existing scene objects"); m_log.Info("[ARCHIVER]: Clearing all existing scene objects");
m_scene.DeleteAllSceneObjects(); m_scene.DeleteAllSceneObjects();
// Reload serialized prims // Reload serialized prims
m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count);
@ -176,10 +176,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid // Try to retain the original creator/owner/lastowner if their uuid is present on this grid
// otherwise, use the master avatar uuid instead // otherwise, use the master avatar uuid instead
UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID; UUID masterAvatarId = m_scene.RegionInfo.MasterAvatarAssignedUUID;
if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner; masterAvatarId = m_scene.RegionInfo.EstateSettings.EstateOwner;
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in sceneObject.Children.Values)
{ {
if (!resolveUserUuid(part.CreatorID)) if (!resolveUserUuid(part.CreatorID))
@ -233,7 +233,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{ {
sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0); sceneObject.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 0);
} }
m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage); m_scene.EventManager.TriggerOarFileLoaded(m_errorMessage);
} }
@ -290,12 +290,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
//m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(new UUID(uuid), String.Empty); AssetBase asset = new AssetBase(new UUID(uuid), String.Empty);
asset.Type = assetType; asset.Metadata.Type = assetType;
asset.Data = data; asset.Data = data;
m_scene.AssetCache.AddAsset(asset); m_scene.AssetCache.AddAsset(asset);
/** /**
* Create layers on decode for image assets. This is likely to significantly increase the time to load archives so * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so
* it might be best done when dearchive takes place on a separate thread * it might be best done when dearchive takes place on a separate thread
if (asset.Type=AssetType.Texture) if (asset.Type=AssetType.Texture)
@ -317,7 +317,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
return false; return false;
} }
} }
/// <summary> /// <summary>
/// Load region settings data /// Load region settings data
/// </summary> /// </summary>
@ -329,7 +329,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
private bool LoadRegionSettings(string settingsPath, byte[] data) private bool LoadRegionSettings(string settingsPath, byte[] data)
{ {
RegionSettings loadedRegionSettings; RegionSettings loadedRegionSettings;
try try
{ {
loadedRegionSettings = RegionSettingsSerializer.Deserialize(data); loadedRegionSettings = RegionSettingsSerializer.Deserialize(data);
@ -337,13 +337,13 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}", "[ARCHIVER]: Could not parse region settings file {0}. Ignoring. Exception was {1}",
settingsPath, e); settingsPath, e);
return false; return false;
} }
RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings; RegionSettings currentRegionSettings = m_scene.RegionInfo.RegionSettings;
currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit; currentRegionSettings.AgentLimit = loadedRegionSettings.AgentLimit;
currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage; currentRegionSettings.AllowDamage = loadedRegionSettings.AllowDamage;
currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide; currentRegionSettings.AllowLandJoinDivide = loadedRegionSettings.AllowLandJoinDivide;
@ -373,10 +373,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
estateModule.sendRegionHandshakeToAll(); estateModule.sendRegionHandshakeToAll();
return true; return true;
} }
@ -411,11 +411,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
if (File.Exists(path)) if (File.Exists(path))
{ {
return new FileStream(path, FileMode.Open); return new FileStream(path, FileMode.Open);
} }
else else
{ {
Uri uri = new Uri(path); // throw exception if not valid URI Uri uri = new Uri(path); // throw exception if not valid URI
if (uri.Scheme == "file") if (uri.Scheme == "file")
{ {
return new FileStream(uri.AbsolutePath, FileMode.Open); return new FileStream(uri.AbsolutePath, FileMode.Open);
} }

View File

@ -86,16 +86,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
string extension = string.Empty; string extension = string.Empty;
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type))
{ {
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type];
} }
xtw.WriteElementString("filename", uuid.ToString() + extension); xtw.WriteElementString("filename", uuid.ToString() + extension);
xtw.WriteElementString("name", asset.Name); xtw.WriteElementString("name", asset.Metadata.Name);
xtw.WriteElementString("description", asset.Description); xtw.WriteElementString("description", asset.Metadata.Description);
xtw.WriteElementString("asset-type", asset.Type.ToString()); xtw.WriteElementString("asset-type", asset.Metadata.Type.ToString());
xtw.WriteEndElement(); xtw.WriteEndElement();
} }
@ -123,15 +123,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
string extension = string.Empty; string extension = string.Empty;
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type)) if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Metadata.Type))
{ {
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type]; extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Metadata.Type];
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded", "[ARCHIVER]: Unrecognized asset type {0} with uuid {1}. This asset will be saved but not reloaded",
asset.Type, asset.ID); asset.Metadata.Type, asset.Metadata.ID);
} }
archive.AddFile( archive.AddFile(

View File

@ -157,8 +157,8 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename); m_log.DebugFormat("[ARCHIVER]: Importing asset {0}", filename);
AssetBase asset = new AssetBase(new UUID(filename), metadata.Name); AssetBase asset = new AssetBase(new UUID(filename), metadata.Name);
asset.Description = metadata.Description; asset.Metadata.Description = metadata.Description;
asset.Type = metadata.AssetType; asset.Metadata.Type = metadata.AssetType;
asset.Data = data; asset.Data = data;
m_cache.AddAsset(asset); m_cache.AddAsset(asset);

View File

@ -37,13 +37,13 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules.World.Estate namespace OpenSim.Region.Environment.Modules.World.Estate
{ {
public class EstateTerrainXferHandler public class EstateTerrainXferHandler
{ {
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private AssetBase m_asset; private AssetBase m_asset;
public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient); public delegate void TerrainUploadComplete(string name, byte[] filedata, IClientAPI remoteClient);
public event TerrainUploadComplete TerrainUploadDone; public event TerrainUploadComplete TerrainUploadDone;
@ -52,21 +52,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
//private string m_name = String.Empty; //private string m_name = String.Empty;
//private UUID TransactionID = UUID.Zero; //private UUID TransactionID = UUID.Zero;
private sbyte type = 0; private sbyte type = 0;
public ulong mXferID; public ulong mXferID;
private TerrainUploadComplete handlerTerrainUploadDone; private TerrainUploadComplete handlerTerrainUploadDone;
public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename) public EstateTerrainXferHandler(IClientAPI pRemoteClient, string pClientFilename)
{ {
m_asset = new AssetBase(); m_asset = new AssetBase();
m_asset.FullID = UUID.Zero; m_asset.Metadata.FullID = UUID.Zero;
m_asset.Type = type; m_asset.Metadata.Type = type;
m_asset.Data = new byte[0]; m_asset.Data = new byte[0];
m_asset.Name = pClientFilename; m_asset.Metadata.Name = pClientFilename;
m_asset.Description = "empty"; m_asset.Metadata.Description = "empty";
m_asset.Local = true; m_asset.Metadata.Local = true;
m_asset.Temporary = true; m_asset.Metadata.Temporary = true;
} }
@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
public void RequestStartXfer(IClientAPI pRemoteClient) public void RequestStartXfer(IClientAPI pRemoteClient)
{ {
mXferID = Util.GetNextXferID(); mXferID = Util.GetNextXferID();
pRemoteClient.SendXferRequest(mXferID, m_asset.Type, m_asset.FullID, 0, Utils.StringToBytes(m_asset.Name)); pRemoteClient.SendXferRequest(mXferID, m_asset.Metadata.Type, m_asset.Metadata.FullID, 0, Utils.StringToBytes(m_asset.Metadata.Name));
} }
/// <summary> /// <summary>
@ -86,7 +86,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
/// </summary> /// </summary>
/// <param name="xferID"></param> /// <param name="xferID"></param>
/// <param name="packetID"></param> /// <param name="packetID"></param>
/// <param name="data"></param> /// <param name="data"></param>
public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data) public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
{ {
if (mXferID == xferID) if (mXferID == xferID)
@ -110,7 +110,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
if ((packetID & 0x80000000) != 0) if ((packetID & 0x80000000) != 0)
{ {
SendCompleteMessage(remoteClient); SendCompleteMessage(remoteClient);
} }
} }
} }
@ -120,7 +120,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
handlerTerrainUploadDone = TerrainUploadDone; handlerTerrainUploadDone = TerrainUploadDone;
if (handlerTerrainUploadDone != null) if (handlerTerrainUploadDone != null)
{ {
handlerTerrainUploadDone(m_asset.Name,m_asset.Data, remoteClient); handlerTerrainUploadDone(m_asset.Metadata.Name, m_asset.Data, remoteClient);
} }
} }
} }

View File

@ -1,29 +1,29 @@
/** /**
* Copyright (c) 2008, Contributors. All rights reserved. * Copyright (c) 2008, Contributors. All rights reserved.
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without modification, * Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met: * are permitted provided that the following conditions are met:
* *
* * Redistributions of source code must retain the above copyright notice, * * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, * * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * and/or other materials provided with the distribution.
* * Neither the name of the Organizations nor the names of Individual * * Neither the name of the Organizations nor the names of Individual
* Contributors may be used to endorse or promote products derived from * Contributors may be used to endorse or promote products derived from
* this software without specific prior written permission. * this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * 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 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * 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 * 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 * 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 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE. * OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
@ -48,7 +48,7 @@ using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Scenes.Hypergrid namespace OpenSim.Region.Environment.Scenes.Hypergrid
{ {
public class HGAssetMapper public class HGAssetMapper
{ {
#region Fields #region Fields
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -128,12 +128,12 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null)) if (m_scene.CommsManager.AssetCache.TryGetCachedAsset(assetID, out asset) && (asset != null))
{ {
m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Name + " " + assetID); m_log.Debug("[HGScene]: Asset made it to asset cache. " + asset.Metadata.Name + " " + assetID);
// I think I need to store it in the asset DB too. // I think I need to store it in the asset DB too.
// For now, let me just do it for textures and scripts // For now, let me just do it for textures and scripts
if (((AssetType)asset.Type == AssetType.Texture) || if (((AssetType)asset.Metadata.Type == AssetType.Texture) ||
((AssetType)asset.Type == AssetType.LSLBytecode) || ((AssetType)asset.Metadata.Type == AssetType.LSLBytecode) ||
((AssetType)asset.Type == AssetType.LSLText)) ((AssetType)asset.Metadata.Type == AssetType.LSLText))
{ {
AssetBase asset1 = new AssetBase(); AssetBase asset1 = new AssetBase();
Copy(asset, asset1); Copy(asset, asset1);
@ -157,9 +157,9 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
if (asset1 != null) if (asset1 != null)
{ {
// See long comment in AssetCache.AddAsset // See long comment in AssetCache.AddAsset
if (!asset1.Temporary || asset1.Local) if (!asset1.Metadata.Temporary || asset1.Metadata.Local)
{ {
// The asset cache returns instances of subclasses of AssetBase: // The asset cache returns instances of subclasses of AssetBase:
// TextureImage or AssetInfo. So in passing them to the remote // TextureImage or AssetInfo. So in passing them to the remote
// server we first need to convert this to instances of AssetBase, // server we first need to convert this to instances of AssetBase,
// which is the serializable class for assets. // which is the serializable class for assets.
@ -179,14 +179,14 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
private void Copy(AssetBase from, AssetBase to) private void Copy(AssetBase from, AssetBase to)
{ {
to.Data = from.Data; to.Data = from.Data;
to.Description = from.Description; to.Metadata.Description = from.Metadata.Description;
to.FullID = from.FullID; to.Metadata.FullID = from.Metadata.FullID;
to.ID = from.ID; to.Metadata.ID = from.Metadata.ID;
to.Local = from.Local; to.Metadata.Local = from.Metadata.Local;
to.Name = from.Name; to.Metadata.Name = from.Metadata.Name;
to.Temporary = from.Temporary; to.Metadata.Temporary = from.Metadata.Temporary;
to.Type = from.Type; to.Metadata.Type = from.Metadata.Type;
} }
private void _guardedAdd(Dictionary<UUID, bool> lst, UUID obj, bool val) private void _guardedAdd(Dictionary<UUID, bool> lst, UUID obj, bool val)
@ -243,7 +243,7 @@ namespace OpenSim.Region.Environment.Scenes.Hypergrid
private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset) private Dictionary<UUID, bool> SniffUUIDs(AssetBase asset)
{ {
Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>(); Dictionary<UUID, bool> uuids = new Dictionary<UUID, bool>();
if ((asset != null) && ((AssetType)asset.Type == AssetType.Object)) if ((asset != null) && ((AssetType)asset.Metadata.Type == AssetType.Object))
{ {
string ass_str = Utils.BytesToString(asset.Data); string ass_str = Utils.BytesToString(asset.Data);
SceneObjectGroup sog = new SceneObjectGroup(ass_str, true); SceneObjectGroup sog = new SceneObjectGroup(ass_str, true);

View File

@ -42,12 +42,12 @@ namespace OpenSim.Region.Environment.Scenes
public partial class Scene public partial class Scene
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// Allows asynchronous derezzing of objects from the scene into a client's inventory. /// Allows asynchronous derezzing of objects from the scene into a client's inventory.
/// </summary> /// </summary>
protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter; protected AsyncSceneObjectGroupDeleter m_asyncSceneObjectDeleter;
/// <summary> /// <summary>
/// Start all the scripts in the scene which should be started. /// Start all the scripts in the scene which should be started.
@ -145,9 +145,9 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item", "[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item",
remoteClient.AgentId); remoteClient.AgentId);
} }
} }
/// <summary> /// <summary>
@ -175,7 +175,7 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false);
return UUID.Zero; return UUID.Zero;
} }
remoteClient.SendAgentAlertMessage("Notecard saved", false); remoteClient.SendAgentAlertMessage("Notecard saved", false);
} }
else if ((InventoryType)item.InvType == InventoryType.LSL) else if ((InventoryType)item.InvType == InventoryType.LSL)
@ -185,7 +185,7 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
return UUID.Zero; return UUID.Zero;
} }
remoteClient.SendAgentAlertMessage("Script saved", false); remoteClient.SendAgentAlertMessage("Script saved", false);
} }
@ -193,21 +193,21 @@ namespace OpenSim.Region.Environment.Scenes
CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data);
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
userInfo.UpdateItem(item); userInfo.UpdateItem(item);
// remoteClient.SendInventoryItemCreateUpdate(item); // remoteClient.SendInventoryItemCreateUpdate(item);
return (asset.FullID); return (asset.Metadata.FullID);
} }
} }
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not resolve user {0} for caps inventory update", "[AGENT INVENTORY]: Could not resolve user {0} for caps inventory update",
remoteClient.AgentId); remoteClient.AgentId);
} }
return UUID.Zero; return UUID.Zero;
} }
@ -283,9 +283,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
part.Inventory.RemoveScriptInstance(item.ItemID); part.Inventory.RemoveScriptInstance(item.ItemID);
} }
// Update item with new asset // Update item with new asset
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
group.UpdateInventoryItem(item); group.UpdateInventoryItem(item);
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
@ -406,7 +406,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="recipientClient"></param> /// <param name="recipientClient"></param>
/// <param name="senderId">ID of the sender of the item</param> /// <param name="senderId">ID of the sender of the item</param>
/// <param name="itemId"></param> /// <param name="itemId"></param>
public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId) public virtual void GiveInventoryItem(IClientAPI recipientClient, UUID senderId, UUID itemId)
{ {
InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId); InventoryItemBase itemCopy = GiveInventoryItem(recipientClient.AgentId, senderId, itemId);
@ -420,19 +420,19 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="recipient"></param> /// <param name="recipient"></param>
/// <param name="senderId">ID of the sender of the item</param> /// <param name="senderId">ID of the sender of the item</param>
/// <param name="itemId"></param> /// <param name="itemId"></param>
/// <returns>The inventory item copy given, null if the give was unsuccessful</returns> /// <returns>The inventory item copy given, null if the give was unsuccessful</returns>
public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId) public virtual InventoryItemBase GiveInventoryItem(UUID recipient, UUID senderId, UUID itemId)
{ {
return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero); return GiveInventoryItem(recipient, senderId, itemId, UUID.Zero);
} }
/// <summary> /// <summary>
/// Give an inventory item from one user to another /// Give an inventory item from one user to another
/// </summary> /// </summary>
/// <param name="recipient"></param> /// <param name="recipient"></param>
/// <param name="senderId">ID of the sender of the item</param> /// <param name="senderId">ID of the sender of the item</param>
/// <param name="itemId"></param> /// <param name="itemId"></param>
/// <param name="recipientFolderId"> /// <param name="recipientFolderId">
/// The id of the folder in which the copy item should go. If UUID.Zero then the item is placed in the most /// The id of the folder in which the copy item should go. If UUID.Zero then the item is placed in the most
/// appropriate default folder. /// appropriate default folder.
@ -485,7 +485,7 @@ namespace OpenSim.Region.Environment.Scenes
itemCopy.AssetType = item.AssetType; itemCopy.AssetType = item.AssetType;
itemCopy.InvType = item.InvType; itemCopy.InvType = item.InvType;
itemCopy.Folder = recipientFolderId; itemCopy.Folder = recipientFolderId;
if (Permissions.PropagatePermissions()) if (Permissions.PropagatePermissions())
{ {
if (item.InvType == 6) if (item.InvType == 6)
@ -557,19 +557,19 @@ namespace OpenSim.Region.Environment.Scenes
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder");
return null; return null;
} }
return null; return null;
} }
/// <summary> /// <summary>
/// Give an entire inventory folder from one user to another. The entire contents (including all descendent /// Give an entire inventory folder from one user to another. The entire contents (including all descendent
/// folders) is given. /// folders) is given.
/// </summary> /// </summary>
/// <param name="recipientId"></param> /// <param name="recipientId"></param>
/// <param name="senderId">ID of the sender of the item</param> /// <param name="senderId">ID of the sender of the item</param>
/// <param name="folderId"></param> /// <param name="folderId"></param>
/// <param name="recipientParentFolderId"> /// <param name="recipientParentFolderId">
/// The id of the receipient folder in which the send folder should be placed. If UUID.Zero then the /// The id of the receipient folder in which the send folder should be placed. If UUID.Zero then the
/// recipient folder is the root folder /// recipient folder is the root folder
/// </param> /// </param>
/// <returns> /// <returns>
@ -588,24 +588,24 @@ namespace OpenSim.Region.Environment.Scenes
return null; return null;
} }
if (!senderUserInfo.HasReceivedInventory) if (!senderUserInfo.HasReceivedInventory)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[AGENT INVENTORY]: Could not give inventory folder - have not yet received inventory for {0}", "[AGENT INVENTORY]: Could not give inventory folder - have not yet received inventory for {0}",
senderId); senderId);
return null; return null;
} }
InventoryFolderImpl folder = senderUserInfo.RootFolder.FindFolder(folderId); InventoryFolderImpl folder = senderUserInfo.RootFolder.FindFolder(folderId);
if (null == folder) if (null == folder)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find inventory folder {0} to give", folderId); "[AGENT INVENTORY]: Could not find inventory folder {0} to give", folderId);
return null; return null;
} }
CachedUserInfo recipientUserInfo CachedUserInfo recipientUserInfo
@ -618,30 +618,30 @@ namespace OpenSim.Region.Environment.Scenes
return null; return null;
} }
if (recipientParentFolderId == UUID.Zero) if (recipientParentFolderId == UUID.Zero)
recipientParentFolderId = recipientUserInfo.RootFolder.ID; recipientParentFolderId = recipientUserInfo.RootFolder.ID;
UUID newFolderId = UUID.Random(); UUID newFolderId = UUID.Random();
recipientUserInfo.CreateFolder(folder.Name, newFolderId, (ushort)folder.Type, recipientParentFolderId); recipientUserInfo.CreateFolder(folder.Name, newFolderId, (ushort)folder.Type, recipientParentFolderId);
// XXX: Messy - we should really get this back in the CreateFolder call // XXX: Messy - we should really get this back in the CreateFolder call
InventoryFolderImpl copiedFolder = recipientUserInfo.RootFolder.FindFolder(newFolderId); InventoryFolderImpl copiedFolder = recipientUserInfo.RootFolder.FindFolder(newFolderId);
// Give all the subfolders // Give all the subfolders
List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls(); List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls();
foreach (InventoryFolderImpl childFolder in subFolders) foreach (InventoryFolderImpl childFolder in subFolders)
{ {
GiveInventoryFolder(recipientId, senderId, childFolder.ID, copiedFolder.ID); GiveInventoryFolder(recipientId, senderId, childFolder.ID, copiedFolder.ID);
} }
// Give all the items // Give all the items
List<InventoryItemBase> items = folder.RequestListOfItems(); List<InventoryItemBase> items = folder.RequestListOfItems();
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
GiveInventoryItem(recipientId, senderId, item.ID, copiedFolder.ID); GiveInventoryItem(recipientId, senderId, item.ID, copiedFolder.ID);
} }
return copiedFolder; return copiedFolder;
} }
@ -688,7 +688,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (newName != String.Empty) if (newName != String.Empty)
{ {
asset.Name = newName; asset.Metadata.Name = newName;
} }
else else
{ {
@ -728,10 +728,10 @@ namespace OpenSim.Region.Environment.Scenes
private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data)
{ {
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = name; asset.Metadata.Name = name;
asset.Description = description; asset.Metadata.Description = description;
asset.Type = assetType; asset.Metadata.Type = assetType;
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
asset.Data = (data == null) ? new byte[1] : data; asset.Data = (data == null) ? new byte[1] : data;
return asset; return asset;
@ -831,11 +831,11 @@ namespace OpenSim.Region.Environment.Scenes
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
item.Creator = remoteClient.AgentId; item.Creator = remoteClient.AgentId;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = name; item.Name = name;
item.Flags = flags; item.Flags = flags;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = invType; item.InvType = invType;
item.Folder = folderID; item.Folder = folderID;
item.CurrentPermissions = currentMask; item.CurrentPermissions = currentMask;
@ -879,7 +879,7 @@ namespace OpenSim.Region.Environment.Scenes
if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId)) if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return; return;
if (transactionID == UUID.Zero) if (transactionID == UUID.Zero)
{ {
CachedUserInfo userInfo CachedUserInfo userInfo
@ -890,7 +890,7 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence presence; ScenePresence presence;
TryGetAvatar(remoteClient.AgentId, out presence); TryGetAvatar(remoteClient.AgentId, out presence);
byte[] data = null; byte[] data = null;
if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum
{ {
Vector3 pos = presence.AbsolutePosition; Vector3 pos = presence.AbsolutePosition;
@ -905,7 +905,7 @@ namespace OpenSim.Region.Environment.Scenes
AssetBase asset = CreateAsset(name, description, assetType, data); AssetBase asset = CreateAsset(name, description, assetType, data);
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
CreateNewInventoryItem(remoteClient, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); CreateNewInventoryItem(remoteClient, folderID, asset.Metadata.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
} }
else else
{ {
@ -1429,7 +1429,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
else // Updating existing item with new perms etc else // Updating existing item with new perms etc
{ {
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
if (agentTransactions != null) if (agentTransactions != null)
{ {
@ -1511,7 +1511,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
else // script has been rezzed directly into a prim's inventory else // script has been rezzed directly into a prim's inventory
{ {
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder); SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
if (part == null) if (part == null)
return; return;
@ -1521,10 +1521,10 @@ namespace OpenSim.Region.Environment.Scenes
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return; return;
if (!Permissions.CanCreateObjectInventory( if (!Permissions.CanCreateObjectInventory(
itemBase.InvType, part.UUID, remoteClient.AgentId)) itemBase.InvType, part.UUID, remoteClient.AgentId))
return; return;
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}")); AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
@ -1550,7 +1550,7 @@ namespace OpenSim.Region.Environment.Scenes
taskItem.Flags = itemBase.Flags; taskItem.Flags = itemBase.Flags;
taskItem.PermsGranter = UUID.Zero; taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0; taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID; taskItem.AssetID = asset.Metadata.FullID;
part.Inventory.AddInventoryItem(taskItem, false); part.Inventory.AddInventoryItem(taskItem, false);
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
@ -1737,7 +1737,7 @@ namespace OpenSim.Region.Environment.Scenes
grp.UUID, grp.UUID,
remoteClient.AgentId); remoteClient.AgentId);
permissionToDelete = permissionToTake; permissionToDelete = permissionToTake;
if (permissionToDelete) if (permissionToDelete)
{ {
AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return"); AddReturn(grp.OwnerID, grp.Name, grp.AbsolutePosition, "parcel owner return");
@ -1794,8 +1794,8 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="action"></param> /// <param name="action"></param>
/// <param name="folderID"></param> /// <param name="folderID"></param>
/// <param name="objectGroup"></param> /// <param name="objectGroup"></param>
/// <param name="remoteClient"> </param> /// <param name="remoteClient"> </param>
public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
SceneObjectGroup objectGroup, IClientAPI remoteClient) SceneObjectGroup objectGroup, IClientAPI remoteClient)
{ {
@ -1807,7 +1807,7 @@ namespace OpenSim.Region.Environment.Scenes
// //
CachedUserInfo userInfo; CachedUserInfo userInfo;
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
action == DeRezAction.SaveToExistingUserInventoryItem) action == DeRezAction.SaveToExistingUserInventoryItem)
{ {
// Take or take copy require a taker // Take or take copy require a taker
@ -1850,25 +1850,25 @@ namespace OpenSim.Region.Environment.Scenes
// //
InventoryFolderBase folder = null; InventoryFolderBase folder = null;
InventoryItemBase item = null; InventoryItemBase item = null;
if (DeRezAction.SaveToExistingUserInventoryItem == action) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item = userInfo.RootFolder.FindItem( item = userInfo.RootFolder.FindItem(
objectGroup.RootPart.FromUserInventoryItemID); objectGroup.RootPart.FromUserInventoryItemID);
if (null == item) if (null == item)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.", "[AGENT INVENTORY]: Object {0} {1} scheduled for save to inventory has already been deleted.",
objectGroup.Name, objectGroup.UUID); objectGroup.Name, objectGroup.UUID);
return UUID.Zero; return UUID.Zero;
} }
} }
else else
{ {
// Folder magic // Folder magic
// //
if (action == DeRezAction.Delete) if (action == DeRezAction.Delete)
{ {
// Deleting someone else's item // Deleting someone else's item
@ -1940,7 +1940,7 @@ namespace OpenSim.Region.Environment.Scenes
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = folder.ID; item.Folder = folder.ID;
item.Owner = userInfo.UserProfile.ID; item.Owner = userInfo.UserProfile.ID;
} }
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
@ -1949,16 +1949,16 @@ namespace OpenSim.Region.Environment.Scenes
(sbyte)AssetType.Object, (sbyte)AssetType.Object,
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
assetID = asset.FullID; assetID = asset.Metadata.FullID;
if (DeRezAction.SaveToExistingUserInventoryItem == action) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
userInfo.UpdateItem(item); userInfo.UpdateItem(item);
} }
else else
{ {
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions()) if (remoteClient != null && (remoteClient.AgentId != objectGroup.RootPart.OwnerID) && Permissions.PropagatePermissions())
{ {
@ -1991,12 +1991,12 @@ namespace OpenSim.Region.Environment.Scenes
// TODO: add the new fields (Flags, Sale info, etc) // TODO: add the new fields (Flags, Sale info, etc)
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
userInfo.AddItem(item); userInfo.AddItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId) if (remoteClient != null && item.Owner == remoteClient.AgentId)
{ {
remoteClient.SendInventoryItemCreateUpdate(item); remoteClient.SendInventoryItemCreateUpdate(item);
@ -2008,10 +2008,10 @@ namespace OpenSim.Region.Environment.Scenes
{ {
notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item); notifyUser.ControllingClient.SendInventoryItemCreateUpdate(item);
} }
} }
} }
} }
return assetID; return assetID;
} }
@ -2025,11 +2025,11 @@ namespace OpenSim.Region.Environment.Scenes
m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID); m_log.InfoFormat("[ATTACHMENT]: Save request for {0} which is unchanged", grp.UUID);
return; return;
} }
m_log.InfoFormat( m_log.InfoFormat(
"[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}", "[ATTACHMENT]: Updating asset for attachment {0}, attachpoint {1}",
grp.UUID, grp.GetAttachmentPoint()); grp.UUID, grp.GetAttachmentPoint());
string sceneObjectXml = objectGroup.ToXmlString(); string sceneObjectXml = objectGroup.ToXmlString();
CachedUserInfo userInfo = CachedUserInfo userInfo =
@ -2077,10 +2077,10 @@ namespace OpenSim.Region.Environment.Scenes
Utils.StringToBytes(sceneObjectXml)); Utils.StringToBytes(sceneObjectXml));
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = foundFolder; item.Folder = foundFolder;
@ -2118,10 +2118,10 @@ namespace OpenSim.Region.Environment.Scenes
item.Creator = grp.RootPart.CreatorID; item.Creator = grp.RootPart.CreatorID;
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = UUID.Zero; // Objects folder! item.Folder = UUID.Zero; // Objects folder!
@ -2241,20 +2241,20 @@ namespace OpenSim.Region.Environment.Scenes
if (rezAsset != null) if (rezAsset != null)
{ {
UUID itemId = UUID.Zero; UUID itemId = UUID.Zero;
// If we have permission to copy then link the rezzed object back to the user inventory // If we have permission to copy then link the rezzed object back to the user inventory
// item that it came from. This allows us to enable 'save object to inventory' // item that it came from. This allows us to enable 'save object to inventory'
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
{ {
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy)
{ {
itemId = item.ID; itemId = item.ID;
} }
} }
string xmlData = Utils.BytesToString(rezAsset.Data); string xmlData = Utils.BytesToString(rezAsset.Data);
SceneObjectGroup group = new SceneObjectGroup(itemId, xmlData, true); SceneObjectGroup group = new SceneObjectGroup(itemId, xmlData, true);
if (!Permissions.CanRezObject( if (!Permissions.CanRezObject(
group.Children.Count, remoteClient.AgentId, pos) group.Children.Count, remoteClient.AgentId, pos)
&& !attachment) && !attachment)
@ -2351,12 +2351,12 @@ namespace OpenSim.Region.Environment.Scenes
group.ClearPartAttachmentData(); group.ClearPartAttachmentData();
} }
} }
if (!attachment) if (!attachment)
{ {
// Fire on_rez // Fire on_rez
group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); group.CreateScriptInstances(0, true, DefaultScriptEngine, 0);
rootPart.ScheduleFullUpdate(); rootPart.ScheduleFullUpdate();
} }
@ -2500,7 +2500,7 @@ namespace OpenSim.Region.Environment.Scenes
DeRezObject(null, grp.RootPart.LocalId, DeRezObject(null, grp.RootPart.LocalId,
grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero); grp.RootPart.GroupID, DeRezAction.Return, UUID.Zero);
} }
return true; return true;
} }
@ -2632,7 +2632,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient); m_sceneGraph.DetachSingleAttachmentToInv(itemID, remoteClient);
} }

View File

@ -115,18 +115,18 @@ namespace OpenSim.Region.Environment.Scenes
/// <value> /// <value>
/// All the region modules attached to this scene. /// All the region modules attached to this scene.
/// </value> /// </value>
public Dictionary<string, IRegionModule> Modules public Dictionary<string, IRegionModule> Modules
{ {
get { return m_modules; } get { return m_modules; }
} }
protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>(); protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>();
/// <value> /// <value>
/// The module interfaces available from this scene. /// The module interfaces available from this scene.
/// </value> /// </value>
protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >(); protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >();
protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
@ -143,7 +143,7 @@ namespace OpenSim.Region.Environment.Scenes
protected IInterregionCommsIn m_interregionCommsIn; protected IInterregionCommsIn m_interregionCommsIn;
protected IDialogModule m_dialogModule; protected IDialogModule m_dialogModule;
protected internal ICapabilitiesModule CapsModule; protected internal ICapabilitiesModule CapsModule;
// Central Update Loop // Central Update Loop
protected int m_fps = 10; protected int m_fps = 10;
@ -280,10 +280,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
public int objectCapacity = 45000; public int objectCapacity = 45000;
/// <value> /// <value>
/// Registered classes that are capable of creating entities. /// Registered classes that are capable of creating entities.
/// </value> /// </value>
protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>(); protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
#endregion #endregion
@ -316,7 +316,7 @@ namespace OpenSim.Region.Environment.Scenes
m_eventManager = new EventManager(); m_eventManager = new EventManager();
m_permissions = new ScenePermissions(this); m_permissions = new ScenePermissions(this);
m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this);
m_asyncSceneObjectDeleter.Enabled = true; m_asyncSceneObjectDeleter.Enabled = true;
@ -421,7 +421,7 @@ namespace OpenSim.Region.Environment.Scenes
protected virtual void RegisterDefaultSceneEvents() protected virtual void RegisterDefaultSceneEvents()
{ {
IDialogModule dm = RequestModuleInterface<IDialogModule>(); IDialogModule dm = RequestModuleInterface<IDialogModule>();
if (dm != null) if (dm != null)
m_eventManager.OnPermissionError += dm.SendAlertToUser; m_eventManager.OnPermissionError += dm.SendAlertToUser;
} }
@ -564,7 +564,7 @@ namespace OpenSim.Region.Environment.Scenes
m_incrementsof15seconds = (int)seconds / 15; m_incrementsof15seconds = (int)seconds / 15;
m_RestartTimerCounter = 0; m_RestartTimerCounter = 0;
m_restartTimer.AutoReset = true; m_restartTimer.AutoReset = true;
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
m_restartTimer.Start(); m_restartTimer.Start();
m_dialogModule.SendNotificationToUsersInRegion( m_dialogModule.SendNotificationToUsersInRegion(
@ -583,8 +583,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
m_dialogModule.SendNotificationToUsersInRegion( m_dialogModule.SendNotificationToUsersInRegion(
UUID.Random(), UUID.Random(),
String.Empty, String.Empty,
RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds"); RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds");
} }
else else
@ -717,7 +717,7 @@ namespace OpenSim.Region.Environment.Scenes
// Stop all client threads. // Stop all client threads.
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(true); }); ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(true); });
// Stop updating the scene objects and agents. // Stop updating the scene objects and agents.
//m_heartbeatTimer.Close(); //m_heartbeatTimer.Close();
shuttingdown = true; shuttingdown = true;
@ -733,7 +733,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_sceneGraph.Close(); m_sceneGraph.Close();
// De-register with region communications (events cleanup) // De-register with region communications (events cleanup)
UnRegisterRegionWithComms(); UnRegisterRegionWithComms();
@ -1400,7 +1400,7 @@ namespace OpenSim.Region.Environment.Scenes
//tc = System.Environment.TickCount - tc; //tc = System.Environment.TickCount - tc;
//m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms"); //m_log.Info("[MAPTILE]: Completed One row in " + tc + " ms");
} }
m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (System.Environment.TickCount - tc) + " ms"); m_log.Info("[MAPTILE]: Generating Maptile Step 1: Done in " + (System.Environment.TickCount - tc) + " ms");
bool drawPrimVolume = true; bool drawPrimVolume = true;
@ -1644,13 +1644,13 @@ namespace OpenSim.Region.Environment.Scenes
m_regInfo.RegionSettings.TerrainImageID = TerrainImageUUID; m_regInfo.RegionSettings.TerrainImageID = TerrainImageUUID;
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.FullID = m_regInfo.RegionSettings.TerrainImageID; asset.Metadata.FullID = m_regInfo.RegionSettings.TerrainImageID;
asset.Data = data; asset.Data = data;
asset.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString(); asset.Metadata.Name = "terrainImage_" + m_regInfo.RegionID.ToString() + "_" + lastMapRefresh.ToString();
asset.Description = RegionInfo.RegionName; asset.Metadata.Description = RegionInfo.RegionName;
asset.Type = 0; asset.Metadata.Type = 0;
asset.Temporary = temporary; asset.Metadata.Temporary = temporary;
AssetCache.AddAsset(asset); AssetCache.AddAsset(asset);
} }
@ -1699,7 +1699,7 @@ namespace OpenSim.Region.Environment.Scenes
m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children", m_log.ErrorFormat("[SCENE] Found a SceneObjectGroup with m_rootPart == null and {0} children",
group.Children == null ? 0 : group.Children.Count); group.Children == null ? 0 : group.Children.Count);
} }
AddRestoredSceneObject(group, true, true); AddRestoredSceneObject(group, true, true);
SceneObjectPart rootPart = group.GetChildPart(group.UUID); SceneObjectPart rootPart = group.GetChildPart(group.UUID);
rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted; rootPart.ObjectFlags &= ~(uint)PrimFlags.Scripted;
@ -1814,7 +1814,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
//m_log.DebugFormat( //m_log.DebugFormat(
// "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName); // "[SCENE]: Scene.AddNewPrim() pcode {0} called for {1} in {2}", shape.PCode, ownerID, RegionInfo.RegionName);
// If an entity creator has been registered for this prim type then use that // If an entity creator has been registered for this prim type then use that
if (m_entityCreators.ContainsKey((PCode)shape.PCode)) if (m_entityCreators.ContainsKey((PCode)shape.PCode))
return m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape); return m_entityCreators[(PCode)shape.PCode].CreateEntity(ownerID, groupID, pos, rot, shape);
@ -2094,7 +2094,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns> /// <returns></returns>
public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod) public bool IncomingInterRegionPrimGroup(UUID primID, string objXMLData, int XMLMethod)
{ {
if (XMLMethod == 0) if (XMLMethod == 0)
{ {
m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID); m_log.DebugFormat("[INTERREGION]: A new prim {0} arrived from a neighbor", primID);
@ -2308,7 +2308,7 @@ namespace OpenSim.Region.Environment.Scenes
CreateAndAddScenePresence(client); CreateAndAddScenePresence(client);
} }
m_LastLogin = System.Environment.TickCount; m_LastLogin = System.Environment.TickCount;
EventManager.TriggerOnNewClient(client); EventManager.TriggerOnNewClient(client);
} }
@ -2390,7 +2390,7 @@ namespace OpenSim.Region.Environment.Scenes
client.OnUnackedTerrain += TerrainUnAcked; client.OnUnackedTerrain += TerrainUnAcked;
client.OnObjectOwner += ObjectOwner; client.OnObjectOwner += ObjectOwner;
if (StatsReporter != null) if (StatsReporter != null)
client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats; client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats;
@ -2561,7 +2561,7 @@ namespace OpenSim.Region.Environment.Scenes
m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}", m_log.ErrorFormat("[APPEARANCE]: Problem fetching appearance for avatar {0}, {1}",
client.Name, e); client.Name, e);
} }
m_log.Warn("[APPEARANCE]: Appearance not found, returning default"); m_log.Warn("[APPEARANCE]: Appearance not found, returning default");
} }
@ -2770,21 +2770,21 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID);
if (sp != null) if (sp != null)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[SCENE]: Adjusting known seeds for existing agent {0} in {1}", "[SCENE]: Adjusting known seeds for existing agent {0} in {1}",
agent.AgentID, RegionInfo.RegionName); agent.AgentID, RegionInfo.RegionName);
sp.AdjustKnownSeeds(); sp.AdjustKnownSeeds();
return; return;
} }
// Don't disable this log message - it's too helpful // Don't disable this log message - it's too helpful
m_log.DebugFormat( m_log.DebugFormat(
"[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})", "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})",
RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode);
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
{ {
m_log.WarnFormat( m_log.WarnFormat(
@ -2808,10 +2808,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent); m_authenticateHandler.AddNewCircuit(agent.circuitcode, agent);
// rewrite session_id // rewrite session_id
CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID); CachedUserInfo userinfo = CommsManager.UserProfileCacheService.GetUserDetails(agent.AgentID);
if (userinfo != null) if (userinfo != null)
{ {
userinfo.SessionID = agent.SessionID; userinfo.SessionID = agent.SessionID;
@ -2873,12 +2873,12 @@ namespace OpenSim.Region.Environment.Scenes
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{ {
ScenePresence presence; ScenePresence presence;
lock (m_scenePresences) lock (m_scenePresences)
{ {
m_scenePresences.TryGetValue(agentID, out presence); m_scenePresences.TryGetValue(agentID, out presence);
} }
if (presence != null) if (presence != null)
{ {
try try
@ -2902,14 +2902,14 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName); // "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null) if (childAgentUpdate != null)
{ {
childAgentUpdate.ChildAgentDataUpdate(cAgentData); childAgentUpdate.ChildAgentDataUpdate(cAgentData);
return true; return true;
} }
return false; return false;
} }
@ -2932,10 +2932,10 @@ namespace OpenSim.Region.Environment.Scenes
// Not Implemented: // Not Implemented:
//TODO: Do we need to pass the message on to one of our neighbors? //TODO: Do we need to pass the message on to one of our neighbors?
} }
return true; return true;
} }
return false; return false;
} }
@ -2957,7 +2957,7 @@ namespace OpenSim.Region.Environment.Scenes
public bool IncomingCloseAgent(UUID agentID) public bool IncomingCloseAgent(UUID agentID)
{ {
//m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
if (presence != null) if (presence != null)
{ {
@ -2972,7 +2972,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
// Don't do this to root agents on logout, it's not nice for the viewer // Don't do this to root agents on logout, it's not nice for the viewer
if (presence.IsChildAgent) if (presence.IsChildAgent)
{ {
// Tell a single agent to disconnect from the region. // Tell a single agent to disconnect from the region.
IEventQueue eq = RequestModuleInterface<IEventQueue>(); IEventQueue eq = RequestModuleInterface<IEventQueue>();
@ -2984,11 +2984,11 @@ namespace OpenSim.Region.Environment.Scenes
else else
presence.ControllingClient.SendShutdownConnectionNotice(); presence.ControllingClient.SendShutdownConnectionNotice();
} }
presence.ControllingClient.Close(true); presence.ControllingClient.Close(true);
return true; return true;
} }
// Agent not here // Agent not here
return false; return false;
} }
@ -3059,7 +3059,7 @@ namespace OpenSim.Region.Environment.Scenes
remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
return; return;
} }
RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags);
} }
@ -3080,7 +3080,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_scenePresences.ContainsKey(remoteClient.AgentId)) if (m_scenePresences.ContainsKey(remoteClient.AgentId))
sp = m_scenePresences[remoteClient.AgentId]; sp = m_scenePresences[remoteClient.AgentId];
} }
if (sp != null) if (sp != null)
{ {
m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, m_sceneGridService.RequestTeleportToLocation(sp, regionHandle,
@ -3211,7 +3211,7 @@ namespace OpenSim.Region.Environment.Scenes
return; return;
l.Add(mod); l.Add(mod);
if (mod is IEntityCreator) if (mod is IEntityCreator)
{ {
IEntityCreator entityCreator = (IEntityCreator)mod; IEntityCreator entityCreator = (IEntityCreator)mod;
@ -3220,7 +3220,7 @@ namespace OpenSim.Region.Environment.Scenes
m_entityCreators[pcode] = entityCreator; m_entityCreators[pcode] = entityCreator;
} }
} }
ModuleInterfaces[typeof(M)] = l; ModuleInterfaces[typeof(M)] = l;
} }
@ -3243,7 +3243,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary> /// <summary>
/// For the given interface, retrieve an array of region modules that implement it. /// For the given interface, retrieve an array of region modules that implement it.
/// </summary> /// </summary>
/// <returns>an empty array if there are no registered modules implementing that interface</returns> /// <returns>an empty array if there are no registered modules implementing that interface</returns>
public override T[] RequestModuleInterfaces<T>() public override T[] RequestModuleInterfaces<T>()
{ {
if (ModuleInterfaces.ContainsKey(typeof(T))) if (ModuleInterfaces.ContainsKey(typeof(T)))
@ -3383,7 +3383,7 @@ namespace OpenSim.Region.Environment.Scenes
else else
{ {
m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied"); m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied");
} }
} }
} }
@ -3855,14 +3855,14 @@ namespace OpenSim.Region.Environment.Scenes
public override bool PresenceChildStatus(UUID avatarID) public override bool PresenceChildStatus(UUID avatarID)
{ {
ScenePresence cp = GetScenePresence(avatarID); ScenePresence cp = GetScenePresence(avatarID);
// FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing
// This needs to be fixed properly by cleaning up the logout code. // This needs to be fixed properly by cleaning up the logout code.
//if (cp != null) //if (cp != null)
// return cp.IsChildAgent; // return cp.IsChildAgent;
//return false; //return false;
return cp.IsChildAgent; return cp.IsChildAgent;
} }
@ -4140,10 +4140,10 @@ namespace OpenSim.Region.Environment.Scenes
item.ID = UUID.Random(); item.ID = UUID.Random();
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
item.AssetID = asset.FullID; item.AssetID = asset.Metadata.FullID;
item.Description = asset.Description; item.Description = asset.Metadata.Description;
item.Name = asset.Name; item.Name = asset.Metadata.Name;
item.AssetType = asset.Type; item.AssetType = asset.Metadata.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = categoryID; item.Folder = categoryID;
@ -4194,7 +4194,7 @@ namespace OpenSim.Region.Environment.Scenes
if (!okToSell) if (!okToSell)
{ {
m_dialogModule.SendAlertToUser( m_dialogModule.SendAlertToUser(
remoteClient, "This item's inventory doesn't appear to be for sale"); remoteClient, "This item's inventory doesn't appear to be for sale");
return false; return false;
} }
@ -4252,7 +4252,7 @@ namespace OpenSim.Region.Environment.Scenes
// This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene // This routine is normally called from within a lock (OdeLock) from within the OdePhysicsScene
// WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called // WARNING: be careful of deadlocks here if you manipulate the scene. Remember you are being called
// from within the OdePhysicsScene. // from within the OdePhysicsScene.
protected internal void jointMoved(PhysicsJoint joint) protected internal void jointMoved(PhysicsJoint joint)
{ {
@ -4348,7 +4348,7 @@ namespace OpenSim.Region.Environment.Scenes
// FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary // FIXME: this causes a sequential lookup of all objects in the scene; use a dictionary
if (joint != null) if (joint != null)
{ {
if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages) if (joint.ErrorMessageCount > PhysicsJoint.maxErrorMessages)
return; return;
SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene); SceneObjectPart jointProxyObject = GetSceneObjectPart(joint.ObjectNameInScene);

View File

@ -37,8 +37,8 @@ using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.ScriptEngine.Shared; using OpenSim.Region.ScriptEngine.Shared;
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
using OpenSim.Region.ScriptEngine.Shared.ScriptBase; using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Interfaces;
using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
@ -117,7 +117,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host = host; m_host = host;
m_localID = localID; m_localID = localID;
m_itemID = itemID; m_itemID = itemID;
if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false))
m_OSFunctionsEnabled = true; m_OSFunctionsEnabled = true;
@ -328,9 +328,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice"); CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
IDialogModule dm = World.RequestModuleInterface<IDialogModule>(); IDialogModule dm = World.RequestModuleInterface<IDialogModule>();
if (dm != null) if (dm != null)
dm.SendGeneralAlert(msg); dm.SendGeneralAlert(msg);
} }
@ -776,7 +776,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return String.Empty; return String.Empty;
} }
} }
public string osGetSimulatorVersion() public string osGetSimulatorVersion()
{ {
// High because it can be used to target attacks to known weaknesses // High because it can be used to target attacks to known weaknesses
@ -802,37 +802,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
World.ParcelMediaSetTime((float)time); World.ParcelMediaSetTime((float)time);
} }
public Hashtable osParseJSON(string JSON) public Hashtable osParseJSON(string JSON)
{ {
CheckThreatLevel(ThreatLevel.None, "osParseJSON"); CheckThreatLevel(ThreatLevel.None, "osParseJSON");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// see http://www.json.org/ for more details on JSON // see http://www.json.org/ for more details on JSON
string currentKey=null; string currentKey=null;
Stack objectStack = new Stack(); // objects in JSON can be nested so we need to keep a track of this Stack objectStack = new Stack(); // objects in JSON can be nested so we need to keep a track of this
Hashtable jsondata = new Hashtable(); // the hashtable to be returned Hashtable jsondata = new Hashtable(); // the hashtable to be returned
int i=0; int i=0;
try try
{ {
// iterate through the serialised stream of tokens and store at the right depth in the hashtable // iterate through the serialised stream of tokens and store at the right depth in the hashtable
// the top level hashtable may contain more nested hashtables within it each containing an objects representation // the top level hashtable may contain more nested hashtables within it each containing an objects representation
for (i=0;i<JSON.Length; i++) for (i=0;i<JSON.Length; i++)
{ {
// Console.WriteLine(""+JSON[i]); // Console.WriteLine(""+JSON[i]);
switch (JSON[i]) switch (JSON[i])
{ {
case '{': case '{':
// create hashtable and add it to the stack or array if we are populating one, we can have a lot of nested objects in JSON // create hashtable and add it to the stack or array if we are populating one, we can have a lot of nested objects in JSON
Hashtable currentObject = new Hashtable(); Hashtable currentObject = new Hashtable();
if (objectStack.Count==0) // the stack should only be empty for the first outer object if (objectStack.Count==0) // the stack should only be empty for the first outer object
{ {
objectStack.Push(jsondata); objectStack.Push(jsondata);
} }
else if (objectStack.Peek().ToString()=="System.Collections.ArrayList") else if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
@ -842,12 +842,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
objectStack.Push(currentObject); objectStack.Push(currentObject);
} }
else else
{ {
// add it to the parent hashtable // add it to the parent hashtable
((Hashtable)objectStack.Peek()).Add(currentKey,currentObject); ((Hashtable)objectStack.Peek()).Add(currentKey,currentObject);
objectStack.Push(currentObject); objectStack.Push(currentObject);
} }
// clear the key // clear the key
currentKey=null; currentKey=null;
break; break;
@ -856,25 +856,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
objectStack.Pop(); objectStack.Pop();
break; break;
case '"':// string boundary case '"':// string boundary
string tokenValue=""; string tokenValue="";
i++; // move to next char i++; // move to next char
// just loop through until the next quote mark storing the string, ignore quotes with pre-ceding \ // just loop through until the next quote mark storing the string, ignore quotes with pre-ceding \
while (JSON[i]!='"') while (JSON[i]!='"')
{ {
tokenValue+=JSON[i]; tokenValue+=JSON[i];
// handle escaped double quotes \" // handle escaped double quotes \"
if (JSON[i]=='\\' && JSON[i+1]=='"') if (JSON[i]=='\\' && JSON[i+1]=='"')
{ {
tokenValue+=JSON[i+1]; tokenValue+=JSON[i+1];
i++; i++;
} }
i++; i++;
} }
// ok we've got a string, if we've got an array on the top of the stack then we store it // ok we've got a string, if we've got an array on the top of the stack then we store it
if (objectStack.Peek().ToString()=="System.Collections.ArrayList") if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{ {
@ -884,14 +884,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
currentKey = tokenValue; currentKey = tokenValue;
} }
else else
{ {
// we have a key so lets store this value // we have a key so lets store this value
((Hashtable)objectStack.Peek()).Add(currentKey,tokenValue); ((Hashtable)objectStack.Peek()).Add(currentKey,tokenValue);
// now lets clear the key, we're done with it and moving on // now lets clear the key, we're done with it and moving on
currentKey=null; currentKey=null;
} }
break; break;
case ':':// key : value separator case ':':// key : value separator
// just ignore // just ignore
@ -900,20 +900,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// just ignore // just ignore
break; break;
case '[': // array start case '[': // array start
ArrayList currentArray = new ArrayList(); ArrayList currentArray = new ArrayList();
if (objectStack.Peek().ToString()=="System.Collections.ArrayList") if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{ {
((ArrayList)objectStack.Peek()).Add(currentArray); ((ArrayList)objectStack.Peek()).Add(currentArray);
} }
else else
{ {
((Hashtable)objectStack.Peek()).Add(currentKey,currentArray); ((Hashtable)objectStack.Peek()).Add(currentKey,currentArray);
// clear the key // clear the key
currentKey=null; currentKey=null;
} }
objectStack.Push(currentArray); objectStack.Push(currentArray);
break; break;
case ',':// seperator case ',':// seperator
// just ignore // just ignore
@ -923,24 +923,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
objectStack.Pop(); objectStack.Pop();
break; break;
case 't': // we've found a character start not in quotes, it must be a boolean true case 't': // we've found a character start not in quotes, it must be a boolean true
if (objectStack.Peek().ToString()=="System.Collections.ArrayList") if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{ {
((ArrayList)objectStack.Peek()).Add(true); ((ArrayList)objectStack.Peek()).Add(true);
} }
else else
{ {
((Hashtable)objectStack.Peek()).Add(currentKey,true); ((Hashtable)objectStack.Peek()).Add(currentKey,true);
currentKey=null; currentKey=null;
} }
//advance the counter to the letter 'e' //advance the counter to the letter 'e'
i = i+3; i = i+3;
break; break;
case 'f': // we've found a character start not in quotes, it must be a boolean false case 'f': // we've found a character start not in quotes, it must be a boolean false
if (objectStack.Peek().ToString()=="System.Collections.ArrayList") if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{ {
((ArrayList)objectStack.Peek()).Add(false); ((ArrayList)objectStack.Peek()).Add(false);
} }
else else
@ -960,53 +960,53 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
default: default:
// ok here we're catching all numeric types int,double,long we might want to spit these up mr accurately // ok here we're catching all numeric types int,double,long we might want to spit these up mr accurately
// but for now we'll just do them as strings // but for now we'll just do them as strings
string numberValue=""; string numberValue="";
// just loop through until the next known marker quote mark storing the string // just loop through until the next known marker quote mark storing the string
while (JSON[i] != '"' && JSON[i] != ',' && JSON[i] != ']' && JSON[i] != '}' && JSON[i] != ' ') while (JSON[i] != '"' && JSON[i] != ',' && JSON[i] != ']' && JSON[i] != '}' && JSON[i] != ' ')
{ {
numberValue+=""+JSON[i++]; numberValue+=""+JSON[i++];
} }
i--; // we want to process this caracter that marked the end of this string in the main loop i--; // we want to process this caracter that marked the end of this string in the main loop
// ok we've got a string, if we've got an array on the top of the stack then we store it // ok we've got a string, if we've got an array on the top of the stack then we store it
if (objectStack.Peek().ToString()=="System.Collections.ArrayList") if (objectStack.Peek().ToString()=="System.Collections.ArrayList")
{ {
((ArrayList)objectStack.Peek()).Add(numberValue); ((ArrayList)objectStack.Peek()).Add(numberValue);
} }
else else
{ {
// we have a key so lets store this value // we have a key so lets store this value
((Hashtable)objectStack.Peek()).Add(currentKey,numberValue); ((Hashtable)objectStack.Peek()).Add(currentKey,numberValue);
// now lets clear the key, we're done with it and moving on // now lets clear the key, we're done with it and moving on
currentKey=null; currentKey=null;
} }
break; break;
} }
} }
} }
catch(Exception) catch(Exception)
{ {
OSSLError("osParseJSON: The JSON string is not valid " + JSON) ; OSSLError("osParseJSON: The JSON string is not valid " + JSON) ;
} }
return jsondata; return jsondata;
} }
// send a message to to object identified by the given UUID, a script in the object must implement the dataserver function // send a message to to object identified by the given UUID, a script in the object must implement the dataserver function
// the dataserver function is passed the ID of the calling function and a string message // the dataserver function is passed the ID of the calling function and a string message
public void osMessageObject(LSL_Key objectUUID, string message) public void osMessageObject(LSL_Key objectUUID, string message)
{ {
CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); CheckThreatLevel(ThreatLevel.Low, "osMessageObject");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) };
SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID)); SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID));
m_ScriptEngine.PostObjectEvent( m_ScriptEngine.PostObjectEvent(
sceneOP.LocalId, new EventParams( sceneOP.LocalId, new EventParams(
"dataserver", resobj, new DetectParams[0])); "dataserver", resobj, new DetectParams[0]));
@ -1024,10 +1024,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Create new asset // Create new asset
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = notecardName; asset.Metadata.Name = notecardName;
asset.Description = "Script Generated Notecard"; asset.Metadata.Description = "Script Generated Notecard";
asset.Type = 7; asset.Metadata.Type = 7;
asset.FullID = UUID.Random(); asset.Metadata.FullID = UUID.Random();
string notecardData = ""; string notecardData = "";
for (int i = 0; i < contents.Length; i++) { for (int i = 0; i < contents.Length; i++) {
@ -1035,7 +1035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
int textLength = notecardData.Length; int textLength = notecardData.Length;
notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
+ textLength.ToString() + "\n" + notecardData + "}\n"; + textLength.ToString() + "\n" + notecardData + "}\n";
asset.Data = Encoding.ASCII.GetBytes(notecardData); asset.Data = Encoding.ASCII.GetBytes(notecardData);
@ -1047,8 +1047,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
taskItem.ResetIDs(m_host.UUID); taskItem.ResetIDs(m_host.UUID);
taskItem.ParentID = m_host.UUID; taskItem.ParentID = m_host.UUID;
taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch();
taskItem.Name = asset.Name; taskItem.Name = asset.Metadata.Name;
taskItem.Description = asset.Description; taskItem.Description = asset.Metadata.Description;
taskItem.Type = 7; taskItem.Type = 7;
taskItem.InvType = 7; taskItem.InvType = 7;
taskItem.OwnerID = m_host.OwnerID; taskItem.OwnerID = m_host.OwnerID;
@ -1062,7 +1062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
taskItem.Flags = 0; taskItem.Flags = 0;
taskItem.PermsGranter = UUID.Zero; taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0; taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID; taskItem.AssetID = asset.Metadata.FullID;
m_host.Inventory.AddInventoryItem(taskItem, false); m_host.Inventory.AddInventoryItem(taskItem, false);
} }