diff options
Start of Inventory service, currently only (partially) functional in standalone mode and using sqlite).
In standalone mode, if you have account authenticate turned on (setting in opensim.ini) then when you create a new account, a set of inventory is created for that account and stored in database (currently only a set of empty folders). Then during login the database is search for that set and sent to the client in the login response.
More functions will be added soon, like creating new folders (and a bit later items) from the client inventory window.
Diffstat (limited to 'OpenSim/Framework/InventoryServiceBase')
-rw-r--r-- | OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs index f2e6128..10da633 100644 --- a/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs +++ b/OpenSim/Framework/InventoryServiceBase/InventoryServiceBase.cs | |||
@@ -12,11 +12,11 @@ namespace OpenSim.Framework.InventoryServiceBase | |||
12 | public class InventoryServiceBase | 12 | public class InventoryServiceBase |
13 | { | 13 | { |
14 | protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); | 14 | protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); |
15 | protected IAssetServer m_assetServer; | 15 | //protected IAssetServer m_assetServer; |
16 | 16 | ||
17 | public InventoryServiceBase(IAssetServer assetServer) | 17 | public InventoryServiceBase() |
18 | { | 18 | { |
19 | m_assetServer = assetServer; | 19 | //m_assetServer = assetServer; |
20 | } | 20 | } |
21 | 21 | ||
22 | /// <summary> | 22 | /// <summary> |
@@ -25,7 +25,7 @@ namespace OpenSim.Framework.InventoryServiceBase | |||
25 | /// <param name="FileName">The filename to the user server plugin DLL</param> | 25 | /// <param name="FileName">The filename to the user server plugin DLL</param> |
26 | public void AddPlugin(string FileName) | 26 | public void AddPlugin(string FileName) |
27 | { | 27 | { |
28 | MainLog.Instance.Verbose("Inventorytorage: Attempting to load " + FileName); | 28 | MainLog.Instance.Verbose("Inventory", "Inventorystorage: Attempting to load " + FileName); |
29 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 29 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
30 | 30 | ||
31 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 31 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
@@ -108,13 +108,31 @@ namespace OpenSim.Framework.InventoryServiceBase | |||
108 | return itemsList; | 108 | return itemsList; |
109 | } | 109 | } |
110 | 110 | ||
111 | public void AddFolder(InventoryFolderBase folder) | ||
112 | { | ||
113 | foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) | ||
114 | { | ||
115 | plugin.Value.addInventoryFolder(folder); | ||
116 | } | ||
117 | } | ||
118 | |||
111 | /// <summary> | 119 | /// <summary> |
112 | /// | 120 | /// |
113 | /// </summary> | 121 | /// </summary> |
114 | /// <param name="inventory"></param> | 122 | /// <param name="inventory"></param> |
115 | public void AddNewInventorySet(UsersInventory inventory) | 123 | public void AddNewInventorySet(UsersInventory inventory) |
116 | { | 124 | { |
125 | foreach (InventoryFolderBase folder in inventory.Folders.Values) | ||
126 | { | ||
127 | this.AddFolder(folder); | ||
128 | } | ||
129 | } | ||
117 | 130 | ||
131 | public void CreateNewUserInventory(LLUUID user) | ||
132 | { | ||
133 | UsersInventory inven = new UsersInventory(); | ||
134 | inven.CreateNewInventorySet(user); | ||
135 | this.AddNewInventorySet(inven); | ||
118 | } | 136 | } |
119 | 137 | ||
120 | public class UsersInventory | 138 | public class UsersInventory |
@@ -127,9 +145,45 @@ namespace OpenSim.Framework.InventoryServiceBase | |||
127 | 145 | ||
128 | } | 146 | } |
129 | 147 | ||
130 | protected virtual void CreateNewInventorySet() | 148 | public virtual void CreateNewInventorySet(LLUUID user) |
131 | { | 149 | { |
132 | 150 | InventoryFolderBase folder = new InventoryFolderBase(); | |
151 | folder.parentID = LLUUID.Zero; | ||
152 | folder.agentID = user; | ||
153 | folder.folderID = LLUUID.Random(); | ||
154 | folder.name = "My Inventory"; | ||
155 | folder.type = 8; | ||
156 | folder.version = 1; | ||
157 | Folders.Add(folder.folderID, folder); | ||
158 | |||
159 | LLUUID rootFolder = folder.folderID; | ||
160 | |||
161 | folder = new InventoryFolderBase(); | ||
162 | folder.parentID = rootFolder; | ||
163 | folder.agentID = user; | ||
164 | folder.folderID = LLUUID.Random(); | ||
165 | folder.name = "Textures"; | ||
166 | folder.type = 0; | ||
167 | folder.version = 1; | ||
168 | Folders.Add(folder.folderID, folder); | ||
169 | |||
170 | folder = new InventoryFolderBase(); | ||
171 | folder.parentID = rootFolder; | ||
172 | folder.agentID = user; | ||
173 | folder.folderID = LLUUID.Random(); | ||
174 | folder.name = "Objects"; | ||
175 | folder.type = 6; | ||
176 | folder.version = 1; | ||
177 | Folders.Add(folder.folderID, folder); | ||
178 | |||
179 | folder = new InventoryFolderBase(); | ||
180 | folder.parentID = rootFolder; | ||
181 | folder.agentID = user; | ||
182 | folder.folderID = LLUUID.Random(); | ||
183 | folder.name = "Clothes"; | ||
184 | folder.type = 5; | ||
185 | folder.version = 1; | ||
186 | Folders.Add(folder.folderID, folder); | ||
133 | } | 187 | } |
134 | } | 188 | } |
135 | } | 189 | } |