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/CAPSService.cs | 1 +
.../Communications/Cache/CachedUserInfo.cs | 14 +-
.../Communications/Cache/InventoryFolder.cs | 12 +-
.../Communications/Cache/UserProfileCache.cs | 32 +--
.../Framework/Communications/IInventoryServices.cs | 16 +-
.../Communications/InventoryServiceBase.cs | 255 +++++----------------
OpenSim/Framework/Communications/LoginResponse.cs | 48 ++--
OpenSim/Framework/Communications/LoginService.cs | 134 ++++++-----
8 files changed, 165 insertions(+), 347 deletions(-)
(limited to 'OpenSim/Framework/Communications')
diff --git a/OpenSim/Framework/Communications/CAPSService.cs b/OpenSim/Framework/Communications/CAPSService.cs
index 40d8d37..a8eac26 100644
--- a/OpenSim/Framework/Communications/CAPSService.cs
+++ b/OpenSim/Framework/Communications/CAPSService.cs
@@ -8,6 +8,7 @@ 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.Servers;
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 9e8c239..99dc45a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -38,7 +38,7 @@ using OpenSim.Framework.Utilities;
namespace OpenSim.Framework.Communications.Caches
{
- public class CachedUserInfo : MarshalByRefObject
+ public class CachedUserInfo
{
private CommunicationsManager m_parentCommsManager;
// Fields
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Caches
}
// Methods
- public void FolderReceive(LLUUID userID, InventoryFolderBase folderInfo)
+ public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
{
if (userID == this.UserProfile.UUID)
{
@@ -59,19 +59,19 @@ namespace OpenSim.Framework.Communications.Caches
{
if (folderInfo.parentID == LLUUID.Zero)
{
- this.RootFolder = new InventoryFolder(folderInfo);
+ this.RootFolder = folderInfo;
}
}
else if (this.RootFolder.folderID == folderInfo.parentID)
{
- this.RootFolder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo));
+ this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
}
else
{
InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID);
if (folder != null)
{
- folder.SubFolders.Add(folderInfo.folderID, new InventoryFolder(folderInfo));
+ folder.SubFolders.Add(folderInfo.folderID, folderInfo);
}
}
}
@@ -131,7 +131,3 @@ namespace OpenSim.Framework.Communications.Caches
}
-
-
-
-
diff --git a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
index a212614..885cffc 100644
--- a/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
+++ b/OpenSim/Framework/Communications/Cache/InventoryFolder.cs
@@ -35,9 +35,6 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Data;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
-using OpenSim.Framework.Console;
-
-using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Framework.Communications.Caches
{
@@ -63,7 +60,7 @@ namespace OpenSim.Framework.Communications.Caches
}
// Methods
- public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type, InventoryCategory category)
+ public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
{
InventoryFolder subFold = new InventoryFolder();
subFold.name = folderName;
@@ -71,12 +68,7 @@ namespace OpenSim.Framework.Communications.Caches
subFold.type = (short) type;
subFold.parentID = this.folderID;
subFold.agentID = this.agentID;
- subFold.category = category;
- if (!SubFolders.ContainsKey(subFold.folderID))
- this.SubFolders.Add(subFold.folderID, subFold);
- else
- MainLog.Instance.Warn("INVENTORYCACHE", "Attempt to create a duplicate folder {0} {1}", folderName, folderID);
-
+ this.SubFolders.Add(subFold.folderID, subFold);
return subFold;
}
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
index 3dadf9c..390b938 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCache.cs
@@ -35,11 +35,10 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Data;
-using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Framework.Communications.Caches
{
- public class UserProfileCache : MarshalByRefObject
+ public class UserProfileCache
{
// Fields
private CommunicationsManager m_parent;
@@ -104,7 +103,7 @@ namespace OpenSim.Framework.Communications.Caches
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
if (info.RootFolder.folderID == parentID)
{
- InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User);
+ InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
if (createdFolder != null)
{
this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
@@ -115,7 +114,7 @@ namespace OpenSim.Framework.Communications.Caches
InventoryFolder folder = info.RootFolder.HasSubFolder(parentID);
if (folder != null)
{
- folder.CreateNewSubFolder(folderID, folderName, folderType, InventoryCategory.User);
+ folder.CreateNewSubFolder(folderID, folderName, folderType);
}
}
}
@@ -125,21 +124,16 @@ namespace OpenSim.Framework.Communications.Caches
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
{
InventoryFolder fold = null;
-
if (folderID == libraryRoot.folderID )
{
- // we are looking for the root of the shared inventory
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems());
}
else if (( fold = libraryRoot.HasSubFolder(folderID)) != null)
{
- // we are looking for a sub folder of the shared inventory
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, folderID, fold.RequestListOfItems());
}
else if (this.UserProfiles.ContainsKey(remoteClient.AgentId))
{
- //if we get here, we are looking the inventory of an agent in this sim
- //now we need to see if we already have the inventory cached
if (this.UserProfiles[remoteClient.AgentId].RootFolder != null)
{
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
@@ -159,23 +153,9 @@ namespace OpenSim.Framework.Communications.Caches
}
}
}
- else
- {
- //nope, inventory wasn't cached, so go to the inventory server and ask for the inventory
- m_parent.InventoryService.RequestInventoryForUser(remoteClient.AgentId, ReceiveFolderInfo, ReceiveItemInfo);
- }
}
}
- public void ReceiveFolderInfo(LLUUID userID, InventoryFolderBase folderInfo)
- {
- }
-
- public void ReceiveItemInfo(LLUUID userID, InventoryItemBase itemInfo)
- {
- }
-
-
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
{
if (ownerID == libraryRoot.agentID)
@@ -201,7 +181,7 @@ namespace OpenSim.Framework.Communications.Caches
///
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
{
- this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
+ this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
}
///
@@ -241,7 +221,3 @@ namespace OpenSim.Framework.Communications.Caches
}
}
-
-
-
-
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index 7b2948f..80c2e64 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -1,31 +1,29 @@
using System;
-using System.Text;
using System.Collections.Generic;
-
-using libsecondlife;
+using System.Text;
using OpenSim.Framework.Data;
+using libsecondlife;
using OpenSim.Framework.Communications.Caches;
+using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Framework.Communications
{
- public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderBase folderInfo);
+ public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo);
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
public interface IInventoryServices
{
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
- void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
+ void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
- void CreateNewUserInventory(LLUUID libraryRootId, LLUUID user);
- void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder);
+ void CreateNewUserInventory(LLUUID user);
///
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
///
///
///
- List RequestFirstLevelFolders(LLUUID folderID);
- List RequestFolderItems(LLUUID folderID);
+ List RequestFirstLevelFolders(LLUUID userID);
}
}
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index 6283b60..da7a0ce 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -1,9 +1,4 @@
using System;
-using System.Text;
-using System.IO;
-using System.Xml;
-using System.Xml.Serialization;
-using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using libsecondlife;
@@ -11,20 +6,21 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Console;
using OpenSim.Framework.Data;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
-using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
namespace OpenSim.Framework.Communications
{
- public abstract class InventoryServiceBase : MarshalByRefObject, IInventoryServices
+ public abstract class InventoryServiceBase : IInventoryServices
{
- protected IInventoryData _databasePlugin;
+ protected Dictionary m_plugins = new Dictionary();
+ //protected IAssetServer m_assetServer;
public InventoryServiceBase()
{
+ //m_assetServer = assetServer;
}
///
- /// Adds a new inventory data server plugin
+ /// Adds a new user server plugin - plugins will be requested in the order they were loaded.
///
/// The filename to the user server plugin DLL
public void AddPlugin(string FileName)
@@ -45,13 +41,8 @@ namespace OpenSim.Framework.Communications
IInventoryData plug =
(IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise();
- this._databasePlugin = plug;
-
- //TODO! find a better place to create inventory skeletons
- loadInventoryFromXmlFile(InventoryCategory.Library, "Inventory_Library.xml");
- loadInventoryFromXmlFile(InventoryCategory.Default, "Inventory_Default.xml");
+ this.m_plugins.Add(plug.getName(), plug);
MainLog.Instance.Verbose("Inventorystorage: Added IInventoryData Interface");
- break;
}
}
}
@@ -63,20 +54,20 @@ namespace OpenSim.Framework.Communications
///
///
///
- public List RequestFirstLevelFolders(LLUUID folderID)
+ public List RequestFirstLevelFolders(LLUUID userID)
{
- InventoryFolderBase root = _databasePlugin.getInventoryFolder(folderID);
-
- List folders = new List();
- if (root != null)
+ List inventoryList = new List();
+ foreach (KeyValuePair plugin in m_plugins)
{
- folders.Add(root);
-
- List subFolders = _databasePlugin.getInventoryFolders(root.folderID);
- foreach (InventoryFolderBase f in subFolders)
- folders.Add(f);
+ InventoryFolderBase rootFolder = plugin.Value.getUserRootFolder(userID);
+ if (rootFolder != null)
+ {
+ inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
+ inventoryList.Insert(0, rootFolder);
+ return inventoryList;
+ }
}
- return folders;
+ return inventoryList;
}
///
@@ -84,7 +75,11 @@ namespace OpenSim.Framework.Communications
///
public InventoryFolderBase RequestUsersRoot(LLUUID userID)
{
- return _databasePlugin.getInventoryFolder(userID); // the id of the root folder, is the user id
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ return plugin.Value.getUserRootFolder(userID);
+ }
+ return null;
}
///
@@ -94,27 +89,47 @@ namespace OpenSim.Framework.Communications
///
public List RequestSubFolders(LLUUID parentFolderID)
{
- return _databasePlugin.getInventoryFolders(parentFolderID);
+ List inventoryList = new List();
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ return plugin.Value.getInventoryFolders(parentFolderID);
+ }
+ return inventoryList;
}
public List RequestFolderItems(LLUUID folderID)
{
- return _databasePlugin.getInventoryInFolder(folderID);
+ List itemsList = new List();
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ itemsList = plugin.Value.getInventoryInFolder(folderID);
+ return itemsList;
+ }
+ return itemsList;
}
public void AddFolder(InventoryFolderBase folder)
{
- _databasePlugin.addInventoryFolder(folder);
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ plugin.Value.addInventoryFolder(folder);
+ }
}
public void AddItem(InventoryItemBase item)
{
- _databasePlugin.addInventoryItem(item);
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ plugin.Value.addInventoryItem(item);
+ }
}
public void deleteItem(InventoryItemBase item)
{
- _databasePlugin.deleteInventoryItem(item);
+ foreach (KeyValuePair plugin in m_plugins)
+ {
+ plugin.Value.deleteInventoryItem(item);
+ }
}
///
@@ -129,53 +144,11 @@ namespace OpenSim.Framework.Communications
}
}
- public void CreateNewUserInventory(LLUUID defaultFolders, LLUUID user)
+ public void CreateNewUserInventory(LLUUID user)
{
- try
- {
- // Get Default folder set from the database
- //TODO! We need to get the whole hierachy and not just one level down
- List folders = this.RequestFirstLevelFolders(LLUUID.Parse("00000112-000f-0000-0000-000100bba000"));
-
- // create an index list, where each of the elements has the index of its parent in the hierachy
- // this algorithm is pretty shoddy O(n^2), but it is only executed once per user.
- int[] parentIdx = new int[folders.Count];
- for (int i = 0; i < folders.Count; i++)
- parentIdx[i] = -1;
-
- for (int i = 0; i < folders.Count; i++)
- for (int j = 0; j < folders.Count; j++)
- if (folders[i].folderID == folders[j].parentID)
- parentIdx[j] = i;
-
-
- //assign a new owerid and a new to the folders
- foreach (InventoryFolderBase ifb in folders)
- {
- if (ifb.parentID == LLUUID.Zero)
- ifb.folderID = user;
- else
- ifb.folderID = LLUUID.Random();
-
- ifb.agentID = user;
- ifb.category = InventoryCategory.User;
- }
-
- // correct the parent id
- for (int i = 0; i < folders.Count; i++)
- {
- if (folders[i].parentID != LLUUID.Zero)
- folders[i].parentID = folders[parentIdx[i]].folderID; // root folder id is the same as the user id
- }
-
- // the list is structurally sound, using new folder id's, so save it
- foreach (InventoryFolderBase ifb in folders)
- _databasePlugin.addInventoryFolder(ifb);
- }
- catch (Exception e)
- {
- MainLog.Instance.Error(e.ToString());
- }
+ UsersInventory inven = new UsersInventory();
+ inven.CreateNewInventorySet(user);
+ this.AddNewInventorySet(inven);
}
public class UsersInventory
@@ -193,11 +166,10 @@ namespace OpenSim.Framework.Communications
InventoryFolderBase folder = new InventoryFolderBase();
folder.parentID = LLUUID.Zero;
folder.agentID = user;
- folder.folderID = user; // id of root folder is the same as the agent id
+ folder.folderID = LLUUID.Random();
folder.name = "My Inventory";
folder.type = 8;
folder.version = 1;
- folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder);
LLUUID rootFolder = folder.folderID;
@@ -209,7 +181,6 @@ namespace OpenSim.Framework.Communications
folder.name = "Textures";
folder.type = 0;
folder.version = 1;
- folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder);
folder = new InventoryFolderBase();
@@ -219,7 +190,6 @@ namespace OpenSim.Framework.Communications
folder.name = "Objects";
folder.type = 6;
folder.version = 1;
- folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder);
folder = new InventoryFolderBase();
@@ -229,130 +199,13 @@ namespace OpenSim.Framework.Communications
folder.name = "Clothes";
folder.type = 5;
folder.version = 1;
- folder.category = InventoryCategory.User;
Folders.Add(folder.folderID, folder);
}
}
-
- public void GetRootFoldersForUser(LLUUID user, out LLUUID libraryFolder, out LLUUID personalFolder)
- {
- List folders = _databasePlugin.getUserRootFolders(user);
- libraryFolder = LLUUID.Zero;
- personalFolder = LLUUID.Zero;
-
- for (int i = 0; i < folders.Count; i++)
- {
- if (folders[i].category == InventoryCategory.Library)
- libraryFolder = folders[i].folderID;
- else if (folders[i].category == InventoryCategory.User)
- personalFolder = folders[i].folderID;
- }
- }
-
- /*
- * Dot net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder
- * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize
- * into this simpler class, and then use that.
- */
- [XmlRoot(ElementName = "inventory", IsNullable = true)]
- public class SerializedInventory
- {
- [XmlRoot(ElementName = "folder", IsNullable = true)]
- public class SerializedFolder : InventoryFolderBase
- {
- [XmlArray(ElementName = "folders", IsNullable = true)]
- [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializedFolder))]
- public ArrayList SubFolders;
-
- [XmlArray(ElementName = "items", IsNullable = true)]
- [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))]
- public ArrayList Items;
- }
-
- [XmlElement(ElementName = "folder", IsNullable = true)]
- public SerializedFolder root;
- }
-
- public void uploadInventory(SerializedInventory.SerializedFolder folder)
- {
- foreach (InventoryItemBase iib in folder.Items)
- {
- // assign default values, if they haven't assigned
- iib.avatarID = folder.agentID;
- if (iib.assetID == LLUUID.Zero)
- iib.assetID = LLUUID.Random();
- if (iib.creatorsID == LLUUID.Zero)
- iib.creatorsID = folder.agentID;
- if (iib.inventoryID == LLUUID.Zero)
- iib.inventoryID = LLUUID.Random();
- if (iib.inventoryName == null || iib.inventoryName.Length == 0)
- iib.inventoryName = "new item";
- iib.parentFolderID = folder.folderID;
-
- _databasePlugin.addInventoryItem(iib);
- }
-
- foreach (SerializedInventory.SerializedFolder sf in folder.SubFolders)
- {
- // assign default values, if they haven't assigned
- sf.agentID = folder.agentID;
- sf.category = folder.category;
- if (sf.folderID == LLUUID.Zero)
- sf.folderID = LLUUID.Random();
- if (sf.name == null || sf.name.Length == 0)
- sf.name = "new folder";
- sf.parentID = folder.folderID;
-
- _databasePlugin.addInventoryFolder(sf);
- uploadInventory(sf);
- }
- }
-
- public void loadInventoryFromXmlFile(InventoryCategory inventoryCategory, string fileName)
- {
- _databasePlugin.deleteInventoryCategory(inventoryCategory);
-
- FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
- XmlReader reader = new XmlTextReader(fs);
- XmlSerializer x = new XmlSerializer(typeof(SerializedInventory));
- SerializedInventory inventory = (SerializedInventory)x.Deserialize(reader);
-
- // the library and default inventories has no owner, so we use a random guid.
- if (inventory.root.category == InventoryCategory.Library || inventory.root.category == InventoryCategory.Default)
- {
- if (inventory.root.folderID != LLUUID.Zero)
- inventory.root.agentID = inventory.root.folderID;
- else
- inventory.root.agentID = LLUUID.Random();
- }
- else if (inventory.root.category == InventoryCategory.User)
- {
- if (inventory.root.agentID == LLUUID.Zero)
- inventory.root.agentID = LLUUID.Random();
- }
-
- inventory.root.folderID = inventory.root.agentID; // the root folder always has the same id as the owning agent
- inventory.root.parentID = LLUUID.Zero;
- inventory.root.version = 0;
- inventory.root.category = inventoryCategory;
-
- _databasePlugin.addInventoryFolder(inventory.root);
- uploadInventory(inventory.root);
- }
-
- protected void saveInventoryToXmlFile(SerializedInventory inventory, string fileName)
- {
- FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
- XmlTextWriter writer = new XmlTextWriter(fs, Encoding.UTF8);
- writer.Formatting = Formatting.Indented;
- XmlSerializer x = new XmlSerializer(typeof(SerializedInventory));
- x.Serialize(writer, inventory);
- }
-
public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
- public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
+ public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder);
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index b4280e7..b5a4184 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -26,10 +26,9 @@ namespace OpenSim.Framework.UserManagement
private ArrayList classifiedCategories;
private ArrayList inventoryRoot;
private ArrayList initialOutfit;
- private ArrayList inventorySkeleton;
+ private ArrayList agentInventory;
private ArrayList inventoryLibraryOwner;
- private ArrayList inventoryLibraryRoot;
- private ArrayList inventoryLibrarySkeleton;
+ private ArrayList inventoryLibrary;
private UserInfo userProfile;
@@ -87,13 +86,11 @@ namespace OpenSim.Framework.UserManagement
this.defaultXmlRpcResponse = new XmlRpcResponse();
this.userProfile = new UserInfo();
-
- this.initialOutfit = new ArrayList();
this.inventoryRoot = new ArrayList();
- this.inventorySkeleton = new ArrayList();
- this.inventoryLibrarySkeleton = new ArrayList();
+ this.initialOutfit = new ArrayList();
+ this.agentInventory = new ArrayList();
+ this.inventoryLibrary = new ArrayList();
this.inventoryLibraryOwner = new ArrayList();
- this.inventoryLibraryRoot = new ArrayList();
this.xmlRpcResponse = new XmlRpcResponse();
this.defaultXmlRpcResponse = new XmlRpcResponse();
@@ -240,15 +237,12 @@ namespace OpenSim.Framework.UserManagement
responseData["classified_categories"] = this.classifiedCategories;
responseData["ui-config"] = this.uiConfig;
- responseData["inventory-skeleton"] = this.inventorySkeleton;
- responseData["inventory-skel-lib"] = this.inventoryLibrarySkeleton;
+ responseData["inventory-skeleton"] = this.agentInventory;
+ responseData["inventory-skel-lib"] = this.inventoryLibrary;
responseData["inventory-root"] = this.inventoryRoot;
- responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
- responseData["inventory-lib-root"] = this.inventoryLibraryRoot;
-
responseData["gestures"] = new ArrayList(); // todo
+ responseData["inventory-lib-owner"] = this.inventoryLibraryOwner;
responseData["initial-outfit"] = this.initialOutfit;
-
responseData["start_location"] = this.startLocation;
responseData["seed_capability"] = this.seedCapability;
responseData["home"] = this.home;
@@ -602,23 +596,23 @@ namespace OpenSim.Framework.UserManagement
{
get
{
- return this.inventorySkeleton;
+ return this.agentInventory;
}
set
{
- this.inventorySkeleton = value;
+ this.agentInventory = value;
}
}
- public ArrayList InventoryLibrarySkeleton
+ public ArrayList InventoryLibrary
{
get
{
- return this.inventoryLibrarySkeleton;
+ return this.inventoryLibrary;
}
set
{
- this.inventoryLibrarySkeleton = value;
+ this.inventoryLibrary = value;
}
}
@@ -634,18 +628,6 @@ namespace OpenSim.Framework.UserManagement
}
}
- public ArrayList InventoryLibraryRoot
- {
- get
- {
- return this.inventoryLibraryRoot;
- }
- set
- {
- this.inventoryLibraryRoot = value;
- }
- }
-
public string Home
{
get
@@ -683,7 +665,3 @@ namespace OpenSim.Framework.UserManagement
}
}
-
-
-
-
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