Merge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/var/git/careminster into careminster-presence-refactor

avinationmerge
Melanie 2011-01-11 14:38:10 +00:00
commit d7fd4b2153
6 changed files with 95 additions and 14 deletions

View File

@ -125,6 +125,9 @@ namespace OpenSim.Framework
private bool _ownerChanged = false; private bool _ownerChanged = false;
// This used ONLY during copy. It can't be relied on at other times!
private bool _scriptRunning = true;
public UUID AssetID { public UUID AssetID {
get { get {
return _assetID; return _assetID;
@ -387,6 +390,15 @@ namespace OpenSim.Framework
} }
} }
public bool ScriptRunning {
get {
return _scriptRunning;
}
set {
_scriptRunning = value;
}
}
// See ICloneable // See ICloneable
#region ICloneable Members #region ICloneable Members

View File

@ -50,5 +50,7 @@ namespace OpenSim.Region.Framework.Interfaces
void ResumeScript(UUID itemID); void ResumeScript(UUID itemID);
ArrayList GetScriptErrors(UUID itemID); ArrayList GetScriptErrors(UUID itemID);
bool HasScript(UUID itemID, out bool running);
} }
} }

View File

@ -2025,6 +2025,9 @@ namespace OpenSim.Region.Framework.Scenes
public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running) public void SetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID, bool running)
{ {
if (!Permissions.CanEditScript(itemID, objectID, controllingClient.AgentId))
return;
SceneObjectPart part = GetSceneObjectPart(objectID); SceneObjectPart part = GetSceneObjectPart(objectID);
if (part == null) if (part == null)
return; return;
@ -2168,5 +2171,15 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGraph.LinkObjects(root, children); m_sceneGraph.LinkObjects(root, children);
} }
private string PermissionString(uint permissions)
{
PermissionMask perms = (PermissionMask)permissions &
(PermissionMask.Move |
PermissionMask.Copy |
PermissionMask.Transfer |
PermissionMask.Modify);
return perms.ToString();
}
} }
} }

View File

@ -2857,10 +2857,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
RootPart.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
for (int i = 0; i < parts.Length; i++) for (int i = 0; i < parts.Length; i++)
{
if (parts[i] != RootPart)
parts[i].UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect); parts[i].UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
} }
} }
}
public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data) public void UpdateExtraParam(uint localID, ushort type, bool inUse, byte[] data)
{ {

View File

@ -48,6 +48,7 @@ namespace OpenSim.Region.Framework.Scenes
private string m_inventoryFileName = String.Empty; private string m_inventoryFileName = String.Empty;
private byte[] m_inventoryFileData = new byte[0]; private byte[] m_inventoryFileData = new byte[0];
private uint m_inventoryFileNameSerial = 0; private uint m_inventoryFileNameSerial = 0;
private bool m_inventoryPrivileged = false;
private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>(); private Dictionary<UUID, ArrayList> m_scriptErrors = new Dictionary<UUID, ArrayList>();
@ -93,6 +94,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_items = value; m_items = value;
m_inventorySerial++; m_inventorySerial++;
QueryScriptStates();
} }
} }
@ -225,6 +227,36 @@ namespace OpenSim.Region.Framework.Scenes
m_items.LockItemsForWrite(false); m_items.LockItemsForWrite(false);
} }
private void QueryScriptStates()
{
if (m_part == null || m_part.ParentGroup == null)
return;
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null) // No engine at all
return;
Items.LockItemsForRead(true);
foreach (TaskInventoryItem item in Items.Values)
{
if (item.InvType == (int)InventoryType.LSL)
{
foreach (IScriptModule e in engines)
{
bool running;
if (e.HasScript(item.ItemID, out running))
{
item.ScriptRunning = running;
break;
}
}
}
}
Items.LockItemsForRead(false);
}
/// <summary> /// <summary>
/// Start all the scripts contained in this prim's inventory /// Start all the scripts contained in this prim's inventory
/// </summary> /// </summary>
@ -348,6 +380,9 @@ namespace OpenSim.Region.Framework.Scenes
m_part.ParentGroup.Scene.EventManager.TriggerRezScript( m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
StoreScriptErrors(item.ItemID, null); StoreScriptErrors(item.ItemID, null);
if (!item.ScriptRunning)
m_part.ParentGroup.Scene.EventManager.TriggerStopScript(
m_part.LocalId, item.ItemID);
m_part.ParentGroup.AddActiveScriptCount(1); m_part.ParentGroup.AddActiveScriptCount(1);
m_part.ScheduleFullUpdate(); m_part.ScheduleFullUpdate();
} }
@ -952,6 +987,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
bool changed = CreateInventoryFileName(); bool changed = CreateInventoryFileName();
bool includeAssets = false;
if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId))
includeAssets = true;
if (m_inventoryPrivileged != includeAssets)
changed = true;
InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero);
Items.LockItemsForRead(true); Items.LockItemsForRead(true);
@ -977,9 +1019,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
bool includeAssets = false; m_inventoryPrivileged = includeAssets;
if (m_part.ParentGroup.Scene.Permissions.CanEditObjectInventory(m_part.UUID, client.AgentId))
includeAssets = true;
foreach (TaskInventoryItem item in m_items.Values) foreach (TaskInventoryItem item in m_items.Values)
{ {
@ -1122,8 +1162,6 @@ namespace OpenSim.Region.Framework.Scenes
uint mask=0x7fffffff; uint mask=0x7fffffff;
foreach (TaskInventoryItem item in m_items.Values) foreach (TaskInventoryItem item in m_items.Values)
{
if (item.InvType != (int)InventoryType.Object)
{ {
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
mask &= ~((uint)PermissionMask.Copy >> 13); mask &= ~((uint)PermissionMask.Copy >> 13);
@ -1131,8 +1169,8 @@ namespace OpenSim.Region.Framework.Scenes
mask &= ~((uint)PermissionMask.Transfer >> 13); mask &= ~((uint)PermissionMask.Transfer >> 13);
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
mask &= ~((uint)PermissionMask.Modify >> 13); mask &= ~((uint)PermissionMask.Modify >> 13);
}
else if (item.InvType == (int)InventoryType.Object)
{ {
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
mask &= ~((uint)PermissionMask.Copy >> 13); mask &= ~((uint)PermissionMask.Copy >> 13);

View File

@ -1695,5 +1695,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine
instance.Resume(); instance.Resume();
} }
public bool HasScript(UUID itemID, out bool running)
{
running = true;
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return false;
running = instance.Running;
return true;
}
} }
} }