From 863195612bdef56165f2b4354bab280c371618b9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Sep 2007 14:57:43 +0000 Subject: Reverting back to 2017 since 2018 were causing Linux breakage; reopening Tleiades patch 444 and 445. --- OpenSim/Framework/Communications/LoginService.cs | 134 +++++++++++++---------- 1 file changed, 79 insertions(+), 55 deletions(-) (limited to 'OpenSim/Framework/Communications/LoginService.cs') diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 4e6aa80..8e7cf80 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs @@ -8,10 +8,11 @@ using Nwc.XmlRpc; using OpenSim.Framework.Console; using OpenSim.Framework.Data; using OpenSim.Framework.Interfaces; +using OpenSim.Framework.Inventory; using OpenSim.Framework.Utilities; -using OpenSim.Framework.Communications; -using OpenSim.Framework.Configuration; +using OpenSim.Framework.Configuration; +using InventoryFolder = OpenSim.Framework.Inventory.InventoryFolder; namespace OpenSim.Framework.UserManagement { @@ -19,12 +20,10 @@ namespace OpenSim.Framework.UserManagement { protected string m_welcomeMessage = "Welcome to OpenSim"; protected UserManagerBase m_userManager = null; - protected IInventoryServices m_inventoryServer = null; - public LoginService(UserManagerBase userManager, IInventoryServices inventoryServer, string welcomeMess) + public LoginService(UserManagerBase userManager, string welcomeMess) { m_userManager = userManager; - m_inventoryServer = inventoryServer; if (welcomeMess != "") { m_welcomeMessage = welcomeMess; @@ -38,6 +37,7 @@ namespace OpenSim.Framework.UserManagement /// The response to send public XmlRpcResponse XmlRpcLoginMethod(XmlRpcRequest request) { + System.Console.WriteLine("Attempting login now..."); XmlRpcResponse response = new XmlRpcResponse(); Hashtable requestData = (Hashtable)request.Params[0]; @@ -85,41 +85,15 @@ namespace OpenSim.Framework.UserManagement { LLUUID agentID = userProfile.UUID; - LLUUID libraryFolderID; - LLUUID personalFolderID; - - m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID); - if (personalFolderID == LLUUID.Zero) - { - m_inventoryServer.CreateNewUserInventory(libraryFolderID, agentID); - m_inventoryServer.GetRootFoldersForUser(agentID, out libraryFolderID, out personalFolderID); - } - - // The option "inventory-lib-owner" requires that we return the id of the - // owner of the library inventory. - Hashtable dynamicStruct = new Hashtable(); - dynamicStruct["agent_id"] = libraryFolderID.ToStringHyphenated(); - logResponse.InventoryLibraryOwner.Add(dynamicStruct); - - // The option "inventory-lib-root" requires that we return the id of the - // root folder of the library inventory. - dynamicStruct = new Hashtable(); - dynamicStruct["folder_id"] = libraryFolderID.ToStringHyphenated(); - logResponse.InventoryLibraryRoot.Add(dynamicStruct); + // Inventory Library Section + InventoryData inventData = this.CreateInventoryData(agentID); + ArrayList AgentInventoryArray = inventData.InventoryArray; - // The option "inventory-root" requires that we return the id of the - // root folder of the users inventory. - dynamicStruct = new Hashtable(); - dynamicStruct["folder_id"] = personalFolderID.ToStringHyphenated(); - logResponse.InventoryRoot.Add(dynamicStruct); - - // The option "inventory-skeleton" requires that we return the structure of the - // users folder hierachy - logResponse.InventorySkeleton = GetInventorySkeleton(personalFolderID); - - // The option "inventory-skel-lib" requires that we return the structure of the - // library folder hierachy - logResponse.InventoryLibrarySkeleton = GetInventorySkeleton(libraryFolderID); + Hashtable InventoryRootHash = new Hashtable(); + InventoryRootHash["folder_id"] = inventData.RootFolderID.ToStringHyphenated(); + ArrayList InventoryRoot = new ArrayList(); + InventoryRoot.Add(InventoryRootHash); + userProfile.rootInventoryFolderID = inventData.RootFolderID; // Circuit Code uint circode = (uint)(Util.RandomClass.Next()); @@ -129,6 +103,10 @@ namespace OpenSim.Framework.UserManagement logResponse.AgentID = agentID.ToStringHyphenated(); logResponse.SessionID = userProfile.currentAgent.sessionID.ToStringHyphenated(); logResponse.SecureSessionID = userProfile.currentAgent.secureSessionID.ToStringHyphenated(); + logResponse.InventoryRoot = InventoryRoot; + logResponse.InventorySkeleton = AgentInventoryArray; + logResponse.InventoryLibrary = this.GetInventoryLibrary(); + logResponse.InventoryLibraryOwner = this.GetLibraryOwner(); logResponse.CircuitCode = (Int32)circode; //logResponse.RegionX = 0; //overwritten //logResponse.RegionY = 0; //overwritten @@ -234,30 +212,76 @@ namespace OpenSim.Framework.UserManagement } /// - /// Create a structure of the generic inventory structure of a specified folder + /// + /// + /// + protected virtual ArrayList GetInventoryLibrary() + { + //return new ArrayList(); + Hashtable TempHash = new Hashtable(); + TempHash["name"] = "OpenSim Library"; + TempHash["parent_id"] = LLUUID.Zero.ToStringHyphenated(); + TempHash["version"] = 1; + TempHash["type_default"] = -1; + TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; + ArrayList temp = new ArrayList(); + temp.Add(TempHash); + + TempHash = new Hashtable(); + TempHash["name"] = "Texture Library"; + TempHash["parent_id"] = "00000112-000f-0000-0000-000100bba000"; + TempHash["version"] = 1; + TempHash["type_default"] = -1; + TempHash["folder_id"] = "00000112-000f-0000-0000-000100bba001"; + temp.Add(TempHash); + return temp; + } + + /// + /// /// /// - protected virtual ArrayList GetInventorySkeleton(LLUUID folderID) + protected virtual ArrayList GetLibraryOwner() { + //for now create random inventory library owner + Hashtable TempHash = new Hashtable(); + TempHash["agent_id"] = "11111111-1111-0000-0000-000100bba000"; + ArrayList inventoryLibOwner = new ArrayList(); + inventoryLibOwner.Add(TempHash); + return inventoryLibOwner; + } - List folders = m_inventoryServer.RequestFirstLevelFolders(folderID); + protected virtual InventoryData CreateInventoryData(LLUUID userID) + { + AgentInventory userInventory = new AgentInventory(); + userInventory.CreateRootFolder(userID, false); - ArrayList temp = new ArrayList(); - foreach (InventoryFolderBase ifb in folders) + ArrayList AgentInventoryArray = new ArrayList(); + Hashtable TempHash; + foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values) { - LLUUID tempFolderID = ifb.folderID; - LLUUID tempParentID = ifb.parentID; - - Hashtable TempHash = new Hashtable(); - TempHash["folder_id"] = tempFolderID.ToStringHyphenated(); - TempHash["name"] = ifb.name; - TempHash["parent_id"] = tempParentID.ToStringHyphenated(); - TempHash["type_default"] = (Int32)ifb.type; - TempHash["version"] = (Int32)ifb.version+1; - temp.Add(TempHash); + 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 temp; + return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID); + } + + public class InventoryData + { + public ArrayList InventoryArray = null; + public LLUUID RootFolderID = LLUUID.Zero; + + public InventoryData(ArrayList invList, LLUUID rootID) + { + InventoryArray = invList; + RootFolderID = rootID; + } } } } -- cgit v1.1