示例#1
0
        /// <summary>
        /// Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      List <ISceneEntity> objectGroups, UUID AgentId,
                                      bool permissionToDelete, bool permissionToTake)
        {
            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder();

            dtis.action             = action;
            dtis.folderID           = folderID;
            dtis.objectGroups       = objectGroups;
            dtis.agentId            = AgentId;
            dtis.permissionToDelete = permissionToDelete;
            dtis.permissionToTake   = permissionToTake;
            //Do this before the locking so that the objects 'appear' gone and the client doesn't think things have gone wrong
            if (permissionToDelete)
            {
                DeleteGroups(objectGroups);
            }

            lock (m_removeFromSimQueue)
            {
                m_removeFromSimQueue.Enqueue(dtis);
            }

            if (!DeleteLoopInUse)
            {
                DeleteLoopInUse = true;
                //m_log.Debug("[SCENE]: Starting delete loop");
                Util.FireAndForget(DoDeleteObject, new Object[] { 0 });
            }
        }
示例#2
0
        public bool DeleteObject()
        {
            DeleteToInventoryHolder x = null;

            try
            {
                int left = 0;
                lock (m_removeFromSimQueue)
                {
                    left = m_removeFromSimQueue.Count;
                }
                if (left > 0)
                {
                    lock (m_removeFromSimQueue)
                    {
                        x = m_removeFromSimQueue.Dequeue();
                    }

                    if (x.permissionToDelete)
                    {
                        IBackupModule backup = m_scene.RequestModuleInterface <IBackupModule>();
                        if (backup != null)
                        {
                            backup.DeleteSceneObjects(x.objectGroups.ToArray(), true);
                        }
                    }
                    m_log.DebugFormat(
                        "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);

                    if (x.permissionToTake)
                    {
                        try
                        {
                            IInventoryAccessModule invAccess = m_scene.RequestModuleInterface <IInventoryAccessModule>();
                            UUID itemID;
                            if (invAccess != null)
                            {
                                invAccess.DeleteToInventory(x.action, x.folderID, x.objectGroups, x.agentId, out itemID);
                            }
                        }
                        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(
                    "[SCENE]: Queued sending of scene object to agent {0} {1} failed: {2}",
                    (x != null ? x.agentId.ToString() : "unavailable"), (x != null ? x.agentId.ToString() : "unavailable"), e.ToString());
            }

            //m_log.Debug("[SCENE]: No objects left in delete queue.");
            return(false);
        }
        /// <summary>
        ///   Delete the given object from the scene
        /// </summary>
        public void DeleteToInventory(DeRezAction action, UUID folderID,
                                      List<ISceneEntity> objectGroups, UUID AgentId,
                                      bool permissionToDelete, bool permissionToTake)
        {
            DeleteToInventoryHolder dtis = new DeleteToInventoryHolder
                                               {
                                                   action = action,
                                                   folderID = folderID,
                                                   objectGroups = objectGroups,
                                                   agentId = AgentId,
                                                   permissionToDelete = permissionToDelete,
                                                   permissionToTake = permissionToTake
                                               };
            //Do this before the locking so that the objects 'appear' gone and the client doesn't think things have gone wrong
            if (permissionToDelete)
            {
                DeleteGroups(objectGroups);
            }

            lock (m_removeFromSimQueue)
            {
                m_removeFromSimQueue.Enqueue(dtis);
            }

            if (!DeleteLoopInUse)
            {
                DeleteLoopInUse = true;
                //MainConsole.Instance.Debug("[SCENE]: Starting delete loop");
                Util.FireAndForget(DoDeleteObject);
            }
        }