diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs index 3665a4b..2c218fc 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs | |||
@@ -359,7 +359,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
359 | 359 | ||
360 | public InventoryItemBase GetInventoryItem(InventoryItemBase item) | 360 | public InventoryItemBase GetInventoryItem(InventoryItemBase item) |
361 | { | 361 | { |
362 | m_log.Info("[HGStandaloneInvService]: Processing request for item " + item.ID); | 362 | m_log.Info("[HGStandaloneInvService]: Get item " + item.ID); |
363 | 363 | ||
364 | item = ((InventoryServiceBase)m_inventoryService).GetInventoryItem(item.ID); | 364 | item = ((InventoryServiceBase)m_inventoryService).GetInventoryItem(item.ID); |
365 | if (item == null) | 365 | if (item == null) |
@@ -369,6 +369,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
369 | 369 | ||
370 | public InventoryItemBase AddItem(InventoryItemBase item) | 370 | public InventoryItemBase AddItem(InventoryItemBase item) |
371 | { | 371 | { |
372 | m_log.DebugFormat("[HGStandaloneInvService]: Add item {0} from {1}", item.ID, item.Owner); | ||
372 | if (m_inventoryService.AddItem(item)) | 373 | if (m_inventoryService.AddItem(item)) |
373 | return item; | 374 | return item; |
374 | else | 375 | else |
@@ -380,6 +381,9 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
380 | 381 | ||
381 | public InventoryItemBase UpdateItem(InventoryItemBase item) | 382 | public InventoryItemBase UpdateItem(InventoryItemBase item) |
382 | { | 383 | { |
384 | m_log.DebugFormat("[HGStandaloneInvService]: Update item {0} from {1}", item.ID, item.Owner); | ||
385 | InventoryItemBase it = m_inventoryService.GetInventoryItem(item.ID); | ||
386 | item.CurrentPermissions = it.CurrentPermissions; | ||
383 | if (m_inventoryService.UpdateItem(item)) | 387 | if (m_inventoryService.UpdateItem(item)) |
384 | return item; | 388 | return item; |
385 | else | 389 | else |
@@ -391,6 +395,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
391 | 395 | ||
392 | public InventoryItemBase MoveItem(InventoryItemBase newitem) | 396 | public InventoryItemBase MoveItem(InventoryItemBase newitem) |
393 | { | 397 | { |
398 | m_log.DebugFormat("[HGStandaloneInvService]: Move item {0} from {1}", newitem.ID, newitem.Owner); | ||
394 | InventoryItemBase Item = m_inventoryService.GetInventoryItem(newitem.ID); | 399 | InventoryItemBase Item = m_inventoryService.GetInventoryItem(newitem.ID); |
395 | if (Item != null) | 400 | if (Item != null) |
396 | { | 401 | { |
@@ -425,6 +430,7 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
425 | 430 | ||
426 | public InventoryItemBase CopyItem(InventoryItemBase olditem) | 431 | public InventoryItemBase CopyItem(InventoryItemBase olditem) |
427 | { | 432 | { |
433 | m_log.DebugFormat("[HGStandaloneInvService]: Copy item {0} from {1}", olditem.ID, olditem.Owner); | ||
428 | InventoryItemBase Item = m_inventoryService.GetInventoryItem(olditem.ID); // this is the old item id | 434 | InventoryItemBase Item = m_inventoryService.GetInventoryItem(olditem.ID); // this is the old item id |
429 | // BIG HACK here | 435 | // BIG HACK here |
430 | UUID newID = olditem.AssetID; | 436 | UUID newID = olditem.AssetID; |
@@ -436,9 +442,9 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
436 | } | 442 | } |
437 | Item.ID = newID; | 443 | Item.ID = newID; |
438 | Item.Folder = olditem.Folder; | 444 | Item.Folder = olditem.Folder; |
445 | Item.Owner = olditem.Owner; | ||
439 | // There should be some tests here about the owner, etc but I'm going to ignore that | 446 | // There should be some tests here about the owner, etc but I'm going to ignore that |
440 | // because I'm not sure it makes any sense | 447 | // because I'm not sure it makes any sense |
441 | |||
442 | // Also I should probably close the asset... | 448 | // Also I should probably close the asset... |
443 | m_inventoryService.AddItem(Item); | 449 | m_inventoryService.AddItem(Item); |
444 | return Item; | 450 | return Item; |
@@ -475,25 +481,26 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
475 | public AssetBase GetAsset(InventoryItemBase item) | 481 | public AssetBase GetAsset(InventoryItemBase item) |
476 | { | 482 | { |
477 | m_log.Info("[HGStandaloneInvService]: Get asset " + item.AssetID + " for item " + item.ID); | 483 | m_log.Info("[HGStandaloneInvService]: Get asset " + item.AssetID + " for item " + item.ID); |
484 | AssetBase asset = new AssetBase(item.AssetID, "NULL"); // send an asset with no data | ||
478 | InventoryItemBase item2 = ((InventoryServiceBase)m_inventoryService).GetInventoryItem(item.ID); | 485 | InventoryItemBase item2 = ((InventoryServiceBase)m_inventoryService).GetInventoryItem(item.ID); |
479 | if (item2 == null) | 486 | if (item2 == null) |
480 | { | 487 | { |
481 | m_log.Debug("[HGStandaloneInvService]: null item"); | 488 | m_log.Debug("[HGStandaloneInvService]: null item"); |
482 | return null; | 489 | return asset; |
483 | } | 490 | } |
484 | if (item2.Owner != item.Owner) | 491 | if (item2.Owner != item.Owner) |
485 | { | 492 | { |
486 | m_log.Debug("[HGStandaloneInvService]: client is trying to get an item for which he is not the owner"); | 493 | m_log.DebugFormat("[HGStandaloneInvService]: client with uuid {0} is trying to get an item of owner {1}", item.Owner, item2.Owner); |
487 | return null; | 494 | return asset; |
488 | } | 495 | } |
489 | 496 | ||
490 | // All good, get the asset | 497 | // All good, get the asset |
491 | AssetBase asset = m_assetProvider.FetchAsset(item.AssetID); | 498 | AssetBase theasset = m_assetProvider.FetchAsset(item.AssetID); |
492 | m_log.Debug("[HGStandaloneInvService] Found asset " + ((asset == null)? "NULL" : "Not Null")); | 499 | m_log.Debug("[HGStandaloneInvService] Found asset " + ((theasset == null)? "NULL" : "Not Null")); |
493 | if (asset == null) | 500 | if (theasset != null) |
494 | { | 501 | { |
502 | asset = theasset; | ||
495 | m_log.Debug(" >> Sending assetID " + item.AssetID); | 503 | m_log.Debug(" >> Sending assetID " + item.AssetID); |
496 | asset = new AssetBase(item.AssetID, "NULL"); // send an asset with no data | ||
497 | } | 504 | } |
498 | return asset; | 505 | return asset; |
499 | } | 506 | } |
@@ -541,6 +548,8 @@ namespace OpenSim.Region.CoreModules.Hypergrid | |||
541 | PostAsset(asset); | 548 | PostAsset(asset); |
542 | 549 | ||
543 | item.AssetID = asset.FullID; | 550 | item.AssetID = asset.FullID; |
551 | item.Owner = userID; | ||
552 | m_inventoryService.UpdateItem(item); | ||
544 | 553 | ||
545 | return (asset.FullID); | 554 | return (asset.FullID); |
546 | } | 555 | } |