From e6bb86a22428c6ed9e3d97e5347835e5e5cff598 Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 22 Mar 2009 15:42:22 +0000
Subject: Add QueryItem method to secure inventory and HG inventory, change
method sig to provide additional information the HG needs.
---
.../Communications/Cache/CachedUserInfo.cs | 21 +++++++++++++-------
.../Communications/ISecureInventoryService.cs | 2 ++
.../Communications/Hypergrid/HGInventoryService.cs | 23 ++++++++++++++++++++++
.../OGS1/OGS1SecureInventoryService.cs | 16 +++++++++++++++
.../Inventory/Transfer/InventoryTransferModule.cs | 8 ++++++--
5 files changed, 61 insertions(+), 9 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 03569f6..4ea1e22 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -773,23 +773,30 @@ namespace OpenSim.Framework.Communications.Cache
// The item will be added tot he local cache. Returns true if the item
// was found and can be sent to the client
//
- public bool QueryItem(UUID itemID)
+ public bool QueryItem(InventoryItemBase item)
{
if (m_hasReceivedInventory)
{
- InventoryItemBase item = RootFolder.FindItem(itemID);
+ InventoryItemBase invItem = RootFolder.FindItem(item.ID);
- if (item != null)
+ if (invItem != null)
{
// Item is in local cache, just update client
//
return true;
}
- item = new InventoryItemBase();
- item.ID = itemID;
+ InventoryItemBase itemInfo = null;
+
+ if (m_commsManager.SecureInventoryService != null)
+ {
+ m_commsManager.SecureInventoryService.QueryItem(item, m_session_id);
+ }
+ else
+ {
+ m_commsManager.InventoryService.QueryItem(item);
+ }
- InventoryItemBase itemInfo = m_commsManager.InventoryService.QueryItem(item);
if (itemInfo != null)
{
InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
@@ -804,7 +811,7 @@ namespace OpenSim.Framework.Communications.Cache
AddRequest(
new InventoryRequest(
Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"),
- new object[] { itemID }));
+ new object[] { item.ID }));
return true;
}
diff --git a/OpenSim/Framework/Communications/ISecureInventoryService.cs b/OpenSim/Framework/Communications/ISecureInventoryService.cs
index 6da13fe..d70dd0b 100644
--- a/OpenSim/Framework/Communications/ISecureInventoryService.cs
+++ b/OpenSim/Framework/Communications/ISecureInventoryService.cs
@@ -96,6 +96,8 @@ namespace OpenSim.Framework.Communications
/// true if the item was successfully deleted
bool DeleteItem(InventoryItemBase item, UUID session_id);
+ InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id);
+
///
/// Does the given user have an inventory structure?
///
diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
index 8296910..9d70c46 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
@@ -317,6 +317,29 @@ namespace OpenSim.Region.Communications.Hypergrid
return false;
}
+
+ public InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id)
+ {
+ if (IsLocalStandaloneUser(item.Owner))
+ {
+ return base.QueryItem(item);
+ }
+
+ try
+ {
+ string invServ = GetUserInventoryURI(item.Owner);
+
+ return SynchronousRestSessionObjectPoster.BeginPostObject(
+ "POST", invServ + "/QueryItem/", item, session_id.ToString(), item.Owner.ToString());
+ }
+ catch (WebException e)
+ {
+ m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
+ e.Source, e.Message);
+ }
+
+ return null;
+ }
#endregion
#region Methods common to ISecureInventoryService and IInventoryService
diff --git a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
index 0f4c732..0f50b01 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
@@ -296,6 +296,22 @@ namespace OpenSim.Region.Communications.OGS1
return false;
}
+ public InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id)
+ {
+ try
+ {
+ return SynchronousRestSessionObjectPoster.BeginPostObject(
+ "POST", _inventoryServerUrl + "/QueryItem/", item, session_id.ToString(), item.Owner.ToString());
+ }
+ catch (WebException e)
+ {
+ m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
+ e.Source, e.Message);
+ }
+
+ return null;
+ }
+
public bool HasInventoryForUser(UUID userID)
{
return false;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 147d453..465167a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -433,10 +433,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
else
{
UUID itemID = new UUID(msg.binaryBucket, 1);
+ InventoryItemBase item = new InventoryItemBase();
+
+ item.ID = itemID;
+ item.Owner = user.ControllingClient.AgentId;
// Fetch from database
//
- if (!userInfo.QueryItem(itemID))
+ if (!userInfo.QueryItem(item))
{
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
return;
@@ -444,7 +448,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// Get item info
//
- InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
+ item = userInfo.RootFolder.FindItem(item.ID);
if (item == null)
{
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give");
--
cgit v1.1