From 8143c597fc5f62ec0d931d2d5b887730e06aec04 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Sep 2007 13:25:45 +0000 Subject: * Tleiades grid mode inventory (#444) - thanx Tleiades! * updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423) --- .../ClientStack/ClientView.ProcessPackets.cs | 5 +- OpenSim/Region/ClientStack/ClientView.cs | 1 - .../Communications/Local/CommunicationsLocal.cs | 2 +- .../Communications/Local/LocalInventoryService.cs | 3 +- .../Communications/Local/LocalLoginService.cs | 51 +--------------- .../Communications/Local/LocalUserServices.cs | 5 +- .../Communications/OGS1/CommunicationsOGS1.cs | 2 +- .../Region/Communications/OGS1/OGS1GridServices.cs | 20 ++++++- .../Communications/OGS1/OGS1InventoryService.cs | 69 ++++++++++++++++++---- OpenSim/Region/Environment/Modules/ChatModule.cs | 4 +- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 6 +- 11 files changed, 92 insertions(+), 76 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index e526f73..b35a9d3 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Text; using libsecondlife; using libsecondlife.Packets; -using OpenSim.Framework.Inventory; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; using OpenSim.Framework.Interfaces; @@ -353,7 +352,7 @@ namespace OpenSim.Region.ClientStack // Console.WriteLine("upload request was for assetid: " + request.AssetBlock.TransactionID.Combine(this.SecureSessionID).ToStringHyphenated()); if (OnAssetUploadRequest != null) { - OnAssetUploadRequest(this, request.AssetBlock.TransactionID.Combine(this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); + OnAssetUploadRequest(this, LLUUID.Combine(request.AssetBlock.TransactionID, this.SecureSessionID), request.AssetBlock.TransactionID, request.AssetBlock.Type, request.AssetBlock.AssetData, request.AssetBlock.StoreLocal); } break; case PacketType.RequestXfer: @@ -418,7 +417,7 @@ namespace OpenSim.Region.ClientStack { if (update.InventoryData[i].TransactionID != LLUUID.Zero) { - OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, update.InventoryData[i].TransactionID.Combine(this.SecureSessionID), update.InventoryData[i].ItemID); + OnUpdateInventoryItem(this, update.InventoryData[i].TransactionID, LLUUID.Combine(update.InventoryData[i].TransactionID, this.SecureSessionID), update.InventoryData[i].ItemID); } } } diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 2489739..ecf78cb 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs @@ -37,7 +37,6 @@ using OpenSim.Framework; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Console; using OpenSim.Framework.Interfaces; -using OpenSim.Framework.Inventory; using OpenSim.Framework.Types; using OpenSim.Framework.Utilities; using Timer = System.Timers.Timer; diff --git a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs index a00b35f..7e08297 100644 --- a/OpenSim/Region/Communications/Local/CommunicationsLocal.cs +++ b/OpenSim/Region/Communications/Local/CommunicationsLocal.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.Communications.Local } else { - this.m_inventoryService.CreateNewUserInventory(userProf.UUID); + this.m_inventoryService.CreateNewUserInventory(LLUUID.Zero, userProf.UUID); Console.WriteLine("Created new inventory set for " + firstName + " " + lastName); return userProf.UUID; } diff --git a/OpenSim/Region/Communications/Local/LocalInventoryService.cs b/OpenSim/Region/Communications/Local/LocalInventoryService.cs index 53f6ffa..5bd3277 100644 --- a/OpenSim/Region/Communications/Local/LocalInventoryService.cs +++ b/OpenSim/Region/Communications/Local/LocalInventoryService.cs @@ -3,6 +3,7 @@ using libsecondlife; using OpenSim.Framework.Communications; using OpenSim.Framework.Data; using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder; +using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; namespace OpenSim.Region.Communications.Local { @@ -49,7 +50,7 @@ namespace OpenSim.Region.Communications.Local } } - public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) + public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) { this.AddFolder(folder); } diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs index ab8e397..95fdf5a 100644 --- a/OpenSim/Region/Communications/Local/LocalLoginService.cs +++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs @@ -7,7 +7,6 @@ using OpenSim.Framework.Data; using OpenSim.Framework.Types; using OpenSim.Framework.UserManagement; using OpenSim.Framework.Utilities; -using OpenSim.Framework.Inventory; namespace OpenSim.Region.Communications.Local { @@ -25,7 +24,7 @@ namespace OpenSim.Region.Communications.Local public event LoginToRegionEvent OnLoginToRegion; public LocalLoginService(UserManagerBase userManager, string welcomeMess, CommunicationsLocal parent, NetworkServersInfo serversInfo, bool authenticate) - : base(userManager, welcomeMess) + : base(userManager, parent.InventoryService, welcomeMess) { m_Parent = parent; this.serversInfo = serversInfo; @@ -53,7 +52,7 @@ namespace OpenSim.Region.Communications.Local profile = this.m_userManager.GetUserProfile(firstname, lastname); if (profile != null) { - m_Parent.InventoryService.CreateNewUserInventory(profile.UUID); + m_Parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); } return profile; @@ -123,51 +122,5 @@ namespace OpenSim.Region.Communications.Local } } - - protected override InventoryData CreateInventoryData(LLUUID userID) - { - List folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID); - if (folders.Count > 0) - { - LLUUID rootID = LLUUID.Zero; - ArrayList AgentInventoryArray = new ArrayList(); - Hashtable TempHash; - foreach (InventoryFolderBase InvFolder in folders) - { - if (InvFolder.parentID == LLUUID.Zero) - { - rootID = InvFolder.folderID; - } - TempHash = new Hashtable(); - TempHash["name"] = InvFolder.name; - TempHash["parent_id"] = InvFolder.parentID.ToStringHyphenated(); - TempHash["version"] = (Int32)InvFolder.version; - TempHash["type_default"] = (Int32)InvFolder.type; - TempHash["folder_id"] = InvFolder.folderID.ToStringHyphenated(); - AgentInventoryArray.Add(TempHash); - } - return new InventoryData(AgentInventoryArray, rootID); - } - else - { - AgentInventory userInventory = new AgentInventory(); - userInventory.CreateRootFolder(userID, false); - - ArrayList AgentInventoryArray = new ArrayList(); - Hashtable TempHash; - foreach (OpenSim.Framework.Inventory.InventoryFolder InvFolder in userInventory.InventoryFolders.Values) - { - TempHash = new Hashtable(); - TempHash["name"] = InvFolder.FolderName; - TempHash["parent_id"] = InvFolder.ParentID.ToStringHyphenated(); - TempHash["version"] = (Int32)InvFolder.Version; - TempHash["type_default"] = (Int32)InvFolder.DefaultType; - TempHash["folder_id"] = InvFolder.FolderID.ToStringHyphenated(); - AgentInventoryArray.Add(TempHash); - } - - return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); - } - } } } diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index 3bc4301..61b8633 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -1,4 +1,5 @@ using System; +using libsecondlife; using OpenSim.Framework.Communications; using OpenSim.Framework.Data; using OpenSim.Framework.Types; @@ -48,10 +49,10 @@ namespace OpenSim.Region.Communications.Local } else { - m_parent.InventoryService.CreateNewUserInventory(profile.UUID); + m_parent.InventoryService.CreateNewUserInventory(LLUUID.Zero, profile.UUID); } return profile; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 96f1933..1aa6498 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs @@ -14,8 +14,8 @@ namespace OpenSim.Region.Communications.OGS1 m_gridService = gridInterComms; m_interRegion = gridInterComms; - m_inventoryService = new OGS1InventoryService(); m_userService = new OGS1UserServices(this); + m_inventoryService = new OGS1InventoryService(serversInfo, m_userService); } } } diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index 1b4b54c..0b78c83 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs @@ -5,6 +5,7 @@ using System.Net; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; +using System.Runtime.Serialization.Formatters; using libsecondlife; using Nwc.XmlRpc; using OpenSim.Framework; @@ -302,8 +303,23 @@ namespace OpenSim.Region.Communications.OGS1 /// private void StartRemoting() { - TcpChannel ch = new TcpChannel(this.serversInfo.RemotingListenerPort); - ChannelServices.RegisterChannel(ch, true); + // we only need to register the tcp channel once, and we don't know which other modules use remoting + if (ChannelServices.GetChannel("tcp") == null) + { + // Creating a custom formatter for a TcpChannel sink chain. + BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider(); + serverProvider.TypeFilterLevel = TypeFilterLevel.Full; + + BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider(); + + IDictionary props = new Hashtable(); + props["port"] = this.serversInfo.RemotingListenerPort; + props["typeFilterLevel"] = TypeFilterLevel.Full; + + TcpChannel ch = new TcpChannel(props, clientProvider, serverProvider); + + ChannelServices.RegisterChannel(ch, true); + } WellKnownServiceTypeEntry wellType = new WellKnownServiceTypeEntry(typeof(OGS1InterRegionRemoting), "InterRegions", WellKnownObjectMode.Singleton); RemotingConfiguration.RegisterWellKnownServiceType(wellType); diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 45188c1..2ec4d10 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs @@ -1,8 +1,15 @@ +using System; +using System.Runtime.Remoting; +using System.Runtime.Remoting.Channels; +using System.Runtime.Remoting.Channels.Tcp; +using System.Runtime.Serialization.Formatters; +using System.Collections; using System.Collections.Generic; + using libsecondlife; using OpenSim.Framework.Communications; using OpenSim.Framework.Data; -using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder; +using OpenSim.Framework.Types; namespace OpenSim.Region.Communications.OGS1 @@ -10,43 +17,83 @@ namespace OpenSim.Region.Communications.OGS1 public class OGS1InventoryService : IInventoryServices { - public OGS1InventoryService() + IUserServices _userServices; + IInventoryServices _inventoryServices; + + public OGS1InventoryService(NetworkServersInfo networkConfig, IUserServices userServices) : + this(networkConfig.InventoryServerName, networkConfig.InventoryServerPort, userServices) + { + } + + public OGS1InventoryService(string serverName, int serverPort, IUserServices userServices) { + _userServices = userServices; + + // we only need to register the tcp channel once, and we don't know which other modules use remoting + if (ChannelServices.GetChannel("tcp") == null) + { + // Creating a custom formatter for a TcpChannel sink chain. + BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider(); + serverProvider.TypeFilterLevel = TypeFilterLevel.Full; + + BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider(); + + IDictionary props = new Hashtable(); + props["typeFilterLevel"] = TypeFilterLevel.Full; + + // Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.) + TcpChannel chan = new TcpChannel(props, clientProvider, serverProvider); + + ChannelServices.RegisterChannel(chan, true); + } + + + string remotingUrl = string.Format("tcp://{0}:{1}/Inventory", serverName, serverPort); + _inventoryServices = (IInventoryServices)Activator.GetObject(typeof(IInventoryServices), remotingUrl); } #region IInventoryServices Members public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) { - + _inventoryServices.RequestInventoryForUser(userID, folderCallBack, itemCallBack); } - public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) + public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) { - + _inventoryServices.AddNewInventoryFolder(userID, folder); } public void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) { - + _inventoryServices.AddNewInventoryItem(userID, item); } public void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) { - + _inventoryServices.DeleteInventoryItem(userID, item); + } + + public List RequestFirstLevelFolders(LLUUID folderID) + { + return _inventoryServices.RequestFirstLevelFolders(folderID); } - public void CreateNewUserInventory(LLUUID user) + public List RequestFolderItems(LLUUID folderID) { - + return _inventoryServices.RequestFolderItems(folderID); } - public List RequestFirstLevelFolders(LLUUID userID) + public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder) { - return new List(); + _inventoryServices.GetRootFoldersForUser(user, out libraryFolder, out personalFolder); } + public void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user) + { + throw new Exception("method not implemented"); + } #endregion } } diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 1c7b806..d76ffe3 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs @@ -162,7 +162,7 @@ namespace OpenSim.Region.Environment.Modules avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId); if (avatar != null) { - dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos); + dis = (int)LLVector3.Mag(avatar.AbsolutePosition-fromPos); } switch (type) @@ -211,4 +211,4 @@ namespace OpenSim.Region.Environment.Modules } } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index e6b8364..5b6fe46 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -561,7 +561,7 @@ namespace OpenSim.Region.Environment.Scenes } /// check for physics-related movement - else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02) + else if (LLVector3.Dist(lastPhysPos,AbsolutePosition) > 0.02) { SendTerseUpdateToAllClients(); m_updateCount = 0; @@ -748,7 +748,7 @@ namespace OpenSim.Region.Environment.Scenes protected void CheckForSignificantMovement() { - if (Helpers.VecDist(AbsolutePosition, posLastSignificantMove) > 2.0) + if (LLVector3.Dist(AbsolutePosition, posLastSignificantMove) > 2.0) { posLastSignificantMove = AbsolutePosition; if (OnSignificantClientMovement != null) @@ -919,4 +919,4 @@ namespace OpenSim.Region.Environment.Scenes RemoveFromPhysicalScene(); } } -} \ No newline at end of file +} -- cgit v1.1