aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/InventoryService/XInventoryService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/InventoryService/XInventoryService.cs')
-rw-r--r--OpenSim/Services/InventoryService/XInventoryService.cs62
1 files changed, 34 insertions, 28 deletions
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs
index 2c79c77..bbd37d1 100644
--- a/OpenSim/Services/InventoryService/XInventoryService.cs
+++ b/OpenSim/Services/InventoryService/XInventoryService.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Services.InventoryService
87 throw new Exception("Could not find a storage interface in the given module"); 87 throw new Exception("Could not find a storage interface in the given module");
88 } 88 }
89 89
90 public bool CreateUserInventory(UUID principalID) 90 public virtual bool CreateUserInventory(UUID principalID)
91 { 91 {
92 // This is braindeaad. We can't ever communicate that we fixed 92 // This is braindeaad. We can't ever communicate that we fixed
93 // an existing inventory. Well, just return root folder status, 93 // an existing inventory. Well, just return root folder status,
@@ -99,7 +99,7 @@ namespace OpenSim.Services.InventoryService
99 99
100 if (rootFolder == null) 100 if (rootFolder == null)
101 { 101 {
102 rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.Folder, "My Inventory")); 102 rootFolder = ConvertToOpenSim(CreateFolder(principalID, UUID.Zero, (int)AssetType.RootFolder, "My Inventory"));
103 result = true; 103 result = true;
104 } 104 }
105 105
@@ -137,7 +137,7 @@ namespace OpenSim.Services.InventoryService
137 return result; 137 return result;
138 } 138 }
139 139
140 private XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name) 140 protected XInventoryFolder CreateFolder(UUID principalID, UUID parentID, int type, string name)
141 { 141 {
142 XInventoryFolder newFolder = new XInventoryFolder(); 142 XInventoryFolder newFolder = new XInventoryFolder();
143 143
@@ -153,7 +153,7 @@ namespace OpenSim.Services.InventoryService
153 return newFolder; 153 return newFolder;
154 } 154 }
155 155
156 private XInventoryFolder[] GetSystemFolders(UUID principalID) 156 protected virtual XInventoryFolder[] GetSystemFolders(UUID principalID)
157 { 157 {
158 XInventoryFolder[] allFolders = m_Database.GetFolders( 158 XInventoryFolder[] allFolders = m_Database.GetFolders(
159 new string[] { "agentID" }, 159 new string[] { "agentID" },
@@ -171,7 +171,7 @@ namespace OpenSim.Services.InventoryService
171 return sysFolders; 171 return sysFolders;
172 } 172 }
173 173
174 public List<InventoryFolderBase> GetInventorySkeleton(UUID principalID) 174 public virtual List<InventoryFolderBase> GetInventorySkeleton(UUID principalID)
175 { 175 {
176 XInventoryFolder[] allFolders = m_Database.GetFolders( 176 XInventoryFolder[] allFolders = m_Database.GetFolders(
177 new string[] { "agentID" }, 177 new string[] { "agentID" },
@@ -191,7 +191,7 @@ namespace OpenSim.Services.InventoryService
191 return folders; 191 return folders;
192 } 192 }
193 193
194 public InventoryFolderBase GetRootFolder(UUID principalID) 194 public virtual InventoryFolderBase GetRootFolder(UUID principalID)
195 { 195 {
196 XInventoryFolder[] folders = m_Database.GetFolders( 196 XInventoryFolder[] folders = m_Database.GetFolders(
197 new string[] { "agentID", "parentFolderID"}, 197 new string[] { "agentID", "parentFolderID"},
@@ -203,7 +203,7 @@ namespace OpenSim.Services.InventoryService
203 return ConvertToOpenSim(folders[0]); 203 return ConvertToOpenSim(folders[0]);
204 } 204 }
205 205
206 public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) 206 public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type)
207 { 207 {
208 XInventoryFolder[] folders = m_Database.GetFolders( 208 XInventoryFolder[] folders = m_Database.GetFolders(
209 new string[] { "agentID", "type"}, 209 new string[] { "agentID", "type"},
@@ -215,7 +215,7 @@ namespace OpenSim.Services.InventoryService
215 return ConvertToOpenSim(folders[0]); 215 return ConvertToOpenSim(folders[0]);
216 } 216 }
217 217
218 public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) 218 public virtual InventoryCollection GetFolderContent(UUID principalID, UUID folderID)
219 { 219 {
220 // This method doesn't receive a valud principal id from the 220 // This method doesn't receive a valud principal id from the
221 // connector. So we disregard the principal and look 221 // connector. So we disregard the principal and look
@@ -250,7 +250,7 @@ namespace OpenSim.Services.InventoryService
250 return inventory; 250 return inventory;
251 } 251 }
252 252
253 public List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID) 253 public virtual List<InventoryItemBase> GetFolderItems(UUID principalID, UUID folderID)
254 { 254 {
255 // Since we probably don't get a valid principal here, either ... 255 // Since we probably don't get a valid principal here, either ...
256 // 256 //
@@ -266,18 +266,18 @@ namespace OpenSim.Services.InventoryService
266 return invItems; 266 return invItems;
267 } 267 }
268 268
269 public bool AddFolder(InventoryFolderBase folder) 269 public virtual bool AddFolder(InventoryFolderBase folder)
270 { 270 {
271 XInventoryFolder xFolder = ConvertFromOpenSim(folder); 271 XInventoryFolder xFolder = ConvertFromOpenSim(folder);
272 return m_Database.StoreFolder(xFolder); 272 return m_Database.StoreFolder(xFolder);
273 } 273 }
274 274
275 public bool UpdateFolder(InventoryFolderBase folder) 275 public virtual bool UpdateFolder(InventoryFolderBase folder)
276 { 276 {
277 return AddFolder(folder); 277 return AddFolder(folder);
278 } 278 }
279 279
280 public bool MoveFolder(InventoryFolderBase folder) 280 public virtual bool MoveFolder(InventoryFolderBase folder)
281 { 281 {
282 XInventoryFolder[] x = m_Database.GetFolders( 282 XInventoryFolder[] x = m_Database.GetFolders(
283 new string[] { "folderID" }, 283 new string[] { "folderID" },
@@ -293,7 +293,7 @@ namespace OpenSim.Services.InventoryService
293 293
294 // We don't check the principal's ID here 294 // We don't check the principal's ID here
295 // 295 //
296 public bool DeleteFolders(UUID principalID, List<UUID> folderIDs) 296 public virtual bool DeleteFolders(UUID principalID, List<UUID> folderIDs)
297 { 297 {
298 // Ignore principal ID, it's bogus at connector level 298 // Ignore principal ID, it's bogus at connector level
299 // 299 //
@@ -308,7 +308,7 @@ namespace OpenSim.Services.InventoryService
308 return true; 308 return true;
309 } 309 }
310 310
311 public bool PurgeFolder(InventoryFolderBase folder) 311 public virtual bool PurgeFolder(InventoryFolderBase folder)
312 { 312 {
313 XInventoryFolder[] subFolders = m_Database.GetFolders( 313 XInventoryFolder[] subFolders = m_Database.GetFolders(
314 new string[] { "parentFolderID" }, 314 new string[] { "parentFolderID" },
@@ -325,17 +325,17 @@ namespace OpenSim.Services.InventoryService
325 return true; 325 return true;
326 } 326 }
327 327
328 public bool AddItem(InventoryItemBase item) 328 public virtual bool AddItem(InventoryItemBase item)
329 { 329 {
330 return m_Database.StoreItem(ConvertFromOpenSim(item)); 330 return m_Database.StoreItem(ConvertFromOpenSim(item));
331 } 331 }
332 332
333 public bool UpdateItem(InventoryItemBase item) 333 public virtual bool UpdateItem(InventoryItemBase item)
334 { 334 {
335 return m_Database.StoreItem(ConvertFromOpenSim(item)); 335 return m_Database.StoreItem(ConvertFromOpenSim(item));
336 } 336 }
337 337
338 public bool MoveItems(UUID principalID, List<InventoryItemBase> items) 338 public virtual bool MoveItems(UUID principalID, List<InventoryItemBase> items)
339 { 339 {
340 // Principal is b0rked. *sigh* 340 // Principal is b0rked. *sigh*
341 // 341 //
@@ -347,7 +347,7 @@ namespace OpenSim.Services.InventoryService
347 return true; 347 return true;
348 } 348 }
349 349
350 public bool DeleteItems(UUID principalID, List<UUID> itemIDs) 350 public virtual bool DeleteItems(UUID principalID, List<UUID> itemIDs)
351 { 351 {
352 // Just use the ID... *facepalms* 352 // Just use the ID... *facepalms*
353 // 353 //
@@ -357,7 +357,7 @@ namespace OpenSim.Services.InventoryService
357 return true; 357 return true;
358 } 358 }
359 359
360 public InventoryItemBase GetItem(InventoryItemBase item) 360 public virtual InventoryItemBase GetItem(InventoryItemBase item)
361 { 361 {
362 XInventoryItem[] items = m_Database.GetItems( 362 XInventoryItem[] items = m_Database.GetItems(
363 new string[] { "inventoryID" }, 363 new string[] { "inventoryID" },
@@ -369,7 +369,7 @@ namespace OpenSim.Services.InventoryService
369 return ConvertToOpenSim(items[0]); 369 return ConvertToOpenSim(items[0]);
370 } 370 }
371 371
372 public InventoryFolderBase GetFolder(InventoryFolderBase folder) 372 public virtual InventoryFolderBase GetFolder(InventoryFolderBase folder)
373 { 373 {
374 XInventoryFolder[] folders = m_Database.GetFolders( 374 XInventoryFolder[] folders = m_Database.GetFolders(
375 new string[] { "folderID"}, 375 new string[] { "folderID"},
@@ -381,7 +381,7 @@ namespace OpenSim.Services.InventoryService
381 return ConvertToOpenSim(folders[0]); 381 return ConvertToOpenSim(folders[0]);
382 } 382 }
383 383
384 public List<InventoryItemBase> GetActiveGestures(UUID principalID) 384 public virtual List<InventoryItemBase> GetActiveGestures(UUID principalID)
385 { 385 {
386 XInventoryItem[] items = m_Database.GetActiveGestures(principalID); 386 XInventoryItem[] items = m_Database.GetActiveGestures(principalID);
387 387
@@ -396,7 +396,7 @@ namespace OpenSim.Services.InventoryService
396 return ret; 396 return ret;
397 } 397 }
398 398
399 public int GetAssetPermissions(UUID principalID, UUID assetID) 399 public virtual int GetAssetPermissions(UUID principalID, UUID assetID)
400 { 400 {
401 return m_Database.GetAssetPermissions(principalID, assetID); 401 return m_Database.GetAssetPermissions(principalID, assetID);
402 } 402 }
@@ -421,7 +421,7 @@ namespace OpenSim.Services.InventoryService
421 421
422 // CM Helpers 422 // CM Helpers
423 // 423 //
424 private InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder) 424 protected InventoryFolderBase ConvertToOpenSim(XInventoryFolder folder)
425 { 425 {
426 InventoryFolderBase newFolder = new InventoryFolderBase(); 426 InventoryFolderBase newFolder = new InventoryFolderBase();
427 427
@@ -435,7 +435,7 @@ namespace OpenSim.Services.InventoryService
435 return newFolder; 435 return newFolder;
436 } 436 }
437 437
438 private XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder) 438 protected XInventoryFolder ConvertFromOpenSim(InventoryFolderBase folder)
439 { 439 {
440 XInventoryFolder newFolder = new XInventoryFolder(); 440 XInventoryFolder newFolder = new XInventoryFolder();
441 441
@@ -449,7 +449,7 @@ namespace OpenSim.Services.InventoryService
449 return newFolder; 449 return newFolder;
450 } 450 }
451 451
452 private InventoryItemBase ConvertToOpenSim(XInventoryItem item) 452 protected InventoryItemBase ConvertToOpenSim(XInventoryItem item)
453 { 453 {
454 InventoryItemBase newItem = new InventoryItemBase(); 454 InventoryItemBase newItem = new InventoryItemBase();
455 455
@@ -468,7 +468,10 @@ namespace OpenSim.Services.InventoryService
468 newItem.EveryOnePermissions = (uint)item.inventoryEveryOnePermissions; 468 newItem.EveryOnePermissions = (uint)item.inventoryEveryOnePermissions;
469 newItem.GroupPermissions = (uint)item.inventoryGroupPermissions; 469 newItem.GroupPermissions = (uint)item.inventoryGroupPermissions;
470 newItem.GroupID = item.groupID; 470 newItem.GroupID = item.groupID;
471 newItem.GroupOwned = item.groupOwned; 471 if (item.groupOwned == 0)
472 newItem.GroupOwned = false;
473 else
474 newItem.GroupOwned = true;
472 newItem.SalePrice = item.salePrice; 475 newItem.SalePrice = item.salePrice;
473 newItem.SaleType = (byte)item.saleType; 476 newItem.SaleType = (byte)item.saleType;
474 newItem.Flags = (uint)item.flags; 477 newItem.Flags = (uint)item.flags;
@@ -477,7 +480,7 @@ namespace OpenSim.Services.InventoryService
477 return newItem; 480 return newItem;
478 } 481 }
479 482
480 private XInventoryItem ConvertFromOpenSim(InventoryItemBase item) 483 protected XInventoryItem ConvertFromOpenSim(InventoryItemBase item)
481 { 484 {
482 XInventoryItem newItem = new XInventoryItem(); 485 XInventoryItem newItem = new XInventoryItem();
483 486
@@ -496,7 +499,10 @@ namespace OpenSim.Services.InventoryService
496 newItem.inventoryEveryOnePermissions = (int)item.EveryOnePermissions; 499 newItem.inventoryEveryOnePermissions = (int)item.EveryOnePermissions;
497 newItem.inventoryGroupPermissions = (int)item.GroupPermissions; 500 newItem.inventoryGroupPermissions = (int)item.GroupPermissions;
498 newItem.groupID = item.GroupID; 501 newItem.groupID = item.GroupID;
499 newItem.groupOwned = item.GroupOwned; 502 if (item.GroupOwned)
503 newItem.groupOwned = 1;
504 else
505 newItem.groupOwned = 0;
500 newItem.salePrice = item.SalePrice; 506 newItem.salePrice = item.SalePrice;
501 newItem.saleType = (int)item.SaleType; 507 newItem.saleType = (int)item.SaleType;
502 newItem.flags = (int)item.Flags; 508 newItem.flags = (int)item.Flags;