aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
diff options
context:
space:
mode:
authorTedd Hansen2008-02-25 20:10:17 +0000
committerTedd Hansen2008-02-25 20:10:17 +0000
commitdbb205c18160cfe031e4076ac650eb37b9613b86 (patch)
tree0b2202ddbc710755e807bed06a0e84a795ca2e20 /OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
parenteol (diff)
downloadopensim-SC_OLD-dbb205c18160cfe031e4076ac650eb37b9613b86.zip
opensim-SC_OLD-dbb205c18160cfe031e4076ac650eb37b9613b86.tar.gz
opensim-SC_OLD-dbb205c18160cfe031e4076ac650eb37b9613b86.tar.bz2
opensim-SC_OLD-dbb205c18160cfe031e4076ac650eb37b9613b86.tar.xz
Moved AsyncCommandManager into separate classes under "plugins".
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs107
1 files changed, 104 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
index 3672e14..15af51f 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncCommandPlugins/XmlRequest.cs
@@ -1,10 +1,111 @@
1using System; 1/*
2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4*
5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission.
15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*
27*/
28
29using System;
30using System.Collections;
2using System.Collections.Generic; 31using System.Collections.Generic;
3using System.Text; 32using System.Threading;
33using libsecondlife;
34using Axiom.Math;
35using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Modules;
37using OpenSim.Region.Environment.Scenes;
38using OpenSim.Framework;
39using OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins;
4 40
5namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins 41namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugins
6{ 42{
7 class XmlRequest 43 public class XmlRequest
8 { 44 {
45 public AsyncCommandManager m_CmdManager;
46
47 public XmlRequest(AsyncCommandManager CmdManager)
48 {
49 m_CmdManager = CmdManager;
50 }
51
52 public void CheckXMLRPCRequests()
53 {
54 if (m_CmdManager.m_ScriptEngine.World == null)
55 return;
56
57 IXMLRPC xmlrpc = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
58
59 if (xmlrpc != null)
60 {
61 RPCRequestInfo rInfo = xmlrpc.GetNextCompletedRequest();
62
63 while (rInfo != null)
64 {
65 if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(rInfo.GetLocalID(), rInfo.GetItemID()) != null)
66 {
67 xmlrpc.RemoveCompletedRequest(rInfo.GetMessageID());
68
69 //Deliver data to prim's remote_data handler
70 object[] resobj = new object[]
71 {
72 2, rInfo.GetChannelKey().ToString(), rInfo.GetMessageID().ToString(), String.Empty,
73 rInfo.GetIntValue(),
74 rInfo.GetStrVal()
75 };
76 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
77 rInfo.GetLocalID(), rInfo.GetItemID(), "remote_data", EventQueueManager.llDetectNull, resobj
78 );
79 }
80
81 rInfo = xmlrpc.GetNextCompletedRequest();
82 }
83
84 SendRemoteDataRequest srdInfo = xmlrpc.GetNextCompletedSRDRequest();
85
86 while (srdInfo != null)
87 {
88 if (m_CmdManager.m_ScriptEngine.m_ScriptManager.GetScript(srdInfo.m_localID, srdInfo.m_itemID) != null)
89 {
90 xmlrpc.RemoveCompletedSRDRequest(srdInfo.GetReqID());
91
92 //Deliver data to prim's remote_data handler
93 object[] resobj = new object[]
94 {
95 3, srdInfo.channel.ToString(), srdInfo.GetReqID().ToString(), String.Empty,
96 srdInfo.idata,
97 srdInfo.sdata
98 };
99 m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
100 srdInfo.m_localID, srdInfo.m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj
101 );
102 }
103
104 srdInfo = xmlrpc.GetNextCompletedSRDRequest();
105 }
106 }
107 }
108
109
9 } 110 }
10} 111}