diff options
author | Kevin Cozens | 2013-03-27 17:26:17 -0400 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-29 23:32:11 +0000 |
commit | cbc9ae898c474295567532c668644d09b698d59b (patch) | |
tree | ed33d08f0646120778581e279d33fecba708839a /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Check viewer 2/3 attachment calls against avatar appearance attachment data r... (diff) | |
download | opensim-SC_OLD-cbc9ae898c474295567532c668644d09b698d59b.zip opensim-SC_OLD-cbc9ae898c474295567532c668644d09b698d59b.tar.gz opensim-SC_OLD-cbc9ae898c474295567532c668644d09b698d59b.tar.bz2 opensim-SC_OLD-cbc9ae898c474295567532c668644d09b698d59b.tar.xz |
Added missing functionality (mainly custom headers) to llHTTPRequest.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 169 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 15 |
2 files changed, 128 insertions, 56 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index bf84b16..969243c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -67,6 +67,7 @@ using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; | |||
67 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; | 67 | using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; |
68 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; | 68 | using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; |
69 | using System.Reflection; | 69 | using System.Reflection; |
70 | using System.Linq; | ||
70 | using PermissionMask = OpenSim.Framework.PermissionMask; | 71 | using PermissionMask = OpenSim.Framework.PermissionMask; |
71 | 72 | ||
72 | namespace OpenSim.Region.ScriptEngine.Shared.Api | 73 | namespace OpenSim.Region.ScriptEngine.Shared.Api |
@@ -92,8 +93,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
92 | /// <summary> | 93 | /// <summary> |
93 | /// Used for script sleeps when we are using co-operative script termination. | 94 | /// Used for script sleeps when we are using co-operative script termination. |
94 | /// </summary> | 95 | /// </summary> |
95 | /// <remarks>null if co-operative script termination is not active</remarks> | 96 | /// <remarks>null if co-operative script termination is not active</remarks> |
96 | WaitHandle m_coopSleepHandle; | 97 | WaitHandle m_coopSleepHandle; |
97 | 98 | ||
98 | /// <summary> | 99 | /// <summary> |
99 | /// The item that hosts this script | 100 | /// The item that hosts this script |
@@ -119,6 +120,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
119 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. | 120 | protected int EMAIL_PAUSE_TIME = 20; // documented delay value for smtp. |
120 | protected ISoundModule m_SoundModule = null; | 121 | protected ISoundModule m_SoundModule = null; |
121 | 122 | ||
123 | //An array of HTTP/1.1 headers that are not allowed to be used | ||
124 | //as custom headers by llHTTPRequest. | ||
125 | private string[] HttpStandardHeaders = | ||
126 | { | ||
127 | "Accept", "Accept-Charset", "Accept-Encoding", "Accept-Language", | ||
128 | "Accept-Ranges", "Age", "Allow", "Authorization", "Cache-Control", | ||
129 | "Connection", "Content-Encoding", "Content-Language", | ||
130 | "Content-Length", "Content-Location", "Content-MD5", | ||
131 | "Content-Range", "Content-Type", "Date", "ETag", "Expect", | ||
132 | "Expires", "From", "Host", "If-Match", "If-Modified-Since", | ||
133 | "If-None-Match", "If-Range", "If-Unmodified-Since", "Last-Modified", | ||
134 | "Location", "Max-Forwards", "Pragma", "Proxy-Authenticate", | ||
135 | "Proxy-Authorization", "Range", "Referer", "Retry-After", "Server", | ||
136 | "TE", "Trailer", "Transfer-Encoding", "Upgrade", "User-Agent", | ||
137 | "Vary", "Via", "Warning", "WWW-Authenticate" | ||
138 | }; | ||
139 | |||
122 | public void Initialize( | 140 | public void Initialize( |
123 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) | 141 | IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle) |
124 | { | 142 | { |
@@ -303,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
303 | /// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number | 321 | /// If the linkset has more than one entity and a linknum greater than zero but equal to or less than the number |
304 | /// of entities, then the entity which corresponds to that linknum is returned. | 322 | /// of entities, then the entity which corresponds to that linknum is returned. |
305 | /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then | 323 | /// Otherwise, if a positive linknum is given which is greater than the number of entities in the linkset, then |
306 | /// null is returned. | 324 | /// null is returned. |
307 | /// </param> | 325 | /// </param> |
308 | public ISceneEntity GetLinkEntity(int linknum) | 326 | public ISceneEntity GetLinkEntity(int linknum) |
309 | { | 327 | { |
@@ -1557,7 +1575,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1557 | if (tex.FaceTextures[i] != null) | 1575 | if (tex.FaceTextures[i] != null) |
1558 | { | 1576 | { |
1559 | tex.FaceTextures[i].Shiny = sval; | 1577 | tex.FaceTextures[i].Shiny = sval; |
1560 | tex.FaceTextures[i].Bump = bump;; | 1578 | tex.FaceTextures[i].Bump = bump; |
1561 | } | 1579 | } |
1562 | tex.DefaultTexture.Shiny = sval; | 1580 | tex.DefaultTexture.Shiny = sval; |
1563 | tex.DefaultTexture.Bump = bump; | 1581 | tex.DefaultTexture.Bump = bump; |
@@ -1666,7 +1684,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1666 | texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); | 1684 | texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); |
1667 | tex.DefaultTexture.RGBA = texcolor; | 1685 | tex.DefaultTexture.RGBA = texcolor; |
1668 | } | 1686 | } |
1669 | 1687 | ||
1670 | part.UpdateTextureEntry(tex.GetBytes()); | 1688 | part.UpdateTextureEntry(tex.GetBytes()); |
1671 | return; | 1689 | return; |
1672 | } | 1690 | } |
@@ -1787,7 +1805,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1787 | rgb.x = texcolor.R; | 1805 | rgb.x = texcolor.R; |
1788 | rgb.y = texcolor.G; | 1806 | rgb.y = texcolor.G; |
1789 | rgb.z = texcolor.B; | 1807 | rgb.z = texcolor.B; |
1790 | 1808 | ||
1791 | return rgb; | 1809 | return rgb; |
1792 | } | 1810 | } |
1793 | else | 1811 | else |
@@ -1819,12 +1837,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1819 | { | 1837 | { |
1820 | UUID textureID = new UUID(); | 1838 | UUID textureID = new UUID(); |
1821 | 1839 | ||
1822 | textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); | 1840 | textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture); |
1823 | if (textureID == UUID.Zero) | 1841 | if (textureID == UUID.Zero) |
1824 | { | 1842 | { |
1825 | if (!UUID.TryParse(texture, out textureID)) | 1843 | if (!UUID.TryParse(texture, out textureID)) |
1826 | return; | 1844 | return; |
1827 | } | 1845 | } |
1828 | 1846 | ||
1829 | Primitive.TextureEntry tex = part.Shape.Textures; | 1847 | Primitive.TextureEntry tex = part.Shape.Textures; |
1830 | 1848 | ||
@@ -2021,7 +2039,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2021 | // IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND. | 2039 | // IF YOU GET REGION CROSSINGS WORKING WITH THIS FUNCTION, REPLACE THE WORKAROUND. |
2022 | // | 2040 | // |
2023 | // This workaround is to prevent silent failure of this function. | 2041 | // This workaround is to prevent silent failure of this function. |
2024 | // According to the specification on the SL Wiki, providing a position outside of the | 2042 | // According to the specification on the SL Wiki, providing a position outside of the |
2025 | if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) | 2043 | if (pos.x < 0 || pos.x > Constants.RegionSize || pos.y < 0 || pos.y > Constants.RegionSize) |
2026 | { | 2044 | { |
2027 | return 0; | 2045 | return 0; |
@@ -2230,7 +2248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2230 | { | 2248 | { |
2231 | return llGetRootRotation(); | 2249 | return llGetRootRotation(); |
2232 | } | 2250 | } |
2233 | 2251 | ||
2234 | m_host.AddScriptLPS(1); | 2252 | m_host.AddScriptLPS(1); |
2235 | Quaternion q = m_host.GetWorldRotation(); | 2253 | Quaternion q = m_host.GetWorldRotation(); |
2236 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); | 2254 | return new LSL_Rotation(q.X, q.Y, q.Z, q.W); |
@@ -2919,7 +2937,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2919 | // we need to convert from a vector describing | 2937 | // we need to convert from a vector describing |
2920 | // the angles of rotation in radians into rotation value | 2938 | // the angles of rotation in radians into rotation value |
2921 | LSL_Rotation rot = llEuler2Rot(angle); | 2939 | LSL_Rotation rot = llEuler2Rot(angle); |
2922 | 2940 | ||
2923 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply | 2941 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply |
2924 | // set the rotation of the object, copy that behavior | 2942 | // set the rotation of the object, copy that behavior |
2925 | PhysicsActor pa = m_host.PhysActor; | 2943 | PhysicsActor pa = m_host.PhysActor; |
@@ -2996,7 +3014,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2996 | 3014 | ||
2997 | if (!UUID.TryParse(id, out objectID)) | 3015 | if (!UUID.TryParse(id, out objectID)) |
2998 | objectID = UUID.Zero; | 3016 | objectID = UUID.Zero; |
2999 | 3017 | ||
3000 | if (objectID == UUID.Zero && name == "") | 3018 | if (objectID == UUID.Zero && name == "") |
3001 | return; | 3019 | return; |
3002 | 3020 | ||
@@ -3182,19 +3200,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3182 | msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; | 3200 | msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; |
3183 | 3201 | ||
3184 | Vector3 pos = m_host.AbsolutePosition; | 3202 | Vector3 pos = m_host.AbsolutePosition; |
3185 | msg.binaryBucket | 3203 | msg.binaryBucket |
3186 | = Util.StringToBytes256( | 3204 | = Util.StringToBytes256( |
3187 | "{0}/{1}/{2}/{3}", | 3205 | "{0}/{1}/{2}/{3}", |
3188 | World.RegionInfo.RegionName, | 3206 | World.RegionInfo.RegionName, |
3189 | (int)Math.Floor(pos.X), | 3207 | (int)Math.Floor(pos.X), |
3190 | (int)Math.Floor(pos.Y), | 3208 | (int)Math.Floor(pos.Y), |
3191 | (int)Math.Floor(pos.Z)); | 3209 | (int)Math.Floor(pos.Z)); |
3192 | 3210 | ||
3193 | if (m_TransferModule != null) | 3211 | if (m_TransferModule != null) |
3194 | { | 3212 | { |
3195 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); | 3213 | m_TransferModule.SendInstantMessage(msg, delegate(bool success) {}); |
3196 | } | 3214 | } |
3197 | 3215 | ||
3198 | ScriptSleep(2000); | 3216 | ScriptSleep(2000); |
3199 | } | 3217 | } |
3200 | 3218 | ||
@@ -3319,7 +3337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3319 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | 3337 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) |
3320 | { | 3338 | { |
3321 | m_host.AddScriptLPS(1); | 3339 | m_host.AddScriptLPS(1); |
3322 | 3340 | ||
3323 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply | 3341 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply |
3324 | // set the rotation of the object, copy that behavior | 3342 | // set the rotation of the object, copy that behavior |
3325 | PhysicsActor pa = m_host.PhysActor; | 3343 | PhysicsActor pa = m_host.PhysActor; |
@@ -4313,7 +4331,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
4313 | public void llCollisionSound(string impact_sound, double impact_volume) | 4331 | public void llCollisionSound(string impact_sound, double impact_volume) |
4314 | { | 4332 | { |
4315 | m_host.AddScriptLPS(1); | 4333 | m_host.AddScriptLPS(1); |
4316 | 4334 | ||
4317 | // TODO: Parameter check logic required. | 4335 | // TODO: Parameter check logic required. |
4318 | m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); | 4336 | m_host.CollisionSound = ScriptUtils.GetAssetIdFromKeyOrItemName(m_host, impact_sound, AssetType.Sound); |
4319 | m_host.CollisionSoundVolume = (float)impact_volume; | 4337 | m_host.CollisionSoundVolume = (float)impact_volume; |
@@ -5008,7 +5026,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5008 | // SL spits out an empty string for types other than key & string | 5026 | // SL spits out an empty string for types other than key & string |
5009 | // At the time of patching, LSL_Key is currently LSL_String, | 5027 | // At the time of patching, LSL_Key is currently LSL_String, |
5010 | // so the OR check may be a little redundant, but it's being done | 5028 | // so the OR check may be a little redundant, but it's being done |
5011 | // for completion and should LSL_Key ever be implemented | 5029 | // for completion and should LSL_Key ever be implemented |
5012 | // as it's own struct | 5030 | // as it's own struct |
5013 | else if (!(src.Data[index] is LSL_String || | 5031 | else if (!(src.Data[index] is LSL_String || |
5014 | src.Data[index] is LSL_Key)) | 5032 | src.Data[index] is LSL_Key)) |
@@ -5144,8 +5162,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5144 | { | 5162 | { |
5145 | m_host.AddScriptLPS(1); | 5163 | m_host.AddScriptLPS(1); |
5146 | 5164 | ||
5147 | return string.Join(", ", | 5165 | return string.Join(", ", |
5148 | (new List<object>(src.Data)).ConvertAll<string>(o => | 5166 | (new List<object>(src.Data)).ConvertAll<string>(o => |
5149 | { | 5167 | { |
5150 | return o.ToString(); | 5168 | return o.ToString(); |
5151 | }).ToArray()); | 5169 | }).ToArray()); |
@@ -6188,7 +6206,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6188 | SetParticleSystem(m_host, rules); | 6206 | SetParticleSystem(m_host, rules); |
6189 | } | 6207 | } |
6190 | 6208 | ||
6191 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules) | 6209 | private void SetParticleSystem(SceneObjectPart part, LSL_List rules) |
6192 | { | 6210 | { |
6193 | if (rules.Length == 0) | 6211 | if (rules.Length == 0) |
6194 | { | 6212 | { |
@@ -6425,7 +6443,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6425 | m_host.OwnerID, m_host.Name, destID, | 6443 | m_host.OwnerID, m_host.Name, destID, |
6426 | (byte)InstantMessageDialog.TaskInventoryOffered, | 6444 | (byte)InstantMessageDialog.TaskInventoryOffered, |
6427 | false, string.Format("'{0}'", category), | 6445 | false, string.Format("'{0}'", category), |
6428 | // We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06 | 6446 | // We won't go so far as to add a SLURL, but this is the format used by LL as of 2012-10-06 |
6429 | // false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), | 6447 | // false, string.Format("'{0}' ( http://slurl.com/secondlife/{1}/{2}/{3}/{4} )", category, World.Name, (int)pos.X, (int)pos.Y, (int)pos.Z), |
6430 | folderID, false, pos, | 6448 | folderID, false, pos, |
6431 | bucket, false); | 6449 | bucket, false); |
@@ -6540,12 +6558,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6540 | public LSL_String llAvatarOnLinkSitTarget(int linknum) | 6558 | public LSL_String llAvatarOnLinkSitTarget(int linknum) |
6541 | { | 6559 | { |
6542 | m_host.AddScriptLPS(1); | 6560 | m_host.AddScriptLPS(1); |
6543 | if(linknum == ScriptBaseClass.LINK_SET || | 6561 | if(linknum == ScriptBaseClass.LINK_SET || |
6544 | linknum == ScriptBaseClass.LINK_ALL_CHILDREN || | 6562 | linknum == ScriptBaseClass.LINK_ALL_CHILDREN || |
6545 | linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString(); | 6563 | linknum == ScriptBaseClass.LINK_ALL_OTHERS) return UUID.Zero.ToString(); |
6546 | 6564 | ||
6547 | List<SceneObjectPart> parts = GetLinkParts(linknum); | 6565 | List<SceneObjectPart> parts = GetLinkParts(linknum); |
6548 | if (parts.Count == 0) return UUID.Zero.ToString(); | 6566 | if (parts.Count == 0) return UUID.Zero.ToString(); |
6549 | return parts[0].SitTargetAvatar.ToString(); | 6567 | return parts[0].SitTargetAvatar.ToString(); |
6550 | } | 6568 | } |
6551 | 6569 | ||
@@ -6922,7 +6940,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6922 | hollow = 0.70f; | 6940 | hollow = 0.70f; |
6923 | } | 6941 | } |
6924 | } | 6942 | } |
6925 | // Otherwise, hollow is limited to 95%. | 6943 | // Otherwise, hollow is limited to 95%. |
6926 | else | 6944 | else |
6927 | { | 6945 | { |
6928 | if (hollow > 0.95f) | 6946 | if (hollow > 0.95f) |
@@ -7956,8 +7974,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7956 | LSL_List remaining = null; | 7974 | LSL_List remaining = null; |
7957 | 7975 | ||
7958 | while (true) | 7976 | while (true) |
7959 | { | 7977 | { |
7960 | if (entity is SceneObjectPart) | 7978 | if (entity is SceneObjectPart) |
7961 | remaining = GetPrimParams((SceneObjectPart)entity, rules, ref result); | 7979 | remaining = GetPrimParams((SceneObjectPart)entity, rules, ref result); |
7962 | else | 7980 | else |
7963 | remaining = GetAgentParams((ScenePresence)entity, rules, ref result); | 7981 | remaining = GetAgentParams((ScenePresence)entity, rules, ref result); |
@@ -8138,7 +8156,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8138 | res.Add(new LSL_Float(1)); | 8156 | res.Add(new LSL_Float(1)); |
8139 | break; | 8157 | break; |
8140 | 8158 | ||
8141 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 8159 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
8142 | res.Add(new LSL_Rotation(sp.Rotation)); | 8160 | res.Add(new LSL_Rotation(sp.Rotation)); |
8143 | break; | 8161 | break; |
8144 | 8162 | ||
@@ -8282,16 +8300,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8282 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); | 8300 | res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); |
8283 | 8301 | ||
8284 | // float revolutions | 8302 | // float revolutions |
8285 | res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); | 8303 | res.Add(new LSL_Float(Math.Round(Shape.PathRevolutions * 0.015d, 2, MidpointRounding.AwayFromZero)) + 1.0d); |
8286 | // Slightly inaccurate, because an unsigned byte is being used to represent | 8304 | // Slightly inaccurate, because an unsigned byte is being used to represent |
8287 | // the entire range of floating-point values from 1.0 through 4.0 (which is how | 8305 | // the entire range of floating-point values from 1.0 through 4.0 (which is how |
8288 | // SL does it). | 8306 | // SL does it). |
8289 | // | 8307 | // |
8290 | // Using these formulas to store and retrieve PathRevolutions, it is not | 8308 | // Using these formulas to store and retrieve PathRevolutions, it is not |
8291 | // possible to use all values between 1.00 and 4.00. For instance, you can't | 8309 | // possible to use all values between 1.00 and 4.00. For instance, you can't |
8292 | // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you | 8310 | // represent 1.10. You can represent 1.09 and 1.11, but not 1.10. So, if you |
8293 | // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them | 8311 | // use llSetPrimitiveParams to set revolutions to 1.10 and then retreive them |
8294 | // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar | 8312 | // with llGetPrimitiveParams, you'll retrieve 1.09. You can also see a similar |
8295 | // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. | 8313 | // behavior in the viewer as you cannot set 1.10. The viewer jumps to 1.11. |
8296 | // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value | 8314 | // In SL, llSetPrimitveParams and llGetPrimitiveParams can set and get a value |
8297 | // such as 1.10. So, SL must store and retreive the actual user input rather | 8315 | // such as 1.10. So, SL must store and retreive the actual user input rather |
@@ -8528,7 +8546,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8528 | case (int)ScriptBaseClass.PRIM_DESC: | 8546 | case (int)ScriptBaseClass.PRIM_DESC: |
8529 | res.Add(new LSL_String(part.Description)); | 8547 | res.Add(new LSL_String(part.Description)); |
8530 | break; | 8548 | break; |
8531 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: | 8549 | case (int)ScriptBaseClass.PRIM_ROT_LOCAL: |
8532 | res.Add(new LSL_Rotation(part.RotationOffset)); | 8550 | res.Add(new LSL_Rotation(part.RotationOffset)); |
8533 | break; | 8551 | break; |
8534 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: | 8552 | case (int)ScriptBaseClass.PRIM_POS_LOCAL: |
@@ -10415,9 +10433,60 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10415 | IHttpRequestModule httpScriptMod = | 10433 | IHttpRequestModule httpScriptMod = |
10416 | m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>(); | 10434 | m_ScriptEngine.World.RequestModuleInterface<IHttpRequestModule>(); |
10417 | List<string> param = new List<string>(); | 10435 | List<string> param = new List<string>(); |
10418 | foreach (object o in parameters.Data) | 10436 | bool ok; |
10437 | Int32 flag; | ||
10438 | |||
10439 | for (int i = 0; i < parameters.Data.Length; i += 2) | ||
10419 | { | 10440 | { |
10420 | param.Add(o.ToString()); | 10441 | ok = Int32.TryParse(parameters.Data[i].ToString(), out flag); |
10442 | if (!ok || flag < 0 || | ||
10443 | flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE) | ||
10444 | { | ||
10445 | throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag"); | ||
10446 | } | ||
10447 | |||
10448 | param.Add(parameters.Data[i].ToString()); //Add parameter flag | ||
10449 | |||
10450 | if (flag != (int)HttpRequestConstants.HTTP_CUSTOM_HEADER) | ||
10451 | { | ||
10452 | param.Add(parameters.Data[i+1].ToString()); //Add parameter value | ||
10453 | } | ||
10454 | else | ||
10455 | { | ||
10456 | //Parameters are in pairs and custom header takes | ||
10457 | //arguments in pairs so adjust for header marker. | ||
10458 | ++i; | ||
10459 | |||
10460 | //Maximum of 8 headers are allowed based on the | ||
10461 | //Second Life documentation for llHTTPRequest. | ||
10462 | for (int count = 1; count <= 8; ++count) | ||
10463 | { | ||
10464 | //Enough parameters remaining for (another) header? | ||
10465 | if (parameters.Data.Length - i < 2) | ||
10466 | { | ||
10467 | //There must be at least one name/value pair for custom header | ||
10468 | if (count == 1) | ||
10469 | throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString()); | ||
10470 | break; | ||
10471 | } | ||
10472 | |||
10473 | if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase)) | ||
10474 | throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString()); | ||
10475 | |||
10476 | param.Add(parameters.Data[i].ToString()); | ||
10477 | param.Add(parameters.Data[i+1].ToString()); | ||
10478 | |||
10479 | //Have we reached the end of the list of headers? | ||
10480 | //End is marked by a string with a single digit. | ||
10481 | if (i+2 >= parameters.Data.Length || | ||
10482 | Char.IsDigit(parameters.Data[i].ToString()[0])) | ||
10483 | { | ||
10484 | break; | ||
10485 | } | ||
10486 | |||
10487 | i += 2; | ||
10488 | } | ||
10489 | } | ||
10421 | } | 10490 | } |
10422 | 10491 | ||
10423 | Vector3 position = m_host.AbsolutePosition; | 10492 | Vector3 position = m_host.AbsolutePosition; |
@@ -10527,12 +10596,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10527 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) | 10596 | public LSL_Integer llGetParcelPrimCount(LSL_Vector pos, int category, int sim_wide) |
10528 | { | 10597 | { |
10529 | m_host.AddScriptLPS(1); | 10598 | m_host.AddScriptLPS(1); |
10530 | 10599 | ||
10531 | ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); | 10600 | ILandObject lo = World.LandChannel.GetLandObject((float)pos.x, (float)pos.y); |
10532 | 10601 | ||
10533 | if (lo == null) | 10602 | if (lo == null) |
10534 | return 0; | 10603 | return 0; |
10535 | 10604 | ||
10536 | IPrimCounts pc = lo.PrimCounts; | 10605 | IPrimCounts pc = lo.PrimCounts; |
10537 | 10606 | ||
10538 | if (sim_wide != ScriptBaseClass.FALSE) | 10607 | if (sim_wide != ScriptBaseClass.FALSE) |
@@ -10562,7 +10631,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10562 | else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) | 10631 | else if (category == ScriptBaseClass.PARCEL_COUNT_TEMP) |
10563 | return 0; // counts not implemented yet | 10632 | return 0; // counts not implemented yet |
10564 | } | 10633 | } |
10565 | 10634 | ||
10566 | return 0; | 10635 | return 0; |
10567 | } | 10636 | } |
10568 | 10637 | ||
@@ -10905,7 +10974,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10905 | return ret; | 10974 | return ret; |
10906 | } | 10975 | } |
10907 | } | 10976 | } |
10908 | 10977 | ||
10909 | return new LSL_List(); | 10978 | return new LSL_List(); |
10910 | } | 10979 | } |
10911 | 10980 | ||
@@ -11282,7 +11351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11282 | // Vector3 bc = group.AbsolutePosition - rayEnd; | 11351 | // Vector3 bc = group.AbsolutePosition - rayEnd; |
11283 | 11352 | ||
11284 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); | 11353 | double d = Math.Abs(Vector3.Mag(Vector3.Cross(ab, ac)) / Vector3.Distance(rayStart, rayEnd)); |
11285 | 11354 | ||
11286 | // Too far off ray, don't bother | 11355 | // Too far off ray, don't bother |
11287 | if (d > radius) | 11356 | if (d > radius) |
11288 | return; | 11357 | return; |
@@ -11611,7 +11680,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11611 | else | 11680 | else |
11612 | { | 11681 | { |
11613 | ScenePresence sp = World.GetScenePresence(result.ConsumerID); | 11682 | ScenePresence sp = World.GetScenePresence(result.ConsumerID); |
11614 | /// It it a boy? a girl? | 11683 | /// It it a boy? a girl? |
11615 | if (sp != null) | 11684 | if (sp != null) |
11616 | itemID = sp.UUID; | 11685 | itemID = sp.UUID; |
11617 | } | 11686 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index bd66ba3..dc5ef13 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -355,6 +355,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
355 | public const int HTTP_MIMETYPE = 1; | 355 | public const int HTTP_MIMETYPE = 1; |
356 | public const int HTTP_BODY_MAXLENGTH = 2; | 356 | public const int HTTP_BODY_MAXLENGTH = 2; |
357 | public const int HTTP_VERIFY_CERT = 3; | 357 | public const int HTTP_VERIFY_CERT = 3; |
358 | public const int HTTP_VERBOSE_THROTTLE = 4; | ||
359 | public const int HTTP_CUSTOM_HEADER = 5; | ||
360 | public const int HTTP_PRAGMA_NO_CACHE = 6; | ||
358 | 361 | ||
359 | public const int PRIM_MATERIAL = 2; | 362 | public const int PRIM_MATERIAL = 2; |
360 | public const int PRIM_PHYSICS = 3; | 363 | public const int PRIM_PHYSICS = 3; |
@@ -635,7 +638,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
635 | public const int TOUCH_INVALID_FACE = -1; | 638 | public const int TOUCH_INVALID_FACE = -1; |
636 | public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); | 639 | public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); |
637 | public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; | 640 | public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; |
638 | 641 | ||
639 | // constants for llGetPrimMediaParams/llSetPrimMediaParams | 642 | // constants for llGetPrimMediaParams/llSetPrimMediaParams |
640 | public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; | 643 | public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; |
641 | public const int PRIM_MEDIA_CONTROLS = 1; | 644 | public const int PRIM_MEDIA_CONTROLS = 1; |
@@ -652,15 +655,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
652 | public const int PRIM_MEDIA_WHITELIST = 12; | 655 | public const int PRIM_MEDIA_WHITELIST = 12; |
653 | public const int PRIM_MEDIA_PERMS_INTERACT = 13; | 656 | public const int PRIM_MEDIA_PERMS_INTERACT = 13; |
654 | public const int PRIM_MEDIA_PERMS_CONTROL = 14; | 657 | public const int PRIM_MEDIA_PERMS_CONTROL = 14; |
655 | 658 | ||
656 | public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; | 659 | public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; |
657 | public const int PRIM_MEDIA_CONTROLS_MINI = 1; | 660 | public const int PRIM_MEDIA_CONTROLS_MINI = 1; |
658 | 661 | ||
659 | public const int PRIM_MEDIA_PERM_NONE = 0; | 662 | public const int PRIM_MEDIA_PERM_NONE = 0; |
660 | public const int PRIM_MEDIA_PERM_OWNER = 1; | 663 | public const int PRIM_MEDIA_PERM_OWNER = 1; |
661 | public const int PRIM_MEDIA_PERM_GROUP = 2; | 664 | public const int PRIM_MEDIA_PERM_GROUP = 2; |
662 | public const int PRIM_MEDIA_PERM_ANYONE = 4; | 665 | public const int PRIM_MEDIA_PERM_ANYONE = 4; |
663 | 666 | ||
664 | public const int PRIM_PHYSICS_SHAPE_TYPE = 30; | 667 | public const int PRIM_PHYSICS_SHAPE_TYPE = 30; |
665 | public const int PRIM_PHYSICS_SHAPE_PRIM = 0; | 668 | public const int PRIM_PHYSICS_SHAPE_PRIM = 0; |
666 | public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; | 669 | public const int PRIM_PHYSICS_SHAPE_CONVEX = 2; |
@@ -688,7 +691,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
688 | public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; | 691 | public const string TEXTURE_PLYWOOD = "89556747-24cb-43ed-920b-47caed15465f"; |
689 | public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; | 692 | public const string TEXTURE_TRANSPARENT = "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"; |
690 | public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; | 693 | public const string TEXTURE_MEDIA = "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"; |
691 | 694 | ||
692 | // Constants for osGetRegionStats | 695 | // Constants for osGetRegionStats |
693 | public const int STATS_TIME_DILATION = 0; | 696 | public const int STATS_TIME_DILATION = 0; |
694 | public const int STATS_SIM_FPS = 1; | 697 | public const int STATS_SIM_FPS = 1; |
@@ -741,7 +744,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
741 | public static readonly LSLInteger RC_GET_ROOT_KEY = 2; | 744 | public static readonly LSLInteger RC_GET_ROOT_KEY = 2; |
742 | public static readonly LSLInteger RC_GET_LINK_NUM = 4; | 745 | public static readonly LSLInteger RC_GET_LINK_NUM = 4; |
743 | 746 | ||
744 | public static readonly LSLInteger RCERR_UNKNOWN = -1; | 747 | public static readonly LSLInteger RCERR_UNKNOWN = -1; |
745 | public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2; | 748 | public static readonly LSLInteger RCERR_SIM_PERF_LOW = -2; |
746 | public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3; | 749 | public static readonly LSLInteger RCERR_CAST_TIME_EXCEEDED = 3; |
747 | 750 | ||