* Normalized and pulled GetInventorySkeleton up.

0.6.5-rc1
lbsa71 2009-03-20 17:25:12 +00:00
parent aab38c2cb2
commit 613201e220
3 changed files with 79 additions and 127 deletions

View File

@ -201,46 +201,12 @@ namespace OpenSim.Client.Linden
if (m_regionsConnector.RegionLoginsEnabled)
{
// m_log.Info("[LLStandaloneLoginModule] Informing region about user");
return m_regionsConnector.NewUserConnection(regionInfo.RegionHandle, agent);
}
return false;
}
// See LoginService
protected override InventoryData GetInventorySkeleton(UUID userID)
{
List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
// If we have user auth but no inventory folders for some reason, create a new set of folders.
if (null == folders || 0 == folders.Count)
{
m_inventoryService.CreateNewUserInventory(userID);
folders = m_inventoryService.GetInventorySkeleton(userID);
}
UUID rootID = UUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
if (InvFolder.ParentID == UUID.Zero)
{
rootID = InvFolder.ID;
}
TempHash = new Hashtable();
TempHash["name"] = InvFolder.Name;
TempHash["parent_id"] = InvFolder.ParentID.ToString();
TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.Type;
TempHash["folder_id"] = InvFolder.ID.ToString();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
public override void LogOffUser(UserProfileData theUser, string message)
{
RegionInfo SimInfo;

View File

@ -90,13 +90,6 @@ namespace OpenSim.Framework.Communications
{
}
/// <summary>
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
/// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception>
protected abstract InventoryData GetInventorySkeleton(UUID userID);
/// <summary>
/// Called when we receive the client's initial XMLRPC login_to_simulator request message
@ -996,14 +989,6 @@ namespace OpenSim.Framework.Communications
return false;
}
// Customise the response
//response.Home =
// string.Format(
// "{{'region_handle':[r{0},r{1}], 'position':[r{2},r{3},r{4}], 'look_at':[r{5},r{6},r{7}]}}",
// (SimInfo.regionLocX * Constants.RegionSize),
// (SimInfo.regionLocY*Constants.RegionSize),
// theUser.HomeLocation.X, theUser.HomeLocation.Y, theUser.HomeLocation.Z,
// theUser.HomeLookAt.X, theUser.HomeLookAt.Y, theUser.HomeLookAt.Z);
theUser.CurrentAgent.Position = new Vector3(128, 128, 0);
response.StartLocation = "safe";
@ -1041,5 +1026,68 @@ namespace OpenSim.Framework.Communications
}
response.ActiveGestures = list;
}
/// <summary>
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
/// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception>
protected InventoryData GetInventorySkeleton(UUID userID)
{
List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
// If we have user auth but no inventory folders for some reason, create a new set of folders.
if (folders == null || folders.Count == 0)
{
m_log.InfoFormat(
"[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID);
// Although the create user function creates a new agent inventory along with a new user profile, some
// tools are creating the user profile directly in the database without creating the inventory. At
// this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
// exist.
if (!m_inventoryService.CreateNewUserInventory(userID))
{
throw new Exception(
String.Format(
"The inventory creation request for user {0} did not succeed."
+ " Please contact your inventory service provider for more information.",
userID));
}
m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
folders = m_inventoryService.GetInventorySkeleton(userID);
if (folders == null || folders.Count == 0)
{
throw new Exception(
String.Format(
"A root inventory folder for user {0} could not be retrieved from the inventory service",
userID));
}
}
UUID rootID = UUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
if (InvFolder.ParentID == UUID.Zero)
{
rootID = InvFolder.ID;
}
TempHash = new Hashtable();
TempHash["name"] = InvFolder.Name;
TempHash["parent_id"] = InvFolder.ParentID.ToString();
TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.Type;
TempHash["folder_id"] = InvFolder.ID.ToString();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
}
}

View File

@ -364,68 +364,6 @@ namespace OpenSim.Grid.UserServer.Modules
return true;
}
// See LoginService
protected override InventoryData GetInventorySkeleton(UUID userID)
{
m_log.DebugFormat(
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
m_config.InventoryUrl, userID);
List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
if (null == folders || folders.Count == 0)
{
m_log.InfoFormat(
"[LOGIN]: A root inventory folder for user {0} was not found. Requesting creation.", userID);
// Although the create user function creates a new agent inventory along with a new user profile, some
// tools are creating the user profile directly in the database without creating the inventory. At
// this time we'll accomodate them by lazily creating the user inventory now if it doesn't already
// exist.
if (!m_inventoryService.CreateNewUserInventory(userID))
{
throw new Exception(
String.Format(
"The inventory creation request for user {0} did not succeed."
+ " Please contact your inventory service provider for more information.",
userID));
}
m_log.InfoFormat("[LOGIN]: A new inventory skeleton was successfully created for user {0}", userID);
folders = m_inventoryService.GetInventorySkeleton(userID);
}
if (folders != null && folders.Count > 0)
{
UUID rootID = UUID.Zero;
ArrayList AgentInventoryArray = new ArrayList();
Hashtable TempHash;
foreach (InventoryFolderBase InvFolder in folders)
{
// m_log.DebugFormat("[LOGIN]: Received agent inventory folder {0}", InvFolder.name);
if (InvFolder.ParentID == UUID.Zero)
{
rootID = InvFolder.ID;
}
TempHash = new Hashtable();
TempHash["name"] = InvFolder.Name;
TempHash["parent_id"] = InvFolder.ParentID.ToString();
TempHash["version"] = (Int32)InvFolder.Version;
TempHash["type_default"] = (Int32)InvFolder.Type;
TempHash["folder_id"] = InvFolder.ID.ToString();
AgentInventoryArray.Add(TempHash);
}
return new InventoryData(AgentInventoryArray, rootID);
}
throw new Exception(
String.Format(
"A root inventory folder for user {0} could not be retrieved from the inventory service",
userID));
}
public XmlRpcResponse XmlRPCSetLoginParams(XmlRpcRequest request)
{
XmlRpcResponse response = new XmlRpcResponse();