From 8a9677a5319793ff630d0761e204ae8961f375aa Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 1 Jan 2010 21:12:46 -0800 Subject: The Library Service is now working. UserProfileCacheService.LibraryRoot is obsolete. Didn't delete it yet to avoid merge conflicts later -- want to stay out of core as much as possible. --- OpenSim/Services/LLLoginService/LLLoginResponse.cs | 34 ++++++++++++---------- OpenSim/Services/LLLoginService/LLLoginService.cs | 24 ++++++++++++--- 2 files changed, 38 insertions(+), 20 deletions(-) (limited to 'OpenSim/Services/LLLoginService') diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index c80ab7f..4db6a05 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs @@ -215,12 +215,12 @@ namespace OpenSim.Services.LLLoginService } public LLLoginResponse(UserAccount account, AgentCircuitData aCircuit, PresenceInfo pinfo, - GridRegion destination, List invSkel, + GridRegion destination, List invSkel, ILibraryService libService, string where, string startlocation, Vector3 position, Vector3 lookAt, string message, GridRegion home, IPEndPoint clientIP) : this() { - FillOutInventoryData(invSkel); + FillOutInventoryData(invSkel, libService); CircuitCode = (int)aCircuit.circuitcode; Lastname = account.LastName; @@ -243,7 +243,7 @@ namespace OpenSim.Services.LLLoginService } - private void FillOutInventoryData(List invSkel) + private void FillOutInventoryData(List invSkel, ILibraryService libService) { InventoryData inventData = null; @@ -272,13 +272,16 @@ namespace OpenSim.Services.LLLoginService } // Inventory Library Section - Hashtable InventoryLibRootHash = new Hashtable(); - InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; - InventoryLibRoot = new ArrayList(); - InventoryLibRoot.Add(InventoryLibRootHash); + if (libService != null && libService.LibraryRootFolder != null) + { + Hashtable InventoryLibRootHash = new Hashtable(); + InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; + InventoryLibRoot = new ArrayList(); + InventoryLibRoot.Add(InventoryLibRootHash); - InventoryLibraryOwner = GetLibraryOwner(); - InventoryLibrary = GetInventoryLibrary(); + InventoryLibraryOwner = GetLibraryOwner(libService.LibraryRootFolder); + InventoryLibrary = GetInventoryLibrary(libService); + } } private void FillOutHomeData(PresenceInfo pinfo, GridRegion home) @@ -646,12 +649,11 @@ namespace OpenSim.Services.LLLoginService /// Converts the inventory library skeleton into the form required by the rpc request. /// /// - protected virtual ArrayList GetInventoryLibrary() + protected virtual ArrayList GetInventoryLibrary(ILibraryService library) { - // While we don't have library... - //Dictionary rootFolders - // = m_libraryRootFolder.RequestSelfAndDescendentFolders(); - Dictionary rootFolders = new Dictionary(); + Dictionary rootFolders = library.GetAllFolders(); + m_log.DebugFormat("[LLOGIN]: Library has {0} folders", rootFolders.Count); + //Dictionary rootFolders = new Dictionary(); ArrayList folderHashes = new ArrayList(); foreach (InventoryFolderBase folder in rootFolders.Values) @@ -672,11 +674,11 @@ namespace OpenSim.Services.LLLoginService /// /// /// - protected virtual ArrayList GetLibraryOwner() + protected virtual ArrayList GetLibraryOwner(InventoryFolderImpl libFolder) { //for now create random inventory library owner Hashtable TempHash = new Hashtable(); - TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; + TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; // libFolder.Owner ArrayList inventoryLibOwner = new ArrayList(); inventoryLibOwner.Add(TempHash); return inventoryLibOwner; diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 58038cb..2b74539 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -26,13 +26,14 @@ namespace OpenSim.Services.LLLoginService private IGridService m_GridService; private IPresenceService m_PresenceService; private ISimulationService m_LocalSimulationService; + private ILibraryService m_LibraryService; private string m_DefaultRegionName; private string m_RemoteSimulationDll; private string m_WelcomeMessage; private bool m_RequireInventory; - public LLLoginService(IConfigSource config, ISimulationService simService) + public LLLoginService(IConfigSource config, ISimulationService simService, ILibraryService libraryService) { IConfig serverConfig = config.Configs["LoginService"]; if (serverConfig == null) @@ -43,13 +44,14 @@ namespace OpenSim.Services.LLLoginService string invService = serverConfig.GetString("InventoryService", String.Empty); string gridService = serverConfig.GetString("GridService", String.Empty); string presenceService = serverConfig.GetString("PresenceService", String.Empty); + string libService = serverConfig.GetString("LibraryService", String.Empty); m_DefaultRegionName = serverConfig.GetString("DefaultRegion", String.Empty); m_RemoteSimulationDll = serverConfig.GetString("RemoteSimulationService", String.Empty); m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); m_RequireInventory = serverConfig.GetBoolean("RequireInventory", true); - // These 3 are required; the other 2 aren't + // These 3 are required; the others aren't if (accountService == string.Empty || authService == string.Empty || invService == string.Empty) throw new Exception("LoginService is missing service specifications"); @@ -62,13 +64,27 @@ namespace OpenSim.Services.LLLoginService m_GridService = ServerUtils.LoadPlugin(gridService, args); if (presenceService != string.Empty) m_PresenceService = ServerUtils.LoadPlugin(presenceService, args); + + // + // deal with the services given as argument + // m_LocalSimulationService = simService; + if (libraryService != null) + { + m_log.DebugFormat("[LLOGIN SERVICE]: Using LibraryService given as argument"); + m_LibraryService = libraryService; + } + else if (libService != string.Empty) + { + m_log.DebugFormat("[LLOGIN SERVICE]: Using instantiated LibraryService"); + m_LibraryService = ServerUtils.LoadPlugin(libService, args); + } m_log.DebugFormat("[LLOGIN SERVICE]: Starting..."); } - public LLLoginService(IConfigSource config) : this(config, null) + public LLLoginService(IConfigSource config) : this(config, null, null) { } @@ -171,7 +187,7 @@ namespace OpenSim.Services.LLLoginService // TODO: Get Friends list... // Finally, fill out the response and return it - LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, + LLLoginResponse response = new LLLoginResponse(account, aCircuit, presence, destination, inventorySkel, m_LibraryService, where, startLocation, position, lookAt, m_WelcomeMessage, home, clientIP); return response; -- cgit v1.1