/// <summary>
/// Move the next object in the queue to inventory. Then delete it properly from the scene.
/// </summary>
/// <returns></returns>
public bool InventoryDeQueueAndDelete()
{
DeleteToInventoryHolder x = null;
try
{
lock (m_inventoryDeletes)
{
int left = m_inventoryDeletes.Count;
if (left > 0)
{
x = m_inventoryDeletes.Dequeue();
// m_log.DebugFormat(
// "[ASYNC DELETER]: Sending object to user's inventory, action {1}, count {2}, {0} item(s) remaining.",
// left, x.action, x.objectGroups.Count);
try
{
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface <IInventoryAccessModule>();
if (invAccess != null)
{
invAccess.CopyToInventory(x.action, x.folderID, x.objectGroups, x.remoteClient, false);
}
if (x.permissionToDelete)
{
foreach (SceneObjectGroup g in x.objectGroups)
{
m_scene.DeleteSceneObject(g, true);
}
}
}
catch (Exception e)
{
m_log.ErrorFormat(
"[ASYNC DELETER]: Exception background sending object: {0}{1}", e.Message, e.StackTrace);
}
return(true);
}
}
}
catch (Exception e)
{
// We can't put the object group details in here since the root part may have disappeared (which is where these sit).
// FIXME: This needs to be fixed.
m_log.ErrorFormat(
"[ASYNC DELETER]: Queued sending of scene object to agent {0} {1} failed: {2} {3}",
(x != null ? x.remoteClient.Name : "unavailable"),
(x != null ? x.remoteClient.AgentId.ToString() : "unavailable"),
e.Message,
e.StackTrace);
}
// m_log.Debug("[ASYNC DELETER]: No objects left in inventory send queue.");
return(false);
}