From 2ceff87a02d9862497d1d8fa965851ae2d9c9b1b Mon Sep 17 00:00:00 2001 From: MW Date: Wed, 11 Jul 2007 17:47:25 +0000 Subject: More work on UserProfile and inventory cache (still currently not enabled). Asset uploading over CAPS now works, and although inventory isn't really working yet, this should now at least enables texturing of prims. --- .../Communications/CommunicationsManager.cs | 4 + .../Framework/Communications/IInventoryServices.cs | 17 +++ .../Communications/caches/CachedUserInfo.cs | 77 +++++++++++++ .../Communications/caches/InventoryFolder.cs | 51 +++++++++ .../Communications/caches/UserProfileCache.cs | 107 ++++++++++++++++++ OpenSim/Framework/Data/InventoryData.cs | 6 +- OpenSim/Framework/General/Interfaces/IClientAPI.cs | 4 + OpenSim/Framework/Servers/BinaryStreamHandler.cs | 44 ++++++++ OpenSim/Framework/Servers/RestMethod.cs | 1 + OpenSim/Region/Caches/CachedUserInfo.cs | 20 ---- OpenSim/Region/Caches/InventoryFolder.cs | 51 --------- OpenSim/Region/Caches/UserProfileCache.cs | 75 ------------- OpenSim/Region/Capabilities/Caps.cs | 20 ++-- OpenSim/Region/Capabilities/LLSDCapsDetails.cs | 2 +- .../Region/ClientStack/Assets/InventoryCache.cs | 1 + OpenSim/Region/ClientStack/ClientView.API.cs | 122 +++++++++++++++++---- prebuild.xml | 28 ++--- 17 files changed, 436 insertions(+), 194 deletions(-) create mode 100644 OpenSim/Framework/Communications/IInventoryServices.cs create mode 100644 OpenSim/Framework/Communications/caches/CachedUserInfo.cs create mode 100644 OpenSim/Framework/Communications/caches/InventoryFolder.cs create mode 100644 OpenSim/Framework/Communications/caches/UserProfileCache.cs create mode 100644 OpenSim/Framework/Servers/BinaryStreamHandler.cs delete mode 100644 OpenSim/Region/Caches/CachedUserInfo.cs delete mode 100644 OpenSim/Region/Caches/InventoryFolder.cs delete mode 100644 OpenSim/Region/Caches/UserProfileCache.cs diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs index 109d027..ebc9632 100644 --- a/OpenSim/Framework/Communications/CommunicationsManager.cs +++ b/OpenSim/Framework/Communications/CommunicationsManager.cs @@ -32,6 +32,7 @@ using OpenSim.Framework.Data; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; using OpenSim.Framework.Servers; +using OpenSim.Framework.Communications.Caches; namespace OpenSim.Framework.Communications { @@ -40,12 +41,15 @@ namespace OpenSim.Framework.Communications { public IUserServices UserServer; public IGridServices GridServer; + public IInventoryServices InventoryServer; public IInterRegionCommunications InterRegion; + public UserProfileCache UserProfilesCache; public NetworkServersInfo ServersInfo; public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer) { ServersInfo = serversInfo; + UserProfilesCache = new UserProfileCache(this); } #region Packet Handlers diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs new file mode 100644 index 0000000..0b05834 --- /dev/null +++ b/OpenSim/Framework/Communications/IInventoryServices.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Data; +using libsecondlife; +using OpenSim.Framework.Communications.Caches; + +namespace OpenSim.Framework.Communications +{ + public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo); + public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); + + public interface IInventoryServices + { + void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); + } +} diff --git a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs new file mode 100644 index 0000000..1c779e9 --- /dev/null +++ b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework.Data; +using libsecondlife; + +namespace OpenSim.Framework.Communications.Caches +{ + public class CachedUserInfo + { + public UserProfileData UserProfile; + //public Dictionary Folders = new Dictionary(); + public InventoryFolder RootFolder; + + public CachedUserInfo() + { + + } + + /// + /// + /// + /// + /// + public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) + { + if (userID == UserProfile.UUID) + { + if (this.RootFolder == null) + { + if (folderInfo.parentID == LLUUID.Zero) + { + this.RootFolder = folderInfo; + } + } + else + { + if (this.RootFolder.folderID == folderInfo.parentID) + { + this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo); + } + else + { + InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID); + if (pFolder != null) + { + pFolder.SubFolders.Add(folderInfo.folderID, folderInfo); + } + } + } + } + } + + public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo) + { + if (userID == UserProfile.UUID) + { + if (this.RootFolder != null) + { + if (itemInfo.parentFolderID == this.RootFolder.folderID) + { + this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo); + } + else + { + InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); + if (pFolder != null) + { + pFolder.Items.Add(itemInfo.inventoryID, itemInfo); + } + } + } + + } + } + } +} diff --git a/OpenSim/Framework/Communications/caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs new file mode 100644 index 0000000..eaddf19 --- /dev/null +++ b/OpenSim/Framework/Communications/caches/InventoryFolder.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework.Data; + +namespace OpenSim.Framework.Communications.Caches +{ + public class InventoryFolder : InventoryFolderBase + { + public Dictionary SubFolders = new Dictionary(); + public Dictionary Items = new Dictionary(); + + public InventoryFolder() + { + } + + public InventoryFolder HasSubFolder(LLUUID folderID) + { + InventoryFolder returnFolder = null; + if (this.SubFolders.ContainsKey(folderID)) + { + returnFolder = this.SubFolders[folderID]; + } + else + { + foreach (InventoryFolder folder in this.SubFolders.Values) + { + returnFolder = folder.HasSubFolder(folderID); + if (returnFolder != null) + { + break; + } + } + } + return returnFolder; + } + + public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) + { + InventoryFolder subFold = new InventoryFolder(); + subFold.name = folderName; + subFold.folderID = folderID; + subFold.type = type; + subFold.parentID = this.folderID; + subFold.agentID = this.agentID; + this.SubFolders.Add(subFold.folderID, subFold); + return subFold; + } + } +} diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs new file mode 100644 index 0000000..0ee63ba --- /dev/null +++ b/OpenSim/Framework/Communications/caches/UserProfileCache.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Text; +using libsecondlife; +using OpenSim.Framework.Data; +using OpenSim.Framework.Communications; + +namespace OpenSim.Framework.Communications.Caches +{ + public class UserProfileCache + { + public Dictionary UserProfiles = new Dictionary(); + + private CommunicationsManager m_parent; + + public UserProfileCache(CommunicationsManager parent) + { + m_parent = parent; + } + + /// + /// A new user has moved into a region in this instance + /// so get info from servers + /// + /// + public void AddNewUser(LLUUID userID) + { + if (!this.UserProfiles.ContainsKey(userID)) + { + CachedUserInfo userInfo = new CachedUserInfo(); + userInfo.UserProfile = this.RequestUserProfileForUser(userID); + this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); + if (userInfo.UserProfile != null) + { + this.UserProfiles.Add(userID, userInfo); + } + else + { + //no profile for this user, what do we do now? + } + } + else + { + //already have a cached profile for this user + //we should make sure its upto date with the user server version + } + } + + /// + /// A new user has moved into a region in this instance + /// so get info from servers + /// + /// + /// + public void AddNewUser(string firstName, string lastName) + { + + } + + /// + /// A user has left this instance + /// so make sure servers have been updated + /// Then remove cached info + /// + /// + public void UserLogOut(LLUUID userID) + { + + } + + /// + /// Request the user profile from User server + /// + /// + private UserProfileData RequestUserProfileForUser(LLUUID userID) + { + return this.m_parent.UserServer.GetUserProfile(userID); + } + + /// + /// Request Iventory Info from Inventory server + /// + /// + private void RequestInventoryForUser(LLUUID userID) + { + + } + + /// + /// Make sure UserProfile is updated on user server + /// + /// + private void UpdateUserProfileToServer(LLUUID userID) + { + + } + + /// + /// Update Inventory data to Inventory server + /// + /// + private void UpdateInventoryToServer(LLUUID userID) + { + + } + } +} diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs index fe2e25c..7253cc7 100644 --- a/OpenSim/Framework/Data/InventoryData.cs +++ b/OpenSim/Framework/Data/InventoryData.cs @@ -48,7 +48,7 @@ namespace OpenSim.Framework.Data /// public int type; /// - /// The folder this item is contained in (NULL_KEY = Inventory Root) + /// The folder this item is contained in /// public LLUUID parentFolderID; /// @@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data /// public LLUUID avatarID; /// - /// The creator of this folder + /// The creator of this item /// public LLUUID creatorsID; /// @@ -91,7 +91,7 @@ namespace OpenSim.Framework.Data /// public LLUUID agentID; /// - /// The folder this folder is contained in (NULL_KEY for root) + /// The folder this folder is contained in /// public LLUUID parentID; /// diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs index 1b0c682..fe1e9dc 100644 --- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs +++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs @@ -30,6 +30,7 @@ using System.Net; using libsecondlife; using libsecondlife.Packets; using OpenSim.Framework.Types; +using OpenSim.Framework.Data; namespace OpenSim.Framework.Interfaces { @@ -176,5 +177,8 @@ namespace OpenSim.Framework.Interfaces void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); + + void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items); + void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item); } } diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs new file mode 100644 index 0000000..302dbff --- /dev/null +++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; + +namespace OpenSim.Framework.Servers +{ + + public class BinaryStreamHandler : BaseStreamHandler + { + BinaryMethod m_restMethod; + + override public byte[] Handle(string path, Stream request) + { + byte[] data = ReadFully(request); + string param = GetParam(path); + string responseString = m_restMethod(data, path, param); + + return Encoding.UTF8.GetBytes(responseString); + } + + public BinaryStreamHandler(string httpMethod, string path, BinaryMethod restMethod) + : base(httpMethod, path) + { + m_restMethod = restMethod; + } + + public byte[] ReadFully(Stream stream) + { + byte[] buffer = new byte[32768]; + using (MemoryStream ms = new MemoryStream()) + { + while (true) + { + int read = stream.Read(buffer, 0, buffer.Length); + if (read <= 0) + return ms.ToArray(); + ms.Write(buffer, 0, read); + } + } + } + } + +} diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs index c6cb230..2a92fc1 100644 --- a/OpenSim/Framework/Servers/RestMethod.cs +++ b/OpenSim/Framework/Servers/RestMethod.cs @@ -28,4 +28,5 @@ namespace OpenSim.Framework.Servers { public delegate string RestMethod( string request, string path, string param ); + public delegate string BinaryMethod(byte[] data, string path, string param); } diff --git a/OpenSim/Region/Caches/CachedUserInfo.cs b/OpenSim/Region/Caches/CachedUserInfo.cs deleted file mode 100644 index 08a7848..0000000 --- a/OpenSim/Region/Caches/CachedUserInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenSim.Framework.Data; -using libsecondlife; - -namespace OpenSim.Region.Caches -{ - public class CachedUserInfo - { - public UserProfileData UserProfile; - //public Dictionary Folders = new Dictionary(); - public InventoryFolder RootFolder; - - public CachedUserInfo() - { - - } - } -} diff --git a/OpenSim/Region/Caches/InventoryFolder.cs b/OpenSim/Region/Caches/InventoryFolder.cs deleted file mode 100644 index 364a184..0000000 --- a/OpenSim/Region/Caches/InventoryFolder.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Framework.Data; - -namespace OpenSim.Region.Caches -{ - public class InventoryFolder : InventoryFolderBase - { - public Dictionary SubFolders = new Dictionary(); - public Dictionary Items = new Dictionary(); - - public InventoryFolder() - { - } - - public InventoryFolder HasSubFolder(LLUUID folderID) - { - InventoryFolder returnFolder = null; - if (this.SubFolders.ContainsKey(folderID)) - { - returnFolder = this.SubFolders[folderID]; - } - else - { - foreach (InventoryFolder folder in this.SubFolders.Values) - { - returnFolder = folder.HasSubFolder(folderID); - if (returnFolder != null) - { - break; - } - } - } - return returnFolder; - } - - public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) - { - InventoryFolder subFold = new InventoryFolder(); - subFold.name = folderName; - subFold.folderID = folderID; - subFold.type = type; - subFold.parentID = this.folderID; - subFold.agentID = this.agentID; - this.SubFolders.Add(subFold.folderID, subFold); - return subFold; - } - } -} diff --git a/OpenSim/Region/Caches/UserProfileCache.cs b/OpenSim/Region/Caches/UserProfileCache.cs deleted file mode 100644 index 0717e55..0000000 --- a/OpenSim/Region/Caches/UserProfileCache.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using libsecondlife; -using OpenSim.Framework.Data; - -namespace OpenSim.Region.Caches -{ - public class UserProfileCache - { - public Dictionary UserProfiles = new Dictionary(); - - public UserProfileCache() - { - - } - - /// - /// A new user has moved into a region in this instance - /// so get info from servers - /// - /// - public void AddNewUser(LLUUID userID) - { - - } - - /// - /// A user has left this instance - /// so make sure servers have been updated - /// Then remove cached info - /// - /// - public void UserLogOut(LLUUID userID) - { - - } - - /// - /// Request the user profile from User server - /// - /// - private void RequestUserProfileForUser(LLUUID userID) - { - - } - - /// - /// Request Iventory Info from Inventory server - /// - /// - private void RequestInventoryForUser(LLUUID userID) - { - - } - - /// - /// Make sure UserProfile is updated on user server - /// - /// - private void UpdateUserProfileToServer(LLUUID userID) - { - - } - - /// - /// Update Inventory data to Inventory server - /// - /// - private void UpdateInventoryToServer(LLUUID userID) - { - - } - } -} diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs index 6068076..db8df9b 100644 --- a/OpenSim/Region/Capabilities/Caps.cs +++ b/OpenSim/Region/Capabilities/Caps.cs @@ -29,6 +29,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Text; +using System.IO; using libsecondlife; using OpenSim.Framework.Servers; using OpenSim.Framework.Types; @@ -118,7 +119,7 @@ namespace OpenSim.Region.Capabilities string capsBaseUrl = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath; caps.MapLayer = capsBaseUrl + m_mapLayerPath; - // caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; + caps.NewFileAgentInventory = capsBaseUrl + m_newInventory; return caps; } @@ -253,10 +254,12 @@ namespace OpenSim.Region.Capabilities LLUUID newInvItem = LLUUID.Random(); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); AssetUploader uploader = new AssetUploader(newAsset, newInvItem, uploaderPath, this.httpListener); + + string capsBase = "/CAPS/" + m_capsObjectPath; + httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); - AddLegacyCapsHandler( httpListener, uploaderPath, uploader.uploaderCaps); - - string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + uploaderPath; + + string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + "/CAPS/" + m_capsObjectPath +uploaderPath; //Console.WriteLine("uploader url is " + uploaderURL); res += ""; res += "uploader" + uploaderURL + ""; @@ -303,10 +306,10 @@ namespace OpenSim.Region.Capabilities } - public string uploaderCaps(string request, string path, string param) + public string uploaderCaps(byte[] data, string path, string param) { - Encoding _enc = Encoding.UTF8; - byte[] data = _enc.GetBytes(request); + //Encoding _enc = Encoding.UTF8; + //byte[] data = _enc.GetBytes(request); //Console.WriteLine("recieved upload " + Util.FieldToString(data)); LLUUID inv = this.inventoryItemID; string res = ""; @@ -324,7 +327,8 @@ namespace OpenSim.Region.Capabilities OnUpLoad(newAssetID, inv, data); } - /*FileStream fs = File.Create("upload.jp2"); + /* + FileStream fs = File.Create("upload.jp2"); BinaryWriter bw = new BinaryWriter(fs); bw.Write(data); bw.Close(); diff --git a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs index 1f8b242..1522559 100644 --- a/OpenSim/Region/Capabilities/LLSDCapsDetails.cs +++ b/OpenSim/Region/Capabilities/LLSDCapsDetails.cs @@ -4,7 +4,7 @@ namespace OpenSim.Region.Capabilities public class LLSDCapsDetails { public string MapLayer = ""; - //public string NewFileAgentInventory = ""; + public string NewFileAgentInventory = ""; //public string EventQueueGet = ""; public LLSDCapsDetails() diff --git a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs index 082c0d0..e2cfa46 100644 --- a/OpenSim/Region/ClientStack/Assets/InventoryCache.cs +++ b/OpenSim/Region/ClientStack/Assets/InventoryCache.cs @@ -196,6 +196,7 @@ namespace OpenSim.Assets public void FetchInventoryDescendents(ClientView userInfo, FetchInventoryDescendentsPacket FetchDescend) { + if (this._agentsInventory.ContainsKey(userInfo.AgentID)) { AgentInventory agentInventory = this._agentsInventory[userInfo.AgentID]; diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs index 225e906..d5b6b52 100644 --- a/OpenSim/Region/ClientStack/ClientView.API.cs +++ b/OpenSim/Region/ClientStack/ClientView.API.cs @@ -35,6 +35,7 @@ using libsecondlife.Packets; using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; using OpenSim.Framework.Types; +using OpenSim.Framework.Data; namespace OpenSim.Region.ClientStack { @@ -76,7 +77,7 @@ namespace OpenSim.Region.ClientStack public event GenericCall6 OnRemoveAvatar; public event RequestMapBlocks OnRequestMapBlocks; public event TeleportLocationRequest OnTeleportLocationRequest; - + public event UUIDNameRequest OnNameFromUUIDRequest; public event ParcelPropertiesRequest OnParcelPropertiesRequest; @@ -188,7 +189,7 @@ namespace OpenSim.Region.ClientStack mov.Data.RegionHandle = regInfo.RegionHandle; mov.Data.Timestamp = 1172750370; // TODO - dynamicalise this - if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) + if ((pos.X == 0) && (pos.Y == 0) && (pos.Z == 0)) { mov.Data.Position = this.startpos; } @@ -325,11 +326,11 @@ namespace OpenSim.Region.ClientStack /// /// /// - public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint ) + public void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourEndPoint) { IPAddress neighbourIP = neighbourEndPoint.Address; - ushort neighbourPort = (ushort) neighbourEndPoint.Port; - + ushort neighbourPort = (ushort)neighbourEndPoint.Port; + EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket(); enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock(); enablesimpacket.SimulatorInfo.Handle = neighbourHandle; @@ -405,7 +406,7 @@ namespace OpenSim.Region.ClientStack mapReply.Data[i].Name = _enc.GetBytes(mapBlocks[i].Name); mapReply.Data[i].RegionFlags = mapBlocks[i].RegionFlags; mapReply.Data[i].Access = mapBlocks[i].Access; - mapReply.Data[i].Agents = mapBlocks[i].Agents; + mapReply.Data[i].Agents = mapBlocks[i].Agents; } this.OutPacket(mapReply); } @@ -421,7 +422,7 @@ namespace OpenSim.Region.ClientStack OutPacket(tpLocal); } - public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags) + public void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint newRegionEndPoint, uint locationID, uint flags) { TeleportFinishPacket teleport = new TeleportFinishPacket(); teleport.Info.AgentID = this.AgentID; @@ -439,7 +440,7 @@ namespace OpenSim.Region.ClientStack teleport.Info.SimIP = ip; teleport.Info.SimPort = (ushort)newRegionEndPoint.Port; teleport.Info.LocationID = 4; - teleport.Info.TeleportFlags = 1 << 4; + teleport.Info.TeleportFlags = 1 << 4; OutPacket(teleport); } @@ -492,6 +493,81 @@ namespace OpenSim.Region.ClientStack OutPacket(kill); } + public void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List items) + { + Encoding enc = Encoding.ASCII; + uint FULL_MASK_PERMISSIONS = 2147483647; + InventoryDescendentsPacket descend = new InventoryDescendentsPacket(); + descend.AgentData.AgentID = this.AgentId; + descend.AgentData.OwnerID = ownerID; + descend.AgentData.FolderID = folderID; + descend.AgentData.Descendents = items.Count; + descend.AgentData.Version = 0; + descend.ItemData = new InventoryDescendentsPacket.ItemDataBlock[items.Count]; + int i = 0; + foreach (InventoryItemBase item in items) + { + descend.ItemData[i] = new InventoryDescendentsPacket.ItemDataBlock(); + descend.ItemData[i].ItemID = item.inventoryID; + descend.ItemData[i].AssetID = item.assetID; + descend.ItemData[i].CreatorID = item.creatorsID; + descend.ItemData[i].BaseMask = FULL_MASK_PERMISSIONS; + descend.ItemData[i].CreationDate = 1000; + descend.ItemData[i].Description = enc.GetBytes(item.inventoryDescription+ "\0"); + descend.ItemData[i].EveryoneMask = FULL_MASK_PERMISSIONS; + descend.ItemData[i].Flags = 1; + descend.ItemData[i].FolderID = item.parentFolderID; + descend.ItemData[i].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); + descend.ItemData[i].GroupMask = FULL_MASK_PERMISSIONS; + descend.ItemData[i].InvType = (sbyte)item.type; + descend.ItemData[i].Name = enc.GetBytes(item.inventoryName+ "\0"); + descend.ItemData[i].NextOwnerMask = FULL_MASK_PERMISSIONS; + descend.ItemData[i].OwnerID = item.avatarID; + descend.ItemData[i].OwnerMask = FULL_MASK_PERMISSIONS; + descend.ItemData[i].SalePrice = 0; + descend.ItemData[i].SaleType = 0; + descend.ItemData[i].Type = (sbyte)item.type; + descend.ItemData[i].CRC = Helpers.InventoryCRC(1000, 0, descend.ItemData[i].InvType, descend.ItemData[i].Type, descend.ItemData[i].AssetID, descend.ItemData[i].GroupID, 100,descend.ItemData[i].OwnerID, descend.ItemData[i].CreatorID, descend.ItemData[i].ItemID, descend.ItemData[i].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + + i++; + } + + this.OutPacket(descend); + + } + + public void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item) + { + Encoding enc = Encoding.ASCII; + uint FULL_MASK_PERMISSIONS = 2147483647; + FetchInventoryReplyPacket inventoryReply = new FetchInventoryReplyPacket(); + inventoryReply.AgentData.AgentID = this.AgentId; + inventoryReply.InventoryData = new FetchInventoryReplyPacket.InventoryDataBlock[1]; + inventoryReply.InventoryData[0] = new FetchInventoryReplyPacket.InventoryDataBlock(); + inventoryReply.InventoryData[0].ItemID = item.inventoryID; + inventoryReply.InventoryData[0].AssetID = item.assetID; + inventoryReply.InventoryData[0].CreatorID = item.creatorsID; + inventoryReply.InventoryData[0].BaseMask = FULL_MASK_PERMISSIONS; + inventoryReply.InventoryData[0].CreationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; + inventoryReply.InventoryData[0].Description = enc.GetBytes(item.inventoryDescription + "\0"); + inventoryReply.InventoryData[0].EveryoneMask = FULL_MASK_PERMISSIONS; + inventoryReply.InventoryData[0].Flags = 0; + inventoryReply.InventoryData[0].FolderID = item.parentFolderID; + inventoryReply.InventoryData[0].GroupID = new LLUUID("00000000-0000-0000-0000-000000000000"); + inventoryReply.InventoryData[0].GroupMask = FULL_MASK_PERMISSIONS; + inventoryReply.InventoryData[0].InvType = (sbyte)item.type; + inventoryReply.InventoryData[0].Name = enc.GetBytes(item.inventoryName + "\0"); + inventoryReply.InventoryData[0].NextOwnerMask = FULL_MASK_PERMISSIONS; + inventoryReply.InventoryData[0].OwnerID = item.avatarID; + inventoryReply.InventoryData[0].OwnerMask = FULL_MASK_PERMISSIONS; + inventoryReply.InventoryData[0].SalePrice = 0; + inventoryReply.InventoryData[0].SaleType = 0; + inventoryReply.InventoryData[0].Type = (sbyte)item.type; + inventoryReply.InventoryData[0].CRC = Helpers.InventoryCRC(1000, 0, inventoryReply.InventoryData[0].InvType, inventoryReply.InventoryData[0].Type, inventoryReply.InventoryData[0].AssetID, inventoryReply.InventoryData[0].GroupID, 100, inventoryReply.InventoryData[0].OwnerID, inventoryReply.InventoryData[0].CreatorID, inventoryReply.InventoryData[0].ItemID, inventoryReply.InventoryData[0].FolderID, FULL_MASK_PERMISSIONS, 1, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS, FULL_MASK_PERMISSIONS); + + this.OutPacket(inventoryReply); + } + #region Appearance/ Wearables Methods @@ -545,20 +621,20 @@ namespace OpenSim.Region.ClientStack OutPacket(avp); } - public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) - { - AvatarAnimationPacket ani = new AvatarAnimationPacket(); - ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; - ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); - ani.AnimationSourceList[0].ObjectID = sourceAgentId; - ani.Sender = new AvatarAnimationPacket.SenderBlock(); - ani.Sender.ID = sourceAgentId; - ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; - ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); - ani.AnimationList[0].AnimID = animID; - ani.AnimationList[0].AnimSequenceID = seq; - this.OutPacket(ani); - } + public void SendAnimation(LLUUID animID, int seq, LLUUID sourceAgentId) + { + AvatarAnimationPacket ani = new AvatarAnimationPacket(); + ani.AnimationSourceList = new AvatarAnimationPacket.AnimationSourceListBlock[1]; + ani.AnimationSourceList[0] = new AvatarAnimationPacket.AnimationSourceListBlock(); + ani.AnimationSourceList[0].ObjectID = sourceAgentId; + ani.Sender = new AvatarAnimationPacket.SenderBlock(); + ani.Sender.ID = sourceAgentId; + ani.AnimationList = new AvatarAnimationPacket.AnimationListBlock[1]; + ani.AnimationList[0] = new AvatarAnimationPacket.AnimationListBlock(); + ani.AnimationList[0].AnimID = animID; + ani.AnimationList[0].AnimSequenceID = seq; + this.OutPacket(ani); + } #endregion @@ -674,7 +750,7 @@ namespace OpenSim.Region.ClientStack /// /// /// - public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID , uint flags) + public void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimData primData, LLVector3 pos, LLUUID textureID, uint flags) { ObjectUpdatePacket outPacket = new ObjectUpdatePacket(); outPacket.RegionData.RegionHandle = regionHandle; diff --git a/prebuild.xml b/prebuild.xml index 248fdf9..99a54f4 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -54,7 +54,7 @@ - + ../../../bin/ @@ -67,18 +67,17 @@ ../../../bin/ - + - - + - + - + ../../../bin/ @@ -93,17 +92,17 @@ ../../../bin/ - - + - + + - + ../../../bin/ @@ -116,11 +115,13 @@ ../../../bin/ - + - - + + + + @@ -603,6 +604,7 @@ + -- cgit v1.1