From c8f79eb9b49a4704e32a26ec04aeec3ff4c02754 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 28 Mar 2008 16:39:38 +0000
Subject: * Refactor: Rename CreateInventoryData() to GetInventorySkeleton() *
 Replace the unused default GetInventorySkeleton() impleemntation with an
 abstract declaration - less confusing this way imho * Add some comments

---
 OpenSim/Framework/Communications/LoginService.cs   | 50 ++++++++--------------
 OpenSim/Grid/UserServer/UserLoginService.cs        |  3 +-
 .../Communications/Local/LocalLoginService.cs      |  3 +-
 3 files changed, 21 insertions(+), 35 deletions(-)

diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs
index 2286b59..e738d0b 100644
--- a/OpenSim/Framework/Communications/LoginService.cs
+++ b/OpenSim/Framework/Communications/LoginService.cs
@@ -41,7 +41,7 @@ using OpenSim.Framework.Statistics;
 
 namespace OpenSim.Framework.UserManagement
 {
-    public class LoginService
+    public abstract class LoginService
     {
         private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 
@@ -73,6 +73,20 @@ namespace OpenSim.Framework.UserManagement
         }
 
         /// <summary>
+        /// Customises the login response and fills in missing values.
+        /// </summary>
+        /// <param name="response">The existing response</param>
+        /// <param name="theUser">The user profile</param>
+        public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
+        
+        /// <summary>
+        /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
+        /// </summary>
+        /// <param name="userID"></param>
+        /// <returns></returns>
+        protected abstract InventoryData GetInventorySkeleton(LLUUID userID);     
+        
+        /// <summary>
         /// Called when we receive the client's initial XMLRPC login_to_simulator request message
         /// </summary>
         /// <param name="request">The XMLRPC request</param>
@@ -196,7 +210,7 @@ namespace OpenSim.Framework.UserManagement
                         LLUUID agentID = userProfile.UUID;
 
                         // Inventory Library Section
-                        InventoryData inventData = CreateInventoryData(agentID);
+                        InventoryData inventData = GetInventorySkeleton(agentID);
                         ArrayList AgentInventoryArray = inventData.InventoryArray;
 
                         Hashtable InventoryRootHash = new Hashtable();
@@ -338,7 +352,7 @@ namespace OpenSim.Framework.UserManagement
                         LLUUID agentID = userProfile.UUID;
 
                         // Inventory Library Section
-                        InventoryData inventData = CreateInventoryData(agentID);
+                        InventoryData inventData = GetInventorySkeleton(agentID);
                         ArrayList AgentInventoryArray = inventData.InventoryArray;
 
                         Hashtable InventoryRootHash = new Hashtable();
@@ -407,15 +421,6 @@ namespace OpenSim.Framework.UserManagement
             }
         }
 
-        /// <summary>
-        /// Customises the login response and fills in missing values.
-        /// </summary>
-        /// <param name="response">The existing response</param>
-        /// <param name="theUser">The user profile</param>
-        public virtual void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest)
-        {
-        }
-
         public Hashtable ProcessHTMLLogin(Hashtable keysvals)
         {
             // Matches all unspecified characters
@@ -754,27 +759,6 @@ namespace OpenSim.Framework.UserManagement
             return inventoryLibOwner;
         }
 
-        protected virtual InventoryData CreateInventoryData(LLUUID userID)
-        {
-            AgentInventory userInventory = new AgentInventory();
-            userInventory.CreateRootFolder(userID);
-
-            ArrayList AgentInventoryArray = new ArrayList();
-            Hashtable TempHash;
-            foreach (InventoryFolder InvFolder in userInventory.InventoryFolders.Values)
-            {
-                TempHash = new Hashtable();
-                TempHash["name"] = InvFolder.FolderName;
-                TempHash["parent_id"] = InvFolder.ParentID.ToString();
-                TempHash["version"] = (Int32) InvFolder.Version;
-                TempHash["type_default"] = (Int32) InvFolder.DefaultType;
-                TempHash["folder_id"] = InvFolder.FolderID.ToString();
-                AgentInventoryArray.Add(TempHash);
-            }
-
-            return new InventoryData(AgentInventoryArray, userInventory.InventoryRoot.FolderID);
-        }
-
         public class InventoryData
         {
             public ArrayList InventoryArray = null;
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index 1a97cd2..e95acac 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -289,7 +289,8 @@ namespace OpenSim.Grid.UserServer
             }
         }
 
-        protected override InventoryData CreateInventoryData(LLUUID userID)
+        // See LoginService
+        protected override InventoryData GetInventorySkeleton(LLUUID userID)
         {
             List<InventoryFolderBase> folders
                 = SynchronousRestObjectPoster.BeginPostObject<Guid, List<InventoryFolderBase>>(
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index 7b30727..5af0077 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -212,7 +212,8 @@ namespace OpenSim.Region.Communications.Local
             return buddylistreturn;
         }
 
-        protected override InventoryData CreateInventoryData(LLUUID userID)
+        // See LoginService        
+        protected override InventoryData GetInventorySkeleton(LLUUID userID)
         {
             List<InventoryFolderBase> folders = m_Parent.InventoryService.RequestFirstLevelFolders(userID);
             if (folders.Count > 0)
-- 
cgit v1.1