From 3697e0898c83597914956157b4bbf880b83d948b Mon Sep 17 00:00:00 2001
From: Charles Krinke
Date: Fri, 27 Jun 2008 02:22:33 +0000
Subject: Mantis#1612. Thank you, kindly, Matth for a patch that: Adds the
beginnints of llRemoteLoadScriptPin() and llSetRemoteScriptAccessPin().
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 98 ++++++++++++++++++++++
.../Region/Environment/Scenes/SceneObjectPart.cs | 7 ++
2 files changed, 105 insertions(+)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index b67de7e..2bd2bad 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1285,7 +1285,105 @@ namespace OpenSim.Region.Environment.Scenes
}
}
+ ///
+ /// Rez a script into a prim's inventory from another prim
+ ///
+ ///
+ ///
+ ///
+ public void RezScript(LLUUID srcId, SceneObjectPart srcPart, LLUUID destId, int pin, int running, int start_param)
+ {
+ TaskInventoryItem srcTaskItem = srcPart.GetInventoryItem(srcId);
+
+ if (srcTaskItem == null)
+ {
+ // error was already logged
+ return;
+ }
+
+ SceneObjectPart destPart = GetSceneObjectPart(destId);
+
+ if (destPart == null)
+ {
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Could not find script for ID {0}",
+ destId);
+ return;
+ }
+
+ if (destPart.ScriptAccessPin != pin)
+ {
+ m_log.WarnFormat(
+ "[PRIM INVENTORY]: " +
+ "Script in object {0} : {1}, attempted to load script {2} : {3} into object {4} : {5} with invalid pin {6}",
+ srcPart.Name, srcId, srcTaskItem.Name, srcTaskItem.ItemID, destPart.Name, destId, pin);
+ // the LSL Wiki says we are supposed to shout on the DEBUG_CHANNEL -
+ // "Object: Task Object trying to illegally load script onto task Other_Object!"
+ // How do we should from in here?
+ return;
+ }
+
+ TaskInventoryItem destTaskItem = new TaskInventoryItem();
+
+ destTaskItem.ItemID = LLUUID.Random();
+ destTaskItem.CreatorID = srcTaskItem.CreatorID;
+ destTaskItem.AssetID = srcTaskItem.AssetID;
+ destTaskItem.GroupID = destPart.GroupID;
+ destTaskItem.OwnerID = destPart.OwnerID;
+ destTaskItem.ParentID = destPart.UUID;
+ destTaskItem.ParentPartID = destPart.UUID;
+
+ destTaskItem.BaseMask = srcTaskItem.BaseMask;
+ destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask;
+ destTaskItem.GroupMask = srcTaskItem.GroupMask;
+ destTaskItem.OwnerMask = srcTaskItem.OwnerMask;
+ destTaskItem.NextOwnerMask = srcTaskItem.NextOwnerMask;
+ destTaskItem.Flags = srcTaskItem.Flags;
+
+ if (destPart.OwnerID != srcPart.OwnerID)
+ {
+ if (ExternalChecks.ExternalChecksPropagatePermissions())
+ {
+ destTaskItem.OwnerMask = srcTaskItem.OwnerMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.GroupMask = srcTaskItem.GroupMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.EveryoneMask = srcTaskItem.EveryoneMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.BaseMask = srcTaskItem.BaseMask &
+ srcTaskItem.NextOwnerMask;
+ destTaskItem.OwnerMask |= 8; // Slam!
+ }
+ }
+ destTaskItem.Description = srcTaskItem.Description;
+ destTaskItem.Name = srcTaskItem.Name;
+ destTaskItem.InvType = srcTaskItem.InvType;
+ destTaskItem.Type = srcTaskItem.Type;
+
+ // need something like destPart.AddInventoryItemExclusive(destTaskItem);
+ // this function is supposed to silently overwrite an existing script with the same name
+
+ destPart.AddInventoryItem(destTaskItem);
+
+ if ( running > 0 )
+ {
+ if (ExternalChecks.ExternalChecksCanRunScript(destTaskItem.AssetID, destPart.UUID, destPart.OwnerID))
+ {
+ // why doesn't the start_param propogate?
+ destPart.StartScript(destTaskItem, start_param);
+ }
+ }
+
+ ScenePresence avatar;
+
+ if(TryGetAvatar(srcTaskItem.OwnerID, out avatar))
+ {
+ destPart.GetProperties(avatar.ControllingClient);
+ }
+ }
+
///
/// Called when an object is removed from the environment into inventory.
///
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 1f5f00f..6009206 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -102,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
[XmlIgnore] public scriptEvents m_aggregateScriptEvents=0;
[XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None;
[XmlIgnore] public bool DIE_AT_EDGE = false;
+ [XmlIgnore] private int m_scriptAccessPin = 0;
[XmlIgnore] public bool m_IsAttachment = false;
[XmlIgnore] public uint m_attachmentPoint = (byte)0;
@@ -211,6 +212,12 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_regionHandle; }
set { m_regionHandle = value; }
}
+
+ public int ScriptAccessPin
+ {
+ get { return m_scriptAccessPin; }
+ set { m_scriptAccessPin = (int)value; }
+ }
public uint GetEffectiveObjectFlags()
{
--
cgit v1.1