Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
	OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
avinationmerge
Melanie 2013-03-29 23:28:47 +00:00
commit d5d6a274a7
7 changed files with 216 additions and 85 deletions

View File

@ -301,10 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// If we're an NPC then skip all the item checks and manipulations since we don't have an // If we're an NPC then skip all the item checks and manipulations since we don't have an
// inventory right now. // inventory right now.
if (sp.PresenceType == PresenceType.Npc) RezSingleAttachmentFromInventoryInternal(sp, sp.PresenceType == PresenceType.Npc ? UUID.Zero : attach.ItemID, attach.AssetID, p | (uint)0x80, null);
RezSingleAttachmentFromInventoryInternal(sp, UUID.Zero, attach.AssetID, p, null, true);
else
RezSingleAttachmentFromInventory(sp, attach.ItemID, p | (uint)0x80, d);
} }
catch (Exception e) catch (Exception e)
{ {
@ -519,26 +516,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
"[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}", "[ATTACHMENTS MODULE]: RezSingleAttachmentFromInventory to point {0} from item {1} for {2} in {3}",
(AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name); (AttachmentPoint)AttachmentPt, itemID, sp.Name, m_scene.Name);
bool append = (AttachmentPt & 0x80) != 0; // We check the attachments in the avatar appearance here rather than the objects attached to the
AttachmentPt &= 0x7f; // ScenePresence itself so that we can ignore calls by viewer 2/3 to attach objects on startup. We are
// already doing this in ScenePresence.MakeRootAgent(). Simulator-side attaching needs to be done
// Viewer 2/3 sometimes asks to re-wear items that are already worn (and show up in it's inventory as such). // because pre-outfit folder viewers (most version 1 viewers) require it.
// This often happens during login - not sure the exact reason.
// For now, we will ignore the request. Unfortunately, this means that we need to dig through all the
// ScenePresence attachments. We can't use the data in AvatarAppearance because that's present at login
// before anything has actually been attached.
bool alreadyOn = false; bool alreadyOn = false;
List<SceneObjectGroup> existingAttachments = sp.GetAttachments(); List<AvatarAttachment> existingAttachments = sp.Appearance.GetAttachments();
foreach (SceneObjectGroup so in existingAttachments) foreach (AvatarAttachment existingAttachment in existingAttachments)
{ {
if (so.FromItemID == itemID) if (existingAttachment.ItemID == itemID)
{ {
alreadyOn = true; alreadyOn = true;
break; break;
} }
} }
// if (sp.Appearance.GetAttachmentForItem(itemID) != null)
if (alreadyOn) if (alreadyOn)
{ {
if (DebugLevel > 0) if (DebugLevel > 0)
@ -549,7 +541,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return null; return null;
} }
return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc, append); return RezSingleAttachmentFromInventoryInternal(sp, itemID, UUID.Zero, AttachmentPt, doc);
} }
public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist) public void RezMultipleAttachmentsFromInventory(IScenePresence sp, List<KeyValuePair<UUID, uint>> rezlist)
@ -558,7 +550,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
return; return;
if (DebugLevel > 0) if (DebugLevel > 0)
m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing multiple attachments from inventory for {0}", sp.Name); m_log.DebugFormat(
"[ATTACHMENTS MODULE]: Rezzing {0} attachments from inventory for {1} in {2}",
rezlist.Count, sp.Name, m_scene.Name);
foreach (KeyValuePair<UUID, uint> rez in rezlist) foreach (KeyValuePair<UUID, uint> rez in rezlist)
{ {
@ -957,11 +951,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
} }
protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc, bool append) IScenePresence sp, UUID itemID, UUID assetID, uint attachmentPt, XmlDocument doc)
{ {
if (m_invAccessModule == null) if (m_invAccessModule == null)
return null; return null;
bool append = (attachmentPt & 0x80) != 0;
attachmentPt &= 0x7f;
SceneObjectGroup objatt; SceneObjectGroup objatt;
if (itemID != UUID.Zero) if (itemID != UUID.Zero)

View File

@ -130,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
config.AddConfig("Modules"); config.AddConfig("Modules");
config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");
modules.Add(new AttachmentsModule()); AttachmentsModule attMod = new AttachmentsModule();
attMod.DebugLevel = 1;
modules.Add(attMod);
modules.Add(new BasicInventoryAccessModule()); modules.Add(new BasicInventoryAccessModule());
} }
@ -728,7 +730,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
public void TestRezAttachmentsOnAvatarEntrance() public void TestRezAttachmentsOnAvatarEntrance()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // TestHelpers.EnableLogging();
Scene scene = CreateTestScene(); Scene scene = CreateTestScene();
UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1); UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(scene, 0x1);

View File

@ -189,6 +189,45 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
case (int)HttpRequestConstants.HTTP_VERIFY_CERT: case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0); htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
break; break;
case (int)HttpRequestConstants.HTTP_VERBOSE_THROTTLE:
// TODO implement me
break;
case (int)HttpRequestConstants.HTTP_CUSTOM_HEADER:
//Parameters are in pairs and custom header takes
//arguments in pairs so adjust for header marker.
++i;
//Maximum of 8 headers are allowed based on the
//Second Life documentation for llHTTPRequest.
for (int count = 1; count <= 8; ++count)
{
//Not enough parameters remaining for a header?
if (parms.Length - i < 2)
break;
//Have we reached the end of the list of headers?
//End is marked by a string with a single digit.
//We already know we have at least one parameter
//so it is safe to do this check at top of loop.
if (Char.IsDigit(parms[i][0]))
break;
if (htc.HttpCustomHeaders == null)
htc.HttpCustomHeaders = new List<string>();
htc.HttpCustomHeaders.Add(parms[i]);
htc.HttpCustomHeaders.Add(parms[i+1]);
i += 2;
}
break;
case (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE:
htc.HttpPragmaNoCache = (int.Parse(parms[i + 1]) != 0);
break;
} }
} }
} }
@ -353,9 +392,12 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
// public const int HTTP_METHOD = 0; // public const int HTTP_METHOD = 0;
// public const int HTTP_MIMETYPE = 1; // public const int HTTP_MIMETYPE = 1;
// public const int HTTP_VERIFY_CERT = 3; // public const int HTTP_VERIFY_CERT = 3;
// public const int HTTP_VERBOSE_THROTTLE = 4;
// public const int HTTP_CUSTOM_HEADER = 5;
// public const int HTTP_PRAGMA_NO_CACHE = 6;
private bool _finished; private bool _finished;
public bool Finished public bool Finished
{ {
get { return _finished; } get { return _finished; }
} }
// public int HttpBodyMaxLen = 2048; // not implemented // public int HttpBodyMaxLen = 2048; // not implemented
@ -367,9 +409,14 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public bool HttpVerifyCert = true; public bool HttpVerifyCert = true;
public IWorkItemResult WorkItem = null; public IWorkItemResult WorkItem = null;
//public bool HttpVerboseThrottle = true; // not implemented
public List<string> HttpCustomHeaders = null;
public bool HttpPragmaNoCache = true;
private Thread httpThread;
// Request info // Request info
private UUID _itemID; private UUID _itemID;
public UUID ItemID public UUID ItemID
{ {
get { return _itemID; } get { return _itemID; }
set { _itemID = value; } set { _itemID = value; }
@ -385,7 +432,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
public string proxyexcepts; public string proxyexcepts;
public string OutboundBody; public string OutboundBody;
private UUID _reqID; private UUID _reqID;
public UUID ReqID public UUID ReqID
{ {
get { return _reqID; } get { return _reqID; }
set { _reqID = value; } set { _reqID = value; }
@ -434,20 +481,34 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
Request.Method = HttpMethod; Request.Method = HttpMethod;
Request.ContentType = HttpMIMEType; Request.ContentType = HttpMIMEType;
if(!HttpVerifyCert) if (!HttpVerifyCert)
{ {
// We could hijack Connection Group Name to identify // We could hijack Connection Group Name to identify
// a desired security exception. But at the moment we'll use a dummy header instead. // a desired security exception. But at the moment we'll use a dummy header instead.
Request.Headers.Add("NoVerifyCert", "true"); Request.Headers.Add("NoVerifyCert", "true");
} }
if (proxyurl != null && proxyurl.Length > 0) // else
// {
// Request.ConnectionGroupName="Verify";
// }
if (!HttpPragmaNoCache)
{ {
if (proxyexcepts != null && proxyexcepts.Length > 0) Request.Headers.Add("Pragma", "no-cache");
}
if (HttpCustomHeaders != null)
{
for (int i = 0; i < HttpCustomHeaders.Count; i += 2)
Request.Headers.Add(HttpCustomHeaders[i],
HttpCustomHeaders[i+1]);
}
if (proxyurl != null && proxyurl.Length > 0)
{
if (proxyexcepts != null && proxyexcepts.Length > 0)
{ {
string[] elist = proxyexcepts.Split(';'); string[] elist = proxyexcepts.Split(';');
Request.Proxy = new WebProxy(proxyurl, true, elist); Request.Proxy = new WebProxy(proxyurl, true, elist);
} }
else else
{ {
Request.Proxy = new WebProxy(proxyurl, true); Request.Proxy = new WebProxy(proxyurl, true);
} }
@ -460,7 +521,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
Request.Headers[entry.Key] = entry.Value; Request.Headers[entry.Key] = entry.Value;
// Encode outbound data // Encode outbound data
if (OutboundBody.Length > 0) if (OutboundBody.Length > 0)
{ {
byte[] data = Util.UTF8.GetBytes(OutboundBody); byte[] data = Util.UTF8.GetBytes(OutboundBody);

View File

@ -36,6 +36,9 @@ namespace OpenSim.Region.Framework.Interfaces
HTTP_MIMETYPE = 1, HTTP_MIMETYPE = 1,
HTTP_BODY_MAXLENGTH = 2, HTTP_BODY_MAXLENGTH = 2,
HTTP_VERIFY_CERT = 3, HTTP_VERIFY_CERT = 3,
HTTP_VERBOSE_THROTTLE = 4,
HTTP_CUSTOM_HEADER = 5,
HTTP_PRAGMA_NO_CACHE = 6
} }
public interface IHttpRequestModule public interface IHttpRequestModule

View File

@ -1100,15 +1100,12 @@ namespace OpenSim.Region.Framework.Scenes
{ {
// Viewers which have a current outfit folder will actually rez their own attachments. However, // Viewers which have a current outfit folder will actually rez their own attachments. However,
// viewers without (e.g. v1 viewers) will not, so we still need to make this call. // viewers without (e.g. v1 viewers) will not, so we still need to make this call.
//
// However, we leave a 5 second pause to try and avoid a clash with viewers that are rezzing
// attachments themselves. This should then mean that this call ends up doing nothing.
if (Scene.AttachmentsModule != null) if (Scene.AttachmentsModule != null)
Util.FireAndForget( Util.FireAndForget(
o => o =>
{ {
if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None) // if (PresenceType != PresenceType.Npc && Util.FireAndForgetMethod != FireAndForgetMethod.None)
System.Threading.Thread.Sleep(5000); // System.Threading.Thread.Sleep(7000);
Scene.AttachmentsModule.RezAttachments(this); Scene.AttachmentsModule.RezAttachments(this);
}); });

View File

@ -71,6 +71,7 @@ using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
using System.Reflection; using System.Reflection;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
using System.Linq;
using PermissionMask = OpenSim.Framework.PermissionMask; using PermissionMask = OpenSim.Framework.PermissionMask;
namespace OpenSim.Region.ScriptEngine.Shared.Api namespace OpenSim.Region.ScriptEngine.Shared.Api
@ -96,8 +97,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// <summary> /// <summary>
/// Used for script sleeps when we are using co-operative script termination. /// Used for script sleeps when we are using co-operative script termination.
/// </summary> /// </summary>
/// <remarks>null if co-operative script termination is not active</remarks> /// <remarks>null if co-operative script termination is not active</remarks>
WaitHandle m_coopSleepHandle; WaitHandle m_coopSleepHandle;
/// <summary> /// <summary>
/// The item that hosts this script /// The item that hosts this script
@ -150,6 +151,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{"TURNLEFT", "Turning Left"}, {"TURNLEFT", "Turning Left"},
{"TURNRIGHT", "Turning Right"} {"TURNRIGHT", "Turning Right"}
}; };
//An array of HTTP/1.1 headers that are not allowed to be used
//as custom headers by llHTTPRequest.
private string[] HttpStandardHeaders =
{
"Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language",
"Accept-Ranges", "Age", "Allow", "Authorization", "Cache-Control",
"Connection", "Content-Encoding", "Content-Language",
"Content-Length", "Content-Location", "Content-MD5",
"Content-Range", "Content-Type", "Date", "ETag", "Expect",
"Expires", "From", "Host", "If-Match", "If-Modified-Since",
"If-None-Match", "If-Range", "If-Unmodified-Since", "Last-Modified",
"Location", "Max-Forwards", "Pragma", "Proxy-Authenticate",
"Proxy-Authorization", "Range", "Referer", "Retry-After", "Server",
"TE", "Trailer", "Transfer-Encoding", "Upgrade", "User-Agent",
"Vary", "Via", "Warning", "WWW-Authenticate"
};
public void Initialize( public void Initialize(
IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
@ -391,7 +408,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number /// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number
/// of entities, then the entity which corresponds to that linknum is returned. /// of entities, then the entity which corresponds to that linknum is returned.
/// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then
/// null is returned. /// null is returned.
/// </param> /// </param>
public ISceneEntity GetLinkEntity(int linknum) public ISceneEntity GetLinkEntity(int linknum)
{ {
@ -1750,7 +1767,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (tex.FaceTextures[i] != null) if (tex.FaceTextures[i] != null)
{ {
tex.FaceTextures[i].Shiny = sval; tex.FaceTextures[i].Shiny = sval;
tex.FaceTextures[i].Bump = bump;; tex.FaceTextures[i].Bump = bump;
} }
tex.DefaultTexture.Shiny = sval; tex.DefaultTexture.Shiny = sval;
tex.DefaultTexture.Bump = bump; tex.DefaultTexture.Bump = bump;
@ -1873,7 +1890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f);
tex.DefaultTexture.RGBA = texcolor; tex.DefaultTexture.RGBA = texcolor;
} }
part.UpdateTextureEntry(tex.GetBytes()); part.UpdateTextureEntry(tex.GetBytes());
return; return;
} }
@ -1996,7 +2013,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
rgb.x = texcolor.R; rgb.x = texcolor.R;
rgb.y = texcolor.G; rgb.y = texcolor.G;
rgb.z = texcolor.B; rgb.z = texcolor.B;
return rgb; return rgb;
} }
else else
@ -2038,12 +2055,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID textureID = new UUID(); UUID textureID = new UUID();
textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
if (textureID == UUID.Zero) if (textureID == UUID.Zero)
{ {
if (!UUID.TryParse(texture, out textureID)) if (!UUID.TryParse(texture, out textureID))
return; return;
} }
Primitive.TextureEntry tex = part.Shape.Textures; Primitive.TextureEntry tex = part.Shape.Textures;
@ -2249,7 +2266,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND. // IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND.
// //
// This workaround is to prevent silent failure of this function. // This workaround is to prevent silent failure of this function.
// According to the specification on the SL Wiki, providing a position outside of the // According to the specification on the SL Wiki, providing a position outside of the
if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize)
{ {
return 0; return 0;
@ -2484,7 +2501,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
return llGetRootRotation(); return llGetRootRotation();
} }
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
Quaternion q = m_host.GetWorldRotation(); Quaternion q = m_host.GetWorldRotation();
@ -3317,7 +3334,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!UUID.TryParse(id, out objectID)) if (!UUID.TryParse(id, out objectID))
objectID = UUID.Zero; objectID = UUID.Zero;
if (objectID == UUID.Zero && name == "") if (objectID == UUID.Zero && name == "")
return; return;
@ -3527,19 +3544,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
Vector3 pos = m_host.AbsolutePosition; Vector3 pos = m_host.AbsolutePosition;
msg.binaryBucket msg.binaryBucket
= Util.StringToBytes256( = Util.StringToBytes256(
"{0}/{1}/{2}/{3}", "{0}/{1}/{2}/{3}",
World.RegionInfo.RegionName, World.RegionInfo.RegionName,
(int)Math.Floor(pos.X), (int)Math.Floor(pos.X),
(int)Math.Floor(pos.Y), (int)Math.Floor(pos.Y),
(int)Math.Floor(pos.Z)); (int)Math.Floor(pos.Z));
if (m_TransferModule != null) if (m_TransferModule != null)
{ {
m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); m_TransferModule.SendInstantMessage(msg, delegate(bool success) {});
} }
ScriptSleep(2000); ScriptSleep(2000);
} }
@ -3664,7 +3681,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public void llRotLookAt(LSL_Rotation target, double strength, double damping) public void llRotLookAt(LSL_Rotation target, double strength, double damping)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
// Per discussion with Melanie, for non-physical objects llLookAt appears to simply // Per discussion with Melanie, for non-physical objects llLookAt appears to simply
// set the rotation of the object, copy that behavior // set the rotation of the object, copy that behavior
PhysicsActor pa = m_host.PhysActor; PhysicsActor pa = m_host.PhysActor;
@ -5458,7 +5475,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// SL spits out an empty string for types other than key & string // SL spits out an empty string for types other than key & string
// At the time of patching, LSL_Key is currently LSL_String, // At the time of patching, LSL_Key is currently LSL_String,
// so the OR check may be a little redundant, but it's being done // so the OR check may be a little redundant, but it's being done
// for completion and should LSL_Key ever be implemented // for completion and should LSL_Key ever be implemented
// as it's own struct // as it's own struct
else if (!(src.Data[index] is LSL_String || else if (!(src.Data[index] is LSL_String ||
src.Data[index] is LSL_Key || src.Data[index] is LSL_Key ||
@ -5595,8 +5612,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return string.Join(", ", return string.Join(", ",
(new List<object>(src.Data)).ConvertAll<string>(o => (new List<object>(src.Data)).ConvertAll<string>(o =>
{ {
return o.ToString(); return o.ToString();
}).ToArray()); }).ToArray());
@ -6700,7 +6717,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
SetParticleSystem(m_host, rules); SetParticleSystem(m_host, rules);
} }
private void SetParticleSystem(SceneObjectPart part, LSL_List rules) private void SetParticleSystem(SceneObjectPart part, LSL_List rules)
{ {
if (rules.Length == 0) if (rules.Length == 0)
{ {
@ -6937,7 +6954,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.OwnerID, m_host.Name, destID, m_host.OwnerID, m_host.Name, destID,
(byte)InstantMessageDialog.TaskInventoryOffered, (byte)InstantMessageDialog.TaskInventoryOffered,
false, string.Format("'{0}'", category), false, string.Format("'{0}'", category),
// We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06 // We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06
// false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), // false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z),
folderID, false, pos, folderID, false, pos,
bucket, false); bucket, false);
@ -7056,12 +7073,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llAvatarOnLinkSitTarget(int linknum) public LSL_String llAvatarOnLinkSitTarget(int linknum)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(linknum == ScriptBaseClass.LINK_SET || if(linknum == ScriptBaseClass.LINK_SET ||
linknum == ScriptBaseClass.LINK_ALL_CHILDREN || linknum == ScriptBaseClass.LINK_ALL_CHILDREN ||
linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString(); linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString();
List<SceneObjectPart> parts = GetLinkParts(linknum); List<SceneObjectPart> parts = GetLinkParts(linknum);
if (parts.Count == 0) return UUID.Zero.ToString(); if (parts.Count == 0) return UUID.Zero.ToString();
return parts[0].SitTargetAvatar.ToString(); return parts[0].SitTargetAvatar.ToString();
} }
@ -7451,7 +7468,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
hollow = 0.70f; hollow = 0.70f;
} }
} }
// Otherwise, hollow is limited to 95%. // Otherwise, hollow is limited to 95%.
else else
{ {
if (hollow > 0.95f) if (hollow > 0.95f)
@ -8906,16 +8923,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
// float revolutions // float revolutions
res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d);
// Slightly inaccurate, because an unsigned byte is being used to represent // Slightly inaccurate, because an unsigned byte is being used to represent
// the entire range of floating-point values from 1.0 through 4.0 (which is how // the entire range of floating-point values from 1.0 through 4.0 (which is how
// SL does it). // SL does it).
// //
// Using these formulas to store and retrieve PathRevolutions, it is not // Using these formulas to store and retrieve PathRevolutions, it is not
// possible to use all values between 1.00 and 4.00. For instance, you can't // possible to use all values between 1.00 and 4.00. For instance, you can't
// represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you
// use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them
// with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar
// behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11.
// In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value
// such as 1.10. So, SL must store and retreive the actual user input rather // such as 1.10. So, SL must store and retreive the actual user input rather
@ -9199,7 +9216,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_DESC: case (int)ScriptBaseClass.PRIM_DESC:
res.Add(new LSL_String(part.Description)); res.Add(new LSL_String(part.Description));
break; break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL: case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
res.Add(new LSL_Rotation(part.RotationOffset)); res.Add(new LSL_Rotation(part.RotationOffset));
break; break;
@ -11127,9 +11144,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IHttpRequestModule httpScriptMod = IHttpRequestModule httpScriptMod =
m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>(); m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>();
List<string> param = new List<string>(); List<string> param = new List<string>();
foreach (object o in parameters.Data) bool ok;
Int32 flag;
for (int i = 0; i < parameters.Data.Length; i += 2)
{ {
param.Add(o.ToString()); ok = Int32.TryParse(parameters.Data[i].ToString(), out flag);
if (!ok || flag < 0 ||
flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE)
{
throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag");
}
param.Add(parameters.Data[i].ToString()); //Add parameter flag
if (flag != (int)HttpRequestConstants.HTTP_CUSTOM_HEADER)
{
param.Add(parameters.Data[i+1].ToString()); //Add parameter value
}
else
{
//Parameters are in pairs and custom header takes
//arguments in pairs so adjust for header marker.
++i;
//Maximum of 8 headers are allowed based on the
//Second Life documentation for llHTTPRequest.
for (int count = 1; count <= 8; ++count)
{
//Enough parameters remaining for (another) header?
if (parameters.Data.Length - i < 2)
{
//There must be at least one name/value pair for custom header
if (count == 1)
throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString());
break;
}
if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase))
throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString());
param.Add(parameters.Data[i].ToString());
param.Add(parameters.Data[i+1].ToString());
//Have we reached the end of the list of headers?
//End is marked by a string with a single digit.
if (i+2 >= parameters.Data.Length ||
Char.IsDigit(parameters.Data[i].ToString()[0]))
{
break;
}
i += 2;
}
}
} }
Vector3 position = m_host.AbsolutePosition; Vector3 position = m_host.AbsolutePosition;
@ -11295,12 +11363,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y);
if (lo == null) if (lo == null)
return 0; return 0;
IPrimCounts pc = lo.PrimCounts; IPrimCounts pc = lo.PrimCounts;
if (sim_wide != ScriptBaseClass.FALSE) if (sim_wide != ScriptBaseClass.FALSE)
@ -11330,7 +11398,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP)
return 0; // counts not implemented yet return 0; // counts not implemented yet
} }
return 0; return 0;
} }
@ -11691,7 +11759,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return ret; return ret;
} }
} }
return new LSL_List(); return new LSL_List();
} }
@ -12071,7 +12139,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// Vector3 bc = group.AbsolutePosition - rayEnd; // Vector3 bc = group.AbsolutePosition - rayEnd;
double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd));
// Too far off ray, don't bother // Too far off ray, don't bother
if (d > radius) if (d > radius)
return; return;
@ -12434,7 +12502,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
else else
{ {
ScenePresence sp = World.GetScenePresence(result.ConsumerID); ScenePresence sp = World.GetScenePresence(result.ConsumerID);
/// It it a boy? a girl? /// It it a boy? a girl?
if (sp != null) if (sp != null)
itemID = sp.UUID; itemID = sp.UUID;
} }

View File

@ -356,6 +356,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int HTTP_MIMETYPE = 1; public const int HTTP_MIMETYPE = 1;
public const int HTTP_BODY_MAXLENGTH = 2; public const int HTTP_BODY_MAXLENGTH = 2;
public const int HTTP_VERIFY_CERT = 3; public const int HTTP_VERIFY_CERT = 3;
public const int HTTP_VERBOSE_THROTTLE = 4;
public const int HTTP_CUSTOM_HEADER = 5;
public const int HTTP_PRAGMA_NO_CACHE = 6;
public const int PRIM_MATERIAL = 2; public const int PRIM_MATERIAL = 2;
public const int PRIM_PHYSICS = 3; public const int PRIM_PHYSICS = 3;
@ -636,7 +639,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int TOUCH_INVALID_FACE = -1; public const int TOUCH_INVALID_FACE = -1;
public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0);
public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR;
// constants for llGetPrimMediaParams/llSetPrimMediaParams // constants for llGetPrimMediaParams/llSetPrimMediaParams
public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0;
public const int PRIM_MEDIA_CONTROLS = 1; public const int PRIM_MEDIA_CONTROLS = 1;
@ -653,10 +656,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const int PRIM_MEDIA_WHITELIST = 12; public const int PRIM_MEDIA_WHITELIST = 12;
public const int PRIM_MEDIA_PERMS_INTERACT = 13; public const int PRIM_MEDIA_PERMS_INTERACT = 13;
public const int PRIM_MEDIA_PERMS_CONTROL = 14; public const int PRIM_MEDIA_PERMS_CONTROL = 14;
public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; public const int PRIM_MEDIA_CONTROLS_STANDARD = 0;
public const int PRIM_MEDIA_CONTROLS_MINI = 1; public const int PRIM_MEDIA_CONTROLS_MINI = 1;
public const int PRIM_MEDIA_PERM_NONE = 0; public const int PRIM_MEDIA_PERM_NONE = 0;
public const int PRIM_MEDIA_PERM_OWNER = 1; public const int PRIM_MEDIA_PERM_OWNER = 1;
public const int PRIM_MEDIA_PERM_GROUP = 2; public const int PRIM_MEDIA_PERM_GROUP = 2;
@ -689,7 +692,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f";
public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903";
public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361";
// Constants for osGetRegionStats // Constants for osGetRegionStats
public const int STATS_TIME_DILATION = 0; public const int STATS_TIME_DILATION = 0;
public const int STATS_SIM_FPS = 1; public const int STATS_SIM_FPS = 1;
@ -742,7 +745,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
public static readonly LSLInteger RC_GET_ROOT_KEY = 2; public static readonly LSLInteger RC_GET_ROOT_KEY = 2;
public static readonly LSLInteger RC_GET_LINK_NUM = 4; public static readonly LSLInteger RC_GET_LINK_NUM = 4;
public static readonly LSLInteger RCERR_UNKNOWN = -1; public static readonly LSLInteger RCERR_UNKNOWN = -1;
public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2; public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2;
public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = -3; public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = -3;