diff options
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs new file mode 100644 index 0000000..ea6c663 --- /dev/null +++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs | |||
@@ -0,0 +1,164 @@ | |||
1 | using System; | ||
2 | using System.Collections; | ||
3 | using System.Collections.Generic; | ||
4 | using System.Net; | ||
5 | using System.Net.Sockets; | ||
6 | using System.Reflection; | ||
7 | using System.Xml; | ||
8 | using OpenMetaverse; | ||
9 | using OpenMetaverse.StructuredData; | ||
10 | using log4net; | ||
11 | using Nini.Config; | ||
12 | using Nwc.XmlRpc; | ||
13 | using OpenSim.Framework; | ||
14 | using OpenSim.Framework.Communications.Cache; | ||
15 | using OpenSim.Framework.Communications.Capabilities; | ||
16 | using OpenSim.Framework.Servers; | ||
17 | using OpenSim.Region.Environment.Interfaces; | ||
18 | using OpenSim.Region.Interfaces; | ||
19 | using OpenSim.Region.Environment.Scenes; | ||
20 | |||
21 | using LLSD = OpenMetaverse.StructuredData.LLSD; | ||
22 | using LLSDMap = OpenMetaverse.StructuredData.LLSDMap; | ||
23 | using LLSDArray = OpenMetaverse.StructuredData.LLSDArray; | ||
24 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | ||
25 | |||
26 | namespace OpenSim.Region.Environment.Modules.Framework | ||
27 | { | ||
28 | public class EventQueueGetModule : IEventQueue, IRegionModule | ||
29 | { | ||
30 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
31 | Scene m_scene = null; | ||
32 | IConfigSource m_gConfig; | ||
33 | |||
34 | #region IRegionModule methods | ||
35 | public void Initialise(Scene scene, IConfigSource config) | ||
36 | { | ||
37 | m_gConfig = config; | ||
38 | m_scene = scene; | ||
39 | |||
40 | |||
41 | IConfig startupConfig = m_gConfig.Configs["Startup"]; | ||
42 | |||
43 | ReadConfigAndPopulate(scene, startupConfig, "Startup"); | ||
44 | |||
45 | scene.RegisterModuleInterface<IEventQueue>(this); | ||
46 | |||
47 | scene.EventManager.OnNewClient += OnNewClient; | ||
48 | scene.EventManager.OnClientClosed += ClientClosed; | ||
49 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | ||
50 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | ||
51 | scene.EventManager.OnClientClosed += ClientLoggedOut; | ||
52 | scene.EventManager.OnRegisterCaps += OnRegisterCaps; | ||
53 | |||
54 | } | ||
55 | |||
56 | private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) | ||
57 | { | ||
58 | |||
59 | } | ||
60 | |||
61 | |||
62 | |||
63 | |||
64 | |||
65 | public void PostInitialise() | ||
66 | { | ||
67 | } | ||
68 | |||
69 | public void Close() | ||
70 | { | ||
71 | } | ||
72 | |||
73 | public string Name | ||
74 | { | ||
75 | get { return "EventQueueGetModule"; } | ||
76 | } | ||
77 | |||
78 | public bool IsSharedModule | ||
79 | { | ||
80 | get { return false; } | ||
81 | } | ||
82 | #endregion | ||
83 | |||
84 | #region IEventQueue Members | ||
85 | public bool Enqueue(object o, UUID avatarID) | ||
86 | { | ||
87 | |||
88 | return false; | ||
89 | } | ||
90 | #endregion | ||
91 | |||
92 | private void OnNewClient(IClientAPI client) | ||
93 | { | ||
94 | |||
95 | client.OnLogout += ClientClosed; | ||
96 | } | ||
97 | |||
98 | |||
99 | public void ClientClosed(IClientAPI client) | ||
100 | { | ||
101 | ClientClosed(client.AgentId); | ||
102 | } | ||
103 | |||
104 | private void ClientLoggedOut(UUID AgentId) | ||
105 | { | ||
106 | |||
107 | } | ||
108 | |||
109 | private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) | ||
110 | { | ||
111 | |||
112 | } | ||
113 | |||
114 | public void ClientClosed(UUID AgentID) | ||
115 | { | ||
116 | |||
117 | } | ||
118 | private void MakeChildAgent(ScenePresence avatar) | ||
119 | { | ||
120 | } | ||
121 | public void OnRegisterCaps(UUID agentID, Caps caps) | ||
122 | { | ||
123 | m_log.DebugFormat("[EVENTQUEUE] OnRegisterCaps: agentID {0} caps {1}", agentID, caps); | ||
124 | string capsBase = "/CAPS/"; | ||
125 | caps.RegisterHandler("EventQueueGet", | ||
126 | new RestHTTPHandler("POST", capsBase + UUID.Random().ToString(), | ||
127 | delegate(Hashtable m_dhttpMethod) | ||
128 | { | ||
129 | return ProcessQueue(m_dhttpMethod,agentID, caps); | ||
130 | })); | ||
131 | } | ||
132 | public Hashtable ProcessQueue(Hashtable request,UUID agentID, Caps caps) | ||
133 | { | ||
134 | |||
135 | Hashtable responsedata = new Hashtable(); | ||
136 | responsedata["int_response_code"] = 502; | ||
137 | responsedata["str_response_string"] = "Upstream error:"; | ||
138 | responsedata["content_type"] = "text/plain"; | ||
139 | responsedata["keepalive"] = true; | ||
140 | |||
141 | /* | ||
142 | responsedata["int_response_code"] = 200; | ||
143 | responsedata["content_type"] = "application/xml"; | ||
144 | responsedata["keepalive"] = true; | ||
145 | |||
146 | responsedata["str_response_string"] = @"<llsd><map><key>events</key><array><map><key>body</key><map><key>AgentData</key><map><key>AgentID</key> | ||
147 | <uuid>0fd0e798-a54f-40b1-0000-000000000000</uuid><key>SessionID</key><uuid>cc91f1fe-9d52-435d-0000-000000000000 | ||
148 | </uuid></map><key>Info</key><map><key>LookAt</key><array><real>0.9869639873504638671875</real><real> | ||
149 | -0.1609439998865127563476562</real><real>0</real></array><key>Position</key><array><real>1.43747997283935546875 | ||
150 | </real><real>95.30560302734375</real><real>57.3480987548828125</real></array></map><key>RegionData</key><map> | ||
151 | <key>RegionHandle</key><binary encoding=" + "\"base64\"" + @">AAPnAAAD8AA=</binary><key>SeedCapability</key><string> | ||
152 | https://sim7.aditi.lindenlab.com:12043/cap/64015fb3-6fee-9205-0000-000000000000</string><key>SimIP</key><binary | ||
153 | encoding=" + "\"base64\"" + @">yA8FSA==</binary><key>SimPort</key><integer>13005</integer></map></map><key>message</key> | ||
154 | <string>CrossedRegion</string></map></array><key>id</key><integer>1</integer></map></llsd>"; | ||
155 | |||
156 | */ | ||
157 | //string requestbody = (string)request["requestbody"]; | ||
158 | //LLSD llsdRequest = LLSDParser.DeserializeXml(request); | ||
159 | //System.Console.WriteLine(requestbody); | ||
160 | return responsedata; | ||
161 | |||
162 | } | ||
163 | } | ||
164 | } | ||