Add a method to delete left over / dropped attachments

avinationmerge
Melanie Thielker 2010-08-24 18:20:24 +02:00
parent 483fc88b07
commit b9e12ed3b7
1 changed files with 32 additions and 0 deletions

View File

@ -5040,5 +5040,37 @@ namespace OpenSim.Region.Framework.Scenes
throw new Exception(error); throw new Exception(error);
} }
} }
public void CleanDroppedAttachments()
{
List<SceneObjectGroup> objectsToDelete =
new List<SceneObjectGroup>();
ForEachSOG(delegate (SceneObjectGroup grp)
{
if (grp.RootPart.Shape.State != 0)
{
UUID agentID = grp.OwnerID;
if (agentID == UUID.Zero)
{
objectsToDelete.Add(grp);
return;
}
ScenePresence sp = GetScenePresence(agentID);
if (sp == null)
{
objectsToDelete.Add(grp);
return;
}
}
});
foreach (SceneObjectGroup grp in objectsToDelete)
{
m_log.InfoFormat("[SCENE]: Deleting dropped attachment {0} of user {1}", grp.UUID, grp.OwnerID);
DeleteSceneObject(grp, true);
}
}
} }
} }