diff options
Diffstat (limited to 'OpenSim/Region')
16 files changed, 332 insertions, 17 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs index a381a1b..4c15ad8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetMeshModule.cs | |||
@@ -264,7 +264,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
264 | response["int_response_code"] = 500; | 264 | response["int_response_code"] = 500; |
265 | response["str_response_string"] = "Script timeout"; | 265 | response["str_response_string"] = "Script timeout"; |
266 | response["content_type"] = "text/plain"; | 266 | response["content_type"] = "text/plain"; |
267 | response["keepalive"] = false; | 267 | response["keepalive"] = true; |
268 | response["reusecontext"] = false; | 268 | response["reusecontext"] = false; |
269 | 269 | ||
270 | return response; | 270 | return response; |
@@ -285,7 +285,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
285 | response["int_response_code"] = 500; | 285 | response["int_response_code"] = 500; |
286 | response["str_response_string"] = "Script timeout"; | 286 | response["str_response_string"] = "Script timeout"; |
287 | response["content_type"] = "text/plain"; | 287 | response["content_type"] = "text/plain"; |
288 | response["keepalive"] = false; | 288 | response["keepalive"] = true; |
289 | response["reusecontext"] = false; | 289 | response["reusecontext"] = false; |
290 | 290 | ||
291 | lock (responses) | 291 | lock (responses) |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs index e053054..54e8d76 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/GetTextureModule.cs | |||
@@ -283,7 +283,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
283 | response["int_response_code"] = 500; | 283 | response["int_response_code"] = 500; |
284 | response["str_response_string"] = "Script timeout"; | 284 | response["str_response_string"] = "Script timeout"; |
285 | response["content_type"] = "text/plain"; | 285 | response["content_type"] = "text/plain"; |
286 | response["keepalive"] = false; | 286 | response["keepalive"] = true; |
287 | response["reusecontext"] = false; | 287 | response["reusecontext"] = false; |
288 | 288 | ||
289 | return response; | 289 | return response; |
@@ -300,11 +300,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
300 | { | 300 | { |
301 | response = new Hashtable(); | 301 | response = new Hashtable(); |
302 | 302 | ||
303 | |||
303 | response["int_response_code"] = 503; | 304 | response["int_response_code"] = 503; |
304 | response["str_response_string"] = "Throttled"; | 305 | response["str_response_string"] = "Throttled"; |
305 | response["content_type"] = "text/plain"; | 306 | response["content_type"] = "text/plain"; |
306 | response["keepalive"] = false; | 307 | response["keepalive"] = true; |
307 | response["reusecontext"] = false; | 308 | response["reusecontext"] = false; |
309 | |||
310 | Hashtable headers = new Hashtable(); | ||
311 | headers["Retry-After"] = 30; | ||
312 | response["headers"] = headers; | ||
308 | 313 | ||
309 | lock (responses) | 314 | lock (responses) |
310 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; | 315 | responses[requestID] = new aPollResponse() {bytes = 0, response = response}; |
@@ -320,7 +325,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
320 | response["int_response_code"] = 500; | 325 | response["int_response_code"] = 500; |
321 | response["str_response_string"] = "Script timeout"; | 326 | response["str_response_string"] = "Script timeout"; |
322 | response["content_type"] = "text/plain"; | 327 | response["content_type"] = "text/plain"; |
323 | response["keepalive"] = false; | 328 | response["keepalive"] = true; |
324 | response["reusecontext"] = false; | 329 | response["reusecontext"] = false; |
325 | 330 | ||
326 | lock (responses) | 331 | lock (responses) |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 4c0fba5..226f2a1 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -475,6 +475,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
475 | set { m_disableFacelights = value; } | 475 | set { m_disableFacelights = value; } |
476 | } | 476 | } |
477 | 477 | ||
478 | public List<uint> SelectedObjects {get; private set;} | ||
478 | 479 | ||
479 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } | 480 | public bool SendLogoutPacketWhenClosing { set { m_SendLogoutPacketWhenClosing = value; } } |
480 | 481 | ||
@@ -495,6 +496,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
495 | // DebugPacketLevel = 1; | 496 | // DebugPacketLevel = 1; |
496 | 497 | ||
497 | CloseSyncLock = new Object(); | 498 | CloseSyncLock = new Object(); |
499 | SelectedObjects = new List<uint>(); | ||
498 | 500 | ||
499 | RegisterInterface<IClientIM>(this); | 501 | RegisterInterface<IClientIM>(this); |
500 | RegisterInterface<IClientInventory>(this); | 502 | RegisterInterface<IClientInventory>(this); |
@@ -7389,6 +7391,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7389 | 7391 | ||
7390 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) | 7392 | for (int i = 0; i < incomingselect.ObjectData.Length; i++) |
7391 | { | 7393 | { |
7394 | if (!SelectedObjects.Contains(incomingselect.ObjectData[i].ObjectLocalID)) | ||
7395 | SelectedObjects.Add(incomingselect.ObjectData[i].ObjectLocalID); | ||
7392 | handlerObjectSelect = OnObjectSelect; | 7396 | handlerObjectSelect = OnObjectSelect; |
7393 | if (handlerObjectSelect != null) | 7397 | if (handlerObjectSelect != null) |
7394 | { | 7398 | { |
@@ -7415,6 +7419,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
7415 | 7419 | ||
7416 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) | 7420 | for (int i = 0; i < incomingdeselect.ObjectData.Length; i++) |
7417 | { | 7421 | { |
7422 | if (!SelectedObjects.Contains(incomingdeselect.ObjectData[i].ObjectLocalID)) | ||
7423 | SelectedObjects.Add(incomingdeselect.ObjectData[i].ObjectLocalID); | ||
7418 | handlerObjectDeselect = OnObjectDeselect; | 7424 | handlerObjectDeselect = OnObjectDeselect; |
7419 | if (handlerObjectDeselect != null) | 7425 | if (handlerObjectDeselect != null) |
7420 | { | 7426 | { |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index f66534d..b5f9da8 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -1757,6 +1757,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1757 | AuthenticateResponse sessionInfo; | 1757 | AuthenticateResponse sessionInfo; |
1758 | if (IsClientAuthorized(uccp, out sessionInfo)) | 1758 | if (IsClientAuthorized(uccp, out sessionInfo)) |
1759 | { | 1759 | { |
1760 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); | ||
1761 | |||
1760 | // Begin the process of adding the client to the simulator | 1762 | // Begin the process of adding the client to the simulator |
1761 | client | 1763 | client |
1762 | = AddClient( | 1764 | = AddClient( |
@@ -1766,6 +1768,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1766 | endPoint, | 1768 | endPoint, |
1767 | sessionInfo); | 1769 | sessionInfo); |
1768 | 1770 | ||
1771 | // This will be true if the client is new, e.g. not | ||
1772 | // an existing child agent, and there is no circuit data | ||
1773 | if (client != null && aCircuit == null) | ||
1774 | { | ||
1775 | m_scene.CloseAgent(client.AgentId, true); | ||
1776 | return; | ||
1777 | } | ||
1778 | |||
1769 | // Now we know we can handle more data | 1779 | // Now we know we can handle more data |
1770 | Thread.Sleep(200); | 1780 | Thread.Sleep(200); |
1771 | 1781 | ||
@@ -1802,7 +1812,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1802 | // We only want to send initial data to new clients, not ones which are being converted from child to root. | 1812 | // We only want to send initial data to new clients, not ones which are being converted from child to root. |
1803 | if (client != null) | 1813 | if (client != null) |
1804 | { | 1814 | { |
1805 | AgentCircuitData aCircuit = m_scene.AuthenticateHandler.GetAgentCircuitData(uccp.CircuitCode.Code); | ||
1806 | bool tp = (aCircuit.teleportFlags > 0); | 1815 | bool tp = (aCircuit.teleportFlags > 0); |
1807 | // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from | 1816 | // Let's delay this for TP agents, otherwise the viewer doesn't know where to get resources from |
1808 | if (!tp) | 1817 | if (!tp) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 0e7ab7e..4fdcd01 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -203,8 +203,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
203 | { | 203 | { |
204 | m_scene.ForEachRootClient(delegate(IClientAPI client) | 204 | m_scene.ForEachRootClient(delegate(IClientAPI client) |
205 | { | 205 | { |
206 | client.SendBlueBoxMessage(fromAvatarID, fromAvatarName, | 206 | client.SendAgentAlertMessage( |
207 | message); | 207 | message, false); |
208 | }); | 208 | }); |
209 | } | 209 | } |
210 | 210 | ||
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs index 0c74b49..e6a0205 100644 --- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs +++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs | |||
@@ -131,7 +131,10 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
131 | public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice) | 131 | public void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice) |
132 | { | 132 | { |
133 | if (m_CountdownTimer != null) | 133 | if (m_CountdownTimer != null) |
134 | return; | 134 | { |
135 | m_CountdownTimer.Stop(); | ||
136 | m_CountdownTimer = null; | ||
137 | } | ||
135 | 138 | ||
136 | if (alerts == null) | 139 | if (alerts == null) |
137 | { | 140 | { |
@@ -276,7 +279,8 @@ namespace OpenSim.Region.CoreModules.World.Region | |||
276 | m_CountdownTimer.Stop(); | 279 | m_CountdownTimer.Stop(); |
277 | m_CountdownTimer = null; | 280 | m_CountdownTimer = null; |
278 | if (m_DialogModule != null && message != String.Empty) | 281 | if (m_DialogModule != null && message != String.Empty) |
279 | m_DialogModule.SendGeneralAlert(message); | 282 | m_DialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); |
283 | //m_DialogModule.SendGeneralAlert(message); | ||
280 | } | 284 | } |
281 | if (m_MarkerPath != String.Empty) | 285 | if (m_MarkerPath != String.Empty) |
282 | File.Delete(Path.Combine(m_MarkerPath, | 286 | File.Delete(Path.Combine(m_MarkerPath, |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 82508ad..3e278a9 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1840,7 +1840,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1840 | // Util.FireAndForget( | 1840 | // Util.FireAndForget( |
1841 | // o => | 1841 | // o => |
1842 | // { | 1842 | // { |
1843 | Scene.AttachmentsModule.RezAttachments(this); | 1843 | if (!isNPC) |
1844 | Scene.AttachmentsModule.RezAttachments(this); | ||
1845 | else | ||
1846 | Util.FireAndForget(x => { | ||
1847 | Scene.AttachmentsModule.RezAttachments(this); | ||
1848 | }); | ||
1844 | // }); | 1849 | // }); |
1845 | } | 1850 | } |
1846 | else | 1851 | else |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 3750494..51ecc8d 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -68,6 +68,8 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
68 | 68 | ||
69 | private bool m_connected = true; | 69 | private bool m_connected = true; |
70 | 70 | ||
71 | public List<uint> SelectedObjects {get; private set;} | ||
72 | |||
71 | public IRCClientView(TcpClient client, Scene scene) | 73 | public IRCClientView(TcpClient client, Scene scene) |
72 | { | 74 | { |
73 | m_client = client; | 75 | m_client = client; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index 709d389..97133c0 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs | |||
@@ -179,7 +179,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule | |||
179 | { | 179 | { |
180 | if(!m_Channels.ContainsKey(itemID)) | 180 | if(!m_Channels.ContainsKey(itemID)) |
181 | { | 181 | { |
182 | m_log.InfoFormat("[XMLRPC GRID ROUTER]: Attempted to unregister non-existing Item: {0}", itemID.ToString()); | 182 | //m_log.InfoFormat("[XMLRPC GRID ROUTER]: Attempted to unregister non-existing Item: {0}", itemID.ToString()); |
183 | return false; | 183 | return false; |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 0b33c51..0b4d03a 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -65,6 +65,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
65 | private readonly Scene m_scene; | 65 | private readonly Scene m_scene; |
66 | private readonly UUID m_ownerID; | 66 | private readonly UUID m_ownerID; |
67 | 67 | ||
68 | public List<uint> SelectedObjects {get; private set;} | ||
69 | |||
68 | public NPCAvatar( | 70 | public NPCAvatar( |
69 | string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) | 71 | string firstname, string lastname, Vector3 position, UUID ownerID, bool senseAsAgent, Scene scene) |
70 | { | 72 | { |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7d5c750..b5ba4a0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -37,6 +37,7 @@ using System.Timers; | |||
37 | using Nini.Config; | 37 | using Nini.Config; |
38 | using log4net; | 38 | using log4net; |
39 | using OpenMetaverse; | 39 | using OpenMetaverse; |
40 | using OpenMetaverse.StructuredData; | ||
40 | using OpenMetaverse.Packets; | 41 | using OpenMetaverse.Packets; |
41 | using OpenSim; | 42 | using OpenSim; |
42 | using OpenSim.Framework; | 43 | using OpenSim.Framework; |
@@ -13658,6 +13659,244 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13658 | 13659 | ||
13659 | return String.Empty; | 13660 | return String.Empty; |
13660 | } | 13661 | } |
13662 | |||
13663 | public LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers) | ||
13664 | { | ||
13665 | OSD o = OSDParser.DeserializeJson(json); | ||
13666 | OSD specVal = JsonGetSpecific(o, specifiers, 0); | ||
13667 | |||
13668 | return specVal.AsString(); | ||
13669 | } | ||
13670 | |||
13671 | public LSL_List llJson2List(LSL_String json) | ||
13672 | { | ||
13673 | try | ||
13674 | { | ||
13675 | OSD o = OSDParser.DeserializeJson(json); | ||
13676 | return (LSL_List)ParseJsonNode(o); | ||
13677 | } | ||
13678 | catch (Exception) | ||
13679 | { | ||
13680 | return new LSL_List(ScriptBaseClass.JSON_INVALID); | ||
13681 | } | ||
13682 | } | ||
13683 | |||
13684 | private object ParseJsonNode(OSD node) | ||
13685 | { | ||
13686 | if (node.Type == OSDType.Integer) | ||
13687 | return new LSL_Integer(node.AsInteger()); | ||
13688 | if (node.Type == OSDType.Boolean) | ||
13689 | return new LSL_Integer(node.AsBoolean() ? 1 : 0); | ||
13690 | if (node.Type == OSDType.Real) | ||
13691 | return new LSL_Float(node.AsReal()); | ||
13692 | if (node.Type == OSDType.UUID || node.Type == OSDType.String) | ||
13693 | return new LSL_String(node.AsString()); | ||
13694 | if (node.Type == OSDType.Array) | ||
13695 | { | ||
13696 | LSL_List resp = new LSL_List(); | ||
13697 | OSDArray ar = node as OSDArray; | ||
13698 | foreach (OSD o in ar) | ||
13699 | resp.Add(ParseJsonNode(o)); | ||
13700 | return resp; | ||
13701 | } | ||
13702 | if (node.Type == OSDType.Map) | ||
13703 | { | ||
13704 | LSL_List resp = new LSL_List(); | ||
13705 | OSDMap ar = node as OSDMap; | ||
13706 | foreach (KeyValuePair<string, OSD> o in ar) | ||
13707 | { | ||
13708 | resp.Add(new LSL_String(o.Key)); | ||
13709 | resp.Add(ParseJsonNode(o.Value)); | ||
13710 | } | ||
13711 | return resp; | ||
13712 | } | ||
13713 | throw new Exception(ScriptBaseClass.JSON_INVALID); | ||
13714 | } | ||
13715 | |||
13716 | public LSL_String llList2Json(LSL_String type, LSL_List values) | ||
13717 | { | ||
13718 | try | ||
13719 | { | ||
13720 | if (type == ScriptBaseClass.JSON_ARRAY) | ||
13721 | { | ||
13722 | OSDArray array = new OSDArray(); | ||
13723 | foreach (object o in values.Data) | ||
13724 | { | ||
13725 | array.Add(ListToJson(o)); | ||
13726 | } | ||
13727 | return OSDParser.SerializeJsonString(array); | ||
13728 | } | ||
13729 | else if (type == ScriptBaseClass.JSON_OBJECT) | ||
13730 | { | ||
13731 | OSDMap map = new OSDMap(); | ||
13732 | for (int i = 0; i < values.Data.Length; i += 2) | ||
13733 | { | ||
13734 | if (!(values.Data[i] is LSL_String)) | ||
13735 | return ScriptBaseClass.JSON_INVALID; | ||
13736 | map.Add(((LSL_String)values.Data[i]).m_string, ListToJson(values.Data[i + 1])); | ||
13737 | } | ||
13738 | return OSDParser.SerializeJsonString(map); | ||
13739 | } | ||
13740 | return ScriptBaseClass.JSON_INVALID; | ||
13741 | } | ||
13742 | catch (Exception ex) | ||
13743 | { | ||
13744 | return ex.Message; | ||
13745 | } | ||
13746 | } | ||
13747 | |||
13748 | private OSD ListToJson(object o) | ||
13749 | { | ||
13750 | if (o is LSL_Float) | ||
13751 | return OSD.FromReal(((LSL_Float)o).value); | ||
13752 | if (o is LSL_Integer) | ||
13753 | { | ||
13754 | int i = ((LSL_Integer)o).value; | ||
13755 | if (i == 0) | ||
13756 | return OSD.FromBoolean(false); | ||
13757 | else if (i == 1) | ||
13758 | return OSD.FromBoolean(true); | ||
13759 | return OSD.FromInteger(i); | ||
13760 | } | ||
13761 | if (o is LSL_Rotation) | ||
13762 | return OSD.FromString(((LSL_Rotation)o).ToString()); | ||
13763 | if (o is LSL_Vector) | ||
13764 | return OSD.FromString(((LSL_Vector)o).ToString()); | ||
13765 | if (o is LSL_String) | ||
13766 | { | ||
13767 | string str = ((LSL_String)o).m_string; | ||
13768 | if (str == ScriptBaseClass.JSON_NULL) | ||
13769 | return new OSD(); | ||
13770 | return OSD.FromString(str); | ||
13771 | } | ||
13772 | throw new Exception(ScriptBaseClass.JSON_INVALID); | ||
13773 | } | ||
13774 | |||
13775 | private OSD JsonGetSpecific(OSD o, LSL_List specifiers, int i) | ||
13776 | { | ||
13777 | object spec = specifiers.Data[i]; | ||
13778 | OSD nextVal = null; | ||
13779 | if (o is OSDArray) | ||
13780 | { | ||
13781 | if (spec is LSL_Integer) | ||
13782 | nextVal = ((OSDArray)o)[((LSL_Integer)spec).value]; | ||
13783 | } | ||
13784 | if (o is OSDMap) | ||
13785 | { | ||
13786 | if (spec is LSL_String) | ||
13787 | nextVal = ((OSDMap)o)[((LSL_String)spec).m_string]; | ||
13788 | } | ||
13789 | if (nextVal != null) | ||
13790 | { | ||
13791 | if (specifiers.Data.Length - 1 > i) | ||
13792 | return JsonGetSpecific(nextVal, specifiers, i + 1); | ||
13793 | } | ||
13794 | return nextVal; | ||
13795 | } | ||
13796 | |||
13797 | public LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value) | ||
13798 | { | ||
13799 | try | ||
13800 | { | ||
13801 | OSD o = OSDParser.DeserializeJson(json); | ||
13802 | JsonSetSpecific(o, specifiers, 0, value); | ||
13803 | return OSDParser.SerializeJsonString(o); | ||
13804 | } | ||
13805 | catch (Exception) | ||
13806 | { | ||
13807 | } | ||
13808 | return ScriptBaseClass.JSON_INVALID; | ||
13809 | } | ||
13810 | |||
13811 | private void JsonSetSpecific(OSD o, LSL_List specifiers, int i, LSL_String val) | ||
13812 | { | ||
13813 | object spec = specifiers.Data[i]; | ||
13814 | // 20131224 not used object specNext = i+1 == specifiers.Data.Length ? null : specifiers.Data[i+1]; | ||
13815 | OSD nextVal = null; | ||
13816 | if (o is OSDArray) | ||
13817 | { | ||
13818 | OSDArray array = ((OSDArray)o); | ||
13819 | if (spec is LSL_Integer) | ||
13820 | { | ||
13821 | int v = ((LSL_Integer)spec).value; | ||
13822 | if (v >= array.Count) | ||
13823 | array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13824 | else | ||
13825 | nextVal = ((OSDArray)o)[v]; | ||
13826 | } | ||
13827 | else if (spec is LSL_String && ((LSL_String)spec) == ScriptBaseClass.JSON_APPEND) | ||
13828 | array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13829 | } | ||
13830 | if (o is OSDMap) | ||
13831 | { | ||
13832 | if (spec is LSL_String) | ||
13833 | { | ||
13834 | OSDMap map = ((OSDMap)o); | ||
13835 | if (map.ContainsKey(((LSL_String)spec).m_string)) | ||
13836 | nextVal = map[((LSL_String)spec).m_string]; | ||
13837 | else | ||
13838 | map.Add(((LSL_String)spec).m_string, JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13839 | } | ||
13840 | } | ||
13841 | if (nextVal != null) | ||
13842 | { | ||
13843 | if (specifiers.Data.Length - 1 > i) | ||
13844 | { | ||
13845 | JsonSetSpecific(nextVal, specifiers, i + 1, val); | ||
13846 | return; | ||
13847 | } | ||
13848 | } | ||
13849 | } | ||
13850 | |||
13851 | private OSD JsonBuildRestOfSpec(LSL_List specifiers, int i, LSL_String val) | ||
13852 | { | ||
13853 | object spec = i >= specifiers.Data.Length ? null : specifiers.Data[i]; | ||
13854 | // 20131224 not used object specNext = i+1 >= specifiers.Data.Length ? null : specifiers.Data[i+1]; | ||
13855 | |||
13856 | if (spec == null) | ||
13857 | return OSD.FromString(val); | ||
13858 | |||
13859 | if (spec is LSL_Integer || | ||
13860 | (spec is LSL_String && ((LSL_String)spec) == ScriptBaseClass.JSON_APPEND)) | ||
13861 | { | ||
13862 | OSDArray array = new OSDArray(); | ||
13863 | array.Add(JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13864 | return array; | ||
13865 | } | ||
13866 | else if (spec is LSL_String) | ||
13867 | { | ||
13868 | OSDMap map = new OSDMap(); | ||
13869 | map.Add((LSL_String)spec, JsonBuildRestOfSpec(specifiers, i + 1, val)); | ||
13870 | return map; | ||
13871 | } | ||
13872 | return new OSD(); | ||
13873 | } | ||
13874 | |||
13875 | public LSL_String llJsonValueType(LSL_String json, LSL_List specifiers) | ||
13876 | { | ||
13877 | OSD o = OSDParser.DeserializeJson(json); | ||
13878 | OSD specVal = JsonGetSpecific(o, specifiers, 0); | ||
13879 | if (specVal == null) | ||
13880 | return ScriptBaseClass.JSON_INVALID; | ||
13881 | switch (specVal.Type) | ||
13882 | { | ||
13883 | case OSDType.Array: | ||
13884 | return ScriptBaseClass.JSON_ARRAY; | ||
13885 | case OSDType.Boolean: | ||
13886 | return specVal.AsBoolean() ? ScriptBaseClass.JSON_TRUE : ScriptBaseClass.JSON_FALSE; | ||
13887 | case OSDType.Integer: | ||
13888 | case OSDType.Real: | ||
13889 | return ScriptBaseClass.JSON_NUMBER; | ||
13890 | case OSDType.Map: | ||
13891 | return ScriptBaseClass.JSON_OBJECT; | ||
13892 | case OSDType.String: | ||
13893 | case OSDType.UUID: | ||
13894 | return ScriptBaseClass.JSON_STRING; | ||
13895 | case OSDType.Unknown: | ||
13896 | return ScriptBaseClass.JSON_NULL; | ||
13897 | } | ||
13898 | return ScriptBaseClass.JSON_INVALID; | ||
13899 | } | ||
13661 | } | 13900 | } |
13662 | 13901 | ||
13663 | public class NotecardCache | 13902 | public class NotecardCache |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index 68aacd2..5b1fdc0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -123,14 +123,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
123 | if (Timers.Count == 0) | 123 | if (Timers.Count == 0) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | Dictionary<string, TimerInfo>.ValueCollection tvals; | 126 | Dictionary<string, TimerInfo> tvals; |
127 | lock (TimerListLock) | 127 | lock (TimerListLock) |
128 | { | 128 | { |
129 | // Go through all timers | 129 | // Go through all timers |
130 | tvals = Timers.Values; | 130 | tvals = new Dictionary<string, TimerInfo>(Timers); |
131 | } | 131 | } |
132 | 132 | ||
133 | foreach (TimerInfo ts in tvals) | 133 | foreach (TimerInfo ts in tvals.Values) |
134 | { | 134 | { |
135 | // Time has passed? | 135 | // Time has passed? |
136 | if (ts.next < DateTime.Now.Ticks) | 136 | if (ts.next < DateTime.Now.Ticks) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 8c51564..b642a9c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | |||
@@ -437,5 +437,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
437 | void llSetAnimationOverride(LSL_String animState, LSL_String anim); | 437 | void llSetAnimationOverride(LSL_String animState, LSL_String anim); |
438 | void llResetAnimationOverride(LSL_String anim_state); | 438 | void llResetAnimationOverride(LSL_String anim_state); |
439 | LSL_String llGetAnimationOverride(LSL_String anim_state); | 439 | LSL_String llGetAnimationOverride(LSL_String anim_state); |
440 | LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers); | ||
441 | LSL_List llJson2List(LSL_String json); | ||
442 | LSL_String llList2Json(LSL_String type, LSL_List values); | ||
443 | LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value); | ||
444 | LSL_String llJsonValueType(LSL_String json, LSL_List specifiers); | ||
440 | } | 445 | } |
441 | } | 446 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index e6ab6ec..0e22ff3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -788,6 +788,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
788 | public const int KFM_CMD_STOP = 1; | 788 | public const int KFM_CMD_STOP = 1; |
789 | public const int KFM_CMD_PAUSE = 2; | 789 | public const int KFM_CMD_PAUSE = 2; |
790 | 790 | ||
791 | public const string JSON_ARRAY = "JSON_ARRAY"; | ||
792 | public const string JSON_OBJECT = "JSON_OBJECT"; | ||
793 | public const string JSON_INVALID = "JSON_INVALID"; | ||
794 | public const string JSON_NUMBER = "JSON_NUMBER"; | ||
795 | public const string JSON_STRING = "JSON_STRING"; | ||
796 | public const string JSON_TRUE = "JSON_TRUE"; | ||
797 | public const string JSON_FALSE = "JSON_FALSE"; | ||
798 | public const string JSON_NULL = "JSON_NULL"; | ||
799 | public const string JSON_APPEND = "JSON_APPEND"; | ||
800 | |||
791 | /// <summary> | 801 | /// <summary> |
792 | /// process name parameter as regex | 802 | /// process name parameter as regex |
793 | /// </summary> | 803 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 78c41a7..5047162 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | |||
@@ -2029,5 +2029,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
2029 | { | 2029 | { |
2030 | return m_LSL_Functions.llGetAnimationOverride(anim_state); | 2030 | return m_LSL_Functions.llGetAnimationOverride(anim_state); |
2031 | } | 2031 | } |
2032 | |||
2033 | public LSL_String llJsonGetValue(LSL_String json, LSL_List specifiers) | ||
2034 | { | ||
2035 | return m_LSL_Functions.llJsonGetValue(json, specifiers); | ||
2036 | } | ||
2037 | |||
2038 | public LSL_List llJson2List(LSL_String json) | ||
2039 | { | ||
2040 | return m_LSL_Functions.llJson2List(json); | ||
2041 | } | ||
2042 | |||
2043 | public LSL_String llList2Json(LSL_String type, LSL_List values) | ||
2044 | { | ||
2045 | return m_LSL_Functions.llList2Json(type, values); | ||
2046 | } | ||
2047 | |||
2048 | public LSL_String llJsonSetValue(LSL_String json, LSL_List specifiers, LSL_String value) | ||
2049 | { | ||
2050 | return m_LSL_Functions.llJsonSetValue(json, specifiers, value); | ||
2051 | } | ||
2052 | |||
2053 | public LSL_String llJsonValueType(LSL_String json, LSL_List specifiers) | ||
2054 | { | ||
2055 | return m_LSL_Functions.llJsonValueType(json, specifiers); | ||
2056 | } | ||
2032 | } | 2057 | } |
2033 | } | 2058 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 4ba0e64..265bd2f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -714,8 +714,11 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
714 | 714 | ||
715 | private void ExtendAndAdd(object o) | 715 | private void ExtendAndAdd(object o) |
716 | { | 716 | { |
717 | Array.Resize(ref m_data, Length + 1); | 717 | object[] tmp; |
718 | m_data.SetValue(o, Length - 1); | 718 | tmp = new object[m_data.Length + 1]; |
719 | m_data.CopyTo(tmp, 0); | ||
720 | tmp.SetValue(o, tmp.Length - 1); | ||
721 | m_data = tmp; | ||
719 | } | 722 | } |
720 | 723 | ||
721 | public static list operator +(list a, LSLString s) | 724 | public static list operator +(list a, LSLString s) |