* Refactor: Rename CreateInventoryData() to GetInventorySkeleton()

* Replace the unused default GetInventorySkeleton() impleemntation with an abstract declaration - less confusing this way imho
* Add some comments
0.6.0-stable
Justin Clarke Casey 2008-03-28 16:39:38 +00:00
parent 512e52be4c
commit c8f79eb9b4
3 changed files with 21 additions and 35 deletions

View File

@ -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);
@ -72,6 +72,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>
@ -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;

View File

@ -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>>(

View File

@ -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)