aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/InventoryServer/GridInventoryService.cs
diff options
context:
space:
mode:
authorMW2007-12-01 18:49:17 +0000
committerMW2007-12-01 18:49:17 +0000
commit5df851761aa796cba70a3b6d8b36d119502c1de2 (patch)
tree4cab0f2d6ea32a6cfb280d74583d8ffce7331c26 /OpenSim/Grid/InventoryServer/GridInventoryService.cs
parentAttempt to fix mantis issue # 65, seems like it is a race condition between t... (diff)
downloadopensim-SC-5df851761aa796cba70a3b6d8b36d119502c1de2.zip
opensim-SC-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.gz
opensim-SC-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.bz2
opensim-SC-5df851761aa796cba70a3b6d8b36d119502c1de2.tar.xz
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)
Diffstat (limited to 'OpenSim/Grid/InventoryServer/GridInventoryService.cs')
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs104
1 files changed, 104 insertions, 0 deletions
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 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework;
5using OpenSim.Framework.Communications;
6using libsecondlife;
7
8namespace OpenSim.Grid.InventoryServer
9{
10 public class GridInventoryService : InventoryServiceBase
11 {
12 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
13 InventoryItemInfo itemCallBack)
14 {
15
16 }
17
18 private bool TryGetUsersInventory(LLUUID userID, out List<InventoryFolderBase> folderList, out List<InventoryItemBase> itemsList)
19 {
20 List<InventoryFolderBase> folders = RequestFirstLevelFolders(userID);
21 List<InventoryItemBase> allItems = new List<InventoryItemBase>();
22
23 if (folders != null)
24 {
25 foreach (InventoryFolderBase folder in folders)
26 {
27 if (folder.parentID != LLUUID.Zero)
28 {
29 List<InventoryItemBase> items = RequestFolderItems(folder.folderID);
30 if (items != null)
31 {
32 allItems.InsertRange(0, items);
33 }
34 }
35 }
36 }
37
38 folderList = folders;
39 itemsList = allItems;
40 if (folderList != null)
41 {
42 return true;
43 }
44 else
45 {
46 return false;
47 }
48 }
49
50 public InventoryCollection GetUserInventory(LLUUID userID)
51 {
52 InventoryCollection invCollection = new InventoryCollection();
53 List<InventoryFolderBase> folders;
54 List<InventoryItemBase> allItems;
55 if (TryGetUsersInventory(userID, out folders, out allItems))
56 {
57 invCollection.AllItems = allItems;
58 invCollection.Folders = folders;
59 invCollection.UserID = userID;
60 }
61 return invCollection;
62 }
63
64 public bool CreateUsersInventory(LLUUID user)
65 {
66 CreateNewUserInventory(user);
67 return true;
68 }
69
70
71 public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)
72 {
73 AddFolder(folder);
74 }
75
76 public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item)
77 {
78 AddItem(item);
79 }
80
81 public bool AddInventoryFolder( InventoryFolderBase folder)
82 {
83 AddNewInventoryFolder(folder.agentID, folder);
84 return true;
85 }
86
87 public bool AddInventoryItem( InventoryItemBase item)
88 {
89 AddNewInventoryItem(item.avatarID, item);
90 return true;
91 }
92
93 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
94 {
95 DeleteItem(item);
96 }
97
98 public bool DeleteInvItem( InventoryItemBase item)
99 {
100 DeleteInventoryItem(item.avatarID, item);
101 return true;
102 }
103 }
104}