diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
4 files changed, 95 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1459778..b9b3318 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3252,7 +3252,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3252 | msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here | 3252 | msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here |
3253 | // m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); | 3253 | // m_log.Debug("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); |
3254 | // m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); | 3254 | // m_log.Debug("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); |
3255 | msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp; | 3255 | DateTime dt = DateTime.UtcNow; |
3256 | |||
3257 | // Ticks from UtcNow, but make it look like local. Evil, huh? | ||
3258 | dt = DateTime.SpecifyKind(dt, DateTimeKind.Local); | ||
3259 | |||
3260 | try | ||
3261 | { | ||
3262 | // Convert that to the PST timezone | ||
3263 | TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("America/Los_Angeles"); | ||
3264 | dt = TimeZoneInfo.ConvertTime(dt, timeZoneInfo); | ||
3265 | } | ||
3266 | catch | ||
3267 | { | ||
3268 | // No logging here, as it could be VERY spammy | ||
3269 | } | ||
3270 | |||
3271 | // And make it look local again to fool the unix time util | ||
3272 | dt = DateTime.SpecifyKind(dt, DateTimeKind.Utc); | ||
3273 | |||
3274 | msg.timestamp = (uint)Util.ToUnixTime(dt); | ||
3275 | |||
3256 | //if (client != null) | 3276 | //if (client != null) |
3257 | //{ | 3277 | //{ |
3258 | msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName; | 3278 | msg.fromAgentName = m_host.Name;//client.FirstName + " " + client.LastName;// fromAgentName; |
@@ -5247,7 +5267,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5247 | case ',': | 5267 | case ',': |
5248 | if (parens == 0) | 5268 | if (parens == 0) |
5249 | { | 5269 | { |
5250 | result.Add(src.Substring(start,length).Trim()); | 5270 | result.Add(new LSL_String(src.Substring(start,length).Trim())); |
5251 | start += length+1; | 5271 | start += length+1; |
5252 | length = 0; | 5272 | length = 0; |
5253 | } | 5273 | } |
@@ -9369,7 +9389,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9369 | 9389 | ||
9370 | if (aList.Data[i] != null) | 9390 | if (aList.Data[i] != null) |
9371 | { | 9391 | { |
9372 | switch ((ParcelMediaCommandEnum) aList.Data[i]) | 9392 | switch ((ParcelMediaCommandEnum) Convert.ToInt32(aList.Data[i].ToString())) |
9373 | { | 9393 | { |
9374 | case ParcelMediaCommandEnum.Url: | 9394 | case ParcelMediaCommandEnum.Url: |
9375 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL)); | 9395 | list.Add(new LSL_String(World.GetLandData(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).MediaURL)); |
@@ -9804,19 +9824,39 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9804 | public LSL_String llXorBase64StringsCorrect(string str1, string str2) | 9824 | public LSL_String llXorBase64StringsCorrect(string str1, string str2) |
9805 | { | 9825 | { |
9806 | m_host.AddScriptLPS(1); | 9826 | m_host.AddScriptLPS(1); |
9807 | string ret = String.Empty; | 9827 | |
9808 | string src1 = llBase64ToString(str1); | 9828 | if (str1 == String.Empty) |
9809 | string src2 = llBase64ToString(str2); | 9829 | return String.Empty; |
9810 | int c = 0; | 9830 | if (str2 == String.Empty) |
9811 | for (int i = 0; i < src1.Length; i++) | 9831 | return str1; |
9832 | |||
9833 | byte[] data1 = Convert.FromBase64String(str1); | ||
9834 | byte[] data2 = Convert.FromBase64String(str2); | ||
9835 | |||
9836 | byte[] d2 = new Byte[data1.Length]; | ||
9837 | int pos = 0; | ||
9838 | |||
9839 | if (data1.Length <= data2.Length) | ||
9812 | { | 9840 | { |
9813 | ret += (char) (src1[i] ^ src2[c]); | 9841 | Array.Copy(data2, 0, d2, 0, data1.Length); |
9842 | } | ||
9843 | else | ||
9844 | { | ||
9845 | while (pos < data1.Length) | ||
9846 | { | ||
9847 | int len = data1.Length - pos; | ||
9848 | if (len > data2.Length) | ||
9849 | len = data2.Length; | ||
9814 | 9850 | ||
9815 | c++; | 9851 | Array.Copy(data2, 0, d2, pos, len); |
9816 | if (c >= src2.Length) | 9852 | pos += len; |
9817 | c = 0; | 9853 | } |
9818 | } | 9854 | } |
9819 | return llStringToBase64(ret); | 9855 | |
9856 | for (pos = 0 ; pos < data1.Length ; pos++ ) | ||
9857 | data1[pos] ^= d2[pos]; | ||
9858 | |||
9859 | return Convert.ToBase64String(data1); | ||
9820 | } | 9860 | } |
9821 | 9861 | ||
9822 | public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) | 9862 | public LSL_String llHTTPRequest(string url, LSL_List parameters, string body) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index fe71ed5..1fa8c30 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -73,6 +73,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
73 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) | 73 | if (m_ScriptEngine.Config.GetBoolean("AllowLightShareFunctions", false)) |
74 | m_LSFunctionsEnabled = true; | 74 | m_LSFunctionsEnabled = true; |
75 | 75 | ||
76 | if (m_ScriptEngine.Config.GetBoolean("AllowCareminsterFunctions", false)) | ||
77 | m_LSFunctionsEnabled = true; | ||
78 | |||
76 | m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); | 79 | m_comms = m_ScriptEngine.World.RequestModuleInterface<IScriptModuleComms>(); |
77 | if (m_comms == null) | 80 | if (m_comms == null) |
78 | m_LSFunctionsEnabled = false; | 81 | m_LSFunctionsEnabled = false; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 212dbe3..5927973 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -663,13 +663,13 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
663 | Object[] ret; | 663 | Object[] ret; |
664 | 664 | ||
665 | if (start < 0) | 665 | if (start < 0) |
666 | start=m_data.Length-start; | 666 | start=m_data.Length+start; |
667 | 667 | ||
668 | if (start < 0) | 668 | if (start < 0) |
669 | start=0; | 669 | start=0; |
670 | 670 | ||
671 | if (end < 0) | 671 | if (end < 0) |
672 | end=m_data.Length-end; | 672 | end=m_data.Length+end; |
673 | if (end < 0) | 673 | if (end < 0) |
674 | end=0; | 674 | end=0; |
675 | 675 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 30e127d..a6ab5e9 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -556,6 +556,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
556 | 556 | ||
557 | if (stateSource == (int)StateSource.ScriptedRez) | 557 | if (stateSource == (int)StateSource.ScriptedRez) |
558 | { | 558 | { |
559 | lock (m_CompileDict) | ||
560 | { | ||
561 | m_CompileDict[itemID] = 0; | ||
562 | } | ||
563 | |||
559 | DoOnRezScript(parms); | 564 | DoOnRezScript(parms); |
560 | } | 565 | } |
561 | else | 566 | else |
@@ -835,8 +840,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
835 | item.Name, startParam, postOnRez, | 840 | item.Name, startParam, postOnRez, |
836 | stateSource, m_MaxScriptQueue); | 841 | stateSource, m_MaxScriptQueue); |
837 | 842 | ||
838 | m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}", | 843 | m_log.DebugFormat( |
839 | part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString()); | 844 | "[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}.{5}", |
845 | part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, | ||
846 | part.ParentGroup.RootPart.AbsolutePosition, part.ParentGroup.Scene.RegionInfo.RegionName); | ||
840 | 847 | ||
841 | if (presence != null) | 848 | if (presence != null) |
842 | { | 849 | { |
@@ -1356,9 +1363,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1356 | string xml = instance.GetXMLState(); | 1363 | string xml = instance.GetXMLState(); |
1357 | 1364 | ||
1358 | XmlDocument sdoc = new XmlDocument(); | 1365 | XmlDocument sdoc = new XmlDocument(); |
1359 | sdoc.LoadXml(xml); | 1366 | bool loadedState = true; |
1360 | XmlNodeList rootL = sdoc.GetElementsByTagName("ScriptState"); | 1367 | try |
1361 | XmlNode rootNode = rootL[0]; | 1368 | { |
1369 | sdoc.LoadXml(xml); | ||
1370 | } | ||
1371 | catch (System.Xml.XmlException e) | ||
1372 | { | ||
1373 | loadedState = false; | ||
1374 | } | ||
1375 | |||
1376 | XmlNodeList rootL = null; | ||
1377 | XmlNode rootNode = null; | ||
1378 | if (loadedState) | ||
1379 | { | ||
1380 | rootL = sdoc.GetElementsByTagName("ScriptState"); | ||
1381 | rootNode = rootL[0]; | ||
1382 | } | ||
1362 | 1383 | ||
1363 | // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> | 1384 | // Create <State UUID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> |
1364 | XmlDocument doc = new XmlDocument(); | 1385 | XmlDocument doc = new XmlDocument(); |
@@ -1374,8 +1395,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1374 | stateData.Attributes.Append(engineName); | 1395 | stateData.Attributes.Append(engineName); |
1375 | doc.AppendChild(stateData); | 1396 | doc.AppendChild(stateData); |
1376 | 1397 | ||
1398 | XmlNode xmlstate = null; | ||
1399 | |||
1377 | // Add <ScriptState>...</ScriptState> | 1400 | // Add <ScriptState>...</ScriptState> |
1378 | XmlNode xmlstate = doc.ImportNode(rootNode, true); | 1401 | if (loadedState) |
1402 | { | ||
1403 | xmlstate = doc.ImportNode(rootNode, true); | ||
1404 | } | ||
1405 | else | ||
1406 | { | ||
1407 | xmlstate = doc.CreateElement("", "ScriptState", ""); | ||
1408 | } | ||
1409 | |||
1379 | stateData.AppendChild(xmlstate); | 1410 | stateData.AppendChild(xmlstate); |
1380 | 1411 | ||
1381 | string assemName = instance.GetAssemblyName(); | 1412 | string assemName = instance.GetAssemblyName(); |