From 5df851761aa796cba70a3b6d8b36d119502c1de2 Mon Sep 17 00:00:00 2001 From: MW Date: Sat, 1 Dec 2007 18:49:17 +0000 Subject: Initial working Grid Inventory server. Only been tested on a very small grid, so likely to have problems on a larger grid with more people? To use , both the user server and Inventory server need to be running this latest revision. (older regions should be able to still be used, just the user won't have inventory on them). Also and HERE IS THE BIG BREAK ISSUE, currently, so that the initial inventory details for a user are added to the inventory db , you need to recreate the accounts using the user server "create user" feature. It should be quite easy to manual populate the inventory database instead but I someone else will need to look into that) Also I've only tested using SQLite as the database provider, there is a Mysql inventory provider but I don't know if it works (SQLite is set as default, so you will need to change it in the inventory server config.xml) --- .../Grid/InventoryServer/GridInventoryService.cs | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 OpenSim/Grid/InventoryServer/GridInventoryService.cs (limited to 'OpenSim/Grid/InventoryServer/GridInventoryService.cs') diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs new file mode 100644 index 0000000..dda2f61 --- /dev/null +++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Text; +using OpenSim.Framework; +using OpenSim.Framework.Communications; +using libsecondlife; + +namespace OpenSim.Grid.InventoryServer +{ + public class GridInventoryService : InventoryServiceBase + { + public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, + InventoryItemInfo itemCallBack) + { + + } + + private bool TryGetUsersInventory(LLUUID userID, out List folderList, out List itemsList) + { + List folders = RequestFirstLevelFolders(userID); + List allItems = new List(); + + if (folders != null) + { + foreach (InventoryFolderBase folder in folders) + { + if (folder.parentID != LLUUID.Zero) + { + List items = RequestFolderItems(folder.folderID); + if (items != null) + { + allItems.InsertRange(0, items); + } + } + } + } + + folderList = folders; + itemsList = allItems; + if (folderList != null) + { + return true; + } + else + { + return false; + } + } + + public InventoryCollection GetUserInventory(LLUUID userID) + { + InventoryCollection invCollection = new InventoryCollection(); + List folders; + List allItems; + if (TryGetUsersInventory(userID, out folders, out allItems)) + { + invCollection.AllItems = allItems; + invCollection.Folders = folders; + invCollection.UserID = userID; + } + return invCollection; + } + + public bool CreateUsersInventory(LLUUID user) + { + CreateNewUserInventory(user); + return true; + } + + + public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) + { + AddFolder(folder); + } + + public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) + { + AddItem(item); + } + + public bool AddInventoryFolder( InventoryFolderBase folder) + { + AddNewInventoryFolder(folder.agentID, folder); + return true; + } + + public bool AddInventoryItem( InventoryItemBase item) + { + AddNewInventoryItem(item.avatarID, item); + return true; + } + + public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) + { + DeleteItem(item); + } + + public bool DeleteInvItem( InventoryItemBase item) + { + DeleteInventoryItem(item.avatarID, item); + return true; + } + } +} -- cgit v1.1