Mantis#1612. Thank you, kindly, Matth for a patch that:
Adds the beginnints of llRemoteLoadScriptPin() and llSetRemoteScriptAccessPin().0.6.0-stable
parent
ca8d1d57e1
commit
3697e0898c
|
@ -1285,6 +1285,104 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rez a script into a prim's inventory from another prim
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="itemID"> </param>
|
||||||
|
/// <param name="localID"></param>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when an object is removed from the environment into inventory.
|
/// Called when an object is removed from the environment into inventory.
|
||||||
|
|
|
@ -102,6 +102,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
[XmlIgnore] public scriptEvents m_aggregateScriptEvents=0;
|
[XmlIgnore] public scriptEvents m_aggregateScriptEvents=0;
|
||||||
[XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None;
|
[XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None;
|
||||||
[XmlIgnore] public bool DIE_AT_EDGE = false;
|
[XmlIgnore] public bool DIE_AT_EDGE = false;
|
||||||
|
[XmlIgnore] private int m_scriptAccessPin = 0;
|
||||||
|
|
||||||
[XmlIgnore] public bool m_IsAttachment = false;
|
[XmlIgnore] public bool m_IsAttachment = false;
|
||||||
[XmlIgnore] public uint m_attachmentPoint = (byte)0;
|
[XmlIgnore] public uint m_attachmentPoint = (byte)0;
|
||||||
|
@ -212,6 +213,12 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
set { m_regionHandle = value; }
|
set { m_regionHandle = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int ScriptAccessPin
|
||||||
|
{
|
||||||
|
get { return m_scriptAccessPin; }
|
||||||
|
set { m_scriptAccessPin = (int)value; }
|
||||||
|
}
|
||||||
|
|
||||||
public uint GetEffectiveObjectFlags()
|
public uint GetEffectiveObjectFlags()
|
||||||
{
|
{
|
||||||
LLObject.ObjectFlags f = Flags;
|
LLObject.ObjectFlags f = Flags;
|
||||||
|
|
|
@ -4660,13 +4660,54 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
public void llSetRemoteScriptAccessPin(int pin)
|
public void llSetRemoteScriptAccessPin(int pin)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
NotImplemented("llSetRemoteScriptAccessPin");
|
|
||||||
|
m_host.ScriptAccessPin = pin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
|
public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
NotImplemented("llRemoteLoadScriptPin");
|
bool found = false;
|
||||||
|
LLUUID destId = LLUUID.Zero;
|
||||||
|
LLUUID srcId = LLUUID.Zero;
|
||||||
|
|
||||||
|
if (!LLUUID.TryParse(target, out destId))
|
||||||
|
{
|
||||||
|
llSay(0, "Could not parse key " + target);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// target must be a different prim than the one containing the script
|
||||||
|
if (m_host.UUID == destId)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy the first script found with this inventory name
|
||||||
|
foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
|
||||||
|
{
|
||||||
|
if (inv.Value.Name == name)
|
||||||
|
{
|
||||||
|
// make sure the object is a script
|
||||||
|
if(10 == inv.Value.Type)
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
srcId = inv.Key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
llSay(0, "Could not find script " + name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the rest of the permission checks are done in RezScript, so check the pin there as well
|
||||||
|
World.RezScript(srcId, m_host, destId, pin, running, start_param);
|
||||||
|
// this will cause the delay even if the script pin or permissions were wrong - seems ok
|
||||||
|
System.Threading.Thread.Sleep(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval)
|
// remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval)
|
||||||
|
|
Loading…
Reference in New Issue