From 1a18948935eb6dcb65fb7a75b241ede9d42af055 Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Fri, 3 Feb 2012 23:04:18 +0100 Subject: Corrected console help texts for "save iar" --- .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 150d913..09b4ba6 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver scene.AddCommand( this, "save iar", - "save iar [-h|--home=] [--noassets] [] [--v|-verbose]", + "save iar [-p|--profile=] [--noassets] [] [-c|--creators] [-v|--verbose]", "Save user inventory archive (IAR).", " is the user's first name." + Environment.NewLine + " is the user's last name." + Environment.NewLine @@ -408,7 +408,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (mainParams.Count < 6) { m_log.Error( - "[INVENTORY ARCHIVER]: usage is save iar [--p|-profile=] [--noassets] []"); + "[INVENTORY ARCHIVER]: usage is save iar [-p|--profile=] [--noassets] [] [-c|--creators] [-v|--verbose]"); return; } -- cgit v1.1 From f17066b7bf27c22448d883e0af9d20a42f671b62 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Feb 2012 22:21:54 +0000 Subject: Change LandDataSerializer deserialization so that in the future it won't care about extra elements or element order. This brings it into line with other deserializations such as object and will improve future backward compatibility. --- OpenSim/Framework/LandData.cs | 2 +- .../Serialization/External/LandDataSerializer.cs | 237 +++++++++++++++------ .../External/UserInventoryItemSerializer.cs | 3 +- .../External/UserProfileSerializer.cs | 5 +- .../Serialization/Tests/LandDataSerializerTests.cs | 37 +++- ...penSim.Framework.Serialization.Tests.dll.config | 33 +++ 6 files changed, 242 insertions(+), 75 deletions(-) create mode 100644 bin/OpenSim.Framework.Serialization.Tests.dll.config diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs index 58a80ef..f6271ef 100644 --- a/OpenSim/Framework/LandData.cs +++ b/OpenSim/Framework/LandData.cs @@ -34,7 +34,7 @@ using OpenMetaverse; namespace OpenSim.Framework { - public struct LandAccessEntry + public class LandAccessEntry { public UUID AgentID; public int Expires; diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index 3ae9a8e..bf6c4e5 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -28,8 +28,10 @@ using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Text; using System.Xml; +using log4net; using OpenMetaverse; using OpenSim.Framework; @@ -40,8 +42,152 @@ namespace OpenSim.Framework.Serialization.External /// public class LandDataSerializer { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); + private delegate void LandDataProcessor(LandData landData, XmlTextReader reader); + private static Dictionary m_ldProcessors + = new Dictionary(); + + private delegate void LandAccessEntryProcessor(LandAccessEntry lae, XmlTextReader reader); + private static Dictionary m_laeProcessors + = new Dictionary(); + + static LandDataSerializer() + { + // LandData processors + m_ldProcessors.Add( + "Area", (ld, xtr) => ld.Area = Convert.ToInt32(xtr.ReadElementString("Area"))); + m_ldProcessors.Add( + "AuctionID", (ld, xtr) => ld.AuctionID = Convert.ToUInt32(xtr.ReadElementString("AuctionID"))); + m_ldProcessors.Add( + "AuthBuyerID", (ld, xtr) => ld.AuthBuyerID = UUID.Parse(xtr.ReadElementString("AuthBuyerID"))); + m_ldProcessors.Add( + "Category", (ld, xtr) => ld.Category = (ParcelCategory)Convert.ToSByte(xtr.ReadElementString("Category"))); + m_ldProcessors.Add( + "ClaimDate", (ld, xtr) => ld.ClaimDate = Convert.ToInt32(xtr.ReadElementString("ClaimDate"))); + m_ldProcessors.Add( + "ClaimPrice", (ld, xtr) => ld.ClaimPrice = Convert.ToInt32(xtr.ReadElementString("ClaimPrice"))); + m_ldProcessors.Add( + "GlobalID", (ld, xtr) => ld.GlobalID = UUID.Parse(xtr.ReadElementString("GlobalID"))); + m_ldProcessors.Add( + "GroupID", (ld, xtr) => ld.GroupID = UUID.Parse(xtr.ReadElementString("GroupID"))); + m_ldProcessors.Add( + "IsGroupOwned", (ld, xtr) => ld.IsGroupOwned = Convert.ToBoolean(xtr.ReadElementString("IsGroupOwned"))); + m_ldProcessors.Add( + "Bitmap", (ld, xtr) => ld.Bitmap = Convert.FromBase64String(xtr.ReadElementString("Bitmap"))); + m_ldProcessors.Add( + "Description", (ld, xtr) => ld.Description = xtr.ReadElementString("Description")); + m_ldProcessors.Add( + "Flags", (ld, xtr) => ld.Flags = Convert.ToUInt32(xtr.ReadElementString("Flags"))); + m_ldProcessors.Add( + "LandingType", (ld, xtr) => ld.LandingType = Convert.ToByte(xtr.ReadElementString("LandingType"))); + m_ldProcessors.Add( + "Name", (ld, xtr) => ld.Name = xtr.ReadElementString("Name")); + m_ldProcessors.Add( + "Status", (ld, xtr) => ld.Status = (ParcelStatus)Convert.ToSByte(xtr.ReadElementString("Status"))); + m_ldProcessors.Add( + "LocalID", (ld, xtr) => ld.LocalID = Convert.ToInt32(xtr.ReadElementString("LocalID"))); + m_ldProcessors.Add( + "MediaAutoScale", (ld, xtr) => ld.MediaAutoScale = Convert.ToByte(xtr.ReadElementString("MediaAutoScale"))); + m_ldProcessors.Add( + "MediaID", (ld, xtr) => ld.MediaID = UUID.Parse(xtr.ReadElementString("MediaID"))); + m_ldProcessors.Add( + "MediaURL", (ld, xtr) => ld.MediaURL = xtr.ReadElementString("MediaURL")); + m_ldProcessors.Add( + "MusicURL", (ld, xtr) => ld.MusicURL = xtr.ReadElementString("MusicURL")); + + m_ldProcessors.Add( + "ParcelAccessList", ProcessParcelAccessList); + + m_ldProcessors.Add( + "PassHours", (ld, xtr) => ld.PassHours = Convert.ToSingle(xtr.ReadElementString("PassHours"))); + m_ldProcessors.Add( + "PassPrice", (ld, xtr) => ld.PassPrice = Convert.ToInt32(xtr.ReadElementString("PassPrice"))); + m_ldProcessors.Add( + "SalePrice", (ld, xtr) => ld.SalePrice = Convert.ToInt32(xtr.ReadElementString("SalePrice"))); + m_ldProcessors.Add( + "SnapshotID", (ld, xtr) => ld.SnapshotID = UUID.Parse(xtr.ReadElementString("SnapshotID"))); + m_ldProcessors.Add( + "UserLocation", (ld, xtr) => ld.UserLocation = Vector3.Parse(xtr.ReadElementString("UserLocation"))); + m_ldProcessors.Add( + "UserLookAt", (ld, xtr) => ld.UserLookAt = Vector3.Parse(xtr.ReadElementString("UserLookAt"))); + + // No longer used here // + // m_ldProcessors.Add("Dwell", (landData, xtr) => return); + + m_ldProcessors.Add( + "OtherCleanTime", (ld, xtr) => ld.OtherCleanTime = Convert.ToInt32(xtr.ReadElementString("OtherCleanTime"))); + + // LandAccessEntryProcessors + m_laeProcessors.Add( + "AgentID", (lae, xtr) => lae.AgentID = UUID.Parse(xtr.ReadElementString("AgentID"))); + m_laeProcessors.Add( + "Time", (lae, xtr) => + { + // We really don't care about temp vs perm here and this + // would break on old oars. Assume all bans are perm + xtr.ReadElementString("Time"); + lae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time")); + } + ); + m_laeProcessors.Add( + "AccessList", (lae, xtr) => lae.Flags = (AccessList)Convert.ToUInt32(xtr.ReadElementString("AccessList"))); + } + + public static void ProcessParcelAccessList(LandData ld, XmlTextReader xtr) + { + if (!xtr.IsEmptyElement) + { + while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) + { + LandAccessEntry lae = new LandAccessEntry(); + + xtr.ReadStartElement("ParcelAccessEntry"); + + string nodeName = string.Empty; + while (xtr.NodeType != XmlNodeType.EndElement) + { + nodeName = xtr.Name; + +// m_log.DebugFormat("[LandDataSerializer]: Processing: {0} in ParcelAccessEntry", nodeName); + + LandAccessEntryProcessor p = null; + if (m_laeProcessors.TryGetValue(xtr.Name, out p)) + { +// m_log.DebugFormat("[LandDataSerializer]: Found {0} processor in ParcelAccessEntry", nodeName); + + try + { + p(lae, xtr); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[LandDataSerializer]: Exception while parsing element {0} in ParcelAccessEntry, continuing. Exception {1}{2}", + nodeName, e.Message, e.StackTrace); + + if (xtr.NodeType == XmlNodeType.EndElement) + xtr.Read(); + } + } + else + { + // m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName); + xtr.ReadOuterXml(); // ignore + } + } + + xtr.ReadEndElement(); + + ld.ParcelAccessList.Add(lae); + } + } + + xtr.Read(); + } + /// /// Reify/deserialize landData /// @@ -63,72 +209,43 @@ namespace OpenSim.Framework.Serialization.External { LandData landData = new LandData(); - StringReader sr = new StringReader(serializedLandData); - XmlTextReader xtr = new XmlTextReader(sr); - - xtr.ReadStartElement("LandData"); - - landData.Area = Convert.ToInt32( xtr.ReadElementString("Area")); - landData.AuctionID = Convert.ToUInt32( xtr.ReadElementString("AuctionID")); - landData.AuthBuyerID = UUID.Parse( xtr.ReadElementString("AuthBuyerID")); - landData.Category = (ParcelCategory)Convert.ToSByte( xtr.ReadElementString("Category")); - landData.ClaimDate = Convert.ToInt32( xtr.ReadElementString("ClaimDate")); - landData.ClaimPrice = Convert.ToInt32( xtr.ReadElementString("ClaimPrice")); - landData.GlobalID = UUID.Parse( xtr.ReadElementString("GlobalID")); - landData.GroupID = UUID.Parse( xtr.ReadElementString("GroupID")); - landData.IsGroupOwned = Convert.ToBoolean( xtr.ReadElementString("IsGroupOwned")); - landData.Bitmap = Convert.FromBase64String( xtr.ReadElementString("Bitmap")); - landData.Description = xtr.ReadElementString("Description"); - landData.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags")); - landData.LandingType = Convert.ToByte( xtr.ReadElementString("LandingType")); - landData.Name = xtr.ReadElementString("Name"); - landData.Status = (ParcelStatus)Convert.ToSByte( xtr.ReadElementString("Status")); - landData.LocalID = Convert.ToInt32( xtr.ReadElementString("LocalID")); - landData.MediaAutoScale = Convert.ToByte( xtr.ReadElementString("MediaAutoScale")); - landData.MediaID = UUID.Parse( xtr.ReadElementString("MediaID")); - landData.MediaURL = xtr.ReadElementString("MediaURL"); - landData.MusicURL = xtr.ReadElementString("MusicURL"); - landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID")); - - landData.ParcelAccessList = new List(); - xtr.Read(); - if (xtr.Name != "ParcelAccessList") - throw new XmlException(String.Format("Expected \"ParcelAccessList\" element but got \"{0}\"", xtr.Name)); - - if (!xtr.IsEmptyElement) + using (XmlTextReader reader = new XmlTextReader(new StringReader(serializedLandData))) { - while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement) - { - LandAccessEntry pae = new LandAccessEntry(); + reader.ReadStartElement("LandData"); - xtr.ReadStartElement("ParcelAccessEntry"); - pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID")); - // We really don't care about temp vs perm here and this - // would break on old oars. Assume all bans are perm - xtr.ReadElementString("Time"); - pae.Expires = 0; // Convert.ToUint( xtr.ReadElementString("Time")); - pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList")); - xtr.ReadEndElement(); + string nodeName = string.Empty; + while (reader.NodeType != XmlNodeType.EndElement) + { + nodeName = reader.Name; - landData.ParcelAccessList.Add(pae); - } - } - xtr.Read(); +// m_log.DebugFormat("[LandDataSerializer]: Processing: {0}", nodeName); - landData.PassHours = Convert.ToSingle( xtr.ReadElementString("PassHours")); - landData.PassPrice = Convert.ToInt32( xtr.ReadElementString("PassPrice")); - landData.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice")); - landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID")); - landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation")); - landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt")); - // No longer used here - xtr.ReadElementString("Dwell"); - landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime")); + LandDataProcessor p = null; + if (m_ldProcessors.TryGetValue(reader.Name, out p)) + { + try + { + p(landData, reader); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[LandDataSerializer]: exception while parsing element {0}, continuing. Exception {1}{2}", + nodeName, e.Message, e.StackTrace); - xtr.ReadEndElement(); + if (reader.NodeType == XmlNodeType.EndElement) + reader.Read(); + } + } + else + { + // m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName); + reader.ReadOuterXml(); // ignore + } + } - xtr.Close(); - sr.Close(); + reader.ReadEndElement(); + } return landData; } diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index f138437..5d986d5 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -41,8 +41,7 @@ namespace OpenSim.Framework.Serialization.External { /// /// Serialize and deserialize user inventory items as an external format. - /// - /// XXX: Please do not use yet. + /// public class UserInventoryItemSerializer { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs index f50b49a..c685a15 100644 --- a/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserProfileSerializer.cs @@ -33,8 +33,11 @@ using OpenSim.Framework; namespace OpenSim.Framework.Serialization.External { /// - /// Serialize and deserialize region settings as an external format. + /// Serialize and deserialize user profiles as an external format. /// + /// + /// Currently UNUSED. + /// public class UserProfileSerializer { public const int MAJOR_VERSION = 0; diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index 3607ce8..11a3a0a 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs @@ -27,11 +27,12 @@ using System; using System.Collections.Generic; -using OpenSim.Framework; -using OpenSim.Framework.Serialization.External; using OpenMetaverse; using OpenMetaverse.StructuredData; using NUnit.Framework; +using OpenSim.Framework; +using OpenSim.Framework.Serialization.External; +using OpenSim.Tests.Common; namespace OpenSim.Framework.Serialization.Tests { @@ -92,6 +93,8 @@ namespace OpenSim.Framework.Serialization.Tests [Test] public void LandDataSerializerSerializeTest() { + TestHelpers.InMethod(); + string serialized = LandDataSerializer.Serialize(this.land).Replace("\r\n", "\n"); Assert.That(serialized.Length > 0, "Serialize(LandData) returned empty string"); @@ -112,20 +115,32 @@ namespace OpenSim.Framework.Serialization.Tests /// Test the LandDataSerializer.Deserialize() method /// [Test] - public void TestLandDataSerializerDeserializeFromStringTest() + public void TestLandDataDeserializeNoAccessLists() + { + TestHelpers.InMethod(); + log4net.Config.XmlConfigurator.Configure(); + + LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); + Assert.That(ld != null, "Deserialize(string) returned null"); + Assert.That(ld.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID"); + Assert.That(ld.Name == this.land.Name, "Reified LandData.Name != original LandData.Name"); + } + + [Test] + public void TestLandDataDeserializeWithAccessLists() { - LandData reifiedLandData = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); - Assert.That(reifiedLandData != null, "Deserialize(string) returned null"); - Assert.That(reifiedLandData.GlobalID == this.land.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID"); - Assert.That(reifiedLandData.Name == this.land.Name, "Reified LandData.Name != original LandData.Name"); + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); - LandData reifiedLandDataWithParcelAccessList = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList); - Assert.That(reifiedLandDataWithParcelAccessList != null, + LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerializedWithParcelAccessList); + Assert.That(ld != null, "Deserialize(string) returned null (pre-serialized with parcel access list)"); - Assert.That(reifiedLandDataWithParcelAccessList.GlobalID == this.landWithParcelAccessList.GlobalID, + Assert.That(ld.GlobalID == this.landWithParcelAccessList.GlobalID, "Reified LandData.GlobalID != original LandData.GlobalID (pre-serialized with parcel access list)"); - Assert.That(reifiedLandDataWithParcelAccessList.Name == this.landWithParcelAccessList.Name, + Assert.That(ld.Name == this.landWithParcelAccessList.Name, "Reified LandData.Name != original LandData.Name (pre-serialized with parcel access list)"); + Assert.That(ld.ParcelAccessList.Count, Is.EqualTo(2)); + Assert.That(ld.ParcelAccessList[0].AgentID, Is.EqualTo(UUID.Parse("62d65d45-c91a-4f77-862c-46557d978b6c"))); } } } diff --git a/bin/OpenSim.Framework.Serialization.Tests.dll.config b/bin/OpenSim.Framework.Serialization.Tests.dll.config new file mode 100644 index 0000000..a3f681d --- /dev/null +++ b/bin/OpenSim.Framework.Serialization.Tests.dll.config @@ -0,0 +1,33 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.1 From 623426421132fdc41d9de006fb55aedc660d5362 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Feb 2012 22:45:50 +0000 Subject: Refactor common deserialization processor code to generic method ExternalRepresentationUtils.ExecuteReadProcessors() --- .../External/ExternalRepresentationUtils.cs | 53 +++++++++++++++- .../Serialization/External/LandDataSerializer.cs | 74 ++-------------------- .../External/UserInventoryItemSerializer.cs | 33 ++-------- prebuild.xml | 1 + 4 files changed, 63 insertions(+), 98 deletions(-) diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index 7447ac2..39a9f37 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -24,11 +24,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + using System; using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Xml; - +using log4net; using OpenMetaverse; using OpenSim.Services.Interfaces; @@ -39,6 +41,55 @@ namespace OpenSim.Framework.Serialization.External /// public class ExternalRepresentationUtils { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + /// + /// Populate a node with data read from xml using a dictinoary of processors + /// + /// + /// + /// A + /// + /// + /// A + /// + public static void ExecuteReadProcessors( + NodeType nodeToFill, Dictionary> processors, XmlTextReader xtr) + { + string nodeName = string.Empty; + while (xtr.NodeType != XmlNodeType.EndElement) + { + nodeName = xtr.Name; + +// m_log.DebugFormat("[ExternalRepresentationUtils]: Processing: {0}", nodeName); + + Action p = null; + if (processors.TryGetValue(xtr.Name, out p)) + { +// m_log.DebugFormat("[ExternalRepresentationUtils]: Found {0} processor, nodeName); + + try + { + p(nodeToFill, xtr); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}", + nodeName, e.Message, e.StackTrace); + + if (xtr.NodeType == XmlNodeType.EndElement) + xtr.Read(); + } + } + else + { + // m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName); + xtr.ReadOuterXml(); // ignore + } + } + } + /// /// Takes a XML representation of a SceneObjectPart and returns another XML representation /// with creator data added to it. diff --git a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs index bf6c4e5..a12877a 100644 --- a/OpenSim/Framework/Serialization/External/LandDataSerializer.cs +++ b/OpenSim/Framework/Serialization/External/LandDataSerializer.cs @@ -46,13 +46,11 @@ namespace OpenSim.Framework.Serialization.External protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); - private delegate void LandDataProcessor(LandData landData, XmlTextReader reader); - private static Dictionary m_ldProcessors - = new Dictionary(); + private static Dictionary> m_ldProcessors + = new Dictionary>(); - private delegate void LandAccessEntryProcessor(LandAccessEntry lae, XmlTextReader reader); - private static Dictionary m_laeProcessors - = new Dictionary(); + private static Dictionary> m_laeProcessors + = new Dictionary>(); static LandDataSerializer() { @@ -146,38 +144,7 @@ namespace OpenSim.Framework.Serialization.External xtr.ReadStartElement("ParcelAccessEntry"); - string nodeName = string.Empty; - while (xtr.NodeType != XmlNodeType.EndElement) - { - nodeName = xtr.Name; - -// m_log.DebugFormat("[LandDataSerializer]: Processing: {0} in ParcelAccessEntry", nodeName); - - LandAccessEntryProcessor p = null; - if (m_laeProcessors.TryGetValue(xtr.Name, out p)) - { -// m_log.DebugFormat("[LandDataSerializer]: Found {0} processor in ParcelAccessEntry", nodeName); - - try - { - p(lae, xtr); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[LandDataSerializer]: Exception while parsing element {0} in ParcelAccessEntry, continuing. Exception {1}{2}", - nodeName, e.Message, e.StackTrace); - - if (xtr.NodeType == XmlNodeType.EndElement) - xtr.Read(); - } - } - else - { - // m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName); - xtr.ReadOuterXml(); // ignore - } - } + ExternalRepresentationUtils.ExecuteReadProcessors(lae, m_laeProcessors, xtr); xtr.ReadEndElement(); @@ -213,36 +180,7 @@ namespace OpenSim.Framework.Serialization.External { reader.ReadStartElement("LandData"); - string nodeName = string.Empty; - while (reader.NodeType != XmlNodeType.EndElement) - { - nodeName = reader.Name; - -// m_log.DebugFormat("[LandDataSerializer]: Processing: {0}", nodeName); - - LandDataProcessor p = null; - if (m_ldProcessors.TryGetValue(reader.Name, out p)) - { - try - { - p(landData, reader); - } - catch (Exception e) - { - m_log.ErrorFormat( - "[LandDataSerializer]: exception while parsing element {0}, continuing. Exception {1}{2}", - nodeName, e.Message, e.StackTrace); - - if (reader.NodeType == XmlNodeType.EndElement) - reader.Read(); - } - } - else - { - // m_log.DebugFormat("[LandDataSerializer]: caught unknown element {0}", nodeName); - reader.ReadOuterXml(); // ignore - } - } + ExternalRepresentationUtils.ExecuteReadProcessors(landData, m_ldProcessors, reader); reader.ReadEndElement(); } diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index 5d986d5..f6fdc4b 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -46,8 +46,8 @@ namespace OpenSim.Framework.Serialization.External { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private delegate void InventoryItemXmlProcessor(InventoryItemBase item, XmlTextReader reader); - private static Dictionary m_InventoryItemXmlProcessors = new Dictionary(); + private static Dictionary> m_InventoryItemXmlProcessors + = new Dictionary>(); #region InventoryItemBase Processor initialization static UserInventoryItemSerializer() @@ -204,39 +204,14 @@ namespace OpenSim.Framework.Serialization.External { reader.ReadStartElement("InventoryItem"); - string nodeName = string.Empty; - while (reader.NodeType != XmlNodeType.EndElement) - { - nodeName = reader.Name; - InventoryItemXmlProcessor p = null; - if (m_InventoryItemXmlProcessors.TryGetValue(reader.Name, out p)) - { - //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); - try - { - p(item, reader); - } - catch (Exception e) - { - m_log.DebugFormat("[InventoryItemSerializer]: exception while parsing {0}: {1}", nodeName, e); - if (reader.NodeType == XmlNodeType.EndElement) - reader.Read(); - } - } - else - { - // m_log.DebugFormat("[InventoryItemSerializer]: caught unknown element {0}", nodeName); - reader.ReadOuterXml(); // ignore - } - - } + ExternalRepresentationUtils.ExecuteReadProcessors( + item, m_InventoryItemXmlProcessors, reader); reader.ReadEndElement(); // InventoryItem } //m_log.DebugFormat("[XXX]: parsed InventoryItemBase {0} - {1}", obj.Name, obj.UUID); return item; - } public static string Serialize(InventoryItemBase inventoryItem, Dictionary options, IUserAccountService userAccountService) diff --git a/prebuild.xml b/prebuild.xml index 65383ee..c402cf5 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -218,6 +218,7 @@ ../../../bin/ + -- cgit v1.1 From 83ef13a79add392247ae8e36b419fdc8bc8c6b8b Mon Sep 17 00:00:00 2001 From: Snoopy Pfeffer Date: Fri, 3 Feb 2012 23:53:18 +0100 Subject: Changed save oar and save iar parameter -p|--profile to -h|--home, including corresponding RemoteAdmin parameter --- .../ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 4 ++-- .../Serialization/External/UserInventoryItemSerializer.cs | 4 ++-- .../Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 2 +- .../Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 10 +++++----- OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 7f1a0ed..24570d6 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -1410,9 +1410,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController // options["version"] = (string)requestData["version"]; //} - if (requestData.Contains("profile")) + if (requestData.Contains("home")) { - options["profile"] = (string)requestData["profile"]; + options["home"] = (string)requestData["home"]; } if ((string)requestData["noassets"] == "true") diff --git a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs index f138437..b351703 100644 --- a/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs +++ b/OpenSim/Framework/Serialization/External/UserInventoryItemSerializer.cs @@ -305,14 +305,14 @@ namespace OpenSim.Framework.Serialization.External writer.WriteEndElement(); if (options.ContainsKey("creators") && inventoryItem.CreatorData != null && inventoryItem.CreatorData != string.Empty) writer.WriteElementString("CreatorData", inventoryItem.CreatorData); - else if (options.ContainsKey("profile")) + else if (options.ContainsKey("home")) { if (userAccountService != null) { UserAccount account = userAccountService.GetUserAccount(UUID.Zero, inventoryItem.CreatorIdAsUuid); if (account != null) { - writer.WriteElementString("CreatorData", (string)options["profile"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName); + writer.WriteElementString("CreatorData", (string)options["home"] + "/" + inventoryItem.CreatorIdAsUuid + ";" + account.FirstName + " " + account.LastName); } writer.WriteElementString("CreatorID", inventoryItem.CreatorId); } diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 36ecb3b..5238325 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs @@ -415,7 +415,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { int majorVersion, minorVersion; - if (options.ContainsKey("profile")) + if (options.ContainsKey("home")) { majorVersion = 1; minorVersion = 2; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 09b4ba6..a81f36c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -122,7 +122,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver scene.AddCommand( this, "save iar", - "save iar [-p|--profile=] [--noassets] [] [-c|--creators] [-v|--verbose]", + "save iar [-h|--home=] [--noassets] [] [-c|--creators] [-v|--verbose]", "Save user inventory archive (IAR).", " is the user's first name." + Environment.NewLine + " is the user's last name." + Environment.NewLine @@ -396,7 +396,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver OptionSet ops = new OptionSet(); //ops.Add("v|version=", delegate(string v) { options["version"] = v; }); - ops.Add("p|profile=", delegate(string v) { options["profile"] = v; }); + ops.Add("h|home=", delegate(string v) { options["home"] = v; }); ops.Add("v|verbose", delegate(string v) { options["verbose"] = v; }); ops.Add("c|creators", delegate(string v) { options["creators"] = v; }); ops.Add("noassets", delegate(string v) { options["noassets"] = v != null; }); @@ -408,13 +408,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver if (mainParams.Count < 6) { m_log.Error( - "[INVENTORY ARCHIVER]: usage is save iar [-p|--profile=] [--noassets] [] [-c|--creators] [-v|--verbose]"); + "[INVENTORY ARCHIVER]: usage is save iar [-h|--home=] [--noassets] [] [-c|--creators] [-v|--verbose]"); return; } m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); - if (options.ContainsKey("profile")) - m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -profile option if you want to produce a compatible IAR"); + if (options.ContainsKey("home")) + m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -home option if you want to produce a compatible IAR"); string firstName = mainParams[2]; string lastName = mainParams[3]; diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 948aac8..8e29e3c 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -310,10 +310,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected AssetBase PostProcess(AssetBase asset) { - if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("profile")) + if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home")) { //m_log.DebugFormat("[ARCHIVER]: Rewriting object data for {0}", asset.ID); - string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["profile"].ToString(), m_userAccountService, m_scopeID); + string xml = ExternalRepresentationUtils.RewriteSOP(Utils.BytesToString(asset.Data), m_options["home"].ToString(), m_userAccountService, m_scopeID); asset.Data = Utils.StringToBytes(xml); } return asset; -- cgit v1.1 From 5c545d1d2e0a1862d063a1bdf80d2cd2fa311101 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Fri, 3 Feb 2012 22:02:36 +0100 Subject: Fix: Covenant changed time not set http://opensimulator.org/mantis/view.php?id=5869 Signed-off-by: BlueWall --- OpenSim/Data/MSSQL/MSSQLSimulationData.cs | 9 +++++---- OpenSim/Data/MSSQL/Resources/RegionStore.migrations | 8 ++++++++ OpenSim/Data/MySQL/MySQLSimulationData.cs | 7 ++++--- OpenSim/Data/MySQL/Resources/RegionStore.migrations | 5 +++++ OpenSim/Data/SQLite/Resources/RegionStore.migrations | 7 ++++++- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++ OpenSim/Framework/IClientAPI.cs | 2 +- OpenSim/Framework/RegionSettings.cs | 10 +++++++++- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++---- .../Region/CoreModules/World/Estate/EstateManagementModule.cs | 2 ++ .../Agent/InternetRelayClientView/Server/IRCClientView.cs | 2 +- OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | 2 +- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 13 files changed, 50 insertions(+), 17 deletions(-) diff --git a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs index be60d4c..e58620a 100644 --- a/OpenSim/Data/MSSQL/MSSQLSimulationData.cs +++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs @@ -1252,7 +1252,7 @@ VALUES ,[elevation_1_ne] = @elevation_1_ne ,[elevation_2_ne] = @elevation_2_ne ,[elevation_1_se] = @elevation_1_se ,[elevation_2_se] = @elevation_2_se ,[elevation_1_sw] = @elevation_1_sw ,[elevation_2_sw] = @elevation_2_sw ,[water_height] = @water_height ,[terrain_raise_limit] = @terrain_raise_limit ,[terrain_lower_limit] = @terrain_lower_limit ,[use_estate_sun] = @use_estate_sun ,[fixed_sun] = @fixed_sun ,[sun_position] = @sun_position -,[covenant] = @covenant , [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id +,[covenant] = @covenant ,[covenant_datetime] = @covenant_datetime, [sunvectorx] = @sunvectorx, [sunvectory] = @sunvectory, [sunvectorz] = @sunvectorz, [Sandbox] = @Sandbox, [loaded_creation_datetime] = @loaded_creation_datetime, [loaded_creation_id] = @loaded_creation_id WHERE [regionUUID] = @regionUUID"; using (SqlConnection conn = new SqlConnection(m_connectionString)) @@ -1307,14 +1307,14 @@ VALUES [block_show_in_search],[agent_limit],[object_bonus],[maturity],[disable_scripts],[disable_collisions],[disable_physics], [terrain_texture_1],[terrain_texture_2],[terrain_texture_3],[terrain_texture_4],[elevation_1_nw],[elevation_2_nw],[elevation_1_ne], [elevation_2_ne],[elevation_1_se],[elevation_2_se],[elevation_1_sw],[elevation_2_sw],[water_height],[terrain_raise_limit], - [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id] + [terrain_lower_limit],[use_estate_sun],[fixed_sun],[sun_position],[covenant],[covenant_datetime],[sunvectorx], [sunvectory], [sunvectorz],[Sandbox], [loaded_creation_datetime], [loaded_creation_id] ) VALUES (@regionUUID,@block_terraform,@block_fly,@allow_damage,@restrict_pushing,@allow_land_resell,@allow_land_join_divide, @block_show_in_search,@agent_limit,@object_bonus,@maturity,@disable_scripts,@disable_collisions,@disable_physics, @terrain_texture_1,@terrain_texture_2,@terrain_texture_3,@terrain_texture_4,@elevation_1_nw,@elevation_2_nw,@elevation_1_ne, @elevation_2_ne,@elevation_1_se,@elevation_2_se,@elevation_1_sw,@elevation_2_sw,@water_height,@terrain_raise_limit, - @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant,@sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; + @terrain_lower_limit,@use_estate_sun,@fixed_sun,@sun_position,@covenant, @covenant_datetime, @sunvectorx,@sunvectory, @sunvectorz, @Sandbox, @loaded_creation_datetime, @loaded_creation_id)"; using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlCommand cmd = new SqlCommand(sql, conn)) @@ -1376,7 +1376,7 @@ VALUES Convert.ToSingle(row["sunvectorz"]) ); newSettings.Covenant = new UUID((Guid)row["covenant"]); - + newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); if (row["loaded_creation_id"] is DBNull) @@ -1789,6 +1789,7 @@ VALUES parameters.Add(_Database.CreateParameter("sunvectory", settings.SunVector.Y)); parameters.Add(_Database.CreateParameter("sunvectorz", settings.SunVector.Z)); parameters.Add(_Database.CreateParameter("covenant", settings.Covenant)); + parameters.Add(_Database.CreateParameter("covenant_datetime", settings.CovenantChangedDateTime)); parameters.Add(_Database.CreateParameter("Loaded_Creation_DateTime", settings.LoadedCreationDateTime)); parameters.Add(_Database.CreateParameter("Loaded_Creation_ID", settings.LoadedCreationID)); diff --git a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations index 3995e6c..a98690a 100644 --- a/OpenSim/Data/MSSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MSSQL/Resources/RegionStore.migrations @@ -1043,3 +1043,11 @@ FOR CreatorID ALTER TABLE primitems ALTER COLUMN CreatorID uniqueidentifier NOT NULL COMMIT + +:VERSION 29 #--------------------- + +BEGIN TRANSACTION + +ALTER TABLE regionsettings ADD covenant_datetime int NOT NULL default 0 + +COMMIT diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 3275146..7c995ad 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -994,7 +994,7 @@ namespace OpenSim.Data.MySQL "elevation_2_sw, water_height, " + "terrain_raise_limit, terrain_lower_limit, " + "use_estate_sun, fixed_sun, sun_position, " + - "covenant, Sandbox, sunvectorx, sunvectory, " + + "covenant, covenant_datetime, Sandbox, sunvectorx, sunvectory, " + "sunvectorz, loaded_creation_datetime, " + "loaded_creation_id, map_tile_ID, " + "TelehubObject, parcel_tile_ID) " + @@ -1010,7 +1010,7 @@ namespace OpenSim.Data.MySQL "?Elevation2SE, ?Elevation1SW, ?Elevation2SW, " + "?WaterHeight, ?TerrainRaiseLimit, " + "?TerrainLowerLimit, ?UseEstateSun, ?FixedSun, " + - "?SunPosition, ?Covenant, ?Sandbox, " + + "?SunPosition, ?Covenant, ?CovenantChangedDateTime, ?Sandbox, " + "?SunVectorX, ?SunVectorY, ?SunVectorZ, " + "?LoadedCreationDateTime, ?LoadedCreationID, " + "?TerrainImageID, ?TelehubObject, ?ParcelImageID) "; @@ -1292,7 +1292,7 @@ namespace OpenSim.Data.MySQL newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); newSettings.Covenant = DBGuid.FromDB(row["covenant"]); - + newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); newSettings.LoadedCreationDateTime = Convert.ToInt32(row["loaded_creation_datetime"]); if (row["loaded_creation_id"] is DBNull) @@ -1630,6 +1630,7 @@ namespace OpenSim.Data.MySQL cmd.Parameters.AddWithValue("FixedSun", settings.FixedSun); cmd.Parameters.AddWithValue("SunPosition", settings.SunPosition); cmd.Parameters.AddWithValue("Covenant", settings.Covenant.ToString()); + cmd.Parameters.AddWithValue("CovenantChangedDateTime", settings.CovenantChangedDateTime); cmd.Parameters.AddWithValue("LoadedCreationDateTime", settings.LoadedCreationDateTime); cmd.Parameters.AddWithValue("LoadedCreationID", settings.LoadedCreationID); cmd.Parameters.AddWithValue("TerrainImageID", settings.TerrainImageID); diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 642e3b7..9891f4b 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -869,3 +869,8 @@ BEGIN; ALTER TABLE `landaccesslist` ADD COLUMN `Expires` INTEGER NOT NULL DEFAULT 0; COMMIT; +:VERSION 42 #--------------------- Region Covenant changed time + +BEGIN; +ALTER TABLE regionsettings ADD COLUMN covenant_datetime int unsigned NOT NULL DEFAULT '0'; +COMMIT; diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 5e2045b..31195af 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -466,4 +466,9 @@ ALTER TABLE `land` ADD COLUMN `MediaSize` VARCHAR(16) NOT NULL DEFAULT '0,0'; ALTER TABLE `land` ADD COLUMN `MediaLoop` BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE `land` ADD COLUMN `ObscureMusic` BOOLEAN NOT NULL DEFAULT FALSE; ALTER TABLE `land` ADD COLUMN `ObscureMedia` BOOLEAN NOT NULL DEFAULT FALSE; -COMMIT; \ No newline at end of file +COMMIT; + +:VERSION 22 +BEGIN; +ALTER TABLE regionsettings ADD COLUMN covenant_datetime INTEGER NOT NULL default 0; +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 2d06f82..a313c4f 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -1185,6 +1185,7 @@ namespace OpenSim.Data.SQLite createCol(regionsettings, "fixed_sun", typeof (Int32)); createCol(regionsettings, "sun_position", typeof (Double)); createCol(regionsettings, "covenant", typeof(String)); + createCol(regionsettings, "covenant_datetime", typeof(Int32)); createCol(regionsettings, "map_tile_ID", typeof(String)); regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; return regionsettings; @@ -1509,6 +1510,7 @@ namespace OpenSim.Data.SQLite newSettings.FixedSun = Convert.ToBoolean(row["fixed_sun"]); newSettings.SunPosition = Convert.ToDouble(row["sun_position"]); newSettings.Covenant = new UUID((String) row["covenant"]); + newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); return newSettings; @@ -1833,6 +1835,7 @@ namespace OpenSim.Data.SQLite row["fixed_sun"] = settings.FixedSun; row["sun_position"] = settings.SunPosition; row["covenant"] = settings.Covenant.ToString(); + row["covenant_datetime"] = settings.CovenantChangedDateTime; row["map_tile_ID"] = settings.TerrainImageID.ToString(); } diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index dd3e656..c85e599 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1235,7 +1235,7 @@ namespace OpenSim.Framework void SendEstateCovenantInformation(UUID covenant); void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, - uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner); + uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner); /// /// Send land properties to the client. diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 91e07df..4ce3392 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -413,6 +413,14 @@ namespace OpenSim.Framework set { m_Covenant = value; } } + private int m_CovenantChanged = 0; + + public int CovenantChangedDateTime + { + get { return m_CovenantChanged; } + set { m_CovenantChanged = value; } + } + private int m_LoadedCreationDateTime; public int LoadedCreationDateTime { @@ -492,4 +500,4 @@ namespace OpenSim.Framework l_SpawnPoints.Clear(); } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index cdd4957..8273c6f 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4439,7 +4439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP EstateCovenantReplyPacket einfopack = new EstateCovenantReplyPacket(); EstateCovenantReplyPacket.DataBlock edata = new EstateCovenantReplyPacket.DataBlock(); edata.CovenantID = covenant; - edata.CovenantTimestamp = 0; + edata.CovenantTimestamp = (uint) m_scene.RegionInfo.RegionSettings.CovenantChangedDateTime; edata.EstateOwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; edata.EstateName = Utils.StringToBytes(m_scene.RegionInfo.EstateSettings.EstateName); einfopack.Data = edata; @@ -4447,8 +4447,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP } public void SendDetailedEstateData( - UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, - UUID covenant, string abuseEmail, UUID estateOwner) + UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, + UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner) { // m_log.DebugFormat( // "[LLCLIENTVIEW]: Sending detailed estate data to {0} with covenant asset id {1}", Name, covenant); @@ -4473,7 +4473,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP returnblock[4].Parameter = Utils.StringToBytes(sunPosition.ToString()); returnblock[5].Parameter = Utils.StringToBytes(parentEstate.ToString()); returnblock[6].Parameter = Utils.StringToBytes(covenant.ToString()); - returnblock[7].Parameter = Utils.StringToBytes("1160895077"); // what is this? + returnblock[7].Parameter = Utils.StringToBytes(covenantChanged.ToString()); returnblock[8].Parameter = Utils.StringToBytes("1"); // what is this? returnblock[9].Parameter = Utils.StringToBytes(abuseEmail); diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 2e1487f..c303d6d 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -80,6 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Estate GetEstateFlags(), sun, Scene.RegionInfo.RegionSettings.Covenant, + (uint) Scene.RegionInfo.RegionSettings.CovenantChangedDateTime, Scene.RegionInfo.EstateSettings.AbuseEmail, estateOwner); @@ -268,6 +269,7 @@ namespace OpenSim.Region.CoreModules.World.Estate // remoteClient.Name, estateCovenantID); Scene.RegionInfo.RegionSettings.Covenant = estateCovenantID; + Scene.RegionInfo.RegionSettings.CovenantChangedDateTime = Util.UnixTimeSinceEpoch(); Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 11f927c..c928af7 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1243,7 +1243,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server } - public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) + public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner) { } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 81bf9ed..be0d56e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -933,7 +933,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void SendTelehubInfo(UUID ObjectID, string ObjectName, Vector3 ObjectPos, Quaternion ObjectRot, List SpawnPoint) { } - public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) + public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner) { } diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 4d3d257..14c1287 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -972,7 +972,7 @@ namespace OpenSim.Tests.Common.Mock { } - public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner) + public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, uint covenantChanged, string abuseEmail, UUID estateOwner) { } -- cgit v1.1 From ce34b359ad0254b6b4f460e2740e1a1ed30c456b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Feb 2012 23:04:26 +0000 Subject: Extend m_avatars lock in NpcModule.CreateNPC over both creation of NPC scene presence and population of m_avatars. This is required to stop a race where the SensorRepeat module can detect an NPC avatar before m_avatars is populated. Extending the lock is the easiest to understand solution rather than getting complicated with null checks. Hopefully resolves http://opensimulator.org/mantis/view.php?id=5872 --- .../Region/OptionalModules/World/NPC/NPCModule.cs | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3831d7a..6a48b89 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -140,24 +140,26 @@ namespace OpenSim.Region.OptionalModules.World.NPC // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); // } - scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); - scene.AddNewClient(npcAvatar, PresenceType.Npc); - - ScenePresence sp; - if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) + lock (m_avatars) { - m_log.DebugFormat( - "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); + scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); + scene.AddNewClient(npcAvatar, PresenceType.Npc); - sp.CompleteMovement(npcAvatar, false); - } - else - { - m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); - } + ScenePresence sp; + if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) + { + m_log.DebugFormat( + "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); + + sp.CompleteMovement(npcAvatar, false); + } + else + { + m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); + } - lock (m_avatars) m_avatars.Add(npcAvatar.AgentId, npcAvatar); + } m_log.DebugFormat("[NPC MODULE]: Created NPC with id {0}", npcAvatar.AgentId); -- cgit v1.1 From 107cef2b0e176a586ef81e3ada1cc3c1641c5467 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 3 Feb 2012 15:18:48 -0800 Subject: Check for null scene in ScheduleFullUpdate and ScheduleTerseUpdate before triggering events on a potentially null Scene --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9b660b6..0e899ca 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2729,8 +2729,6 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null) return; - ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); - ParentGroup.QueueForUpdateCheck(); int timeNow = Util.UnixTimeSinceEpoch(); @@ -2752,6 +2750,9 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", // UUID, Name, TimeStampFull); + + if (ParentGroup.Scene != null) + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); } /// @@ -2763,13 +2764,12 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null) return; - ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); - // This was pulled from SceneViewer. Attachments always receive full updates. // I could not verify if this is a requirement but this maintains existing behavior if (ParentGroup.IsAttachment) { ScheduleFullUpdate(); + return; } if (UpdateFlag == UpdateRequired.NONE) @@ -2784,6 +2784,9 @@ namespace OpenSim.Region.Framework.Scenes // "[SCENE OBJECT PART]: Scheduling terse update for {0}, {1} at {2}", // UUID, Name, TimeStampTerse); } + + if (ParentGroup.Scene != null) + ParentGroup.Scene.EventManager.TriggerSceneObjectPartUpdated(this); } public void ScriptSetPhysicsStatus(bool UsePhysics) -- cgit v1.1 From 312e1457dd576bc61ac2fd2e104813dd86134c4d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Feb 2012 23:47:01 +0000 Subject: Change SceneObjectSerializer to use common ExternalRepresentationUtils.ExecuteReadProcessors() methods. Adds ability to submit a customized exception message to match logging. --- .../External/ExternalRepresentationUtils.cs | 37 ++++++-- .../Scenes/Serialization/SceneObjectSerializer.cs | 103 ++++++--------------- prebuild.xml | 1 + 3 files changed, 58 insertions(+), 83 deletions(-) diff --git a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs index 39a9f37..a392af6 100644 --- a/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs +++ b/OpenSim/Framework/Serialization/External/ExternalRepresentationUtils.cs @@ -47,15 +47,36 @@ namespace OpenSim.Framework.Serialization.External /// Populate a node with data read from xml using a dictinoary of processors /// /// - /// - /// A - /// - /// - /// A - /// + /// /param> + /// public static void ExecuteReadProcessors( NodeType nodeToFill, Dictionary> processors, XmlTextReader xtr) { + ExecuteReadProcessors( + nodeToFill, + processors, + xtr, + (o, name, e) + => m_log.ErrorFormat( + "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}", + name, e.Message, e.StackTrace)); + } + + /// + /// Populate a node with data read from xml using a dictinoary of processors + /// + /// + /// + /// + /// + /// Action to take if there is a parsing problem. This will usually just be to log the exception + /// + public static void ExecuteReadProcessors( + NodeType nodeToFill, + Dictionary> processors, + XmlTextReader xtr, + Action parseExceptionAction) + { string nodeName = string.Empty; while (xtr.NodeType != XmlNodeType.EndElement) { @@ -74,9 +95,7 @@ namespace OpenSim.Framework.Serialization.External } catch (Exception e) { - m_log.ErrorFormat( - "[ExternalRepresentationUtils]: Exception while parsing element {0}, continuing. Exception {1}{2}", - nodeName, e.Message, e.StackTrace); + parseExceptionAction(nodeToFill, nodeName, e); if (xtr.NodeType == XmlNodeType.EndElement) xtr.Read(); diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index b54fcb7..ab02f92 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -34,6 +34,7 @@ using System.Xml; using log4net; using OpenMetaverse; using OpenSim.Framework; +using OpenSim.Framework.Serialization.External; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -276,14 +277,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization #region manual serialization - private delegate void SOPXmlProcessor(SceneObjectPart sop, XmlTextReader reader); - private static Dictionary m_SOPXmlProcessors = new Dictionary(); + private static Dictionary> m_SOPXmlProcessors + = new Dictionary>(); - private delegate void TaskInventoryXmlProcessor(TaskInventoryItem item, XmlTextReader reader); - private static Dictionary m_TaskInventoryXmlProcessors = new Dictionary(); + private static Dictionary> m_TaskInventoryXmlProcessors + = new Dictionary>(); - private delegate void ShapeXmlProcessor(PrimitiveBaseShape shape, XmlTextReader reader); - private static Dictionary m_ShapeXmlProcessors = new Dictionary(); + private static Dictionary> m_ShapeXmlProcessors + = new Dictionary>(); static SceneObjectSerializer() { @@ -1464,34 +1465,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadStartElement("SceneObjectPart"); - string nodeName = string.Empty; - while (reader.NodeType != XmlNodeType.EndElement) - { - nodeName = reader.Name; - SOPXmlProcessor p = null; - if (m_SOPXmlProcessors.TryGetValue(reader.Name, out p)) - { - //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); - try - { - p(obj, reader); - } - catch (Exception e) - { - m_log.DebugFormat( - "[SceneObjectSerializer]: exception while parsing {0} in object {1} {2}: {3}{4}", - obj.Name, obj.UUID, nodeName, e.Message, e.StackTrace); - if (reader.NodeType == XmlNodeType.EndElement) - reader.Read(); - } - } - else - { -// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element {0}", nodeName); - reader.ReadOuterXml(); // ignore - } - - } + ExternalRepresentationUtils.ExecuteReadProcessors( + obj, + m_SOPXmlProcessors, + reader, + (o, nodeName, e) + => m_log.ErrorFormat( + "[SceneObjectSerializer]: Exception while parsing {0} in object {1} {2}: {3}{4}", + ((SceneObjectPart)o).Name, ((SceneObjectPart)o).UUID, nodeName, e.Message, e.StackTrace)); reader.ReadEndElement(); // SceneObjectPart @@ -1516,17 +1497,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadStartElement("TaskInventoryItem", String.Empty); // TaskInventory TaskInventoryItem item = new TaskInventoryItem(); - while (reader.NodeType != XmlNodeType.EndElement) - { - TaskInventoryXmlProcessor p = null; - if (m_TaskInventoryXmlProcessors.TryGetValue(reader.Name, out p)) - p(item, reader); - else - { -// m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in TaskInventory {0}, {1}", reader.Name, reader.Value); - reader.ReadOuterXml(); - } - } + + ExternalRepresentationUtils.ExecuteReadProcessors( + item, + m_TaskInventoryXmlProcessors, + reader); + reader.ReadEndElement(); // TaskInventoryItem tinv.Add(item.ItemID, item); @@ -1559,35 +1535,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadStartElement(name, String.Empty); // Shape - string nodeName = string.Empty; - while (reader.NodeType != XmlNodeType.EndElement) - { - nodeName = reader.Name; - //m_log.DebugFormat("[XXX] Processing: {0}", reader.Name); - ShapeXmlProcessor p = null; - if (m_ShapeXmlProcessors.TryGetValue(reader.Name, out p)) - { - try - { - p(shape, reader); - } - catch (Exception e) - { - errors = true; - m_log.DebugFormat( - "[SceneObjectSerializer]: exception while parsing Shape property {0}: {1}{2}", - nodeName, e.Message, e.StackTrace); - - if (reader.NodeType == XmlNodeType.EndElement) - reader.Read(); - } - } - else - { - // m_log.DebugFormat("[SceneObjectSerializer]: caught unknown element in Shape {0}", reader.Name); - reader.ReadOuterXml(); - } - } + ExternalRepresentationUtils.ExecuteReadProcessors( + shape, + m_ShapeXmlProcessors, + reader, + (o, nodeName, e) + => m_log.ErrorFormat( + "[SceneObjectSerializer]: Exception while parsing Shape property {0}: {1}{2}", + nodeName, e.Message, e.StackTrace)); reader.ReadEndElement(); // Shape diff --git a/prebuild.xml b/prebuild.xml index c402cf5..94d86d1 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -768,6 +768,7 @@ + -- cgit v1.1 From 9b762a5a84004c2d5585a34e2fc10f41a7e626fd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Feb 2012 00:20:27 +0000 Subject: Only look for an uploaded transactional asset in Scene.UpdateTaskInventory if we have been passed a non-zero transaction ID. This resolves the recent regression from deeb728 where notecards could not be saved in prim inventories. This looks like a better solution than deeb728 since only non-caps updates pass in a transaction ID. Hopefully resolves http://opensimulator.org/mantis/view.php?id=5873 --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 39 +++++++++++----------- .../Scenes/Tests/SceneObjectScriptTests.cs | 2 +- .../Scenes/Tests/ScenePresenceAgentTests.cs | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index dd3208a..6d7559e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1473,26 +1473,25 @@ namespace OpenSim.Region.Framework.Scenes // "[PRIM INVENTORY]: Updating item {0} in {1} for UpdateTaskInventory()", // currentItem.Name, part.Name); - // Viewers from at least Linden Lab 1.23 onwards use a capability to update script contents rather - // than UDP. With viewers from at least 1.23 onwards, changing properties on scripts (e.g. renaming) causes - // this to spew spurious errors and "thing saved" messages. - // Rather than retaining complexity in the code and removing useful error messages, I'm going to - // comment this section out. If this was still working for very old viewers and there is - // a large population using them which cannot upgrade to 1.23 or derivatives then we can revisit - // this - justincc -// IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); -// if (agentTransactions != null) -// { -// agentTransactions.HandleTaskItemUpdateFromTransaction( -// remoteClient, part, transactionID, currentItem); -// -// if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) -// remoteClient.SendAgentAlertMessage("Notecard saved", false); -// else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) -// remoteClient.SendAgentAlertMessage("Script saved", false); -// else -// remoteClient.SendAgentAlertMessage("Item saved", false); -// } + // Only look for an uploaded updated asset if we are passed a transaction ID. This is only the + // case for updates uploded through UDP. Updates uploaded via a capability (e.g. a script update) + // will not pass in a transaction ID in the update message. + if (transactionID != UUID.Zero) + { + IAgentAssetTransactions agentTransactions = this.RequestModuleInterface(); + if (agentTransactions != null) + { + agentTransactions.HandleTaskItemUpdateFromTransaction( + remoteClient, part, transactionID, currentItem); + + if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) + remoteClient.SendAgentAlertMessage("Notecard saved", false); + else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) + remoteClient.SendAgentAlertMessage("Script saved", false); + else + remoteClient.SendAgentAlertMessage("Item saved", false); + } + } // Base ALWAYS has move currentItem.BasePermissions |= (uint)PermissionMask.Move; diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs index 6f99abd..c582cf6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectScriptTests.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests // log4net.Config.XmlConfigurator.Configure(); UUID userId = TestHelpers.ParseTail(0x1); - UUID itemId = TestHelpers.ParseTail(0x2); +// UUID itemId = TestHelpers.ParseTail(0x2); string itemName = "Test Script Item"; Scene scene = SceneHelpers.SetupScene(); diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index d4c299f..ed9b179 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -174,7 +174,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); - UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); +// UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001"); TestScene myScene1 = SceneHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000); TestScene myScene2 = SceneHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000); -- cgit v1.1 From 6c252a0fa1342ea71bf7d2d0a417d9ff6ddea1b3 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Feb 2012 00:55:03 +0000 Subject: Add TestRegionSettingsDeserialize --- .../Serialization/Tests/LandDataSerializerTests.cs | 2 +- .../Tests/RegionSettingsSerializerTests.cs | 134 +++++++++++++++++++++ 2 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs diff --git a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs index 11a3a0a..b8ed9e1 100644 --- a/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs +++ b/OpenSim/Framework/Serialization/Tests/LandDataSerializerTests.cs @@ -118,7 +118,7 @@ namespace OpenSim.Framework.Serialization.Tests public void TestLandDataDeserializeNoAccessLists() { TestHelpers.InMethod(); - log4net.Config.XmlConfigurator.Configure(); +// log4net.Config.XmlConfigurator.Configure(); LandData ld = LandDataSerializer.Deserialize(LandDataSerializerTest.preSerialized); Assert.That(ld != null, "Deserialize(string) returned null"); diff --git a/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs new file mode 100644 index 0000000..a61e4af --- /dev/null +++ b/OpenSim/Framework/Serialization/Tests/RegionSettingsSerializerTests.cs @@ -0,0 +1,134 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using OpenMetaverse; +using OpenMetaverse.StructuredData; +using NUnit.Framework; +using OpenSim.Framework; +using OpenSim.Framework.Serialization.External; +using OpenSim.Tests.Common; + +namespace OpenSim.Framework.Serialization.Tests +{ + [TestFixture] + public class RegionSettingsSerializerTests + { + private string m_serializedRs = @" + + + True + True + True + True + True + True + True + True + True + 1 + True + 40 + 1.4 + + + 00000000-0000-0000-0000-000000000020 + 00000000-0000-0000-0000-000000000040 + 00000000-0000-0000-0000-000000000060 + 00000000-0000-0000-0000-000000000080 + 1.9 + 15.9 + 49 + 45.3 + 2.1 + 4.5 + 9.2 + 19.2 + + + 23 + 17.9 + 0.4 + True + true + 12 + +"; + + private RegionSettings m_rs; + + [SetUp] + public void Setup() + { + m_rs = new RegionSettings(); + m_rs.AgentLimit = 17; + m_rs.AllowDamage = true; + m_rs.AllowLandJoinDivide = true; + m_rs.AllowLandResell = true; + m_rs.BlockFly = true; + m_rs.BlockShowInSearch = true; + m_rs.BlockTerraform = true; + m_rs.DisableCollisions = true; + m_rs.DisablePhysics = true; + m_rs.DisableScripts = true; + m_rs.Elevation1NW = 15.9; + m_rs.Elevation1NE = 45.3; + m_rs.Elevation1SE = 49; + m_rs.Elevation1SW = 1.9; + m_rs.Elevation2NW = 4.5; + m_rs.Elevation2NE = 19.2; + m_rs.Elevation2SE = 9.2; + m_rs.Elevation2SW = 2.1; + m_rs.FixedSun = true; + m_rs.SunPosition = 12.0; + m_rs.ObjectBonus = 1.4; + m_rs.RestrictPushing = true; + m_rs.TerrainLowerLimit = 0.4; + m_rs.TerrainRaiseLimit = 17.9; + m_rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020"); + m_rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040"); + m_rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060"); + m_rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080"); + m_rs.UseEstateSun = true; + m_rs.WaterHeight = 23; + } + + [Test] + public void TestRegionSettingsDeserialize() + { + TestHelpers.InMethod(); +// log4net.Config.XmlConfigurator.Configure(); + + RegionSettings deserRs = RegionSettingsSerializer.Deserialize(m_serializedRs); + Assert.That(deserRs, Is.Not.Null); + Assert.That(deserRs.TerrainTexture2, Is.EqualTo(m_rs.TerrainTexture2)); + Assert.That(deserRs.DisablePhysics, Is.EqualTo(m_rs.DisablePhysics)); + Assert.That(deserRs.TerrainLowerLimit, Is.EqualTo(m_rs.TerrainLowerLimit)); + } + } +} -- cgit v1.1 From 09d6521361273e2ec4cabfd168d37781fc685785 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Feb 2012 01:00:11 +0000 Subject: Correct RC_* LSL constants used by llCastRay(). Many thanks to WhiteStar for doing the research on this. --- .../Shared/Api/Runtime/LSL_Constants.cs | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index a69b4cb..da1ef91 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -621,20 +621,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const string URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; public const string URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; - public static readonly LSLInteger RC_REJECT_TYPES = 2; - public static readonly LSLInteger RC_DATA_FLAGS = 4; - public static readonly LSLInteger RC_MAX_HITS = 8; - public static readonly LSLInteger RC_DETECT_PHANTOM = 16; + public static readonly LSLInteger RC_REJECT_TYPES = 0; + public static readonly LSLInteger RC_DETECT_PHANTOM = 1; + public static readonly LSLInteger RC_DATA_FLAGS = 2; + public static readonly LSLInteger RC_MAX_HITS = 3; - public static readonly LSLInteger RC_REJECT_AGENTS = 2; - public static readonly LSLInteger RC_REJECT_PHYSICAL = 4; - public static readonly LSLInteger RC_REJECT_NONPHYSICAL = 8; - public static readonly LSLInteger RC_REJECT_LAND = 16; + public static readonly LSLInteger RC_REJECT_AGENTS = 1; + public static readonly LSLInteger RC_REJECT_PHYSICAL = 2; + public static readonly LSLInteger RC_REJECT_NONPHYSICAL = 4; + public static readonly LSLInteger RC_REJECT_LAND = 8; - public static readonly LSLInteger RC_GET_NORMAL = 2; - public static readonly LSLInteger RC_GET_ROOT_KEY = 4; - public static readonly LSLInteger RC_GET_LINK_NUM = 8; + public static readonly LSLInteger RC_GET_NORMAL = 1; + public static readonly LSLInteger RC_GET_ROOT_KEY = 2; + public static readonly LSLInteger RC_GET_LINK_NUM = 4; - public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 1; + public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3; } } -- cgit v1.1 From edc11a1d3978a863f36bce3e65ff417f4a3d039f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Feb 2012 01:04:00 +0000 Subject: Add missing RCERR_UNKNOWN and RCERR_SIM_PERF_LOW LSL constants that would eventually be used by llCastRay(), though OpenSim does not use these yet. --- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index da1ef91..bb498b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -635,6 +635,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public static readonly LSLInteger RC_GET_ROOT_KEY = 2; public static readonly LSLInteger RC_GET_LINK_NUM = 4; + public static readonly LSLInteger RCERR_UNKNOWN = -1; + public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2; public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3; } } -- cgit v1.1 From 8779ff3c8f01550ecff822696eafbfef708743af Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 4 Feb 2012 02:00:35 +0000 Subject: Supply correct parameters to detailed authentication login fail message --- OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs index 14d96cb..48eb3f8 100644 --- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs +++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs @@ -90,7 +90,7 @@ namespace OpenSim.Services.AuthenticationService { m_log.DebugFormat( "[AUTH SERVICE]: Salted hash {0} of given password did not match salted hash of {1} for PrincipalID {2}. Authentication failure.", - principalID); + hashed, data.Data["passwordHash"], principalID); return String.Empty; } } -- cgit v1.1 From 6034e5d112b0086cfd4768d58289e301358a2c6a Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 4 Feb 2012 00:28:22 -0500 Subject: Add default value to TelehubObject --- OpenSim/Data/MySQL/Resources/RegionStore.migrations | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenSim/Data/MySQL/Resources/RegionStore.migrations b/OpenSim/Data/MySQL/Resources/RegionStore.migrations index 9891f4b..099beaf 100644 --- a/OpenSim/Data/MySQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/MySQL/Resources/RegionStore.migrations @@ -874,3 +874,13 @@ COMMIT; BEGIN; ALTER TABLE regionsettings ADD COLUMN covenant_datetime int unsigned NOT NULL DEFAULT '0'; COMMIT; + +:VERSION 43 #--------------------- + +BEGIN; + +ALTER TABLE `regionsettings` MODIFY COLUMN `TelehubObject` VARCHAR(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; + +COMMIT; + + -- cgit v1.1