From d072a615eedffb8d8dceccd39f1d5451e8d52d68 Mon Sep 17 00:00:00 2001 From: Jim Radford Date: Sat, 7 Nov 2009 14:57:56 +0000 Subject: [PATCH] * Clarify documentation in InventoryManager * Allow the destination folder for InventoryItems offered to be set in the callback, will use the Default folder for the type of asset being sent if not set * Couple minor fixups in PacketDecoder for the BinaryBucket field in the ImprovedInstantMessage packet * Remove GroupTitle field from EventQueue decoder for the AgentGroupDataUpdateMessage, this is something opensim hacked in but its not used by the client so we'll just ignore it * Added copyright header to TerrainCompressor.cs git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3216 52acb1d6-8a22-11de-b505-999d5b087335 --- OpenMetaverse/AvatarManager.cs | 3 +- OpenMetaverse/InventoryManager.cs | 19 +++++-- OpenMetaverse/Messages/LindenMessages.cs | 8 +-- OpenMetaverse/PacketDecoder.cs | 63 +++++++++++++++++++++--- OpenMetaverse/TerrainCompressor.cs | 26 ++++++++++ 5 files changed, 102 insertions(+), 17 deletions(-) diff --git a/OpenMetaverse/AvatarManager.cs b/OpenMetaverse/AvatarManager.cs index 59df9e20..105227de 100644 --- a/OpenMetaverse/AvatarManager.cs +++ b/OpenMetaverse/AvatarManager.cs @@ -852,8 +852,7 @@ namespace OpenMetaverse avatarGroup.AcceptNotices = msg.GroupDataBlock[i].AcceptNotices; avatarGroup.GroupID = msg.GroupDataBlock[i].GroupID; avatarGroup.GroupInsigniaID = msg.GroupDataBlock[i].GroupInsigniaID; - avatarGroup.GroupName = msg.GroupDataBlock[i].GroupName; - avatarGroup.GroupTitle = msg.GroupDataBlock[i].GroupTitle; + avatarGroup.GroupName = msg.GroupDataBlock[i].GroupName; avatarGroup.GroupPowers = msg.GroupDataBlock[i].GroupPowers; avatarGroup.ListInProfile = msg.NewGroupDataBlock[i].ListInProfile; diff --git a/OpenMetaverse/InventoryManager.cs b/OpenMetaverse/InventoryManager.cs index 0aa63ac8..f88460d5 100644 --- a/OpenMetaverse/InventoryManager.cs +++ b/OpenMetaverse/InventoryManager.cs @@ -2375,7 +2375,7 @@ namespace OpenMetaverse /// UUID of group to own the object /// User defined queryID to correlate replies /// If set to true, the CreateSelected flag - /// will be set on the rezzed object + /// will be set on the rezzed object public UUID RequestRezFromInventory(Simulator simulator, Quaternion rotation, Vector3 position, InventoryItem item, UUID groupOwner, UUID queryID, bool rezSelected) { @@ -2428,6 +2428,7 @@ namespace OpenMetaverse /// DeRez an object from the simulator to the agents Objects folder in the agents Inventory /// /// The simulator Local ID of the object + /// If objectLocalID is a child primitive in a linkset, the entire linkset will be derezzed public void RequestDeRezToInventory(uint objectLocalID) { RequestDeRezToInventory(objectLocalID, DeRezDestination.AgentInventoryTake, @@ -2443,6 +2444,7 @@ namespace OpenMetaverse /// if DeRezzing object to a tasks Inventory, the Tasks /// The transaction ID for this request which /// can be used to correlate this request with other packets + /// If objectLocalID is a child primitive in a linkset, the entire linkset will be derezzed public void RequestDeRezToInventory(uint objectLocalID, DeRezDestination destType, UUID destFolder, UUID transactionID) { DeRezObjectPacket take = new DeRezObjectPacket(); @@ -3444,10 +3446,17 @@ namespace OpenMetaverse break; case InstantMessageDialog.GroupNotice: imp.MessageBlock.Dialog = (byte)InstantMessageDialog.GroupNoticeInventoryAccepted; - break; + break; } - imp.MessageBlock.BinaryBucket = destinationFolderID.GetBytes(); + if (args.FolderID != UUID.Zero) + { + imp.MessageBlock.BinaryBucket = args.FolderID.GetBytes(); + } + else + { + imp.MessageBlock.BinaryBucket = destinationFolderID.GetBytes(); + } } else { @@ -4163,10 +4172,14 @@ namespace OpenMetaverse /// Set to true to accept offer, false to decline it public bool Accept { get; set; } + /// The folder to accept the inventory into, if null default folder for will be used + public UUID FolderID { get; set; } + public InstantMessage Offer { get { return m_Offer; } } public AssetType AssetType { get { return m_AssetType; } } public UUID ObjectID { get { return m_ObjectID; } } public bool FromTask { get { return m_FromTask; } } + public InventoryObjectOfferedEventArgs(InstantMessage offerDetails, AssetType type, UUID objectID, bool fromTask) { diff --git a/OpenMetaverse/Messages/LindenMessages.cs b/OpenMetaverse/Messages/LindenMessages.cs index 1bb23fd3..c149bc1d 100644 --- a/OpenMetaverse/Messages/LindenMessages.cs +++ b/OpenMetaverse/Messages/LindenMessages.cs @@ -1181,9 +1181,7 @@ namespace OpenMetaverse.Messages.Linden /// The of the groups insignia public UUID GroupInsigniaID; /// The name of the group - public string GroupName; - /// The Active Title - public string GroupTitle; + public string GroupName; /// The aggregate permissions the agent has in the group for all roles the agent /// is assigned public GroupPowers GroupPowers; @@ -1224,13 +1222,12 @@ namespace OpenMetaverse.Messages.Linden for (int i = 0; i < GroupDataBlock.Length; i++) { - OSDMap group = new OSDMap(7); + OSDMap group = new OSDMap(6); group["AcceptNotices"] = OSD.FromBoolean(GroupDataBlock[i].AcceptNotices); group["Contribution"] = OSD.FromInteger(GroupDataBlock[i].Contribution); group["GroupID"] = OSD.FromUUID(GroupDataBlock[i].GroupID); group["GroupInsigniaID"] = OSD.FromUUID(GroupDataBlock[i].GroupInsigniaID); group["GroupName"] = OSD.FromString(GroupDataBlock[i].GroupName); - group["GroupTitle"] = OSD.FromString(GroupDataBlock[i].GroupTitle); group["GroupPowers"] = OSD.FromLong((long)GroupDataBlock[i].GroupPowers); groupDataArray.Add(group); } @@ -1277,7 +1274,6 @@ namespace OpenMetaverse.Messages.Linden groupData.GroupName = groupMap["GroupName"].AsString(); groupData.GroupPowers = (GroupPowers)groupMap["GroupPowers"].AsLong(); groupData.AcceptNotices = groupMap["AcceptNotices"].AsBoolean(); - groupData.GroupTitle = groupMap["GroupTitle"].AsString(); GroupDataBlock[i] = groupData; } diff --git a/OpenMetaverse/PacketDecoder.cs b/OpenMetaverse/PacketDecoder.cs index 750189f2..1f611b0f 100644 --- a/OpenMetaverse/PacketDecoder.cs +++ b/OpenMetaverse/PacketDecoder.cs @@ -1,4 +1,30 @@ -using System; +/* + * Copyright (c) 2009, openmetaverse.org + * All rights reserved. + * + * - 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. + * - Neither the name of the openmetaverse.org 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +using System; using System.Collections.Generic; using System.Reflection; using System.Text; @@ -61,6 +87,10 @@ namespace OpenMetaverse.Packets AddCallback("SimAccess", DecodeSimAccess); AddCallback("ControlFlags", DecodeControlFlags); + // AgentUpdate + AddCallback("AgentData.State", DecodeAgentState); + AddCallback("AgentData.Flags", DecodeAgentFlags); + // ViewerEffect TypeData AddCallback("ViewerEffect.Effect.TypeData", DecodeViewerEffectTypeData); AddCallback("ViewerEffect.Effect.Type", DecodeViewerEffectType); @@ -658,7 +688,6 @@ namespace OpenMetaverse.Packets result.AppendFormat("{0,30}", ""); return result.ToString(); - } private static string DecodeEstateParameter(string fieldName, object fieldData) @@ -973,16 +1002,21 @@ namespace OpenMetaverse.Packets } else if (bytes.Length == 17) { - bucket = String.Format("{0} {1,-40} ({2}) [Byte[]]", + bucket = String.Format("{0,-36} {1} ({2})", new UUID(bytes, 1), bytes[0], - (AssetType)bytes[0]); + (AssetType)(sbyte)bytes[0]); + } + else if (bytes.Length == 16) // the folder ID for the asset to be stored into if we accept an inventory offer + { + bucket = new UUID(bytes, 0).ToString(); } else { - bucket = Utils.BytesToString(bytes); + bucket = Utils.BytesToString(bytes); // we'll try a string lastly } - return String.Format("{0,30}: {1,-40} [Byte[]]", fieldName, bucket); + + return String.Format("{0,30}: {1,-40} [Byte[{2}]]", fieldName, bucket, bytes.Length); } private static string DecodeBinaryToHexString(string fieldName, object fieldData) @@ -1393,6 +1427,23 @@ namespace OpenMetaverse.Packets return String.Format("{0,30}: (No Decoder) Length={1}" + Environment.NewLine, fieldName, data.Length) + Utils.BytesToHexString(data, String.Format("{0,30}", "")); } } + + private static string DecodeAgentState(string fieldName, object fieldData) + { + return String.Format("{0,30}: {1,-2} {2,-37} [AgentState]", + fieldName, + fieldData, + "(" + (AgentState)(byte)fieldData + ")"); + } + + private static string DecodeAgentFlags(string fieldName, object fieldData) + { + return String.Format("{0,30}: {1,-2} {2,-37} [AgentFlags]", + fieldName, + fieldData, + "(" + (AgentFlags)(byte)fieldData + ")"); + } + private static string DecodeViewerEffectType(string fieldName, object fieldData) { diff --git a/OpenMetaverse/TerrainCompressor.cs b/OpenMetaverse/TerrainCompressor.cs index a6fc201a..96c50c51 100644 --- a/OpenMetaverse/TerrainCompressor.cs +++ b/OpenMetaverse/TerrainCompressor.cs @@ -1,3 +1,29 @@ +/* + * Copyright (c) 2009, openmetaverse.org + * All rights reserved. + * + * - 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. + * - Neither the name of the openmetaverse.org 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + using System; using OpenMetaverse.Packets;