Committing partial work on passing folders across instances. This may crash.
parent
f86c13f48e
commit
412112acba
|
@ -114,6 +114,12 @@ namespace OpenSim.Data
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
InventoryItemBase queryInventoryItem(UUID item);
|
InventoryItemBase queryInventoryItem(UUID item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
InventoryFolderBase queryInventoryFolder(UUID folder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a new folder specified by folder
|
/// Adds a new folder specified by folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -535,6 +535,11 @@ namespace OpenSim.Data.MSSQL
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all activated gesture-items in the inventory of the specified avatar.
|
/// Returns all activated gesture-items in the inventory of the specified avatar.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -553,6 +553,11 @@ namespace OpenSim.Data.MySQL
|
||||||
return getInventoryItem(itemID);
|
return getInventoryItem(itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
||||||
|
{
|
||||||
|
return getInventoryFolder(folderID);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new inventory folder
|
/// Creates a new inventory folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -182,6 +182,11 @@ namespace OpenSim.Data.NHibernate
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an inventory folder by its UUID
|
/// Returns an inventory folder by its UUID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -631,6 +631,11 @@ namespace OpenSim.Data.SQLite
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete all items in the specified folder
|
/// Delete all items in the specified folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo);
|
internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo);
|
||||||
internal delegate void DeleteItemDelegate(UUID itemID);
|
internal delegate void DeleteItemDelegate(UUID itemID);
|
||||||
internal delegate void QueryItemDelegate(UUID itemID);
|
internal delegate void QueryItemDelegate(UUID itemID);
|
||||||
|
internal delegate void QueryFolderDelegate(UUID folderID);
|
||||||
|
|
||||||
internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID);
|
internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID);
|
||||||
internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID);
|
internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID);
|
||||||
|
@ -819,6 +820,56 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool QueryFolder(InventoryFolderBase folder)
|
||||||
|
{
|
||||||
|
if (m_hasReceivedInventory)
|
||||||
|
{
|
||||||
|
InventoryFolderBase invFolder = RootFolder.FindFolder(folder.ID);
|
||||||
|
|
||||||
|
if (invFolder != null)
|
||||||
|
{
|
||||||
|
// Folder is in local cache, just update client
|
||||||
|
//
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryFolderBase folderInfo = null;
|
||||||
|
|
||||||
|
if (m_commsManager.SecureInventoryService != null)
|
||||||
|
{
|
||||||
|
folderInfo = m_commsManager.SecureInventoryService.QueryFolder(folder, m_session_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
folderInfo = m_commsManager.InventoryService.QueryFolder(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (folderInfo != null)
|
||||||
|
{
|
||||||
|
InventoryFolderImpl createdFolder = RootFolder.CreateChildFolder(folderInfo.ID, folderInfo.Name, (ushort)folderInfo.Type);
|
||||||
|
|
||||||
|
createdFolder.Version = folderInfo.Version;
|
||||||
|
createdFolder.Owner = folderInfo.Owner;
|
||||||
|
createdFolder.ParentID = folderInfo.ParentID;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddRequest(
|
||||||
|
new InventoryRequest(
|
||||||
|
Delegate.CreateDelegate(typeof(QueryFolderDelegate), this, "QueryFolder"),
|
||||||
|
new object[] { folder.ID }));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -112,6 +112,14 @@ namespace OpenSim.Framework.Communications
|
||||||
/// <returns>true if the item was found in local cache</returns>
|
/// <returns>true if the item was found in local cache</returns>
|
||||||
InventoryItemBase QueryItem(InventoryItemBase item);
|
InventoryItemBase QueryItem(InventoryItemBase item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Query the server for a folder that may have been added by
|
||||||
|
/// another region
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="folder"></param>
|
||||||
|
/// <returns>true if the folder was found in local cache</returns>
|
||||||
|
InventoryFolderBase QueryFolder(InventoryFolderBase folder);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does the given user have an inventory structure?
|
/// Does the given user have an inventory structure?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -98,6 +98,8 @@ namespace OpenSim.Framework.Communications
|
||||||
|
|
||||||
InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id);
|
InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id);
|
||||||
|
|
||||||
|
InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does the given user have an inventory structure?
|
/// Does the given user have an inventory structure?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -292,6 +292,20 @@ namespace OpenSim.Framework.Communications
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item)
|
||||||
|
{
|
||||||
|
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||||
|
{
|
||||||
|
InventoryFolderBase result = plugin.queryInventoryFolder(item.ID);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Purge a folder of all items items and subfolders.
|
/// Purge a folder of all items items and subfolders.
|
||||||
///
|
///
|
||||||
|
|
|
@ -131,6 +131,10 @@ namespace OpenSim.Grid.InventoryServer
|
||||||
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
|
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
|
||||||
"POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
|
"POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
|
||||||
|
|
||||||
|
m_httpServer.AddStreamHandler(
|
||||||
|
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
|
||||||
|
"POST", "/QueryFolder/", m_inventoryService.QueryFolder, m_inventoryService.CheckAuthSession));
|
||||||
|
|
||||||
// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
|
// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
|
||||||
// system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
|
// system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
|
||||||
// It would have been better to rename this request, but complexities in the BaseHttpServer
|
// It would have been better to rename this request, but complexities in the BaseHttpServer
|
||||||
|
|
|
@ -340,6 +340,29 @@ namespace OpenSim.Region.Communications.Hypergrid
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id)
|
||||||
|
{
|
||||||
|
if (IsLocalStandaloneUser(item.Owner))
|
||||||
|
{
|
||||||
|
return base.QueryFolder(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string invServ = GetUserInventoryURI(item.Owner);
|
||||||
|
|
||||||
|
return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
|
||||||
|
"POST", invServ + "/QueryFolder/", 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
|
||||||
|
|
|
@ -312,6 +312,22 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase QueryFolder(InventoryFolderBase item)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, InventoryFolderBase>(
|
||||||
|
"POST", _inventoryServerUrl + "/QueryFolder/", item);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
|
|
@ -312,6 +312,22 @@ namespace OpenSim.Region.Communications.OGS1
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
|
||||||
|
"POST", _inventoryServerUrl + "/QueryFolder/", 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;
|
||||||
|
|
|
@ -426,9 +426,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||||
|
|
||||||
if (AssetType.Folder == assetType)
|
if (AssetType.Folder == assetType)
|
||||||
{
|
{
|
||||||
// Folders not implemented yet
|
UUID folderID = new UUID(msg.binaryBucket, 1);
|
||||||
|
InventoryFolderBase folder = new InventoryFolderBase();
|
||||||
|
|
||||||
|
folder.ID = folderID;
|
||||||
|
folder.Owner = user.ControllingClient.AgentId;
|
||||||
|
|
||||||
|
// Fetch from database
|
||||||
//
|
//
|
||||||
return;
|
if (!userInfo.QueryFolder(folder))
|
||||||
|
{
|
||||||
|
m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get folder info
|
||||||
|
//
|
||||||
|
InventoryFolderImpl folderInfo = userInfo.RootFolder.FindFolder(folder.ID);
|
||||||
|
if (folderInfo == null)
|
||||||
|
{
|
||||||
|
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve folder to give");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
user.ControllingClient.SendBulkUpdateInventory(folderInfo);
|
||||||
|
|
||||||
|
// Deliver message
|
||||||
|
//
|
||||||
|
user.ControllingClient.SendInstantMessage(
|
||||||
|
new UUID(msg.fromAgentID), msg.message,
|
||||||
|
new UUID(msg.toAgentID),
|
||||||
|
msg.fromAgentName, msg.dialog, msg.timestamp,
|
||||||
|
folderID, false, msg.binaryBucket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -618,6 +618,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!recipientUserInfo.HasReceivedInventory)
|
||||||
|
{
|
||||||
|
recipientUserInfo.FetchInventory();
|
||||||
|
if (!WaitForInventory(recipientUserInfo))
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (recipientParentFolderId == UUID.Zero)
|
if (recipientParentFolderId == UUID.Zero)
|
||||||
recipientParentFolderId = recipientUserInfo.RootFolder.ID;
|
recipientParentFolderId = recipientUserInfo.RootFolder.ID;
|
||||||
|
|
||||||
|
|
|
@ -120,6 +120,11 @@ namespace OpenSim.Tests.Common.Mock
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public InventoryFolderBase queryInventoryFolder(UUID folderID)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void addInventoryFolder(InventoryFolderBase folder)
|
public void addInventoryFolder(InventoryFolderBase folder)
|
||||||
{
|
{
|
||||||
m_folders[folder.ID] = folder;
|
m_folders[folder.ID] = folder;
|
||||||
|
|
Loading…
Reference in New Issue