Add QueryItem method to secure inventory and HG inventory, change method sig to
provide additional information the HG needs.0.6.5-rc1
parent
73a982babe
commit
e6bb86a224
|
@ -773,23 +773,30 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
// The item will be added tot he local cache. Returns true if the item
|
// The item will be added tot he local cache. Returns true if the item
|
||||||
// was found and can be sent to the client
|
// was found and can be sent to the client
|
||||||
//
|
//
|
||||||
public bool QueryItem(UUID itemID)
|
public bool QueryItem(InventoryItemBase item)
|
||||||
{
|
{
|
||||||
if (m_hasReceivedInventory)
|
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
|
// Item is in local cache, just update client
|
||||||
//
|
//
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = new InventoryItemBase();
|
InventoryItemBase itemInfo = null;
|
||||||
item.ID = itemID;
|
|
||||||
|
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)
|
if (itemInfo != null)
|
||||||
{
|
{
|
||||||
InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
|
InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
|
||||||
|
@ -804,7 +811,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
AddRequest(
|
AddRequest(
|
||||||
new InventoryRequest(
|
new InventoryRequest(
|
||||||
Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"),
|
Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"),
|
||||||
new object[] { itemID }));
|
new object[] { item.ID }));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,8 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <returns>true if the item was successfully deleted</returns>
|
/// <returns>true if the item was successfully deleted</returns>
|
||||||
bool DeleteItem(InventoryItemBase item, UUID session_id);
|
bool DeleteItem(InventoryItemBase item, UUID session_id);
|
||||||
|
|
||||||
|
InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does the given user have an inventory structure?
|
/// Does the given user have an inventory structure?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -317,6 +317,29 @@ namespace OpenSim.Region.Communications.Hypergrid
|
||||||
|
|
||||||
return false;
|
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<InventoryItemBase, InventoryItemBase>.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
|
#endregion
|
||||||
|
|
||||||
#region Methods common to ISecureInventoryService and IInventoryService
|
#region Methods common to ISecureInventoryService and IInventoryService
|
||||||
|
|
|
@ -296,6 +296,22 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return SynchronousRestSessionObjectPoster<InventoryItemBase, InventoryItemBase>.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)
|
public bool HasInventoryForUser(UUID userID)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -433,10 +433,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UUID itemID = new UUID(msg.binaryBucket, 1);
|
UUID itemID = new UUID(msg.binaryBucket, 1);
|
||||||
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
|
|
||||||
|
item.ID = itemID;
|
||||||
|
item.Owner = user.ControllingClient.AgentId;
|
||||||
|
|
||||||
// Fetch from database
|
// Fetch from database
|
||||||
//
|
//
|
||||||
if (!userInfo.QueryItem(itemID))
|
if (!userInfo.QueryItem(item))
|
||||||
{
|
{
|
||||||
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
|
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
|
||||||
return;
|
return;
|
||||||
|
@ -444,7 +448,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
|
|
||||||
// Get item info
|
// Get item info
|
||||||
//
|
//
|
||||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
item = userInfo.RootFolder.FindItem(item.ID);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give");
|
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give");
|
||||||
|
|
Loading…
Reference in New Issue