mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 18:55:58 +08:00
Add a QueryItem method to the inventory subsystem. Currently implemented for
MySQL only, stubs for the others. This allows updating the cache with a single item from the database.
This commit is contained in:
@@ -36,6 +36,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||
internal delegate void AddItemDelegate(InventoryItemBase itemInfo);
|
||||
internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo);
|
||||
internal delegate void DeleteItemDelegate(UUID itemID);
|
||||
internal delegate void QueryItemDelegate(UUID itemID);
|
||||
|
||||
internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID);
|
||||
internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID);
|
||||
@@ -767,6 +768,47 @@ namespace OpenSim.Framework.Communications.Cache
|
||||
|
||||
return RootFolder.FindFolderForType(type);
|
||||
}
|
||||
|
||||
// Load additional items that other regions have put into the database
|
||||
// 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)
|
||||
{
|
||||
if (m_hasReceivedInventory)
|
||||
{
|
||||
InventoryItemBase item = RootFolder.FindItem(itemID);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
// Item is in local cache, just update client
|
||||
//
|
||||
return true;
|
||||
}
|
||||
|
||||
InventoryItemBase itemInfo = m_commsManager.InventoryService.QueryItem(item);
|
||||
if (itemInfo != null)
|
||||
{
|
||||
InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
|
||||
ItemReceive(itemInfo, folder);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddRequest(
|
||||
new InventoryRequest(
|
||||
Delegate.CreateDelegate(typeof(QueryItemDelegate), this, "QueryItem"),
|
||||
new object[] { itemID }));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -104,6 +104,14 @@ namespace OpenSim.Framework.Communications
|
||||
/// <returns>true if the item was successfully deleted</returns>
|
||||
bool DeleteItem(InventoryItemBase item);
|
||||
|
||||
/// <summary>
|
||||
/// Query the server for an item that may have been added by
|
||||
/// another region
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns>true if the item was found in local cache</returns>
|
||||
InventoryItemBase QueryItem(InventoryItemBase item);
|
||||
|
||||
/// <summary>
|
||||
/// Does the given user have an inventory structure?
|
||||
/// </summary>
|
||||
|
||||
@@ -278,6 +278,20 @@ namespace OpenSim.Framework.Communications
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryItemBase result = plugin.queryInventoryItem(item.ID);
|
||||
if (result != null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Purge a folder of all items items and subfolders.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user